From 46f37f7426d3ed164008cf053d9089a8b3df384d Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 5 Sep 2018 15:14:20 +0200 Subject: [PATCH] using @mlink/scrypt for node 10 compatibility --- package-lock.json | 34 +++++++++++++++++++++------------- package.json | 4 ++-- src/services/my_scrypt.js | 4 ++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index ad8f5fb17..1919e6a7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -502,6 +502,22 @@ } } }, + "@mlink/scrypt": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@mlink/scrypt/-/scrypt-6.1.2.tgz", + "integrity": "sha512-7w1QoOih2eW0d0Lj5SK9mFV/8OhtZqYnT0IQiY/iCEcjdGAAt145YAAiq21iVV+H0Xe62fnF6VbZPMO3+qrSAQ==", + "requires": { + "bindings": "1.3.0", + "nan": "2.11.0" + }, + "dependencies": { + "nan": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==" + } + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -1908,6 +1924,11 @@ "chainsaw": "0.1.0" } }, + "bindings": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" + }, "bl": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", @@ -8953,11 +8974,6 @@ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, - "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" - }, "nanomatch": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", @@ -11272,14 +11288,6 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "scrypt": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", - "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", - "requires": { - "nan": "2.7.0" - } - }, "seek-bzip": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", diff --git a/package.json b/package.json index 4f2c45f67..6942572cc 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "request-promise": "4.2.2", "rimraf": "2.6.2", "sanitize-filename": "1.6.1", - "scrypt": "6.0.3", "serve-favicon": "2.5.0", "session-file-store": "1.2.0", "simple-node-logger": "0.93.37", @@ -69,7 +68,8 @@ "turndown": "^5.0.1", "unescape": "1.0.1", "ws": "6.0.0", - "xml2js": "0.4.19" + "xml2js": "0.4.19", + "@mlink/scrypt": "6.1.2" }, "devDependencies": { "electron": "2.0.7", diff --git a/src/services/my_scrypt.js b/src/services/my_scrypt.js index ed724bb22..51a22863d 100644 --- a/src/services/my_scrypt.js +++ b/src/services/my_scrypt.js @@ -1,7 +1,7 @@ "use strict"; const optionService = require('./options'); -const scrypt = require('scrypt'); +const scrypt = require('@mlink/scrypt'); async function getVerificationHash(password) { const salt = await optionService.getOption('passwordVerificationSalt'); @@ -17,7 +17,7 @@ async function getPasswordDerivedKey(password) { async function getScryptHash(password, salt) { const hashed = scrypt.hashSync(password, - {N: 16384, r:8, p:1}, + {N: 14, r:8, p:1}, 32, salt);