/** * Token Delivery Handler * * Handles response interception to deliver tokens via Cookies or JSON. */ import { NAuthConfig, NAuthLogger } from '../index'; import { NAuthRequest, NAuthResponse } from '../platform/interfaces'; export declare class TokenDeliveryHandler { private config; private logger?; constructor(config: NAuthConfig, logger?: NAuthLogger | undefined); /** * Type guard for detecting an auth response payload. * * We intentionally validate types at runtime because the handler receives `unknown` * response bodies from framework adapters. */ private isAuthResponseBody; /** * Process the response body. * If it contains tokens, handle delivery and return sanitized body. * If not, return original body. */ handleResponse(req: NAuthRequest, res: NAuthResponse, body: unknown): Promise; /** * Resolve the delivery mode for this request. * * Precedence: route override, then hybrid origin policy, then the global method. * * A route override that contradicts a non-hybrid `method` is reported through * {@link assertOverrideAllowed} before being honoured. */ private resolveDeliveryMode; /** * Report a route override that the configured delivery method does not permit. * * Overrides only make sense under `method: 'hybrid'`, where both transports are live. * Asking for JSON under `'cookies'` is a route opting out of httpOnly cookies, and * asking for cookies under `'json'` is a route enabling a transport the application * disabled — both are usually mistakes. * * Warns by default and throws only when `tokenDelivery.strictOverrides` is set, so * that upgrading cannot break a running application. The NestJS adapter has always * thrown here; `strictOverrides: true` brings Express and Fastify into line. * * @param routeMode - The mode the route asked for * @param method - The configured delivery method * @throws {NAuthException} When `strictOverrides` is enabled and the modes conflict */ private assertOverrideAllowed; private setTokenCookies; private parseExpiry; } //# sourceMappingURL=token-delivery.handler.d.ts.map