import*as n from"../../../web-server/jwt/jwt.js";function e(t){if(!t)return null;const r=Array.isArray(t)?t[0]:t;return!r||!r.startsWith("Bearer ")?null:r.substring(7)}function u(t){try{const{payload:r}=n.decode(t),o=Math.floor(Date.now()/1e3);return typeof r.exp=="number"&&r.exp<o?null:r}catch(r){return console.error("Failed to decode JWT token:",r),null}}function i(t){const r=t.authorization||t.Authorization,o=e(r);return o?u(o):null}export{e as extractTokenFromAuthHeader,i as getUserInfoFromHeaders,u as getUserInfoFromToken};
