Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

refactor(agent-vault): move credentialPreview to the Review step

Scott Wilson340e5cbcb0a1
diff --git a/frontend/src/components/agent-vault/service-sheet/CredentialFields.tsx b/frontend/src/components/agent-vault/service-sheet/CredentialFields.tsx
index 4a1e2eef9a..7214603adf 100644
--- a/frontend/src/components/agent-vault/service-sheet/CredentialFields.tsx
+++ b/frontend/src/components/agent-vault/service-sheet/CredentialFields.tsx
@@ -36,21 +36,6 @@ import {
VariableSuggestions
} from "./VariableReferenceInput";
-export const credentialPreview = (
- form: {
- credentialType: AgentVaultCredentialType;
- headerName?: string;
- headerPrefix?: string;
- },
- secret = "••••••••"
-): string | null => {
- if (form.credentialType === AgentVaultCredentialType.Passthrough) return null;
- if (form.credentialType === AgentVaultCredentialType.Basic)
- return `Authorization: Basic ${secret}`;
- const prefix = form.headerPrefix ? `${form.headerPrefix} ` : "";
- return `${form.headerName || "Authorization"}: ${prefix}${secret}`;
-};
-
type SecretName =
| "secret"
| "username"
diff --git a/frontend/src/components/agent-vault/service-sheet/ReviewFields.tsx b/frontend/src/components/agent-vault/service-sheet/ReviewFields.tsx
index 922a641d9f..e889b61ef6 100644
--- a/frontend/src/components/agent-vault/service-sheet/ReviewFields.tsx
+++ b/frontend/src/components/agent-vault/service-sheet/ReviewFields.tsx
@@ -10,7 +10,6 @@ import {
} from "@app/components/v3";
import { AgentVaultCredentialType } from "@app/hooks/api/agentVault";
-import { credentialPreview } from "./CredentialFields";
import {
CREDENTIAL_LABELS,
isAllMethods,
@@ -21,6 +20,17 @@ import {
const MASK = "\u2022".repeat(8);
+const credentialPreview = (form: {
+ credentialType: AgentVaultCredentialType;
+ headerName?: string;
+ headerPrefix?: string;
+}): string | null => {
+ if (form.credentialType === AgentVaultCredentialType.Passthrough) return null;
+ if (form.credentialType === AgentVaultCredentialType.Basic) return `Authorization: Basic ${MASK}`;
+ const prefix = form.headerPrefix ? `${form.headerPrefix} ` : "";
+ return `${form.headerName || "Authorization"}: ${prefix}${MASK}`;
+};
+
const alignColumns = (rows: string[][]) => {
const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
return rows