From 70242f3be77bb1e3d47c74fa1a6ccc83ab47821f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Sat, 26 Nov 2022 21:26:19 +0000 Subject: [PATCH] Fixing some issues detected by testing. --- packages/backend-core/src/db/utils.ts | 2 +- packages/backend-core/src/newid.ts | 5 +++++ packages/backend-core/src/utils/hashing.ts | 6 +----- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 packages/backend-core/src/newid.ts diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts index 558dde1e3b..cfab451de4 100644 --- a/packages/backend-core/src/db/utils.ts +++ b/packages/backend-core/src/db/utils.ts @@ -1,4 +1,4 @@ -import { newid } from "../utils" +import { newid } from "../utils/hashing" import { DEFAULT_TENANT_ID, Config } from "../constants" import env from "../environment" import { diff --git a/packages/backend-core/src/newid.ts b/packages/backend-core/src/newid.ts new file mode 100644 index 0000000000..5676c23f48 --- /dev/null +++ b/packages/backend-core/src/newid.ts @@ -0,0 +1,5 @@ +import { v4 } from "uuid" + +export function newid() { + return v4().replace(/-/g, "") +} diff --git a/packages/backend-core/src/utils/hashing.ts b/packages/backend-core/src/utils/hashing.ts index d9277ee3e7..220ffea47f 100644 --- a/packages/backend-core/src/utils/hashing.ts +++ b/packages/backend-core/src/utils/hashing.ts @@ -1,6 +1,6 @@ import env from "../environment" +export * from "../newid" const bcrypt = env.JS_BCRYPT ? require("bcryptjs") : require("bcrypt") -import { v4 } from "uuid" const SALT_ROUNDS = env.SALT_ROUNDS || 10 @@ -12,7 +12,3 @@ export async function hash(data: string) { export async function compare(data: string, encrypted: string) { return bcrypt.compare(data, encrypted) } - -export function newid() { - return v4().replace(/-/g, "") -}