1
0
Fork 0

Compare commits

...

4 Commits

@ -132,14 +132,18 @@ This error is thrown if there is a different problem with the input (either the
### scrypt.InternalError ### scrypt.InternalError
This error is thrown when an internal error of some other kind occurs in the `scrypt` library. The original error message is retained. This error is thrown when an internal error of some other kind occurs in the `node-scrypt` library. The original error message is retained.
### scrypt.scryptLib ### scrypt.scryptLib
Provides access to the underlying `scrypt` library that is used. Useful if you want to eg. specify custom Scrypt parameters. Provides access to the underlying `node-scrypt2` library that is used. Useful if you want to eg. specify custom Scrypt parameters.
## Changelog ## Changelog
### v1.0.0 ### v1.0.0
Initial release. Initial release.
### v2.1.0
Utilizes `node-scrypt2` to support node 10+.

@ -1,4 +1,4 @@
scrypt = require "scrypt" scrypt = require "node-scrypt2"
errors = require "errors" errors = require "errors"
Promise = require "bluebird" Promise = require "bluebird"
@ -68,7 +68,7 @@ module.exports =
verifyHash: (password, hash, callback) -> verifyHash: (password, hash, callback) ->
(new Promise (resolve, reject) -> (new Promise (resolve, reject) ->
hashBuffer = new Buffer(hash, "base64") hashBuffer = Buffer.from(hash, "base64")
scrypt.verifyKdf hashBuffer, normalizePassword(password), scryptHandler(resolve, reject) scrypt.verifyKdf hashBuffer, normalizePassword(password), scryptHandler(resolve, reject)
).nodeify(callback) ).nodeify(callback)

@ -1,6 +1,6 @@
var Promise, defaultParameters, errors, getDefaultParameters, normalizePassword, scrypt, scryptErrorMap, scryptHandler; var Promise, defaultParameters, errors, getDefaultParameters, normalizePassword, scrypt, scryptErrorMap, scryptHandler;
scrypt = require("scrypt"); scrypt = require("node-scrypt2");
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 new Buffer(password); return Buffer.from(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 = new Buffer(hash, "base64"); hashBuffer = Buffer.from(hash, "base64");
return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject)); return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject));
})).nodeify(callback); })).nodeify(callback);
}, },

@ -1,6 +1,6 @@
{ {
"name": "scrypt-for-humans", "name": "scrypt-for-humans",
"version": "2.0.5", "version": "2.1.0",
"description": "A human-friendly API wrapper for the Node.js Scrypt bindings.", "description": "A human-friendly API wrapper for the Node.js Scrypt bindings.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -31,6 +31,6 @@
"dependencies": { "dependencies": {
"bluebird": "^2.6.4", "bluebird": "^2.6.4",
"errors": "^0.2.0", "errors": "^0.2.0",
"scrypt": "^6.0.1" "node-scrypt2": "^1.0.0"
} }
} }

Loading…
Cancel
Save