This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
brief-04-back/services/CredentialService.js
2024-04-17 16:55:04 +02:00

18 lines
452 B
JavaScript

const Argon2id = require("@node-rs/argon2");
/**
* Generates a hash from a given password using Argon2id algorithm.
*
* @param {string} password - The password to generate a hash for.
* @return {Promise<string>} - The generated hash.
*/
async function getHashFromPassword(password) {
return await Argon2id.hash(password,{
secret: Buffer.from(`${process.env.HASH_SECRET}`),
algorithm: 2
})
}
module.exports = {
getHashFromPassword
}