Register, Login, and Logout
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
const argon2 = require('argon2');
|
||||
|
||||
async function HashPassword(password) {
|
||||
try {
|
||||
return await argon2.hash(password);
|
||||
} catch(err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async function TestPassword(password, hash) {
|
||||
try {
|
||||
return await argon2.verify(hash, password);
|
||||
} catch(err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
HashPassword,
|
||||
TestPassword
|
||||
}
|
||||
Reference in New Issue
Block a user