You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
349 B

import argon2 from 'argon2';
/**
* Checks if `password` matches the hash.
*/
export function isPasswordValid(
password: string,
hash: string
): Promise<boolean> {
return argon2.verify(hash, password);
}
/**
* Hashes a password.
*/
export async function hashPassword(password: string): Promise<string> {
return argon2.hash(password);
}