mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
13 lines
338 B
TypeScript
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);
|
|
}
|
|
}
|