1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/PasswordHelper.ts
2017-07-09 22:36:25 +02:00

13 lines
338 B
TypeScript

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);
}
}