using new scrypt api from node 10 as a replacement of third party library

This commit is contained in:
azivner 2018-10-14 11:48:29 +02:00
parent c6bfd3909f
commit 209551a205
5 changed files with 3 additions and 16 deletions

View file

@ -29,7 +29,6 @@ cp -r bin/deps/sqlite/* $WIN_RES_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/image/cjpeg.exe $WIN_RES_DIR/node_modules/mozjpeg/vendor/
cp bin/deps/image/pngquant.exe $WIN_RES_DIR/node_modules/pngquant-bin/vendor/
cp bin/deps/image/gifsicle.exe $WIN_RES_DIR/node_modules/giflossy/vendor/
cp bin/deps/scrypt.node $WIN_RES_DIR/node_modules/@mlink/scrypt/build/Release/
echo "Cleaning up unnecessary binaries from all builds"

Binary file not shown.

9
package-lock.json generated
View file

@ -364,15 +364,6 @@
"core-js": "^2.5.7"
}
},
"@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.10.0"
}
},
"@mrmlnc/readdir-enhanced": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",

View file

@ -26,7 +26,6 @@
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs"
},
"dependencies": {
"@mlink/scrypt": "6.1.2",
"async-mutex": "0.1.3",
"axios": "0.18",
"body-parser": "1.18.3",

View file

@ -1,7 +1,7 @@
"use strict";
const optionService = require('./options');
const scrypt = require('@mlink/scrypt');
const crypto = require('crypto');
async function getVerificationHash(password) {
const salt = await optionService.getOption('passwordVerificationSalt');
@ -16,10 +16,8 @@ async function getPasswordDerivedKey(password) {
}
async function getScryptHash(password, salt) {
const hashed = scrypt.hashSync(password,
{N: 14, r:8, p:1},
32,
salt);
const hashed = crypto.scryptSync(password, salt, 32,
{N: 16384, r:8, p:1});
return hashed;
}