/** * @file Pure helpers for a client-side OAuth authorization-code flow: PKCE * S256 pair generation (RFC 7636 §4), the RFC 8414 issuer-discovery URL, * the authorization URL the browser opens, and the loopback callback * parser (RFC 8252). Every function here is network-free so the whole * protocol surface is unit-testable; the flow driver — listener, browser * open, token exchange — lives with the caller. * `./login`'s `loginWithSocketOauth()` adopts these helpers in v7; until * then it carries its own inline copies and both stand. */ export interface AuthorizationUrlConfig { authorizationEndpoint: string; challenge: string; clientId: string; redirectUri: string; scopes: readonly string[]; state: string; } /** * The full authorization URL the browser opens: the authorization endpoint * with the PKCE challenge (S256), client id, redirect URI, requested scopes, * and the `state` value that later binds the loopback callback to this run. */ export declare function buildAuthorizationUrl(config: AuthorizationUrlConfig): string; /** * The RFC 8414 well-known URL for an issuer, honoring a path component * (path-inserted form — * `https://host/.well-known/oauth-authorization-server/` — the probe * order RFC 8414 §3 specifies for issuers with a path). */ export declare function buildDiscoveryUrl(issuer: string): string; export interface PkcePair { challenge: string; verifier: string; } /** * A fresh PKCE verifier/challenge pair (S256, RFC 7636 §4). The verifier is * 32 random bytes base64url-encoded; the challenge is the base64url SHA-256 * of the verifier, which binds the authorization code to this process. */ export declare function generatePkcePair(): PkcePair; /** * Parse the RFC 8252 loopback callback request: the authorization code when * `state` matches, or an error describing what came back instead. A state * mismatch is an error, not a retry — a callback this run did not initiate * must never yield a code. */ export declare function parseCallbackRequest(requestUrl: string, expectedState: string): { code: string; } | { error: string; };