mirror of
https://github.com/zadam/trilium.git
synced 2025-01-19 05:33:19 +08:00
using new scrypt api from node 10 as a replacement of third party library
This commit is contained in:
parent
c6bfd3909f
commit
209551a205
5 changed files with 3 additions and 16 deletions
|
@ -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/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/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/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"
|
echo "Cleaning up unnecessary binaries from all builds"
|
||||||
|
|
||||||
|
|
Binary file not shown.
9
package-lock.json
generated
9
package-lock.json
generated
|
@ -364,15 +364,6 @@
|
||||||
"core-js": "^2.5.7"
|
"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": {
|
"@mrmlnc/readdir-enhanced": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs"
|
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mlink/scrypt": "6.1.2",
|
|
||||||
"async-mutex": "0.1.3",
|
"async-mutex": "0.1.3",
|
||||||
"axios": "0.18",
|
"axios": "0.18",
|
||||||
"body-parser": "1.18.3",
|
"body-parser": "1.18.3",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
const scrypt = require('@mlink/scrypt');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
async function getVerificationHash(password) {
|
async function getVerificationHash(password) {
|
||||||
const salt = await optionService.getOption('passwordVerificationSalt');
|
const salt = await optionService.getOption('passwordVerificationSalt');
|
||||||
|
@ -16,10 +16,8 @@ async function getPasswordDerivedKey(password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getScryptHash(password, salt) {
|
async function getScryptHash(password, salt) {
|
||||||
const hashed = scrypt.hashSync(password,
|
const hashed = crypto.scryptSync(password, salt, 32,
|
||||||
{N: 14, r:8, p:1},
|
{N: 16384, r:8, p:1});
|
||||||
32,
|
|
||||||
salt);
|
|
||||||
|
|
||||||
return hashed;
|
return hashed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue