///
import { Buffer } from 'node:buffer';
export interface JwtHeader {
typ?: 'JWT';
alg: JwtAlgorithm;
/** Key ID */
kid?: string;
/** JSON Web Key Set URL */
jku?: string;
}
export declare enum JwtAlgorithm {
RS256 = "RS256"
}
export interface JwtPayload {
/** Audience */
aud: string;
/** Expiration timestamp (seconds) */
exp: number;
/** Issue timestamp (seconds) */
iat: number;
/** Issuer */
iss: string;
/** Token ID */
jti: string;
/** Subject */
sub: string | number;
/** Token type */
typ: string;
}
type JwtVerifier = (data: Buffer, signature: Buffer, key: string) => boolean;
export declare class Jwt {
readonly header: H;
readonly payload: T;
constructor(header: H, payload: T);
static decode(token: string): readonly [Jwt, Buffer];
verify(signature: Buffer, key: string, verifier?: JwtVerifier): boolean;
static verifiers: Record;
}
export interface Jwks {
keys: Jwk[];
}
export interface Jwk {
/** Key type */
kty: string;
use?: JwkUse | string;
key_ops?: JwkKeyOperation | string;
alg?: JwtAlgorithm | string;
/** Key ID */
kid?: string;
x5u?: string[];
x5c?: string[];
x5t?: string;
'x5t#S256'?: string;
}
export declare enum JwkUse {
SIGNATURE = "sig",
ENCRYPTION = "enc"
}
export declare enum JwkKeyOperation {
SIGN = "sign",
VERIFY = "verify",
ENCRYPT = "encrypt",
DECRYPT = "decrypt",
WRAP_KEY = "wrapKey",
UNWRAP_KEY = "unwrapKey",
DERIVE_KEY = "deriveKey",
DERIVE_BITS = "deriveBits"
}
export declare function getJwks(url: string, cache_dir?: string): Promise;
export {};