UNPKG

passport-jose

Version:

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

17 lines (16 loc) 955 B
import { Strategy as PassportStrategy } from 'passport-strategy'; import * as jose from 'jose'; import type { JoseKey, StrategyOptionsWithRequest, StrategyOptionsWithoutRequest, VerifyCallback, VerifyCallbackWithRequest } from './types'; export declare class Strategy extends PassportStrategy { readonly name = "jwt"; private readonly _getKeyOrSecret; private readonly _verify; private readonly _jwtFromRequest; private readonly _passReqToCallback; private readonly _verifyOpts; constructor(options: StrategyOptionsWithoutRequest, verify: VerifyCallback); constructor(options: StrategyOptionsWithRequest, verify: VerifyCallbackWithRequest); static JwtVerifier<T extends JoseKey | jose.JWTVerifyGetKey>(token: string | Uint8Array, secretOrKeyOrGetKey: T, options: jose.JWTVerifyOptions, callback: (err: Error | null, payload?: jose.JWTPayload) => void): void; authenticate(req: any): void; private _challenge; }