11 lines
331 B
TypeScript
11 lines
331 B
TypeScript
import bcrypt from 'bcryptjs';
|
|
|
|
/** Pure password helpers (no server-only import) so they are unit-testable. */
|
|
export function hashPassword(plain: string): Promise<string> {
|
|
return bcrypt.hash(plain, 10);
|
|
}
|
|
|
|
export function verifyPassword(plain: string, hash: string): Promise<boolean> {
|
|
return bcrypt.compare(plain, hash);
|
|
}
|