//#region src/oauth/callback-server.d.ts /** * Localhost callback server used by the Authorization Code + PKCE * flow. The server binds a random port in the operator-supplied * range, exposes a single `/callback` endpoint, and resolves with the * parsed query parameters as soon as the browser hits the redirect * URI. * * The implementation is intentionally bare-bones (Node's built-in * `http` module) so the framework does not pull a web framework into * the security package. * * @packageDocumentation */ /** Parsed callback query parameters. */ interface CallbackParams { readonly code: string; readonly state?: string; readonly raw: ReadonlyMap; } /** * Options accepted by {@link startLocalCallbackServer}. * * @stable */ interface LocalCallbackServerOptions { /** Inclusive port range. Defaults to `[49152, 65535]`. */ readonly portRange?: readonly [number, number]; /** Maximum number of bind attempts before failing. Defaults to 5. */ readonly maxAttempts?: number; /** Optional override for the callback path. Defaults to `/callback`. */ readonly path?: string; /** Browser-facing success page (HTML). Optional. */ readonly successHtml?: string; /** Browser-facing error page (HTML). Optional. */ readonly errorHtml?: string; } /** Handle returned by {@link startLocalCallbackServer}. */ interface LocalCallbackServer { readonly redirectUri: string; readonly port: number; readonly waitForCallback: (signal?: AbortSignal) => Promise; readonly close: () => Promise; } /** * Bind a localhost callback server on a random port in * `options.portRange`. The handle exposes the chosen redirect URI * and a `waitForCallback(signal)` helper that resolves once the * browser hits the path. * * @stable */ declare function startLocalCallbackServer(options?: LocalCallbackServerOptions): Promise; //#endregion export { CallbackParams, LocalCallbackServer, LocalCallbackServerOptions, startLocalCallbackServer }; //# sourceMappingURL=callback-server.d.ts.map