12 lines
338 B
TypeScript
12 lines
338 B
TypeScript
import bcrypt from "bcryptjs";
|
|
|
|
export async function verifyPassword(
|
|
plainTextPassword: string,
|
|
hashedPassword: string,
|
|
): Promise<boolean> {
|
|
return bcrypt.compare(plainTextPassword, hashedPassword);
|
|
}
|
|
|
|
export async function hashPassword(plainTextPassword: string): Promise<string> {
|
|
return bcrypt.hash(plainTextPassword, 12);
|
|
}
|