/** * PKCE (Proof Key for Code Exchange) utilities for secure authorization flows. * Implements RFC 7636 using the Web Crypto API for cryptographic operations. */ /** * Generates a cryptographically random code verifier for PKCE. * The verifier is a Base64URL-encoded string of 32 random bytes (43 characters). * * @returns A random code verifier string. * @throws `Error` - If cryptographic random generation fails (requires secure context/HTTPS). * * @example * ```typescript * const verifier = generateCodeVerifier(); * // e.g., "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk" * ``` */ export declare function generateCodeVerifier(): string; /** * Generates a code challenge from a code verifier using SHA-256. * The challenge is the Base64URL-encoded SHA-256 hash of the verifier. * * @param verifier - The code verifier to hash. * @returns A promise that resolves with the code challenge string. * * @example * ```typescript * const verifier = generateCodeVerifier(); * const challenge = await generateCodeChallenge(verifier); * // Send challenge to server, keep verifier secret * ``` */ export declare function generateCodeChallenge(verifier: string): Promise; /** * Generates a cryptographically random state parameter for OAuth flows. * The state is a Base64URL-encoded string of 16 random bytes (22 characters). * * Used to prevent CSRF attacks and to correlate requests with responses. * * @returns A random state string. * @throws `Error` - If cryptographic random generation fails (requires secure context/HTTPS). * * @example * ```typescript * const state = generateState(); * // e.g., "xyzzy123ABC_def-GHI" * ``` */ export declare function generateState(): string; //# sourceMappingURL=pkce.d.ts.map