passwordHandler
function passwordHandler(password: string, hashedPassword: string)
async
Compares a plaintext password with a hashed password.
Returns: Promise<boolean>
true
if passwords match, otherwisefalse
.
See the official bcrypt package documentation for more details:
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
password | string | The plaintext password. | ||
hashedPassword | string | The hashed password for comparison. |
See:
const isMatch = await passwordHandler("myPassword", storedHashedPassword);
if (isMatch) {
console.log("Password is correct");
}