1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/PasswordHelper.ts

13 lines
338 B
TypeScript
Raw Normal View History

2017-07-10 04:36:25 +08:00
import * as bcrypt from "bcrypt";
export class PasswordHelper {
public static async cryptPassword(password) {
const salt = await bcrypt.genSalt(10);
return await bcrypt.hash(password, salt);
}
public static async comparePassword(password, encryptedPassword) {
return bcrypt.compare(password, encryptedPassword);
}
}