Skip to content

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

review fixes: docs + frontend

x032205f6e802c01767
diff --git a/docs/api-reference/endpoints/certificates/bundle.mdx b/docs/api-reference/endpoints/certificates/bundle.mdx
index 78cf7e073d..5fbda7d963 100644
--- a/docs/api-reference/endpoints/certificates/bundle.mdx
+++ b/docs/api-reference/endpoints/certificates/bundle.mdx
@@ -1,5 +1,5 @@
---
-title: "List"
+title: "Get Certificate Bundle"
openapi: "GET /api/v2/workspace/{slug}/bundle"
---
diff --git a/docs/api-reference/endpoints/certificates/private-key.mdx b/docs/api-reference/endpoints/certificates/private-key.mdx
index 15056fceb8..244aecea3b 100644
--- a/docs/api-reference/endpoints/certificates/private-key.mdx
+++ b/docs/api-reference/endpoints/certificates/private-key.mdx
@@ -1,4 +1,4 @@
---
-title: "List"
+title: "Get Certificate Private Key"
openapi: "GET /api/v2/workspace/{slug}/private-key"
---
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
index 081a59e67f..54620f1d67 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
@@ -1,14 +1,14 @@
import { Modal, ModalContent } from "@app/components/v2";
-import { useGetCertBody } from "@app/hooks/api";
-import { UsePopUpState } from "@app/hooks/usePopUp";
-
-import { CertificateContent } from "./CertificateContent";
import {
ProjectPermissionCertificateActions,
ProjectPermissionSub,
useProjectPermission
} from "@app/context";
+import { useGetCertBody } from "@app/hooks/api";
import { useGetCertBundle } from "@app/hooks/api/certificates/queries";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+import { CertificateContent } from "./CertificateContent";
type Props = {
popUp: UsePopUpState<["certificateCert"]>;
@@ -26,9 +26,18 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
ProjectPermissionSub.Certificates
);
- const { data } = canReadPrivateKey
- ? useGetCertBundle(serialNumber)
- : useGetCertBody(serialNumber);
+ // useGetCertBundle fails unless user has the correct permissions
+ const { data: bundleData } = useGetCertBundle(serialNumber);
+ const { data: bodyData } = useGetCertBody(serialNumber);
+
+ const data:
+ | {
+ certificate: string;
+ certificateChain: string;
+ serialNumber: string;
+ privateKey?: string;
+ }
+ | undefined = canReadPrivateKey ? bundleData : bodyData;
return (
<Modal
@@ -43,8 +52,7 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
serialNumber={data.serialNumber}
certificate={data.certificate}
certificateChain={data.certificateChain}
- // A hacky fix for typescript error
- privateKey={(data as { privateKey?: string }).privateKey}
+ privateKey={data.privateKey}
/>
) : (
<div />