import { StepUpRequiredError } from './errors'; import { AcrValue } from './params'; declare const CHALLENGE_ERROR = "insufficient_user_authentication"; export type ParsedStepUpChallenge = { acr: AcrValue | null; maxAge: number | null; errorDescription: string; }; export type StepUpChallenge = { status: 401; headers: { "WWW-Authenticate": string; "Access-Control-Expose-Headers": "WWW-Authenticate"; }; body: { error: typeof CHALLENGE_ERROR; error_description: string; }; }; /** * RFC 9470 challenge for an API whose verified token does not meet the requirement. * Copy `Access-Control-Expose-Headers` when the API enables CORS so browsers can read it. * Keep `errorDescription` free of token contents. */ export declare const buildStepUpChallenge: (requirement: { acr?: AcrValue; maxAge?: number; errorDescription?: string; }) => StepUpChallenge; type AuthChallenge = { scheme: string; params: Record; }; /** * Splits a WWW-Authenticate header into challenges. * Commas inside quoted values do not separate parameters, and a token that is * not `name=value` starts the next challenge. */ export declare const parseWwwAuthenticate: (header: string) => AuthChallenge[]; /** * Reads an RFC 9470 step-up challenge from a 401 response. * Returns null for any other 401, including `invalid_token`, so existing * refresh and sign-in handling is unchanged. */ export declare const parseStepUpChallenge: (response: { status: number; headers: { get(name: string): string | null; }; }) => ParsedStepUpChallenge | null; /** `StepUpRequiredError` for an RFC 9470 challenge response, or null for any other response. */ export declare const stepUpRequiredFromResponse: (response: { status: number; headers: { get(name: string): string | null; }; }) => StepUpRequiredError | null; export {};