@gaonengwww/jose
Version:
JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes
34 lines (31 loc) • 1.21 kB
TypeScript
import { JSONWebKeySet, JWSHeaderParameters, FlattenedJWSInput, CryptoKey } from '../types.d.js';
declare const customFetch: unique symbol;
type FetchImplementation = (url: string, options: {
headers: Headers;
method: 'GET';
redirect: 'manual';
signal: AbortSignal;
}) => Promise<Response>;
declare const jwksCache: unique symbol;
interface RemoteJWKSetOptions {
timeoutDuration?: number;
cooldownDuration?: number;
cacheMaxAge?: number | typeof Infinity;
headers?: Record<string, string>;
[jwksCache]?: JWKSCacheInput;
[customFetch]?: FetchImplementation;
}
interface ExportedJWKSCache {
jwks: JSONWebKeySet;
uat: number;
}
type JWKSCacheInput = ExportedJWKSCache | Record<string, never>;
declare function createRemoteJWKSet(url: URL, options?: RemoteJWKSetOptions): {
(protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput): Promise<CryptoKey>;
coolingDown: boolean;
fresh: boolean;
reloading: boolean;
reload: () => Promise<void>;
jwks: () => JSONWebKeySet | undefined;
};
export { type ExportedJWKSCache, type FetchImplementation, type JWKSCacheInput, type RemoteJWKSetOptions, createRemoteJWKSet, customFetch, jwksCache };