/** * Password Generator - Generates cryptographically secure random passwords * * This module provides a platform-agnostic password generator that works in both * browser and Node.js environments using the platformCrypto abstraction. * * Uses Fisher-Yates shuffle with cryptographically secure random indices for * uniform distribution of characters. * * @module passwordGenerator * @see Requirements 1.1, 1.4, 1.5, 1.6 */ /** * Options for password generation. */ export interface PasswordGeneratorOptions { /** Length of the password (8-128 characters) */ length: number; /** Include uppercase letters (A-Z) */ uppercase?: boolean; /** Include lowercase letters (a-z) */ lowercase?: boolean; /** Include numbers (0-9) */ numbers?: boolean; /** Include symbols (!@#$%^&*()_+-=[]{}|;:,.<>?) */ symbols?: boolean; /** Minimum number of uppercase letters required */ minUppercase?: number; /** Minimum number of lowercase letters required */ minLowercase?: number; /** Minimum number of numbers required */ minNumbers?: number; /** Minimum number of symbols required */ minSymbols?: number; } /** * PasswordGenerator - Generates cryptographically secure random passwords * * Uses Fisher-Yates shuffle with cryptographically secure random bytes for * uniform distribution of characters. * * @see Requirement 1.1 - Cryptographically secure random passwords using platform-agnostic random byte generation * @see Requirement 1.4 - Validates password options (length 8-128, at least one character set enabled, minimum counts not exceeding length) * @see Requirement 1.5 - Supports configurable character sets with minimum count requirements * @see Requirement 1.6 - Uses Fisher-Yates shuffle with cryptographically secure random indices * * @example * ```typescript * // Generate a 16-character password with all character sets * const password = PasswordGenerator.generate({ * length: 16, * uppercase: true, * lowercase: true, * numbers: true, * symbols: true, * minUppercase: 2, * minLowercase: 2, * minNumbers: 2, * minSymbols: 2 * }); * ``` */ export declare class PasswordGenerator { private static readonly UPPERCASE; private static readonly LOWERCASE; private static readonly NUMBERS; private static readonly SYMBOLS; /** * Validate password generation options. * * @param options - Password generation options to validate * @throws Error if length is not between 8 and 128 * @throws Error if no character set is enabled * @throws Error if sum of minimum counts exceeds password length * * @see Requirement 1.4 - Validates password options */ static validate(options: PasswordGeneratorOptions): void; /** * Generate a cryptographically secure random password. * * @param options - Password generation options * @returns Generated password string * @throws Error if options are invalid * * @see Requirement 1.1 - Cryptographically secure random passwords * @see Requirement 1.5 - Configurable character sets with minimum count requirements * @see Requirement 1.6 - Fisher-Yates shuffle with cryptographically secure random indices */ static generate(options: PasswordGeneratorOptions): string; /** * Get a random character from a charset. * * @param charset - String of characters to choose from * @returns A single random character from the charset */ private static randomChar; /** * Generate a cryptographically secure random integer in range [0, max). * * Uses getRandomBytes from platformCrypto for cross-platform compatibility. * Uses DataView for reading uint32 from Uint8Array. * * @param max - Upper bound (exclusive) * @returns Random integer in range [0, max) * * @see Requirement 1.1 - Platform-agnostic random byte generation */ private static randomInt; } //# sourceMappingURL=passwordGenerator.d.ts.map