forked from ss1121/FKP-REST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcrypt.js
More file actions
41 lines (39 loc) · 1.19 KB
/
bcrypt.js
File metadata and controls
41 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// "use strict";
// var bcrypt = require("bcrypt");
//
// // These do not need to be promisified
// module.exports = bcrypt.genSaltSync;
// module.exports = bcrypt.hashSync;
// module.exports = bcrypt.compareSync;
// module.exports.getRounds = bcrypt.getRounds;
//
// module.exports.genSalt = function(rounds, ignore) {
// return new Promise(function(resolve, reject) {
// bcrypt.genSalt(rounds, ignore, function(err, salt) {
// if (err) { return reject(err); }
// return resolve(salt);
// });
// });
// };
//
// module.exports.hash = function(data, salt) {
// return new Promise(function(resolve, reject) {
// bcrypt.hash(data, salt, function(err, hash) {
// if (err) { return reject(err); }
// return resolve(hash);
// });
// });
// };
//
// module.exports.compare = function(data, hash) {
// return new Promise(function(resolve, reject) {
// bcrypt.compare(data, hash, function(err, matched) {
// if (err) { return reject(err); }
// return resolve(matched);
// });
// });
// };
var bcrypt = require('bcryptjs');
module.exports.genSalt = bcrypt.genSaltSync
module.exports.hash = bcrypt.hashSync
module.exports.compare = bcrypt.compareSync