Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
using new scrypt api from node 10 as a replacement of third party library
azivner209551a205b4
diff --git a/bin/build.sh b/bin/build.shindex 88b6582e84..2ce6612757 100755--- a/bin/build.sh+++ b/bin/build.sh@@ -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"diff --git a/bin/deps/scrypt.node b/bin/deps/scrypt.nodedeleted file mode 100644index 93629c1004..0000000000Binary files a/bin/deps/scrypt.node and /dev/null differdiff --git a/package-lock.json b/package-lock.jsonindex 8034aa5aaa..6e6ed72057 100644--- a/package-lock.json+++ b/package-lock.json@@ -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",diff --git a/package.json b/package.jsonindex 641892c3cd..db4de3ee56 100644--- a/package.json+++ b/package.json@@ -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",diff --git a/src/services/my_scrypt.js b/src/services/my_scrypt.jsindex 51a22863da..5ca250b09d 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('@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;}