perfect-password
v1.0.1
Published
A secure password manager with strength and breach checking features
Maintainers
Readme
🔐 perfect Manager
A lightweight and secure Node.js package to check password strength and verify if a password has appeared in known data breaches.
It helps developers enforce strong password policies and protect users from compromised credentials.
✨ Features
- ✅ Password Strength Checker
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
- 🔎 Password Breach Checker
- Uses Have I Been Pwned API (k-anonymity model)
- Checks if password exists in global breach database
- 📦 Easy to Integrate — just install and use
- 🚀 Lightweight (only
axiosdependency)
📦 Installation
npm install perfect-password
import { checkStrength, checkBreach } from "perfect-password";
const strength = checkStrength("MyPass@123");
console.log(strength);
// Output:
{
strength: 'Strong',
reasons: []
}
checkStrength("mypassword");
// -> { strength: 'Weak', reasons: [ 'Password must include an uppercase letter', 'Password must include a number', 'Password must include a special character' ] }
const breach = await checkBreach("MyPass@123");
console.log(breach);
// Possible outputs:
// ✅ Password not found in any breach
// ⚠️ Password found in 42 breaches
import { checkStrength, checkBreach } from "perfect-password";
async function validatePassword(password) {
const strength = checkStrength(password);
const breach = await checkBreach(password);
return { ...strength, breach };
}
validatePassword("MyPass@123").then(console.log);
// Example Output:
// {
// strength: 'Strong',
// reasons: [],
// breach: '✅ Password not found in any breach'
// }