/** * Discovery cache for OIDC metadata with in-flight request deduplication * @internal */ import type * as jose from "jose"; import * as oauth from "oauth4webapi"; /** * Options for the discovery cache. */ interface CacheOptions { /** * Time-to-live in seconds for cached entries. Default: 600 */ ttl?: number; /** * Maximum number of domain entries to cache. Default: 100 */ maxEntries?: number; } /** * Discovery cache for OIDC metadata with in-flight deduplication and JWKS caching. * * Features: * - LRU eviction when max entries is reached * - TTL-based lazy expiration * - In-flight request deduplication (multiple requests for the same domain are deduplicated) * - Automatic rejection cleanup if a request fails * - Co-located JWKS cache for jose * - Hard boundary eviction (LRU) * * @internal */ export declare class DiscoveryCache { private cache; private inFlight; private jwksCache; private ttl; private maxEntries; /** * Creates a new DiscoveryCache instance. * * @param options - Cache configuration options */ constructor(options?: CacheOptions); /** * Gets or fetches discovery metadata for a domain. * * Implements in-flight deduplication: if multiple calls are made for the same domain * before the first completes, they all await the same promise. * * @param domain - The Auth0 domain to fetch metadata for * @param fetchMetadata - Async function that fetches the metadata if not cached * @returns A promise resolving to the authorization server metadata * * @internal */ get(domain: string, fetchMetadata: (domain: string) => Promise): Promise; /** * Gets or creates a JWKS cache entry for the given JWKS URI. * * The JWKS cache is separate from the discovery metadata cache and has * its own size limit. * * @param jwksUri - The JWKS endpoint URI * @returns The JWKS cache object (jose.JWKSCacheInput format) * * @internal */ getJwksCacheForUri(jwksUri: string): jose.JWKSCacheInput; /** * Clears all cached entries (discovery metadata and JWKS cache). * * @internal */ clear(): void; } export {};