first commit

This commit is contained in:
kajvan
2023-10-10 17:07:22 +02:00
commit f7e668c8fb
10 changed files with 988 additions and 0 deletions
+20
View File
@@ -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;