Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor frontend to make it extensible
Matheus Nogueira59231a7c16f7
diff --git a/frontend/src/components/honey-tokens/CreateHoneyTokenModal.tsx b/frontend/src/components/honey-tokens/CreateHoneyTokenModal.tsxindex 1dee662968..1b70533530 100644--- a/frontend/src/components/honey-tokens/CreateHoneyTokenModal.tsx+++ b/frontend/src/components/honey-tokens/CreateHoneyTokenModal.tsx@@ -5,7 +5,7 @@ import { HoneyTokenModalHeader } from "@app/components/honey-tokens/HoneyTokenMoimport { HoneyTokenSelect } from "@app/components/honey-tokens/HoneyTokenSelect";import { Modal, ModalContent } from "@app/components/v2";import { DocumentationLinkBadge } from "@app/components/v3";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { ProjectEnv } from "@app/hooks/api/projects/types";type SharedProps = {diff --git a/frontend/src/components/honey-tokens/EditHoneyTokenModal.tsx b/frontend/src/components/honey-tokens/EditHoneyTokenModal.tsxindex 560f3b8229..a536f8dc0a 100644--- a/frontend/src/components/honey-tokens/EditHoneyTokenModal.tsx+++ b/frontend/src/components/honey-tokens/EditHoneyTokenModal.tsx@@ -1,7 +1,8 @@import { HoneyTokenForm } from "@app/components/honey-tokens/forms";import { HoneyTokenModalHeader } from "@app/components/honey-tokens/HoneyTokenModalHeader";import { Modal, ModalContent } from "@app/components/v2";-import { HoneyTokenType, TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";+import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";type Props = {honeyToken?: TDashboardHoneyToken;diff --git a/frontend/src/components/honey-tokens/HoneyTokenModalHeader.tsx b/frontend/src/components/honey-tokens/HoneyTokenModalHeader.tsxindex 63312bc657..5675cdcf8b 100644--- a/frontend/src/components/honey-tokens/HoneyTokenModalHeader.tsx+++ b/frontend/src/components/honey-tokens/HoneyTokenModalHeader.tsx@@ -1,6 +1,6 @@import { DocumentationLinkBadge } from "@app/components/v3";import { HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";type Props = {type: HoneyTokenType;diff --git a/frontend/src/components/honey-tokens/HoneyTokenSelect.tsx b/frontend/src/components/honey-tokens/HoneyTokenSelect.tsxindex 68e7241927..fc7bf008de 100644--- a/frontend/src/components/honey-tokens/HoneyTokenSelect.tsx+++ b/frontend/src/components/honey-tokens/HoneyTokenSelect.tsx@@ -1,5 +1,5 @@import { HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";type Props = {onSelect: (type: HoneyTokenType) => void;diff --git a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsxnew file mode 100644index 0000000000..e500dc2d77--- /dev/null+++ b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx@@ -0,0 +1,34 @@+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";+import { ViewRotationGeneratedCredentialsDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/ViewRotationGeneratedCredentialsDisplay";+import { TAwsHoneyToken } from "@app/hooks/api/honeyTokens/types";++type Props = {+ secretsMapping: TAwsHoneyToken["secretsMapping"];+ credentials: Record<string, string>;+};++const CREDENTIAL_FIELDS: { key: keyof TAwsHoneyToken["secretsMapping"]; label: string }[] = [+ { key: "accessKeyId", label: "Access Key ID" },+ { key: "secretAccessKey", label: "Secret Access Key" }+];++export const AwsHoneyTokenCredentials = ({ secretsMapping, credentials }: Props) => {+ return (+ <ViewRotationGeneratedCredentialsDisplay+ activeCredentials={+ <>+ {CREDENTIAL_FIELDS.map(({ key, label }) => {+ const secretName = secretsMapping[key];+ const value = secretName ? credentials[secretName] : undefined;++ return (+ <CredentialDisplay key={key} label={label} isSensitive>+ {value}+ </CredentialDisplay>+ );+ })}+ </>+ }+ />+ );+};diff --git a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsxindex 72f05af374..97da07ebf4 100644--- a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx+++ b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx@@ -1,9 +1,11 @@-import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";-import { ViewRotationGeneratedCredentialsDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/ViewRotationGeneratedCredentialsDisplay";+import { ReactNode } from "react";+import { Modal, ModalContent, Spinner } from "@app/components/v2";-import { HONEY_TOKEN_CREDENTIAL_FIELDS } from "@app/helpers/honeyTokens";import { useGetHoneyTokenCredentials } from "@app/hooks/api/honeyTokens";-import { HoneyTokenType, TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";+import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";++import { AwsHoneyTokenCredentials } from "./ViewHoneyTokenCredentials/AwsHoneyTokenCredentials";type Props = {honeyToken?: TDashboardHoneyToken;@@ -12,22 +14,60 @@ type Props = {onOpenChange: (isOpen: boolean) => void;};-export const ViewHoneyTokenCredentialsModal = ({+const renderCredentials = (+ honeyToken: TDashboardHoneyToken,+ credentials: Record<string, string>+): ReactNode => {+ switch (honeyToken.type) {+ case HoneyTokenType.AWS:+ return (+ <AwsHoneyTokenCredentials+ secretsMapping={honeyToken.secretsMapping}+ credentials={credentials}+ />+ );+ default:+ throw new Error("Unhandled honey token type");+ }+};++const ModalBody = ({honeyToken,projectId,- isOpen,- onOpenChange-}: Props) => {+ isOpen+}: {+ honeyToken?: TDashboardHoneyToken;+ projectId: string;+ isOpen: boolean;+}) => {const { data: credentials, isPending } = useGetHoneyTokenCredentials({honeyTokenId: honeyToken?.id ?? "",projectId,enabled: isOpen && Boolean(honeyToken)});- const credentialFields = honeyToken- ? HONEY_TOKEN_CREDENTIAL_FIELDS[honeyToken.type as HoneyTokenType]- : [];+ if (isPending) {+ return (+ <div className="flex flex-col items-center justify-center py-4">+ <Spinner size="lg" className="text-mineshaft-500" />+ <p className="mt-4 text-sm text-mineshaft-400">Loading credentials...</p>+ </div>+ );+ }+ if (credentials && honeyToken) {+ return renderCredentials(honeyToken, credentials);+ }++ return <p className="text-sm text-red">No credentials found for this honey token.</p>;+};++export const ViewHoneyTokenCredentialsModal = ({+ honeyToken,+ projectId,+ isOpen,+ onOpenChange+}: Props) => {return (<Modal isOpen={isOpen} onOpenChange={onOpenChange}><ModalContent@@ -35,35 +75,7 @@ export const ViewHoneyTokenCredentialsModal = ({title="Generated Credentials"subTitle={honeyToken ? `View the credentials for "${honeyToken.name}".` : ""}>- {isPending ? (- <div className="flex flex-col items-center justify-center py-4">- <Spinner size="lg" className="text-mineshaft-500" />- <p className="mt-4 text-sm text-mineshaft-400">Loading credentials...</p>- </div>- ) : credentials ? (- <ViewRotationGeneratedCredentialsDisplay- activeCredentials={- <>- {credentialFields.map(({ key, label }) => {- const secretName = honeyToken?.secretsMapping?.[key];- const value = secretName ? credentials[secretName] : undefined;-- return (- <CredentialDisplay- key={key}- label={label}- isSensitive- >- {value}- </CredentialDisplay>- );- })}- </>- }- />- ) : (- <p className="text-sm text-red">No credentials found for this honey token.</p>- )}+ <ModalBody honeyToken={honeyToken} projectId={projectId} isOpen={isOpen} /></ModalContent></Modal>);diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenForm.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenForm.tsxindex b086707c16..dbeb19a3a6 100644--- a/frontend/src/components/honey-tokens/forms/HoneyTokenForm.tsx+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenForm.tsx@@ -8,11 +8,13 @@ import { Button } from "@app/components/v2";import { useProject } from "@app/context";import { HONEY_TOKEN_DEFAULT_SECRET_NAMES, HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";import { useCreateHoneyToken, useUpdateHoneyToken } from "@app/hooks/api/honeyTokens";-import { HoneyTokenType, TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";+import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";import { ProjectEnv } from "@app/hooks/api/projects/types";import { fetchProjectSecrets } from "@app/hooks/api/secrets/queries";import { HoneyTokenMappingFields } from "./HoneyTokenMappingFields/HoneyTokenMappingFields";+import { HoneyTokenParametersFields } from "./HoneyTokenParametersFields/HoneyTokenParametersFields";import { HoneyTokenReviewFields } from "./HoneyTokenReviewFields/HoneyTokenReviewFields";import { HoneyTokenConfigurationFields } from "./HoneyTokenConfigurationFields";import { HoneyTokenDetailsFields } from "./HoneyTokenDetailsFields";@@ -34,12 +36,14 @@ const CREATE_TABS: { name: string; key: string; fields: (keyof THoneyTokenForm)[key: "configuration",fields: ["environment"]},+ { name: "Parameters", key: "parameters", fields: [] },{ name: "Mapping", key: "mapping", fields: ["secretsMapping"] },{ name: "Details", key: "details", fields: ["name", "description"] },{ name: "Review", key: "review", fields: [] }];const EDIT_TABS: { name: string; key: string; fields: (keyof THoneyTokenForm)[] }[] = [+ { name: "Parameters", key: "parameters", fields: [] },{ name: "Mapping", key: "mapping", fields: ["secretsMapping"] },{ name: "Details", key: "details", fields: ["name", "description"] },{ name: "Review", key: "review", fields: [] }@@ -235,6 +239,9 @@ export const HoneyTokenForm = ({<HoneyTokenConfigurationFields environments={environments} /></Tab.Panel>)}+ <Tab.Panel>+ <HoneyTokenParametersFields />+ </Tab.Panel><Tab.Panel><HoneyTokenMappingFields /></Tab.Panel>diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/AwsHoneyTokenMappingFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/AwsHoneyTokenMappingFields.tsxindex 2ea4c5c192..5d02237102 100644--- a/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/AwsHoneyTokenMappingFields.tsx+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/AwsHoneyTokenMappingFields.tsx@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { FormControl, FormLabel, Input } from "@app/components/v2";import { Badge } from "@app/components/v3";import { HONEY_TOKEN_DEFAULT_SECRET_NAMES } from "@app/helpers/honeyTokens";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { THoneyTokenForm } from "../schemas";diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/HoneyTokenMappingFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/HoneyTokenMappingFields.tsxindex 6995771388..7e5e4dc161 100644--- a/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/HoneyTokenMappingFields.tsx+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenMappingFields/HoneyTokenMappingFields.tsx@@ -1,6 +1,6 @@import { useFormContext } from "react-hook-form";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { THoneyTokenForm } from "../schemas";import { AwsHoneyTokenMappingFields } from "./AwsHoneyTokenMappingFields";diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/AwsHoneyTokenParametersFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/AwsHoneyTokenParametersFields.tsxnew file mode 100644index 0000000000..f58b9efb6b--- /dev/null+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/AwsHoneyTokenParametersFields.tsx@@ -0,0 +1,8 @@+export const AwsHoneyTokenParametersFields = () => {+ return (+ <p className="text-sm text-bunker-300">+ No additional parameters are required for AWS Honey Tokens. The decoy IAM credentials will be+ generated automatically.+ </p>+ );+};diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/HoneyTokenParametersFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/HoneyTokenParametersFields.tsxnew file mode 100644index 0000000000..c359e9488c--- /dev/null+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenParametersFields/HoneyTokenParametersFields.tsx@@ -0,0 +1,27 @@+import { useFormContext } from "react-hook-form";++import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";++import { THoneyTokenForm } from "../schemas";+import { AwsHoneyTokenParametersFields } from "./AwsHoneyTokenParametersFields";++const COMPONENT_MAP: Record<HoneyTokenType, React.FC> = {+ [HoneyTokenType.AWS]: AwsHoneyTokenParametersFields+};++export const HoneyTokenParametersFields = () => {+ const { watch } = useFormContext<THoneyTokenForm>();++ const honeyTokenType = watch("type");++ const Component = COMPONENT_MAP[honeyTokenType];++ return (+ <>+ <p className="mb-4 text-sm text-bunker-300">+ Configure the required parameters for this Honey Token.+ </p>+ <Component />+ </>+ );+};diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/AwsHoneyTokenReviewFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/AwsHoneyTokenReviewFields.tsxindex 83e04e75bb..7a9a25425a 100644--- a/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/AwsHoneyTokenReviewFields.tsx+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/AwsHoneyTokenReviewFields.tsx@@ -1,7 +1,7 @@import { useFormContext } from "react-hook-form";import { GenericFieldLabel } from "@app/components/v2";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { THoneyTokenForm } from "../schemas";import { HoneyTokenReviewSection } from "./HoneyTokenReviewSection";diff --git a/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/HoneyTokenReviewFields.tsx b/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/HoneyTokenReviewFields.tsxindex a2fe393909..25e1b7f215 100644--- a/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/HoneyTokenReviewFields.tsx+++ b/frontend/src/components/honey-tokens/forms/HoneyTokenReviewFields/HoneyTokenReviewFields.tsx@@ -2,7 +2,7 @@ import { useFormContext } from "react-hook-form";import { GenericFieldLabel } from "@app/components/v2";import { HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { THoneyTokenForm } from "../schemas";import { AwsHoneyTokenReviewFields } from "./AwsHoneyTokenReviewFields";diff --git a/frontend/src/components/honey-tokens/forms/schemas/aws-honey-token-schema.ts b/frontend/src/components/honey-tokens/forms/schemas/aws-honey-token-schema.tsindex 409660db4f..e30a54a8ce 100644--- a/frontend/src/components/honey-tokens/forms/schemas/aws-honey-token-schema.ts+++ b/frontend/src/components/honey-tokens/forms/schemas/aws-honey-token-schema.ts@@ -1,6 +1,6 @@import { z } from "zod";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";import { BaseHoneyTokenSchema } from "./base-honey-token-schema";diff --git a/frontend/src/helpers/honeyTokens.ts b/frontend/src/helpers/honeyTokens.tsindex e3be57334c..82641a8de9 100644--- a/frontend/src/helpers/honeyTokens.ts+++ b/frontend/src/helpers/honeyTokens.ts@@ -1,5 +1,5 @@import { AppConnection } from "@app/hooks/api/appConnections/enums";-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";export const HONEY_TOKEN_MAP: Record<HoneyTokenType,diff --git a/frontend/src/hooks/api/honeyToken/types.ts b/frontend/src/hooks/api/honeyToken/types.tsindex 9aa93c0ff1..4ff8e463c5 100644--- a/frontend/src/hooks/api/honeyToken/types.ts+++ b/frontend/src/hooks/api/honeyToken/types.ts@@ -1,6 +1,6 @@-export enum HoneyTokenType {- AWS = "aws"-}+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";++export { HoneyTokenType };export type THoneyTokenConfig = {id: string | null;diff --git a/frontend/src/hooks/api/honeyTokens/enums.ts b/frontend/src/hooks/api/honeyTokens/enums.tsnew file mode 100644index 0000000000..2bcf67306e--- /dev/null+++ b/frontend/src/hooks/api/honeyTokens/enums.ts@@ -0,0 +1,8 @@+export enum HoneyTokenType {+ AWS = "aws"+}++export enum HoneyTokenStatus {+ Active = "active",+ Triggered = "triggered"+}diff --git a/frontend/src/hooks/api/honeyTokens/index.ts b/frontend/src/hooks/api/honeyTokens/index.tsindex 177955438b..f49a872a5a 100644--- a/frontend/src/hooks/api/honeyTokens/index.ts+++ b/frontend/src/hooks/api/honeyTokens/index.ts@@ -1,3 +1,4 @@+export * from "./enums";export * from "./mutations";export * from "./queries";export * from "./types";diff --git a/frontend/src/hooks/api/honeyTokens/mutations.tsx b/frontend/src/hooks/api/honeyTokens/mutations.tsxindex 91847a872c..a31fb121e0 100644--- a/frontend/src/hooks/api/honeyTokens/mutations.tsx+++ b/frontend/src/hooks/api/honeyTokens/mutations.tsx@@ -3,7 +3,12 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";import { dashboardKeys } from "@app/hooks/api/dashboard/queries";-import { TCreateHoneyTokenDTO, TDeleteHoneyTokenDTO, THoneyToken, TUpdateHoneyTokenDTO } from "./types";+import {+ TCreateHoneyTokenDTO,+ TDeleteHoneyTokenDTO,+ THoneyToken,+ TUpdateHoneyTokenDTO+} from "./types";export const useCreateHoneyToken = () => {const queryClient = useQueryClient();diff --git a/frontend/src/hooks/api/honeyTokens/queries.tsx b/frontend/src/hooks/api/honeyTokens/queries.tsxindex fe13039ccb..07a3c2bb1c 100644--- a/frontend/src/hooks/api/honeyTokens/queries.tsx+++ b/frontend/src/hooks/api/honeyTokens/queries.tsx@@ -5,7 +5,8 @@ import { apiRequest } from "@app/config/request";export const honeyTokenKeys = {all: ["honeyTokens"] as const,list: (projectId: string) => [...honeyTokenKeys.all, "list", projectId] as const,- credentials: (honeyTokenId: string) => [...honeyTokenKeys.all, "credentials", honeyTokenId] as const+ credentials: (honeyTokenId: string) =>+ [...honeyTokenKeys.all, "credentials", honeyTokenId] as const};export const useGetHoneyTokenCredentials = ({diff --git a/frontend/src/hooks/api/honeyTokens/types.ts b/frontend/src/hooks/api/honeyTokens/types.tsindex cb4651e4cc..1f7b51de22 100644--- a/frontend/src/hooks/api/honeyTokens/types.ts+++ b/frontend/src/hooks/api/honeyTokens/types.ts@@ -1,56 +1,15 @@-export enum HoneyTokenType {- AWS = "aws"-}--export enum HoneyTokenStatus {- Active = "active",- Triggered = "triggered"-}--export type THoneyToken = {- id: string;- name: string;- type: HoneyTokenType;- status: HoneyTokenStatus;- projectId: string;- folderId: string;- connectionId: string;- secretsMapping: Record<string, string>;- description?: string | null;- createdAt: string;- updatedAt: string;-};--export type TDashboardHoneyToken = THoneyToken & {- environment: {- id: string;- name: string;- slug: string;- };- folder: {- path: string;- };-};--export type TCreateHoneyTokenDTO = {- projectId: string;- type: HoneyTokenType;- name: string;- description?: string | null;- secretsMapping: Record<string, string>;- environment: string;- secretPath: string;-};--export type TUpdateHoneyTokenDTO = {- honeyTokenId: string;- projectId: string;- name?: string;- description?: string | null;- secretsMapping?: Record<string, string>;-};--export type TDeleteHoneyTokenDTO = {- honeyTokenId: string;- projectId: string;-};+export type {+ TAwsHoneyToken,+ TAwsHoneyTokenCredentialsResponse,+ TAwsHoneyTokenOption,+ TCreateHoneyTokenDTO,+ TDashboardAwsHoneyToken,+ TDashboardHoneyToken,+ TDeleteHoneyTokenDTO,+ THoneyToken,+ THoneyTokenCredentialsResponse,+ THoneyTokenCredentialsResponseMap,+ THoneyTokenOption,+ THoneyTokenOptionMap,+ TUpdateHoneyTokenDTO+} from "./types/index";diff --git a/frontend/src/hooks/api/honeyTokens/types/aws-honey-token.ts b/frontend/src/hooks/api/honeyTokens/types/aws-honey-token.tsnew file mode 100644index 0000000000..176d87a313--- /dev/null+++ b/frontend/src/hooks/api/honeyTokens/types/aws-honey-token.ts@@ -0,0 +1,32 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";++import {+ TDashboardHoneyTokenBase,+ THoneyTokenBase,+ THoneyTokenCredentialsResponseBase,+ THoneyTokenOptionBase+} from "./honey-token-base";++export type TAwsHoneyToken = THoneyTokenBase & {+ type: HoneyTokenType.AWS;+ secretsMapping: {+ accessKeyId: string;+ secretAccessKey: string;+ };+};++export type TAwsHoneyTokenCredentials = {+ accessKeyId: string;+ secretAccessKey: string;+};++export type TAwsHoneyTokenCredentialsResponse = THoneyTokenCredentialsResponseBase<+ HoneyTokenType.AWS,+ TAwsHoneyTokenCredentials+>;++export type TAwsHoneyTokenOption = THoneyTokenOptionBase<HoneyTokenType.AWS, AppConnection.AWS>;++export type TDashboardAwsHoneyToken = TAwsHoneyToken &+ Omit<TDashboardHoneyTokenBase, keyof THoneyTokenBase>;diff --git a/frontend/src/hooks/api/honeyTokens/types/honey-token-base.ts b/frontend/src/hooks/api/honeyTokens/types/honey-token-base.tsnew file mode 100644index 0000000000..f9ac469d37--- /dev/null+++ b/frontend/src/hooks/api/honeyTokens/types/honey-token-base.ts@@ -0,0 +1,40 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { HoneyTokenStatus } from "@app/hooks/api/honeyTokens/enums";++export type THoneyTokenBase = {+ id: string;+ name: string;+ description?: string | null;+ status: HoneyTokenStatus;+ projectId: string;+ folderId: string;+ connectionId: string;+ createdAt: string;+ updatedAt: string;+};++export type TDashboardHoneyTokenBase = THoneyTokenBase & {+ environment: {+ id: string;+ name: string;+ slug: string;+ };+ folder: {+ path: string;+ };+};++export type THoneyTokenOptionBase<U, T extends AppConnection> = {+ name: string;+ type: U;+ connection: T;+ template: {+ secretsMapping: Record<string, string>;+ };+};++export type THoneyTokenCredentialsResponseBase<U, T> = {+ type: U;+ honeyTokenId: string;+ credentials: T;+};diff --git a/frontend/src/hooks/api/honeyTokens/types/index.ts b/frontend/src/hooks/api/honeyTokens/types/index.tsnew file mode 100644index 0000000000..3ff4b673b5--- /dev/null+++ b/frontend/src/hooks/api/honeyTokens/types/index.ts@@ -0,0 +1,60 @@+import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";++import {+ TAwsHoneyToken,+ TAwsHoneyTokenCredentialsResponse,+ TAwsHoneyTokenOption,+ TDashboardAwsHoneyToken+} from "./aws-honey-token";++export type THoneyToken = TAwsHoneyToken;++export type TDashboardHoneyToken = TDashboardAwsHoneyToken;++export type THoneyTokenOption = TAwsHoneyTokenOption;++export type THoneyTokenCredentialsResponse = TAwsHoneyTokenCredentialsResponse;++export type THoneyTokenOptionMap = {+ [HoneyTokenType.AWS]: TAwsHoneyTokenOption;+};++export type THoneyTokenCredentialsResponseMap = {+ [HoneyTokenType.AWS]: TAwsHoneyTokenCredentialsResponse;+};++export type TCreateHoneyTokenDTO = {+ projectId: string;+ type: HoneyTokenType;+ name: string;+ description?: string | null;+ secretsMapping: Record<string, string>;+ environment: string;+ secretPath: string;+};++export type TUpdateHoneyTokenDTO = {+ honeyTokenId: string;+ projectId: string;+ name?: string;+ description?: string | null;+ secretsMapping?: Record<string, string>;+};++export type TDeleteHoneyTokenDTO = {+ honeyTokenId: string;+ projectId: string;+};++export {+ type TAwsHoneyToken,+ type TAwsHoneyTokenCredentialsResponse,+ type TAwsHoneyTokenOption,+ type TDashboardAwsHoneyToken+} from "./aws-honey-token";+export {+ type TDashboardHoneyTokenBase,+ type THoneyTokenBase,+ type THoneyTokenCredentialsResponseBase,+ type THoneyTokenOptionBase+} from "./honey-token-base";diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsxindex e73622383d..0c653387d1 100644--- a/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx+++ b/frontend/src/pages/secret-manager/OverviewPage/components/HoneyTokenTableRow/HoneyTokenTableRow.tsx@@ -1,4 +1,11 @@-import { AsteriskIcon, ChevronDownIcon, EditIcon, InfoIcon, SirenIcon, TrashIcon } from "lucide-react";+import {+ AsteriskIcon,+ ChevronDownIcon,+ EditIcon,+ InfoIcon,+ SirenIcon,+ TrashIcon+} from "lucide-react";import { twMerge } from "tailwind-merge";import { ProjectPermissionCan } from "@app/components/permissions";@@ -21,11 +28,8 @@ import {} from "@app/context/ProjectPermissionContext/types";import { HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";import { useToggle } from "@app/hooks";-import {- HoneyTokenStatus,- HoneyTokenType,- TDashboardHoneyToken-} from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenStatus, HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";+import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";import { ResourceEnvironmentStatusCell } from "../ResourceEnvironmentStatusCell";diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsxindex b201871513..9fe7dc2750 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/HoneyTokenListView/HoneyTokenItem.tsx@@ -10,11 +10,8 @@ import { IconButton, Tag, Tooltip } from "@app/components/v2";import { ProjectPermissionSub } from "@app/context";import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";import { HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";-import {- HoneyTokenStatus,- HoneyTokenType,- TDashboardHoneyToken-} from "@app/hooks/api/honeyTokens/types";+import { HoneyTokenStatus, HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";+import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";type Props = {honeyToken: TDashboardHoneyToken;@@ -48,7 +45,12 @@ export const HoneyTokenItem = ({ honeyToken, onEdit, onDelete, onViewCredentialsaria-expanded={isExpanded}aria-label={`${isExpanded ? "Collapse" : "Expand"} honey token secrets for ${name}`}>- <div className={twMerge("flex w-11 items-center py-2 pl-5", status === HoneyTokenStatus.Triggered ? "text-red" : "text-yellow")}>+ <div+ className={twMerge(+ "flex w-11 items-center py-2 pl-5",+ status === HoneyTokenStatus.Triggered ? "text-red" : "text-yellow"+ )}+ ><SirenIcon className="size-4" /></div><div className="flex grow items-center py-2 pr-2 pl-4">