mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 19:28:16 +00:00
Rename all certcert to certbody
This commit is contained in:
@@ -132,7 +132,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handler: async (req) => {
|
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,
|
serialNumber: req.params.serialNumber,
|
||||||
actor: req.permission.type,
|
actor: req.permission.type,
|
||||||
actorId: req.permission.id,
|
actorId: req.permission.id,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { getProjectKmsCertificateKeyId } from "@app/services/project/project-fns
|
|||||||
|
|
||||||
import { getCaCertChain, rebuildCaCrl } from "../certificate-authority/certificate-authority-fns";
|
import { getCaCertChain, rebuildCaCrl } from "../certificate-authority/certificate-authority-fns";
|
||||||
import { revocationReasonToCrlCode } from "./certificate-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 = {
|
type TCertificateServiceFactoryDep = {
|
||||||
certificateDAL: Pick<TCertificateDALFactory, "findOne" | "deleteById" | "update" | "find">;
|
certificateDAL: Pick<TCertificateDALFactory, "findOne" | "deleteById" | "update" | "find">;
|
||||||
@@ -141,7 +141,7 @@ export const certificateServiceFactory = ({
|
|||||||
* Return certificate body and certificate chain for certificate with
|
* Return certificate body and certificate chain for certificate with
|
||||||
* serial number [serialNumber]
|
* 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 cert = await certificateDAL.findOne({ serialNumber });
|
||||||
const ca = await certificateAuthorityDAL.findById(cert.caId);
|
const ca = await certificateAuthorityDAL.findById(cert.caId);
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ export const certificateServiceFactory = ({
|
|||||||
|
|
||||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
|
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({
|
const keyId = await getProjectKmsCertificateKeyId({
|
||||||
projectId: ca.projectId,
|
projectId: ca.projectId,
|
||||||
@@ -165,7 +165,7 @@ export const certificateServiceFactory = ({
|
|||||||
|
|
||||||
const decryptedCert = await kmsService.decrypt({
|
const decryptedCert = await kmsService.decrypt({
|
||||||
kmsId: keyId,
|
kmsId: keyId,
|
||||||
cipherTextBlob: certCert.encryptedCertificate
|
cipherTextBlob: certBody.encryptedCertificate
|
||||||
});
|
});
|
||||||
|
|
||||||
const certObj = new x509.X509Certificate(decryptedCert);
|
const certObj = new x509.X509Certificate(decryptedCert);
|
||||||
@@ -189,6 +189,6 @@ export const certificateServiceFactory = ({
|
|||||||
getCert,
|
getCert,
|
||||||
deleteCert,
|
deleteCert,
|
||||||
revokeCert,
|
revokeCert,
|
||||||
getCertCert
|
getCertBody
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ export type TRevokeCertDTO = {
|
|||||||
revocationReason: CrlReason;
|
revocationReason: CrlReason;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|
||||||
export type TGetCertCertDTO = {
|
export type TGetCertBodyDTO = {
|
||||||
serialNumber: string;
|
serialNumber: string;
|
||||||
} & Omit<TProjectPermission, "projectId">;
|
} & Omit<TProjectPermission, "projectId">;
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export { useDeleteCert, useRevokeCert } from "./mutations";
|
export { useDeleteCert, useRevokeCert } from "./mutations";
|
||||||
export { useGetCert, useGetCertCert } from "./queries";
|
export { useGetCert, useGetCertBody } from "./queries";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { TCertificate } from "./types";
|
|||||||
|
|
||||||
export const certKeys = {
|
export const certKeys = {
|
||||||
getCertById: (serialNumber: string) => [{ serialNumber }, "cert"],
|
getCertById: (serialNumber: string) => [{ serialNumber }, "cert"],
|
||||||
getCertCert: (serialNumber: string) => [{ serialNumber }, "certCert"]
|
getCertBody: (serialNumber: string) => [{ serialNumber }, "certBody"]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useGetCert = (serialNumber: string) => {
|
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({
|
return useQuery({
|
||||||
queryKey: certKeys.getCertCert(serialNumber),
|
queryKey: certKeys.getCertBody(serialNumber),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await apiRequest.get<{
|
const { data } = await apiRequest.get<{
|
||||||
certificate: string;
|
certificate: string;
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { Modal, ModalContent } from "@app/components/v2";
|
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 { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
import { CertificateContent } from "./CertificateContent";
|
import { CertificateContent } from "./CertificateContent";
|
||||||
@@ -10,7 +10,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||||
const { data } = useGetCertCert(
|
const { data } = useGetCertBody(
|
||||||
(popUp?.certificateCert?.data as { serialNumber: string })?.serialNumber || ""
|
(popUp?.certificateCert?.data as { serialNumber: string })?.serialNumber || ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user