Skip to content

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

Rename all certcert to certbody

Tuan Dang34338720e5fd
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index 257edec1f1..3d99936954 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -132,7 +132,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { certificate, certificateChain, serialNumber } = await server.services.certificate.getCertCert({
+ const { certificate, certificateChain, serialNumber } = await server.services.certificate.getCertBody({
serialNumber: req.params.serialNumber,
actor: req.permission.type,
actorId: req.permission.id,
diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.ts
index b5a44b7482..569b387918 100644
--- a/backend/src/services/certificate/certificate-service.ts
+++ b/backend/src/services/certificate/certificate-service.ts
@@ -15,7 +15,7 @@ import { getProjectKmsCertificateKeyId } from "@app/services/project/project-fns
import { getCaCertChain, rebuildCaCrl } from "../certificate-authority/certificate-authority-fns";
import { revocationReasonToCrlCode } from "./certificate-fns";
-import { CertStatus, TDeleteCertDTO, TGetCertCertDTO, TGetCertDTO, TRevokeCertDTO } from "./certificate-types";
+import { CertStatus, TDeleteCertDTO, TGetCertBodyDTO, TGetCertDTO, TRevokeCertDTO } from "./certificate-types";
type TCertificateServiceFactoryDep = {
certificateDAL: Pick<TCertificateDALFactory, "findOne" | "deleteById" | "update" | "find">;
@@ -141,7 +141,7 @@ export const certificateServiceFactory = ({
* Return certificate body and certificate chain for certificate with
* serial number [serialNumber]
*/
- const getCertCert = async ({ serialNumber, actorId, actorAuthMethod, actor, actorOrgId }: TGetCertCertDTO) => {
+ const getCertBody = async ({ serialNumber, actorId, actorAuthMethod, actor, actorOrgId }: TGetCertBodyDTO) => {
const cert = await certificateDAL.findOne({ serialNumber });
const ca = await certificateAuthorityDAL.findById(cert.caId);
@@ -155,7 +155,7 @@ export const certificateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
- const certCert = await certificateBodyDAL.findOne({ certId: cert.id });
+ const certBody = await certificateBodyDAL.findOne({ certId: cert.id });
const keyId = await getProjectKmsCertificateKeyId({
projectId: ca.projectId,
@@ -165,7 +165,7 @@ export const certificateServiceFactory = ({
const decryptedCert = await kmsService.decrypt({
kmsId: keyId,
- cipherTextBlob: certCert.encryptedCertificate
+ cipherTextBlob: certBody.encryptedCertificate
});
const certObj = new x509.X509Certificate(decryptedCert);
@@ -189,6 +189,6 @@ export const certificateServiceFactory = ({
getCert,
deleteCert,
revokeCert,
- getCertCert
+ getCertBody
};
};
diff --git a/backend/src/services/certificate/certificate-types.ts b/backend/src/services/certificate/certificate-types.ts
index cb7cf5466d..93f72afe36 100644
--- a/backend/src/services/certificate/certificate-types.ts
+++ b/backend/src/services/certificate/certificate-types.ts
@@ -38,6 +38,6 @@ export type TRevokeCertDTO = {
revocationReason: CrlReason;
} & Omit<TProjectPermission, "projectId">;
-export type TGetCertCertDTO = {
+export type TGetCertBodyDTO = {
serialNumber: string;
} & Omit<TProjectPermission, "projectId">;
diff --git a/frontend/src/hooks/api/certificates/index.tsx b/frontend/src/hooks/api/certificates/index.tsx
index df3f39fc73..dd922fd6a2 100644
--- a/frontend/src/hooks/api/certificates/index.tsx
+++ b/frontend/src/hooks/api/certificates/index.tsx
@@ -1,2 +1,2 @@
export { useDeleteCert, useRevokeCert } from "./mutations";
-export { useGetCert, useGetCertCert } from "./queries";
+export { useGetCert, useGetCertBody } from "./queries";
diff --git a/frontend/src/hooks/api/certificates/queries.tsx b/frontend/src/hooks/api/certificates/queries.tsx
index 86ae3d4bec..50c751c06d 100644
--- a/frontend/src/hooks/api/certificates/queries.tsx
+++ b/frontend/src/hooks/api/certificates/queries.tsx
@@ -6,7 +6,7 @@ import { TCertificate } from "./types";
export const certKeys = {
getCertById: (serialNumber: string) => [{ serialNumber }, "cert"],
- getCertCert: (serialNumber: string) => [{ serialNumber }, "certCert"]
+ getCertBody: (serialNumber: string) => [{ serialNumber }, "certBody"]
};
export const useGetCert = (serialNumber: string) => {
@@ -24,9 +24,9 @@ export const useGetCert = (serialNumber: string) => {
});
};
-export const useGetCertCert = (serialNumber: string) => {
+export const useGetCertBody = (serialNumber: string) => {
return useQuery({
- queryKey: certKeys.getCertCert(serialNumber),
+ queryKey: certKeys.getCertBody(serialNumber),
queryFn: async () => {
const { data } = await apiRequest.get<{
certificate: string;
diff --git a/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateCertModal.tsx b/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateCertModal.tsx
index 97c56b0ecb..01c79589cf 100644
--- a/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateCertModal.tsx
+++ b/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateCertModal.tsx
@@ -1,5 +1,5 @@
import { Modal, ModalContent } from "@app/components/v2";
-import { useGetCertCert } from "@app/hooks/api";
+import { useGetCertBody } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { CertificateContent } from "./CertificateContent";
@@ -10,7 +10,7 @@ type Props = {
};
export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { data } = useGetCertCert(
+ const { data } = useGetCertBody(
(popUp?.certificateCert?.data as { serialNumber: string })?.serialNumber || ""
);