Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Requested changes

Daniel Hougaard108f3cf1176a
diff --git a/backend/src/lib/crypto/srp.ts b/backend/src/lib/crypto/srp.ts
index 069d5a554b..cdf8626093 100644
--- a/backend/src/lib/crypto/srp.ts
+++ b/backend/src/lib/crypto/srp.ts
@@ -8,10 +8,6 @@ import { TUserEncryptionKeys } from "@app/db/schemas";
import { decryptSymmetric, encryptAsymmetric, encryptSymmetric } from "./encryption";
-// Importing the argon2 constants from the argon2 module fails due to an issue with importing commonjs modules.
-// Read more: https://stackoverflow.com/questions/70605320/named-export-types-not-found-the-requested-module-mongoose-is-a-commonjs-mo
-const ARGON_2_ID = 2;
-
export const generateSrpServerKey = async (salt: string, verifier: string) => {
// eslint-disable-next-line new-cap
const server = new jsrp.server();
@@ -62,7 +58,7 @@ export const generateUserSrpKeys = async (email: string, password: string) => {
timeCost: 3,
parallelism: 1,
hashLength: 32,
- type: ARGON_2_ID,
+ type: argon2.argon2id,
raw: true
});
if (!derivedKey) throw new Error("Failed to derive key from password");
@@ -106,7 +102,7 @@ export const getUserPrivateKey = async (password: string, user: TUserEncryptionK
timeCost: 3,
parallelism: 1,
hashLength: 32,
- type: ARGON_2_ID,
+ type: argon2.argon2id,
raw: true
});
if (!derivedKey) throw new Error("Failed to derive key from password");
diff --git a/backend/src/lib/project/index.ts b/backend/src/services/project/project-fns.ts
similarity index 77%
rename from backend/src/lib/project/index.ts
rename to backend/src/services/project/project-fns.ts
index e0ed0d70bb..eb6fe3b116 100644
--- a/backend/src/lib/project/index.ts
+++ b/backend/src/services/project/project-fns.ts
@@ -1,18 +1,8 @@
import crypto from "crypto";
-import { ProjectMembershipRole, TProjectKeys } from "@app/db/schemas";
-
-import { decryptAsymmetric, encryptAsymmetric } from "../crypto";
-
-type AddUserToWsDTO = {
- decryptKey: TProjectKeys & { sender: { publicKey: string } };
- userPrivateKey: string;
- members: {
- orgMembershipId: string;
- projectMembershipRole: ProjectMembershipRole;
- userPublicKey: string;
- }[];
-};
+import { decryptAsymmetric, encryptAsymmetric } from "@app/lib/crypto";
+
+import { AddUserToWsDTO } from "./project-types";
export const createWsMembers = ({ members, decryptKey, userPrivateKey }: AddUserToWsDTO) => {
const key = decryptAsymmetric({