Skip to content

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

Allow app config override for encryptWithRootEncryptionKey

x032205d5e99d7fc624
diff --git a/backend/src/lib/crypto/cryptography/crypto.ts b/backend/src/lib/crypto/cryptography/crypto.ts
index b8fc45645a..05ea315cd5 100644
--- a/backend/src/lib/crypto/cryptography/crypto.ts
+++ b/backend/src/lib/crypto/cryptography/crypto.ts
@@ -250,8 +250,11 @@ const cryptographyFactory = () => {
};
};
- const encryptWithRootEncryptionKey = (data: string) => {
- const appCfg = getConfig();
+ const encryptWithRootEncryptionKey = (
+ data: string,
+ appCfgOverride?: Pick<TEnvConfig, "ROOT_ENCRYPTION_KEY" | "ENCRYPTION_KEY">
+ ) => {
+ const appCfg = appCfgOverride || getConfig();
const rootEncryptionKey = appCfg.ROOT_ENCRYPTION_KEY;
const encryptionKey = appCfg.ENCRYPTION_KEY;