cal.pub0.org/lib/auth.ts

11 lines
320 B
TypeScript

import { hash, compare } from 'bcryptjs';
export async function hashPassword(password) {
const hashedPassword = await hash(password, 12);
return hashedPassword;
}
export async function verifyPassword(password, hashedPassword) {
const isValid = await compare(password, hashedPassword);
return isValid;
}