mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 05:13:43 +00:00
misc: updated est configuration to be binded to certificate template
This commit is contained in:
@@ -1,20 +1,11 @@
|
||||
export { CaRenewalType, CaStatus, CaType } from "./enums";
|
||||
export {
|
||||
useCreateCa,
|
||||
useCreateCaEstConfig,
|
||||
useCreateCertificate,
|
||||
useDeleteCa,
|
||||
useImportCaCertificate,
|
||||
useRenewCa,
|
||||
useSignIntermediate,
|
||||
useUpdateCa,
|
||||
useUpdateCaEstConfig
|
||||
useUpdateCa
|
||||
} from "./mutations";
|
||||
export {
|
||||
useGetCaById,
|
||||
useGetCaCert,
|
||||
useGetCaCerts,
|
||||
useGetCaCrl,
|
||||
useGetCaCsr,
|
||||
useGetCaEstConfig
|
||||
} from "./queries";
|
||||
export { useGetCaById, useGetCaCert, useGetCaCerts, useGetCaCrl, useGetCaCsr } from "./queries";
|
||||
|
||||
@@ -7,7 +7,6 @@ import { caKeys } from "./queries";
|
||||
import {
|
||||
TCertificateAuthority,
|
||||
TCreateCaDTO,
|
||||
TCreateCaEstConfigDTO,
|
||||
TCreateCertificateDTO,
|
||||
TCreateCertificateResponse,
|
||||
TDeleteCaDTO,
|
||||
@@ -17,8 +16,7 @@ import {
|
||||
TRenewCaResponse,
|
||||
TSignIntermediateDTO,
|
||||
TSignIntermediateResponse,
|
||||
TUpdateCaDTO,
|
||||
TUpdateCaEstConfigDTO
|
||||
TUpdateCaDTO
|
||||
} from "./types";
|
||||
|
||||
export const useCreateCa = () => {
|
||||
@@ -134,29 +132,3 @@ export const useRenewCa = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useCreateCaEstConfig = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<{}, {}, TCreateCaEstConfigDTO>({
|
||||
mutationFn: async (body) => {
|
||||
const { data } = await apiRequest.post(`/api/v1/pki/ca/${body.caId}/est-config`, body);
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { caId }) => {
|
||||
queryClient.invalidateQueries(caKeys.getCaEstConfig(caId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useUpdateCaEstConfig = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<{}, {}, TUpdateCaEstConfigDTO>({
|
||||
mutationFn: async (body) => {
|
||||
const { data } = await apiRequest.patch(`/api/v1/pki/ca/${body.caId}/est-config`, body);
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { caId }) => {
|
||||
queryClient.invalidateQueries(caKeys.getCaEstConfig(caId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { TCaEstConfig, TCertificateAuthority } from "./types";
|
||||
import { TCertificateAuthority } from "./types";
|
||||
|
||||
export const caKeys = {
|
||||
getCaById: (caId: string) => [{ caId }, "ca"],
|
||||
@@ -88,19 +88,3 @@ export const useGetCaCrl = (caId: string) => {
|
||||
enabled: Boolean(caId)
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetCaEstConfig = (caId: string) => {
|
||||
return useQuery({
|
||||
queryKey: caKeys.getCaEstConfig(caId),
|
||||
queryFn: async () => {
|
||||
const {
|
||||
data: { caEstConfig }
|
||||
} = await apiRequest.get<{
|
||||
caEstConfig: TCaEstConfig;
|
||||
}>(`/api/v1/pki/ca/${caId}/est-config`);
|
||||
|
||||
return caEstConfig;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
});
|
||||
};
|
||||
|
||||
@@ -110,23 +110,3 @@ export type TRenewCaResponse = {
|
||||
certificateChain: string;
|
||||
serialNumber: string;
|
||||
};
|
||||
|
||||
export type TCaEstConfig = {
|
||||
caId: string;
|
||||
caChain: string;
|
||||
isEnabled: false;
|
||||
};
|
||||
|
||||
export type TCreateCaEstConfigDTO = {
|
||||
caId: string;
|
||||
caChain: string;
|
||||
passphrase: string;
|
||||
isEnabled: boolean;
|
||||
};
|
||||
|
||||
export type TUpdateCaEstConfigDTO = {
|
||||
caId: string;
|
||||
caChain?: string;
|
||||
passphrase?: string;
|
||||
isEnabled?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user