remove argon and use bcryptjs

This commit is contained in:
Martin McKeaveney 2020-01-23 10:15:58 +00:00
parent 549b0727a0
commit 37b1a507ea
10 changed files with 5571 additions and 6 deletions

5
package-lock.json generated
View File

@ -1356,6 +1356,11 @@
"tweetnacl": "^0.14.3" "tweetnacl": "^0.14.3"
} }
}, },
"bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
},
"before-after-hook": { "before-after-hook": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",

View File

@ -4,7 +4,9 @@
"devDependencies": { "devDependencies": {
"lerna": "^3.14.1" "lerna": "^3.14.1"
}, },
"dependencies": {}, "dependencies": {
"bcryptjs": "^2.4.3"
},
"scripts": { "scripts": {
"bootstrap": "lerna bootstrap", "bootstrap": "lerna bootstrap",
"build": "lerna run build", "build": "lerna run build",

13
packages/core/package-lock.json generated Normal file
View File

@ -0,0 +1,13 @@
{
"name": "@budibase/core",
"version": "0.0.15",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
}
}
}

View File

@ -72,6 +72,7 @@
}, },
"dependencies": { "dependencies": {
"@nx-js/compiler-util": "^2.0.0", "@nx-js/compiler-util": "^2.0.0",
"bcryptjs": "^2.4.3",
"date-fns": "^1.29.0", "date-fns": "^1.29.0",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"lunr": "^2.3.5", "lunr": "^2.3.5",

View File

@ -0,0 +1,14 @@
import bcrypt from "bcryptjs";
function hash(password) {
return bcrypt.hashSync(password, 10);
}
function verify(password, hash) {
return bcrypt.compareSync(password, hash);
}
export default {
hash, verify
};

View File

@ -6,7 +6,7 @@ import getAuthApi from "./authApi";
import getActionsApi from "./actionsApi"; import getActionsApi from "./actionsApi";
import {setupDatastore, createEventAggregator} from "./appInitialise"; import {setupDatastore, createEventAggregator} from "./appInitialise";
import {initialiseActions} from "./actionsApi/initialise" import {initialiseActions} from "./actionsApi/initialise"
import {isSomething} from "./common"; import {isSomething, crypto} from "./common";
import {cleanup} from "./transactions/cleanup"; import {cleanup} from "./transactions/cleanup";
import {generateFullPermissions} from "./authApi/generateFullPermissions"; import {generateFullPermissions} from "./authApi/generateFullPermissions";
import {getApplicationDefinition} from "./templateApi/getApplicationDefinition"; import {getApplicationDefinition} from "./templateApi/getApplicationDefinition";
@ -111,5 +111,6 @@ export {initialiseData} from "./appInitialise/initialiseData";
export {getDatabaseManager} from "./appInitialise/databaseManager"; export {getDatabaseManager} from "./appInitialise/databaseManager";
export {hierarchy}; export {hierarchy};
export {common}; export {common};
export {crypto};
export default getAppApis; export default getAppApis;

View File

@ -1,4 +1,13 @@
import {hash, verify} from "argon2"; import bcrypt from "bcryptjs";
function hash(password) {
return bcrypt.hashSync(password, 10);
}
function verify(password, hash) {
return bcrypt.compareSync(password, hash);
}
export default { export default {
hash, verify hash, verify

5522
packages/server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@
"@budibase/client": "^0.0.15", "@budibase/client": "^0.0.15",
"@budibase/core": "^0.0.15", "@budibase/core": "^0.0.15",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"argon2": "^0.23.0",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"koa": "^2.7.0", "koa": "^2.7.0",
"koa-body": "^4.1.0", "koa-body": "^4.1.0",

View File

@ -1,5 +1,4 @@
const crypto = require("../nodeCrypto"); const {getAppApis, getTemplateApi, crypto } = require("@budibase/core");
const {getAppApis, getTemplateApi} = require("@budibase/core");
const getDatastore = require("./datastore"); const getDatastore = require("./datastore");
const { masterAppPackage } = require("../utilities/createAppPackage"); const { masterAppPackage } = require("../utilities/createAppPackage");
const getDatabaseManager = require("../utilities/databaseManager"); const getDatabaseManager = require("../utilities/databaseManager");