15 lines
319 B
TypeScript
15 lines
319 B
TypeScript
import bcrypt from 'bcryptjs';
|
|
|
|
const BCRYPT_ROUNDS = 12;
|
|
|
|
export async function hashPassword(password: string): Promise<string> {
|
|
return bcrypt.hash(password, BCRYPT_ROUNDS);
|
|
}
|
|
|
|
export async function verifyPassword(
|
|
password: string,
|
|
hash: string
|
|
): Promise<boolean> {
|
|
return bcrypt.compare(password, hash);
|
|
}
|