Swap bcrypt library.

This commit is contained in:
Mike Cao 2021-04-28 02:45:38 -07:00
parent b294c8ef72
commit 20dc76861f
3 changed files with 22 additions and 194 deletions

View file

@ -1,6 +1,6 @@
import crypto from 'crypto';
import { v4, v5, validate } from 'uuid';
import bcrypt from 'bcrypt';
import bcrypt from 'bcryptjs';
import { JWT, JWE, JWK } from 'jose';
import { startOfMonth } from 'date-fns';
@ -40,11 +40,11 @@ export function getRandomChars(n) {
}
export async function hashPassword(password) {
return bcrypt.hash(password, SALT_ROUNDS);
return bcrypt.hashSync(password, SALT_ROUNDS);
}
export async function checkPassword(password, hash) {
return bcrypt.compare(password, hash);
return bcrypt.compareSync(password, hash);
}
export async function createToken(payload) {