Merge remote-tracking branch 'origin/main' into feat/native-slack-integration

This commit is contained in:
Sheen Capadngan
2024-09-04 23:10:15 +08:00
93 changed files with 6556 additions and 1663 deletions
+41 -1
View File
@@ -20,7 +20,9 @@ export enum DynamicSecretProviders {
Cassandra = "cassandra",
AwsIam = "aws-iam",
Redis = "redis",
AwsElastiCache = "aws-elasticache"
AwsElastiCache = "aws-elasticache",
MongoAtlas = "mongo-db-atlas",
ElasticSearch = "elastic-search"
}
export enum SqlProviders {
@@ -97,6 +99,44 @@ export type TDynamicSecretProvider =
revocationStatement: string;
ca?: string | undefined;
};
}
| {
type: DynamicSecretProviders.MongoAtlas;
inputs: {
adminPublicKey: string;
adminPrivateKey: string;
groupId: string;
roles: {
databaseName: string;
roleName: string;
collectionName?: string;
}[];
scopes?: {
name: string;
type: string;
}[];
};
}
| {
type: DynamicSecretProviders.ElasticSearch;
inputs: {
host: string;
port: number;
ca?: string | undefined;
roles: string[];
auth:
| {
type: "user";
username: string;
password: string;
}
| {
type: "api-key";
apiKey: string;
apiKeyId: string;
};
};
};
export type TCreateDynamicSecretDTO = {
@@ -71,6 +71,8 @@ export const useCreateIntegration = () => {
key: string;
value: string;
}[];
githubVisibility?: string;
githubVisibilityRepoIds?: string[];
kmsKeyId?: string;
shouldDisableDelete?: boolean;
shouldMaskSecrets?: boolean;
@@ -34,6 +34,9 @@ export type TIntegration = {
syncMessage?: string;
__v: number;
metadata?: {
githubVisibility?: string;
githubVisibilityRepoIds?: string[];
secretSuffix?: string;
syncBehavior?: IntegrationSyncBehavior;
mappingBehavior?: IntegrationMappingBehavior;
+20 -19
View File
@@ -7,7 +7,11 @@ import { TSharedSecret, TViewSharedSecretResponse } from "./types";
export const secretSharingKeys = {
allSharedSecrets: () => ["sharedSecrets"] as const,
specificSharedSecrets: ({ offset, limit }: { offset: number; limit: number }) =>
[...secretSharingKeys.allSharedSecrets(), { offset, limit }] as const
[...secretSharingKeys.allSharedSecrets(), { offset, limit }] as const,
getSecretById: (arg: { id: string; hashedHex: string; password?: string }) => [
"shared-secret",
arg
]
};
export const useGetSharedSecrets = ({
@@ -38,31 +42,28 @@ export const useGetSharedSecrets = ({
export const useGetActiveSharedSecretById = ({
sharedSecretId,
hashedHex
hashedHex,
password
}: {
sharedSecretId: string;
hashedHex: string;
password?: string;
}) => {
return useQuery<TViewSharedSecretResponse, [string]>({
enabled: Boolean(sharedSecretId) && Boolean(hashedHex),
queryFn: async () => {
const params = new URLSearchParams({
hashedHex
});
const { data } = await apiRequest.get<TViewSharedSecretResponse>(
return useQuery<TViewSharedSecretResponse>(
secretSharingKeys.getSecretById({ id: sharedSecretId, hashedHex, password }),
async () => {
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
`/api/v1/secret-sharing/public/${sharedSecretId}`,
{
params
hashedHex,
password
}
);
return {
encryptedValue: data.encryptedValue,
iv: data.iv,
tag: data.tag,
accessType: data.accessType,
orgName: data.orgName
};
return data;
},
{
enabled: Boolean(sharedSecretId) && Boolean(hashedHex)
}
});
);
};
+10 -5
View File
@@ -15,6 +15,7 @@ export type TSharedSecret = {
export type TCreateSharedSecretRequest = {
name?: string;
password?: string;
encryptedValue: string;
hashedHex: string;
iv: string;
@@ -25,11 +26,14 @@ export type TCreateSharedSecretRequest = {
};
export type TViewSharedSecretResponse = {
encryptedValue: string;
iv: string;
tag: string;
accessType: SecretSharingAccessType;
orgName?: string;
isPasswordProtected: boolean;
secret: {
encryptedValue: string;
iv: string;
tag: string;
accessType: SecretSharingAccessType;
orgName?: string;
};
};
export type TDeleteSharedSecretRequest = {
@@ -40,3 +44,4 @@ export enum SecretSharingAccessType {
Anyone = "anyone",
Organization = "organization"
}