We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b05cf4 commit 458b4e8Copy full SHA for 458b4e8
packages/server/src/encryption.js
@@ -1,4 +1,5 @@
1
import bcrypt from 'bcryptjs';
2
+import crypto from 'crypto';
3
4
const hashPassword = async (password) => {
5
const salt = await bcrypt.genSalt(10);
@@ -8,6 +9,13 @@ const hashPassword = async (password) => {
8
9
10
export { hashPassword };
11
-const verifyPassword = async (password, hash) => bcrypt.compare(password, hash);
12
+const shaPassword = password => {
13
+ const hash = crypto.createHash('sha256');
14
+ hash.update(password);
15
+
16
+ return hash.digest('hex');
17
+}
18
19
+const verifyPassword = async (password, hash) => bcrypt.compare(shaPassword(password), hash);
20
21
export { verifyPassword };
0 commit comments