Files
freno-dev/src/server/password.ts
2025-12-19 11:48:00 -05:00

17 lines
435 B
TypeScript

import * as bcrypt from "bcrypt";
export async function hashPassword(password: string): Promise<string> {
const saltRounds = 10;
const salt = await bcrypt.genSalt(saltRounds);
const hashedPassword = await bcrypt.hash(password, salt);
return hashedPassword;
}
export async function checkPassword(
password: string,
hash: string
): Promise<boolean> {
const match = await bcrypt.compare(password, hash);
return match;
}