first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const bcrypt = require('bcrypt');
|
||||
|
||||
class PassCheck{
|
||||
constructor(BcryptSaltRounds, PassPolicyOptions) {
|
||||
this.BcryptSaltRounds = BcryptSaltRounds;
|
||||
this.PassPolicy = new PassPolicy(PassPolicyOptions);
|
||||
}
|
||||
|
||||
async verifyPassword(password, hash) {
|
||||
return await bcrypt.compare(password, hash);
|
||||
}
|
||||
|
||||
async hashPassword(password) {
|
||||
const salt = await bcrypt.genSalt(this.BcryptSaltRounds);
|
||||
const hash = await bcrypt.hash(password, salt);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PassCheck;
|
||||
Reference in New Issue
Block a user