Compares the plain text password with a hashed password using bcrypt.
The hashed password to compare against.
A promise that resolves to true if the passwords match, otherwise false.
Hashes the password using bcrypt with a customizable salt rounds factor.
The number of salt rounds to use. Defaults to 10.
A promise that resolves to the hashed password.
Checks if the password is weak. A password is considered weak if it does not meet the following criteria:
A promise that resolves if the password is strong, otherwise throws an error.
StaticfromStatic factory method to create a Password instance.
The plain text password.
A new Password instance.
The
Passwordclass provides methods for securely hashing, comparing, and checking the strength of passwords. It integrates withbcryptfor hashing and comparison and also checks for weak or compromised passwords using both strength rules and the Pwned Passwords API.