cal/lib/auth.ts

11 lines
320 B
TypeScript
Raw Normal View History

2021-03-24 12:03:04 -03:00
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;
}