import { IncomingMessage, Server, ServerResponse } from "node:http"; /** Configures the loopback callback server. */ export interface CallbackServerOptions { expectedState: string; timeoutMs?: number; signal?: AbortSignal; } /** Authorization-code and state pair captured from a successful redirect. */ export interface CallbackResult { code: string; state: string; } /** Live handle to a running callback server. */ export interface CallbackServerHandle { redirectURI: string; result: Promise; close: () => Promise; } type RequestHandler = (req: IncomingMessage, res: ServerResponse) => void; type LoopbackListener = (handler: RequestHandler, host: string) => Promise; /** * Binds an HTTP server to the loopback interface, preferring IPv4. * * RFC 8252 §7.3: "use whichever is available". Prefer IPv4; fall back to * IPv6 only when the IPv4 loopback isn't configured on this host. `listenFn` * is an injection seam for tests — production callers use the default. */ export declare function bindLoopback(handler: RequestHandler, listenFn?: LoopbackListener): Promise<{ server: Server; host: "127.0.0.1" | "::1"; }>; /** Starts a loopback HTTP server that captures the OAuth redirect. */ export declare function startCallbackServer(opts: CallbackServerOptions): Promise; export {};