Files
AM_CMS_Summative/app/lib/auth.ts
T
2026-11-06 10:02:29 +00:00

14 lines
379 B
TypeScript

import bcrypt from "bcryptjs";
const SALT_ROUNDS = 10;
export async function hashPassword(password: string): Promise<string> { // hashes and salts password
return bcrypt.hash(password, SALT_ROUNDS)
}
export async function verifyPassword( // compares password to hash
password: string,
hash: string
): Promise<boolean> {
return bcrypt.compare(password, hash);
}