18 lines
433 B
TypeScript
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;
|