/** * TOTP (Time-based One-Time Password) implementation. * * Pure Node.js crypto implementation — no external dependencies required. * Implements RFC 6238 (TOTP) and RFC 4226 (HOTP). */ /** * Encode a Buffer to Base32 string (RFC 4648) */ export declare function base32Encode(buffer: Buffer): string; /** * Decode a Base32 string to Buffer */ export declare function base32Decode(encoded: string): Buffer; /** * Generate a TOTP value for the current time step */ export declare function generateTotp(secret: Buffer, timeStep?: number): string; /** * Verify a TOTP token with a configurable time window * * @param secret - The shared secret as a Buffer * @param token - The 6-digit TOTP code to verify * @param window - Number of time steps to check on each side (default: 1) * @returns true if the token is valid within the window */ export declare function verifyTotp(secret: Buffer, token: string, window?: number): boolean; /** * Generate a new TOTP secret and return the setup information * * @param issuer - The issuer name (app name) for the QR code * @param accountName - The account identifier (usually email) * @returns Object with base32 secret and otpauth URI */ export declare function generateTotpSecret(issuer: string, accountName: string): { secret: string; uri: string; }; /** * Generate a set of one-time recovery codes * * @param count - Number of recovery codes to generate (default: 10) * @returns Array of formatted recovery code strings (e.g. "A1B2C-D3E4F") */ export declare function generateRecoveryCodes(count?: number): string[]; /** * Hash a recovery code for storage */ export declare function hashRecoveryCode(code: string): string;