Move secret versioning and snapshot functionality into ee and begin license scoping

This commit is contained in:
Tuan Dang
2022-12-25 17:08:21 -05:00
parent ff3370819d
commit 26fe1dd821
23 changed files with 290 additions and 178 deletions
@@ -0,0 +1,22 @@
/**
* Class to handle Enterprise Edition license actions
*/
class EELicenseService {
/**
* Check if license key [licenseKey] corresponds to a
* valid Infisical Enterprise Edition license.
* @param {Object} obj
* @param {Object} obj.licenseKey
* @returns {Boolean}
*/
static async checkLicense({
licenseKey
}: {
licenseKey: string;
}) {
// TODO
return true;
}
}
export default EELicenseService;
@@ -0,0 +1,29 @@
import { takeSecretSnapshotHelper } from '../helpers/secret';
import EELicenseService from './EELicenseService';
/**
* Class to handle Enterprise Edition secret actions
*/
class EESecretService {
/**
* Save a copy of the current state of secrets in workspace with id
* [workspaceId] under a new snapshot with incremented version under the
* SecretSnapshot collection.
* Requires a valid license key [licenseKey]
* @param {Object} obj
* @param {String} obj.workspaceId
*/
static async takeSecretSnapshot({
licenseKey,
workspaceId
}: {
licenseKey: string;
workspaceId: string;
}) {
EELicenseService.checkLicense({ licenseKey });
await takeSecretSnapshotHelper({ workspaceId });
}
}
export default EESecretService;
+7
View File
@@ -0,0 +1,7 @@
import EELicenseService from "./EELicenseService";
import EESecretService from "./EESecretService";
export {
EELicenseService,
EESecretService
}