aboutsummaryrefslogtreecommitdiff
path: root/src/lib/password.ts
blob: f5c450bd9d19017151c1b4961f078baf50c748cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import bcrypt from 'bcryptjs';

const SALT_ROUNDS = 10;

export function hashPassword(password: string, rounds = SALT_ROUNDS) {
  return bcrypt.hashSync(password, rounds);
}

export function checkPassword(password: string, passwordHash: string) {
  return bcrypt.compareSync(password, passwordHash);
}