parent
689d1c8944
commit
d1544f1773
@ -1,18 +0,0 @@
|
||||
import * as bcrypt from "bcryptjs";
|
||||
|
||||
const saltRounds = 10; // Le nombre de tours de salage
|
||||
|
||||
/* Fonction pour hasher le mot de passe */
|
||||
export async function hashPassword(password: string): Promise<string> {
|
||||
const hashedPassword = await bcrypt.hash(password, saltRounds);
|
||||
return hashedPassword;
|
||||
}
|
||||
|
||||
/* Fonction pour vérifier le mot de passe */
|
||||
export async function comparePassword(
|
||||
plainPassword: string,
|
||||
hashedPassword: string
|
||||
): Promise<boolean> {
|
||||
const isMatch = await bcrypt.compare(plainPassword, hashedPassword);
|
||||
return isMatch;
|
||||
}
|
Loading…
Reference in new issue