UNPKG

firebase-auth-cloudflare-workers

Version:

Zero-dependencies firebase auth library for Cloudflare Workers.

33 lines (32 loc) 1.17 kB
import type { KeyFetcher } from './jwk-fetcher'; import type { RS256Token } from './jwt-decoder'; import type { KeyStorer } from './key-store'; export declare const rs256alg: RsaHashedKeyGenParams; export interface SignatureVerifier { verify(token: RS256Token): Promise<void>; } /** * Class for verifying JWT signature with a public key. */ export declare class PublicKeySignatureVerifier implements SignatureVerifier { private keyFetcher; constructor(keyFetcher: KeyFetcher); static withCertificateUrl(clientCertUrl: string, keyStorer: KeyStorer): PublicKeySignatureVerifier; /** * Verifies the signature of a JWT using the provided secret or a function to fetch * the public key. * * @param token - The JWT to be verified. * @throws If the JWT is not a valid RS256 token. * @returns A Promise resolving for a token with a valid signature. */ verify(token: RS256Token): Promise<void>; private verifySignature; private fetchPublicKeys; } /** * Class for verifying unsigned (emulator) JWTs. */ export declare class EmulatorSignatureVerifier implements SignatureVerifier { verify(): Promise<void>; }