Skip to content

Commit 20dc768

Browse files
committed
Swap bcrypt library.
1 parent b294c8e commit 20dc768

File tree

3 files changed

+22
-194
lines changed

3 files changed

+22
-194
lines changed

lib/crypto.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import crypto from 'crypto';
22
import { v4, v5, validate } from 'uuid';
3-
import bcrypt from 'bcrypt';
3+
import bcrypt from 'bcryptjs';
44
import { JWT, JWE, JWK } from 'jose';
55
import { startOfMonth } from 'date-fns';
66

@@ -40,11 +40,11 @@ export function getRandomChars(n) {
4040
}
4141

4242
export async function hashPassword(password) {
43-
return bcrypt.hash(password, SALT_ROUNDS);
43+
return bcrypt.hashSync(password, SALT_ROUNDS);
4444
}
4545

4646
export async function checkPassword(password, hash) {
47-
return bcrypt.compare(password, hash);
47+
return bcrypt.compareSync(password, hash);
4848
}
4949

5050
export async function createToken(payload) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"dependencies": {
5959
"@prisma/client": "2.21.2",
6060
"@reduxjs/toolkit": "^1.5.1",
61-
"bcrypt": "^5.0.1",
61+
"bcryptjs": "^2.4.3",
6262
"chalk": "^4.1.1",
6363
"chart.js": "^2.9.4",
6464
"classnames": "^2.3.1",

0 commit comments

Comments
 (0)