In `credential.service.ts`, markers were added to functions `getHashFromPassword` and `comparePassword` to indicate necessity for testing. This provides clear indications for developers about which functions require tests to be written or updated. Signed-off-by: Mathis <yidhra@tuta.io>
24 lines
556 B
TypeScript
24 lines
556 B
TypeScript
import Argon2id from "@node-rs/argon2";
|
|
|
|
//ToTest
|
|
export async function getHashFromPassword(password: string) {
|
|
return await Argon2id.hash(password,{
|
|
secret: Buffer.from(`${process.env["HASH_SECRET"]}`),
|
|
algorithm: 2
|
|
})
|
|
}
|
|
|
|
//ToTest
|
|
export async function comparePassword(password: string, hash: string) {
|
|
return await Argon2id.verify(hash, password, {
|
|
secret: Buffer.from(`${process.env["HASH_SECRET"]}`),
|
|
algorithm: 2
|
|
});
|
|
}
|
|
|
|
const CredentialService = {
|
|
compare: comparePassword,
|
|
hash: getHashFromPassword,
|
|
}
|
|
|
|
export default CredentialService; |