diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index f6cb47bc8b..f1c4b2d28f 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -25,6 +25,7 @@ "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", + "bcryptjs": "2.4.3", "dotenv": "16.0.1", "emitter-listener": "1.1.2", "ioredis": "4.28.0", diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 04d09d2eb7..b979635fcc 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -19,6 +19,7 @@ if (!LOADED && isDev() && !isTest()) { const env = { isTest, isDev, + JS_BCRYPT: process.env.JS_BCRYPT, JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005", COUCH_DB_USERNAME: process.env.COUCH_DB_USER, diff --git a/packages/backend-core/src/hashing.js b/packages/backend-core/src/hashing.js index 45abe2f9bd..7524e66043 100644 --- a/packages/backend-core/src/hashing.js +++ b/packages/backend-core/src/hashing.js @@ -1,5 +1,5 @@ -const bcrypt = require("bcrypt") const env = require("./environment") +const bcrypt = env.JS_BCRYPT ? require("bcryptjs") : require("bcrypt") const { v4 } = require("uuid") const SALT_ROUNDS = env.SALT_ROUNDS || 10 diff --git a/packages/cli/src/environment.js b/packages/cli/src/environment.js index a42eceb07e..c8c8fe87e9 100644 --- a/packages/cli/src/environment.js +++ b/packages/cli/src/environment.js @@ -1 +1,2 @@ process.env.NO_JS = "1" +process.env.JS_BCRYPT = "1" diff --git a/packages/cli/src/prebuilds.js b/packages/cli/src/prebuilds.js index b582b090e7..0decdc6c63 100644 --- a/packages/cli/src/prebuilds.js +++ b/packages/cli/src/prebuilds.js @@ -27,7 +27,10 @@ function checkForBinaries() { } function cleanup(evt) { - if (evt && evt.errno) { + if (!isNaN(evt)) { + return + } + if (evt) { console.error( error( "Failed to run CLI command - please report with the following message:"