UNPKG

fortify2-js

Version:

MOST POWERFUL JavaScript Security Library! Military-grade cryptography + 19 enhanced object methods + quantum-resistant algorithms + perfect TypeScript support. More powerful than Lodash with built-in security.

109 lines (106 loc) 3.27 kB
import { PasswordManager } from './password-core.js'; import '../random/random-types.js'; import '../random/random-sources.js'; import 'crypto'; import 'nehonix-uri-processor'; import '../../utils/memory/index.js'; import '../../types.js'; export { PasswordAlgorithm, PasswordSecurityLevel } from './password-types.js'; import '../hash/hash-core.js'; import '../hash/hash-types.js'; import 'argon2'; import '../../algorithms/hash-algorithms.js'; import 'child_process'; import '../../types/secure-memory.js'; import 'https'; import '../../security/runtime-verification.js'; import '../../security/tamper-evident-logging.js'; /* --------------------------------------------------------------------------------------------- * Copyright (c) NEHONIX INC. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * FortifyJS Password Management Module => FPMM * * Modular, military-grade password management system * * @example * ```typescript * import { PasswordManager } from "fortify2-js/core/password"; * * // Create password manager instance * const pm = PasswordManager.getInstance(); * * // Hash a password * const hash = await pm.hash("mySecurePassword123!"); * * // Verify a password * const result = await pm.verify("mySecurePassword123!", hash); * console.log(result.isValid); // true * * // Generate secure password * const generated = pm.generatePassword({ length: 16, minStrengthScore: 90 }); * console.log(generated.password); * * // Migrate from bcrypt * const migration = await pm.migrate("password", bcryptHash); * if (migration.migrated) { * console.log("Successfully migrated to FortifyJS!"); * } * ``` */ PasswordManager.getInstance(); /** * Get default password policy */ function getDefaultPasswordPolicy() { return { minLength: 8, maxLength: 128, requireUppercase: true, requireLowercase: true, requireNumbers: true, requireSymbols: true, minStrengthScore: 70, forbiddenPatterns: [ /^[0-9]+$/, // All numbers /^[a-zA-Z]+$/, // All letters /^(.)\1{2,}$/, // Repeated characters /^(qwerty|asdfgh|zxcvbn)/i, // Keyboard patterns /^(password|admin|user)/i, // Common words ], forbiddenWords: [ "password", "admin", "user", "login", "welcome", "123456", "qwerty", "abc123", "password123", ], }; } /** * Get recommended security configuration */ function getRecommendedConfig() { return { defaultAlgorithm: "argon2id", defaultSecurityLevel: "high", timingSafeVerification: true, secureMemoryWipe: true, enableMigration: true, policy: getDefaultPasswordPolicy(), }; } // ===== DEFAULT INSTANCE ===== /** * Default password manager instance * Ready to use out of the box */ PasswordManager.getInstance(getRecommendedConfig()); export { PasswordManager, getDefaultPasswordPolicy, getRecommendedConfig }; //# sourceMappingURL=index.js.map