Add hashing y verificación de contraseña

This commit is contained in:
Carlos Narro
2026-05-30 19:32:28 +02:00
parent 5fb0d571cd
commit 49b5910593
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import bcrypt from 'bcryptjs';
const SALT_ROUNDS = 10;
export function hashPassword(plain: string): Promise<string> {
return bcrypt.hash(plain, SALT_ROUNDS);
}
export function verifyPassword(plain: string, hash: string): Promise<boolean> {
return bcrypt.compare(plain, hash);
}