10 lines
293 B
TypeScript
10 lines
293 B
TypeScript
import * as bcrypt from 'bcryptjs';
|
|
|
|
export async function hashPassword(plain: string, rounds: number = 10): Promise<string> {
|
|
return bcrypt.hash(plain, rounds);
|
|
}
|
|
|
|
export async function verifyPassword(plain: string, hash: string): Promise<boolean> {
|
|
return bcrypt.compare(plain, hash);
|
|
}
|