Skip to content

Commit 458b4e8

Browse files
committed
Test of sha passwords (meteor accounts)
1 parent 8b05cf4 commit 458b4e8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/server/src/encryption.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import bcrypt from 'bcryptjs';
2+
import crypto from 'crypto';
23

34
const hashPassword = async (password) => {
45
const salt = await bcrypt.genSalt(10);
@@ -8,6 +9,13 @@ const hashPassword = async (password) => {
89

910
export { hashPassword };
1011

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);
1220

1321
export { verifyPassword };

0 commit comments

Comments
 (0)