Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 21x 241x 211x | import bcrypt from 'bcrypt';
import { PasswordHasher } from '../../application/user/password-hasher';
const SALT_ROUNDS = 12;
export class BcryptPasswordHasher implements PasswordHasher {
async hash(plainPassword: string): Promise<string> {
return bcrypt.hash(plainPassword, SALT_ROUNDS);
}
async compare(plainPassword: string, passwordHash: string): Promise<boolean> {
return bcrypt.compare(plainPassword, passwordHash);
}
}
|