amati/src/modules/auth/utils/comparePassword.ts
2024-02-14 09:56:37 +07:00

18 lines
433 B
TypeScript

import bcrypt from "bcrypt";
/**
* Compares a plain text password with a hashed password.
*
* @param password - The plain text password to compare.
* @param hash - The hashed password to compare against.
* @returns True if the passwords match, false otherwise.
*/
async function comparePassword(
password: string,
hash: string
): Promise<boolean> {
return bcrypt.compare(password, hash);
}
export default comparePassword;