mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +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) => {
|
||||
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,
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
@@ -38,6 +38,6 @@ export type TRevokeCertDTO = {
|
||||
revocationReason: CrlReason;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
export type TGetCertCertDTO = {
|
||||
export type TGetCertBodyDTO = {
|
||||
serialNumber: string;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
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 = {
|
||||
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;
|
||||
|
||||
@@ -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 || ""
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user