UNPKG

passport-jose

Version:

Passport JWT strategy with EdDSA, ES256 and modern cryptographic algorithm support via JOSE

20 lines (19 loc) 545 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = void 0; const BEARER_SCHEME_REGEX = /^Bearer$/i; const parseAuthHeader = (headerValue) => { if (typeof headerValue !== 'string') { return null; } const parts = headerValue.split(' '); if (parts.length !== 2) { return null; } const [scheme, credentials] = parts; if (BEARER_SCHEME_REGEX.test(scheme)) { return { scheme, value: credentials }; } return null; }; exports.parse = parseAuthHeader;