Fix: Added explicit SecretType type

This commit is contained in:
Daniel Hougaard
2024-06-21 15:20:37 +02:00
parent a2fd071b62
commit 7cf7eb5acb
+14 -9
View File
@@ -1,11 +1,16 @@
import type { UserWsKeyPair } from "../keys/types"; import type { UserWsKeyPair } from "../keys/types";
import type { WsTag } from "../tags/types"; import type { WsTag } from "../tags/types";
export enum SecretType {
Shared = "shared",
Personal = "personal"
}
export type EncryptedSecret = { export type EncryptedSecret = {
id: string; id: string;
version: number; version: number;
workspace: string; workspace: string;
type: "shared" | "personal"; type: SecretType;
environment: string; environment: string;
secretKeyCiphertext: string; secretKeyCiphertext: string;
secretKeyIV: string; secretKeyIV: string;
@@ -49,7 +54,7 @@ export type EncryptedSecretVersion = {
secretId: string; secretId: string;
version: number; version: number;
workspace: string; workspace: string;
type: string; type: SecretType;
isDeleted: boolean; isDeleted: boolean;
envId: string; envId: string;
secretKeyCiphertext: string; secretKeyCiphertext: string;
@@ -101,14 +106,14 @@ export type TCreateSecretsV3DTO = {
secretPath: string; secretPath: string;
workspaceId: string; workspaceId: string;
environment: string; environment: string;
type: string; type: SecretType;
}; };
export type TUpdateSecretsV3DTO = { export type TUpdateSecretsV3DTO = {
latestFileKey: UserWsKeyPair; latestFileKey: UserWsKeyPair;
workspaceId: string; workspaceId: string;
environment: string; environment: string;
type: string; type: SecretType;
secretPath: string; secretPath: string;
skipMultilineEncoding?: boolean; skipMultilineEncoding?: boolean;
newSecretName?: string; newSecretName?: string;
@@ -124,7 +129,7 @@ export type TUpdateSecretsV3DTO = {
export type TDeleteSecretsV3DTO = { export type TDeleteSecretsV3DTO = {
workspaceId: string; workspaceId: string;
environment: string; environment: string;
type: "shared" | "personal"; type: SecretType;
secretPath: string; secretPath: string;
secretName: string; secretName: string;
secretId?: string; secretId?: string;
@@ -140,7 +145,7 @@ export type TCreateSecretBatchDTO = {
secretValue: string; secretValue: string;
secretComment: string; secretComment: string;
skipMultilineEncoding?: boolean; skipMultilineEncoding?: boolean;
type: "shared" | "personal"; type: SecretType;
metadata?: { metadata?: {
source?: string; source?: string;
}; };
@@ -153,7 +158,7 @@ export type TUpdateSecretBatchDTO = {
secretPath: string; secretPath: string;
latestFileKey: UserWsKeyPair; latestFileKey: UserWsKeyPair;
secrets: Array<{ secrets: Array<{
type: "shared" | "personal"; type: SecretType;
secretName: string; secretName: string;
skipMultilineEncoding?: boolean; skipMultilineEncoding?: boolean;
secretValue: string; secretValue: string;
@@ -168,14 +173,14 @@ export type TDeleteSecretBatchDTO = {
secretPath: string; secretPath: string;
secrets: Array<{ secrets: Array<{
secretName: string; secretName: string;
type: "shared" | "personal"; type: SecretType;
}>; }>;
}; };
export type CreateSecretDTO = { export type CreateSecretDTO = {
workspaceId: string; workspaceId: string;
environment: string; environment: string;
type: "shared" | "personal"; type: SecretType;
secretKey: string; secretKey: string;
secretKeyCiphertext: string; secretKeyCiphertext: string;
secretKeyIV: string; secretKeyIV: string;