And workspace-environment specific integrations syncs to secrets v3 endpoints, add PostHog

This commit is contained in:
Tuan Dang
2023-04-17 14:23:56 +03:00
parent 338d287d35
commit 763ec1aa0f
18 changed files with 281 additions and 294 deletions
+3 -16
View File
@@ -30,6 +30,7 @@ import {
} from '../variables';
import { getEncryptionKey } from '../config';
import { encryptSymmetric } from '../utils/crypto';
import { SecretService } from '../services';
/**
* Validate authenticated clients for workspace with id [workspaceId] based
@@ -158,23 +159,9 @@ const createWorkspace = async ({
});
// initialize blind index salt for workspace
const salt = crypto.randomBytes(16).toString('base64');
const {
ciphertext: encryptedSaltCiphertext,
iv: saltIV,
tag: saltTag
} = encryptSymmetric({
plaintext: salt,
key: getEncryptionKey()
await SecretService.createSecretBlindIndexData({
workspaceId: workspace._id
});
await new SecretBlindIndexData({
workspace: workspace._id,
encryptedSaltCiphertext,
saltIV,
saltTag
}).save();
} catch (err) {
Sentry.setUser(null);