Skip to content

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

Fix dummy signup project to support V2

Daniel Hougaardbb92cef764fc
diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.ts
index 21f73e4c63..06f13dc656 100644
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@ -1,10 +1,5 @@
-import crypto from "crypto";
-
-import { encryptAssymmetric } from "@app/components/utilities/cryptography/crypto";
import encryptSecrets from "@app/components/utilities/secrets/encryptSecrets";
-import { uploadWsKey } from "@app/hooks/api/keys/queries";
import { createSecret } from "@app/hooks/api/secrets/mutations";
-import { fetchUserDetails } from "@app/hooks/api/users/queries";
import { createWorkspace } from "@app/hooks/api/workspace/queries";
const secretsToBeAdded = [
@@ -91,43 +86,22 @@ const initProjectHelper = async ({
}) => {
// create new project
const {
- data: { workspace }
+ data: { project }
} = await createWorkspace({
- workspaceName: projectName,
- organizationId
- });
-
- // create and upload new (encrypted) project key
- const randomBytes = crypto.randomBytes(16).toString("hex");
- const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
-
- if (!PRIVATE_KEY) throw new Error("Failed to find private key");
-
- const user = await fetchUserDetails();
-
- const { ciphertext, nonce } = encryptAssymmetric({
- plaintext: randomBytes,
- publicKey: user.publicKey,
- privateKey: PRIVATE_KEY
- });
-
- await uploadWsKey({
- workspaceId: workspace.id,
- userId: user.id,
- encryptedKey: ciphertext,
- nonce
+ organizationId,
+ projectName
});
// encrypt and upload secrets to new project
const secrets = await encryptSecrets({
secretsToEncrypt: secretsToBeAdded,
- workspaceId: workspace.id,
+ workspaceId: project.id,
env: "dev"
});
secrets?.forEach((secret) => {
createSecret({
- workspaceId: workspace.id,
+ workspaceId: project.id,
environment: secret.environment,
type: secret.type,
secretKey: secret.secretName,
@@ -147,7 +121,7 @@ const initProjectHelper = async ({
});
});
- return workspace;
+ return project;
};
export { initProjectHelper };