From 4c2ce2600080c434127f18d8d7035028a123cc11 Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Fri, 13 Mar 2020 16:03:54 -0400 Subject: [PATCH 1/5] working napi (node > 10) scrypt impl --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a20b56..6a6975b 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,6 @@ "dependencies": { "bluebird": "^2.6.4", "errors": "^0.2.0", - "scrypt": "^6.0.1" + "scrypt": "github:jkantr/node-scrypt#napi" } } -- 2.40.1 From 38272bbbd3171c5e66e0e385f6dbcfcc43fc6627 Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Fri, 13 Mar 2020 16:04:09 -0400 Subject: [PATCH 2/5] fix buffer deprecation --- lib/scrypt-for-humans.coffee | 2 +- lib/scrypt-for-humans.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/scrypt-for-humans.coffee b/lib/scrypt-for-humans.coffee index b8d201e..148ba2e 100644 --- a/lib/scrypt-for-humans.coffee +++ b/lib/scrypt-for-humans.coffee @@ -68,7 +68,7 @@ module.exports = verifyHash: (password, hash, callback) -> (new Promise (resolve, reject) -> - hashBuffer = new Buffer(hash, "base64") + hashBuffer = Buffer.from(hash, "base64") scrypt.verifyKdf hashBuffer, normalizePassword(password), scryptHandler(resolve, reject) ).nodeify(callback) diff --git a/lib/scrypt-for-humans.js b/lib/scrypt-for-humans.js index 4bace34..7bb3da5 100644 --- a/lib/scrypt-for-humans.js +++ b/lib/scrypt-for-humans.js @@ -56,7 +56,7 @@ normalizePassword = function(password) { if (Buffer.isBuffer(password)) { return password; } else { - return new Buffer(password); + return Buffer.from(password); } }; @@ -113,7 +113,7 @@ module.exports = { verifyHash: function(password, hash, callback) { return (new Promise(function(resolve, reject) { var hashBuffer; - hashBuffer = new Buffer(hash, "base64"); + hashBuffer = Buffer.from(hash, "base64"); return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject)); })).nodeify(callback); }, -- 2.40.1 From 8961a5d955c938a654c8abee05d481967303a9ae Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Fri, 13 Mar 2020 18:43:28 -0400 Subject: [PATCH 3/5] update to use node-scrypt2, bump to 2.1.0 --- lib/scrypt-for-humans.coffee | 2 +- lib/scrypt-for-humans.js | 2 +- package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scrypt-for-humans.coffee b/lib/scrypt-for-humans.coffee index 148ba2e..9b0eaf2 100644 --- a/lib/scrypt-for-humans.coffee +++ b/lib/scrypt-for-humans.coffee @@ -1,4 +1,4 @@ -scrypt = require "scrypt" +scrypt = require "node-scrypt2" errors = require "errors" Promise = require "bluebird" diff --git a/lib/scrypt-for-humans.js b/lib/scrypt-for-humans.js index 7bb3da5..fc85fdf 100644 --- a/lib/scrypt-for-humans.js +++ b/lib/scrypt-for-humans.js @@ -1,6 +1,6 @@ var Promise, defaultParameters, errors, getDefaultParameters, normalizePassword, scrypt, scryptErrorMap, scryptHandler; -scrypt = require("scrypt"); +scrypt = require("node-scrypt2"); errors = require("errors"); diff --git a/package.json b/package.json index 6a6975b..619a083 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrypt-for-humans", - "version": "2.0.5", + "version": "2.1.0", "description": "A human-friendly API wrapper for the Node.js Scrypt bindings.", "main": "index.js", "scripts": { @@ -31,6 +31,6 @@ "dependencies": { "bluebird": "^2.6.4", "errors": "^0.2.0", - "scrypt": "github:jkantr/node-scrypt#napi" + "node-scrypt2": "^1.0.0" } } -- 2.40.1 From 9a3bde08729665890ccbcfca10e107b0a924accd Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Fri, 13 Mar 2020 18:43:36 -0400 Subject: [PATCH 4/5] additional readme things --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3938bcf..0d45251 100644 --- a/README.md +++ b/README.md @@ -132,14 +132,18 @@ This error is thrown if there is a different problem with the input (either the ### 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 -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 ### v1.0.0 Initial release. + +### v2.1.0 + +Utilizes `node-scrypt2` to support node 10+. -- 2.40.1 From cf65bbc6082ad723c89fbb1c0c2d5e56d700c206 Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Thu, 19 Mar 2020 13:52:11 -0400 Subject: [PATCH 5/5] bump node-scrypt2 version for windows 10 compat --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 619a083..89a29eb 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,6 @@ "dependencies": { "bluebird": "^2.6.4", "errors": "^0.2.0", - "node-scrypt2": "^1.0.0" + "node-scrypt2": "^1.0.1" } } -- 2.40.1