|
|
@ -1,6 +1,6 @@
|
|
|
|
var Promise, defaultParameters, errors, getDefaultParameters, normalizePassword, scrypt, scryptErrorMap, scryptHandler;
|
|
|
|
var Promise, defaultParameters, errors, getDefaultParameters, normalizePassword, scrypt, scryptErrorMap, scryptHandler;
|
|
|
|
|
|
|
|
|
|
|
|
scrypt = require("node-scrypt2");
|
|
|
|
scrypt = require("scrypt");
|
|
|
|
|
|
|
|
|
|
|
|
errors = require("errors");
|
|
|
|
errors = require("errors");
|
|
|
|
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ normalizePassword = function(password) {
|
|
|
|
if (Buffer.isBuffer(password)) {
|
|
|
|
if (Buffer.isBuffer(password)) {
|
|
|
|
return password;
|
|
|
|
return password;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return Buffer.from(password);
|
|
|
|
return new Buffer(password);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -113,7 +113,7 @@ module.exports = {
|
|
|
|
verifyHash: function(password, hash, callback) {
|
|
|
|
verifyHash: function(password, hash, callback) {
|
|
|
|
return (new Promise(function(resolve, reject) {
|
|
|
|
return (new Promise(function(resolve, reject) {
|
|
|
|
var hashBuffer;
|
|
|
|
var hashBuffer;
|
|
|
|
hashBuffer = Buffer.from(hash, "base64");
|
|
|
|
hashBuffer = new Buffer(hash, "base64");
|
|
|
|
return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject));
|
|
|
|
return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject));
|
|
|
|
})).nodeify(callback);
|
|
|
|
})).nodeify(callback);
|
|
|
|
},
|
|
|
|
},
|
|
|
|