Refactor infisical-node to config file for birds eye view of envars

This commit is contained in:
Tuan Dang
2023-03-15 00:09:40 +07:00
parent 31111fc63b
commit a6c8638345
33 changed files with 264 additions and 262 deletions
+3 -3
View File
@@ -1,5 +1,4 @@
import * as Sentry from '@sentry/node';
import infisical from 'infisical-node';
import {
Bot,
BotKey,
@@ -14,6 +13,7 @@ import {
decryptAsymmetric
} from '../utils/crypto';
import { SECRET_SHARED } from '../variables';
import { getEncryptionKey } from '../config';
/**
* Create an inactive bot with name [name] for workspace with id [workspaceId]
@@ -33,7 +33,7 @@ const createBot = async ({
const { publicKey, privateKey } = generateKeyPair();
const { ciphertext, iv, tag } = encryptSymmetric({
plaintext: privateKey,
key: infisical.get('ENCRYPTION_KEY')!
key: getEncryptionKey()
});
bot = await new Bot({
@@ -130,7 +130,7 @@ const getKey = async ({ workspaceId }: { workspaceId: string }) => {
ciphertext: bot.encryptedPrivateKey,
iv: bot.iv,
tag: bot.tag,
key: infisical.get('ENCRYPTION_KEY')!
key: getEncryptionKey()
});
key = decryptAsymmetric({