/** * BreachDetector - Check passwords against Have I Been Pwned database * * Uses k-anonymity model: only sends first 5 chars of SHA-1 hash to API. * This ensures the full password hash is never transmitted, protecting user privacy. * * Works in both browser and Node.js environments using: * - Platform-agnostic SHA-1 hashing via @noble/hashes * - Native fetch API (available in modern browsers and Node.js 18+) * * @module breachDetector * @see Requirements 3.1, 3.2, 3.3, 3.4, 3.5 */ /** * Result of a breach check operation. * * @see Requirement 3.4 */ export interface BreachCheckResult { /** Whether the password was found in breach databases */ breached: boolean; /** Number of times the password appeared in breaches (0 if not breached) */ count: number; /** Whether the HIBP API was reachable */ serviceAvailable: boolean; } /** * BreachDetector - Check passwords against Have I Been Pwned database * * Uses k-anonymity model: only sends first 5 chars of SHA-1 hash to API. * This ensures the full password hash is never transmitted, protecting user privacy. * * @see Requirements 3.1, 3.2, 3.3, 3.4, 3.5 * * @example * ```typescript * const result = await BreachDetector.check('password123'); * if (result.breached) { * console.log(`Password found in ${result.count} breaches!`); * } else if (!result.serviceAvailable) { * console.log('Could not check - HIBP service unavailable'); * } else { * console.log('Password not found in known breaches'); * } * ``` */ export declare class BreachDetector { private static readonly HIBP_API_URL; /** * Check if a password has been exposed in known data breaches. * * Uses the Have I Been Pwned Passwords API with k-anonymity: * - Computes SHA-1 hash of the password * - Sends only the first 5 characters of the hash to the API * - Compares the remaining hash suffix locally against returned results * * @param password - The password to check * @returns Promise resolving to breach check result * * @see Requirement 3.1 - k-anonymity (only first 5 chars of SHA-1 sent) * @see Requirement 3.2 - Uses Fetch API in browser * @see Requirement 3.3 - Uses native fetch in Node.js 18+ * @see Requirement 3.4 - Returns breach status, count, and service availability * @see Requirement 3.5 - Returns serviceAvailable: false on API errors */ static check(password: string): Promise; } //# sourceMappingURL=breachDetector.d.ts.map