import type { AuthServerMetadata } from './token-exchange.js'; import type { GetKeyMaterial, FetchLike, OnEvent } from './types.js'; import type { Capability, AAuthMission } from './aauth-header.js'; export interface AAuthFetchOptions { getKeyMaterial: GetKeyMaterial; authServerUrl?: string; /** Cached auth-server metadata; when provided, token exchange skips the /.well-known fetch. */ authServerMetadata?: AuthServerMetadata; /** Called with freshly-fetched metadata so the caller can persist it. */ onMetadata?: (metadata: AuthServerMetadata) => void; /** Called with the auth token minted during a challenge exchange, so the caller * can surface it as a reusable credential (e.g. `fetch --with-token`). */ onAuthToken?: (authToken: string, expiresIn: number) => void; /** Called with an opaque AAuth-Access token received from a resource (two-party * mode), including rolling-refresh replacements, so the caller can surface it * for reuse. */ onOpaqueToken?: (opaqueToken: string) => void; /** Seed an opaque AAuth-Access token (two-party mode) to send on the first * request to a resource — the reuse counterpart of `onOpaqueToken`. */ opaqueToken?: string; onInteraction?: (url: string, code: string) => void; onClarification?: (question: string) => Promise; onEvent?: OnEvent; justification?: string; loginHint?: string; tenant?: string; domainHint?: string; capabilities?: Capability[]; mission?: AAuthMission; prompt?: string; /** Total consent-poll timeout in seconds (default 900) — see pollDeferred. */ maxPollDuration?: number; } /** * Create a protocol-aware fetch that handles the full AAuth challenge-response flow. * * Wraps createSignedFetch with: * 1. 401 AAuth-Requirement challenge handling (token exchange + retry) * 2. 202 resource interaction (polling) * 3. Auth token caching by {resource origin, authServer} */ export declare function createAAuthFetch(options: AAuthFetchOptions): FetchLike; //# sourceMappingURL=aauth-fetch.d.ts.map