Skip to content

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

Refactor code

Fang-Pen Lin6b85ab54a4f1
diff --git a/backend/src/db/schemas/pki-acme-orders.ts b/backend/src/db/schemas/pki-acme-orders.ts
index d52c30662c..5f18a3b8cb 100644
--- a/backend/src/db/schemas/pki-acme-orders.ts
+++ b/backend/src/db/schemas/pki-acme-orders.ts
@@ -12,7 +12,9 @@ export const PkiAcmeOrdersSchema = z.object({
accountId: z.string().uuid(),
status: z.string(),
createdAt: z.date(),
- updatedAt: z.date()
+ updatedAt: z.date(),
+ notBefore: z.date().nullable().optional(),
+ notAfter: z.date().nullable().optional()
});
export type TPkiAcmeOrders = z.infer<typeof PkiAcmeOrdersSchema>;
diff --git a/backend/src/ee/routes/v1/pki-acme-router.ts b/backend/src/ee/routes/v1/pki-acme-router.ts
index 362c8b38ed..0cb39657df 100644
--- a/backend/src/ee/routes/v1/pki-acme-router.ts
+++ b/backend/src/ee/routes/v1/pki-acme-router.ts
@@ -4,16 +4,14 @@ import { FastifyReply } from "fastify";
import { z } from "zod";
import {
+ AcmeOrderResourceSchema,
CreateAcmeAccountResponseSchema,
CreateAcmeOrderBodySchema,
- CreateAcmeOrderResponseSchema,
DeactivateAcmeAccountBodySchema,
DeactivateAcmeAccountResponseSchema,
FinalizeAcmeOrderBodySchema,
- FinalizeAcmeOrderResponseSchema,
GetAcmeAuthorizationResponseSchema,
GetAcmeDirectoryResponseSchema,
- GetAcmeOrderResponseSchema,
ListAcmeOrdersPayloadSchema,
ListAcmeOrdersResponseSchema,
RawJwsPayloadSchema,
@@ -138,38 +136,40 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
}
});
- // POST /api/v1/pki/acme/profiles/<profile_id>/new-order
- // New Certificate Order (RFC 8555 Section 7.4)
+ // POST /api/v1/pki/acme/profiles/<profile_id>/accounts/<account_id>
+ // Account Deactivation (RFC 8555 Section 7.3.6)
server.route({
method: "POST",
- url: "/profiles/:profileId/new-order",
+ url: "/profiles/:profileId/accounts/:accountId",
config: {
rateLimit: writeLimit
},
schema: {
hide: false,
tags: [ApiDocsTags.PkiAcme],
- description: "ACME New Order - apply for a new certificate",
+ description: "ACME Account Deactivation",
params: z.object({
- profileId: z.string().uuid()
+ profileId: z.string().uuid(),
+ accountId: z.string()
}),
body: RawJwsPayloadSchema,
response: {
- 201: CreateAcmeOrderResponseSchema
+ 200: DeactivateAcmeAccountResponseSchema
}
},
// TODO: replace with verify ACME signature here instead
// onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req, res) => {
- const { profileId, accountId, payload } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
+ const { payload, profileId, accountId } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
profileId: req.params.profileId,
rawJwsPayload: req.body,
- schema: CreateAcmeOrderBodySchema
+ schema: DeactivateAcmeAccountBodySchema,
+ expectedAccountId: req.params.accountId
});
return sendAcmeResponse(
res,
profileId,
- await server.services.pkiAcme.createAcmeOrder({
+ await server.services.pkiAcme.deactivateAcmeAccount({
profileId,
accountId,
payload
@@ -178,40 +178,38 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
}
});
- // POST /api/v1/pki/acme/profiles/<profile_id>/accounts/<account_id>
- // Account Deactivation (RFC 8555 Section 7.3.6)
+ // POST /api/v1/pki/acme/profiles/<profile_id>/new-order
+ // New Certificate Order (RFC 8555 Section 7.4)
server.route({
method: "POST",
- url: "/profiles/:profileId/accounts/:accountId",
+ url: "/profiles/:profileId/new-order",
config: {
rateLimit: writeLimit
},
schema: {
hide: false,
tags: [ApiDocsTags.PkiAcme],
- description: "ACME Account Deactivation",
+ description: "ACME New Order - apply for a new certificate",
params: z.object({
- profileId: z.string().uuid(),
- accountId: z.string()
+ profileId: z.string().uuid()
}),
body: RawJwsPayloadSchema,
response: {
- 200: DeactivateAcmeAccountResponseSchema
+ 201: AcmeOrderResourceSchema
}
},
// TODO: replace with verify ACME signature here instead
// onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req, res) => {
- const { payload, profileId, accountId } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
+ const { profileId, accountId, payload } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
profileId: req.params.profileId,
rawJwsPayload: req.body,
- schema: DeactivateAcmeAccountBodySchema,
- expectedAccountId: req.params.accountId
+ schema: CreateAcmeOrderBodySchema
});
return sendAcmeResponse(
res,
profileId,
- await server.services.pkiAcme.deactivateAcmeAccount({
+ await server.services.pkiAcme.createAcmeOrder({
profileId,
accountId,
payload
@@ -220,25 +218,25 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
}
});
- // POST /api/v1/pki/acme/profiles/<profile_id>/accounts/<account_id>/orders
- // List Orders (RFC 8555 Section 7.1.2.1)
+ // POST /api/v1/pki/acme/profiles/<profile_id>/orders/<order_id>
+ // Get Order (RFC 8555 Section 7.1.3)
server.route({
method: "POST",
- url: "/profiles/:profileId/accounts/:accountId/orders",
+ url: "/profiles/:profileId/orders/:orderId",
config: {
rateLimit: readLimit
},
schema: {
hide: false,
tags: [ApiDocsTags.PkiAcme],
- description: "ACME List Orders - get existing orders from current account",
+ description: "ACME Get Order - return status and details of the order",
params: z.object({
profileId: z.string().uuid(),
- accountId: z.string()
+ orderId: z.string().uuid()
}),
body: RawJwsPayloadSchema,
response: {
- 200: ListAcmeOrdersResponseSchema
+ 200: AcmeOrderResourceSchema
}
},
// TODO: replace with verify ACME signature here instead
@@ -246,98 +244,97 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
handler: async (req, res) => {
const { profileId, accountId } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
profileId: req.params.profileId,
- rawJwsPayload: req.body,
- schema: ListAcmeOrdersPayloadSchema,
- expectedAccountId: req.params.accountId
+ rawJwsPayload: req.body
});
return sendAcmeResponse(
res,
profileId,
- await server.services.pkiAcme.listAcmeOrders({
+ await server.services.pkiAcme.getAcmeOrder({
profileId,
- accountId
+ accountId,
+ orderId: req.params.orderId
})
);
}
});
- // POST /api/v1/pki/acme/profiles/<profile_id>/orders/<order_id>
- // Get Order (RFC 8555 Section 7.1.3)
+ // POST /api/v1/pki/acme/profiles/<profile_id>/orders/<order_id>/finalize
+ // Applying for Certificate Issuance (RFC 8555 Section 7.4)
server.route({
method: "POST",
- url: "/profiles/:profileId/orders/:orderId",
+ url: "/profiles/:profileId/orders/:orderId/finalize",
config: {
- rateLimit: readLimit
+ rateLimit: writeLimit
},
schema: {
hide: false,
tags: [ApiDocsTags.PkiAcme],
- description: "ACME Get Order - return status and details of the order",
+ description: "ACME Finalize Order - finalize cert order by providing CSR",
params: z.object({
profileId: z.string().uuid(),
orderId: z.string().uuid()
}),
body: RawJwsPayloadSchema,
response: {
- 200: GetAcmeOrderResponseSchema
+ 200: AcmeOrderResourceSchema
}
},
// TODO: replace with verify ACME signature here instead
// onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req, res) => {
- const { profileId, accountId } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
+ const { profileId, accountId, payload } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
profileId: req.params.profileId,
- rawJwsPayload: req.body
+ rawJwsPayload: req.body,
+ schema: FinalizeAcmeOrderBodySchema
});
return sendAcmeResponse(
res,
profileId,
- await server.services.pkiAcme.getAcmeOrder({
+ await server.services.pkiAcme.finalizeAcmeOrder({
profileId,
accountId,
- orderId: req.params.orderId
+ orderId: req.params.orderId,
+ payload
})
);
}
});
-
- // POST /api/v1/pki/acme/profiles/<profile_id>/orders/<order_id>/finalize
- // Applying for Certificate Issuance (RFC 8555 Section 7.4)
+ // POST /api/v1/pki/acme/profiles/<profile_id>/accounts/<account_id>/orders
+ // List Orders (RFC 8555 Section 7.1.2.1)
server.route({
method: "POST",
- url: "/profiles/:profileId/orders/:orderId/finalize",
+ url: "/profiles/:profileId/accounts/:accountId/orders",
config: {
- rateLimit: writeLimit
+ rateLimit: readLimit
},
schema: {
hide: false,
tags: [ApiDocsTags.PkiAcme],
- description: "ACME Finalize Order - finalize cert order by providing CSR",
+ description: "ACME List Orders - get existing orders from current account",
params: z.object({
profileId: z.string().uuid(),
- orderId: z.string().uuid()
+ accountId: z.string()
}),
body: RawJwsPayloadSchema,
response: {
- 200: FinalizeAcmeOrderResponseSchema
+ 200: ListAcmeOrdersResponseSchema
}
},
// TODO: replace with verify ACME signature here instead
// onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req, res) => {
- const { profileId, accountId, payload } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
+ const { profileId, accountId } = await server.services.pkiAcme.validateExistingAccountJwsPayload({
profileId: req.params.profileId,
- rawJwsPayload: req.body
- schema: FinalizeAcmeOrderBodySchema,
+ rawJwsPayload: req.body,
+ schema: ListAcmeOrdersPayloadSchema,
+ expectedAccountId: req.params.accountId
});
return sendAcmeResponse(
res,
profileId,
- await server.services.pkiAcme.finalizeAcmeOrder({
+ await server.services.pkiAcme.listAcmeOrders({
profileId,
- accountId,
- orderId: req.params.orderId,
- payload
+ accountId
})
);
}
diff --git a/backend/src/ee/services/pki-acme/pki-acme-schemas.ts b/backend/src/ee/services/pki-acme/pki-acme-schemas.ts
index a10476ca40..ad40ea17b7 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-schemas.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-schemas.ts
@@ -90,9 +90,11 @@ export const CreateAcmeOrderBodySchema = z.object({
notAfter: z.string().optional()
});
-export const CreateAcmeOrderResponseSchema = z.object({
- status: z.string(),
- expires: z.string(),
+export const AcmeOrderResourceSchema = z.object({
+ status: z.enum(Object.values(AcmeOrderStatus) as [string, ...string[]]),
+ expires: z.string().optional(),
+ notBefore: z.string().optional(),
+ notAfter: z.string().optional(),
identifiers: z.array(
z.object({
type: z.string(),
@@ -120,39 +122,11 @@ export const ListAcmeOrdersResponseSchema = z.object({
orders: z.array(z.string())
});
-export const GetAcmeOrderResponseSchema = z.object({
- status: z.enum(Object.values(AcmeOrderStatus) as [string, ...string[]]),
- expires: z.string().optional(),
- identifiers: z.array(
- z.object({
- type: z.string(),
- value: z.string()
- })
- ),
- authorizations: z.array(z.string()),
- finalize: z.string(),
- certificate: z.string().optional()
-});
-
// Finalize Order payload schema
export const FinalizeAcmeOrderBodySchema = z.object({
csr: z.string()
});
-export const FinalizeAcmeOrderResponseSchema = z.object({
- status: z.enum(Object.values(AcmeOrderStatus) as [string, ...string[]]),
- expires: z.string().optional(),
- identifiers: z.array(
- z.object({
- type: z.string(),
- value: z.string()
- })
- ),
- authorizations: z.array(z.string()),
- finalize: z.string(),
- certificate: z.string().optional()
-});
-
export const GetAcmeAuthorizationResponseSchema = z.object({
status: z.enum(Object.values(AcmeAuthStatus) as [string, ...string[]]),
expires: z.string().optional(),
diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts
index d15992c990..49dfb72ef1 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -37,16 +37,14 @@ import {
TCreateAcmeAccountPayload,
TCreateAcmeAccountResponse,
TCreateAcmeOrderPayload,
- TCreateAcmeOrderResponse,
TDeactivateAcmeAccountPayload,
TDeactivateAcmeAccountResponse,
TFinalizeAcmeOrderPayload,
- TFinalizeAcmeOrderResponse,
TGetAcmeAuthorizationResponse,
TGetAcmeDirectoryResponse,
- TGetAcmeOrderResponse,
TJwsPayload,
TListAcmeOrdersResponse,
+ TAcmeOrderResource,
TPkiAcmeServiceFactory,
TRawJwsPayload,
TRespondToAcmeChallengeResponse
@@ -206,6 +204,36 @@ export const pkiAcmeServiceFactory = ({
};
};
+ const buildAcmeOrderResource = ({
+ profileId,
+ order
+ }: {
+ order: {
+ id: string;
+ status: string;
+ expiresAt: Date;
+ notBefore?: Date | null;
+ notAfter?: Date | null;
+ authorizations: TPkiAcmeAuths[];
+ };
+ profileId: string;
+ }) => {
+ return {
+ status: order.status,
+ expires: order.expiresAt.toISOString(),
+ notBefore: order.notBefore?.toISOString(),
+ notAfter: order.notAfter?.toISOString(),
+ identifiers: order.authorizations.map((auth: TPkiAcmeAuths) => ({
+ type: auth.identifierType,
+ value: auth.identifierValue
+ })),
+ authorizations: order.authorizations.map((auth: TPkiAcmeAuths) =>
+ buildUrl(`/api/v1/pki/acme/profiles/${profileId}/authorizations/${auth.id}`)
+ ),
+ finalize: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/orders/${order.id}/finalize`)
+ };
+ };
+
const getAcmeNewNonce = async (profileId: string): Promise<string> => {
const profile = await validateAcmeProfile(profileId);
// FIXME: Implement ACME new nonce generation
@@ -213,6 +241,9 @@ export const pkiAcmeServiceFactory = ({
return "FIXME-generate-nonce";
};
+ /** --------------------------------------------------------------
+ * ACME Account
+ * -------------------------------------------------------------- */
const createAcmeAccount = async ({
profileId,
alg,
@@ -251,6 +282,7 @@ export const pkiAcmeServiceFactory = ({
publicKey: jwk,
emails: contact ?? []
});
+ // TODO: create audit log here
// TODO: check EAB authentication here
return {
status: 201,
@@ -265,6 +297,31 @@ export const pkiAcmeServiceFactory = ({
};
};
+ const deactivateAcmeAccount = async ({
+ profileId,
+ accountId,
+ payload: { status } = { status: "deactivated" }
+ }: {
+ profileId: string;
+ accountId: string;
+ payload?: TDeactivateAcmeAccountPayload;
+ }): Promise<TAcmeResponse<TDeactivateAcmeAccountResponse>> => {
+ const profile = await validateAcmeProfile(profileId);
+ // FIXME: Implement ACME account deactivation
+ return {
+ status: 200,
+ body: {
+ status: "deactivated"
+ },
+ headers: {
+ Location: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/accounts/${accountId}`)
+ }
+ };
+ };
+
+ /** --------------------------------------------------------------
+ * ACME Order
+ * -------------------------------------------------------------- */
const createAcmeOrder = async ({
profileId,
accountId,
@@ -273,7 +330,7 @@ export const pkiAcmeServiceFactory = ({
profileId: string;
accountId: string;
payload: TCreateAcmeOrderPayload;
- }): Promise<TAcmeResponse<TCreateAcmeOrderResponse>> => {
+ }): Promise<TAcmeResponse<TAcmeOrderResource>> => {
// TODO: check and see if we have existing orders for this account that meet the criteria
// if we do, return the existing order
@@ -314,71 +371,22 @@ export const pkiAcmeServiceFactory = ({
})),
tx
);
+ // TODO: create audit log here
return { ...createdOrder, authorizations, account };
});
return {
status: 201,
- body: {
- status: order.status,
- expires: order.expiresAt.toISOString(),
- identifiers: order.authorizations.map((auth: TPkiAcmeAuths) => ({
- type: auth.identifierType,
- value: auth.identifierValue
- })),
- authorizations: order.authorizations.map((auth: TPkiAcmeAuths) =>
- buildUrl(`/api/v1/pki/acme/profiles/${order.account.profileId}/authorizations/${auth.id}`)
- ),
- finalize: buildUrl(`/api/v1/pki/acme/profiles/${order.account.profileId}/orders/${order.id}/finalize`)
- },
+ body: buildAcmeOrderResource({
+ profileId,
+ order
+ }),
headers: {
Location: buildUrl(`/api/v1/pki/acme/profiles/${order.account.profileId}/orders/${order.id}`)
}
};
};
- const deactivateAcmeAccount = async ({
- profileId,
- accountId,
- payload: { status } = { status: "deactivated" }
- }: {
- profileId: string;
- accountId: string;
- payload?: TDeactivateAcmeAccountPayload;
- }): Promise<TAcmeResponse<TDeactivateAcmeAccountResponse>> => {
- const profile = await validateAcmeProfile(profileId);
- // FIXME: Implement ACME account deactivation
- return {
- status: 200,
- body: {
- status: "deactivated"
- },
- headers: {
- Location: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/accounts/${accountId}`)
- }
- };
- };
-
- const listAcmeOrders = async ({
- profileId,
- accountId
- }: {
- profileId: string;
- accountId: string;
- }): Promise<TAcmeResponse<TListAcmeOrdersResponse>> => {
- const profile = await validateAcmeProfile(profileId);
- // FIXME: Implement ACME list orders
- return {
- status: 200,
- body: {
- orders: []
- },
- headers: {
- Location: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/accounts/${accountId}/orders`)
- }
- };
- };
-
const getAcmeOrder = async ({
profileId,
accountId,
@@ -387,25 +395,14 @@ export const pkiAcmeServiceFactory = ({
profileId: string;
accountId: string;
orderId: string;
- }): Promise<TAcmeResponse<TGetAcmeOrderResponse>> => {
+ }): Promise<TAcmeResponse<TAcmeOrderResource>> => {
const order = await acmeOrderDAL.findByIdWithAuthorizations(orderId);
if (!order || order.accountId !== accountId) {
throw new NotFoundError({ message: "ACME order not found" });
}
return {
status: 200,
- body: {
- status: order.status,
- expires: order.expiresAt.toISOString(),
- identifiers: order.authorizations.map((auth: TPkiAcmeAuths) => ({
- type: auth.identifierType,
- value: auth.identifierValue
- })),
- authorizations: order.authorizations.map((auth: TPkiAcmeAuths) =>
- buildUrl(`/api/v1/pki/acme/profiles/${profileId}/authorizations/${auth.id}`)
- ),
- finalize: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/orders/${orderId}/finalize`)
- },
+ body: buildAcmeOrderResource({ profileId, order }),
headers: { Location: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/orders/${orderId}`) }
};
};
@@ -420,7 +417,7 @@ export const pkiAcmeServiceFactory = ({
accountId: string;
orderId: string;
payload: TFinalizeAcmeOrderPayload;
- }): Promise<TAcmeResponse<TFinalizeAcmeOrderResponse>> => {
+ }): Promise<TAcmeResponse<TAcmeOrderResource>> => {
const profile = await validateAcmeProfile(profileId);
const { csr } = payload;
// FIXME: Implement ACME finalize order
@@ -440,6 +437,26 @@ export const pkiAcmeServiceFactory = ({
};
};
+ const listAcmeOrders = async ({
+ profileId,
+ accountId
+ }: {
+ profileId: string;
+ accountId: string;
+ }): Promise<TAcmeResponse<TListAcmeOrdersResponse>> => {
+ const profile = await validateAcmeProfile(profileId);
+ // FIXME: Implement ACME list orders
+ return {
+ status: 200,
+ body: {
+ orders: []
+ },
+ headers: {
+ Location: buildUrl(`/api/v1/pki/acme/profiles/${profileId}/accounts/${accountId}/orders`)
+ }
+ };
+ };
+
const downloadAcmeCertificate = async ({
profileId,
orderId
@@ -459,6 +476,9 @@ export const pkiAcmeServiceFactory = ({
};
};
+ /** --------------------------------------------------------------
+ * ACME Authorization
+ * -------------------------------------------------------------- */
const getAcmeAuthorization = async ({
profileId,
accountId,
diff --git a/backend/src/ee/services/pki-acme/pki-acme-types.ts b/backend/src/ee/services/pki-acme/pki-acme-types.ts
index 93f14de176..672300f187 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-types.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-types.ts
@@ -2,17 +2,15 @@ import { z } from "zod";
import { JWSHeaderParameters } from "jose";
import {
+ AcmeOrderResourceSchema,
CreateAcmeAccountBodySchema,
CreateAcmeAccountResponseSchema,
CreateAcmeOrderBodySchema,
- CreateAcmeOrderResponseSchema,
DeactivateAcmeAccountBodySchema,
DeactivateAcmeAccountResponseSchema,
FinalizeAcmeOrderBodySchema,
- FinalizeAcmeOrderResponseSchema,
GetAcmeAuthorizationResponseSchema,
GetAcmeDirectoryResponseSchema,
- GetAcmeOrderResponseSchema,
ListAcmeOrdersResponseSchema,
ProtectedHeaderSchema,
RawJwsPayloadSchema,
@@ -21,11 +19,9 @@ import {
export type TGetAcmeDirectoryResponse = z.infer<typeof GetAcmeDirectoryResponseSchema>;
export type TCreateAcmeAccountResponse = z.infer<typeof CreateAcmeAccountResponseSchema>;
-export type TCreateAcmeOrderResponse = z.infer<typeof CreateAcmeOrderResponseSchema>;
+export type TAcmeOrderResource = z.infer<typeof AcmeOrderResourceSchema>;
export type TDeactivateAcmeAccountResponse = z.infer<typeof DeactivateAcmeAccountResponseSchema>;
export type TListAcmeOrdersResponse = z.infer<typeof ListAcmeOrdersResponseSchema>;
-export type TGetAcmeOrderResponse = z.infer<typeof GetAcmeOrderResponseSchema>;
-export type TFinalizeAcmeOrderResponse = z.infer<typeof FinalizeAcmeOrderResponseSchema>;
export type TDownloadAcmeCertificateDTO = string;
export type TGetAcmeAuthorizationResponse = z.infer<typeof GetAcmeAuthorizationResponseSchema>;
export type TRespondToAcmeChallengeResponse = z.infer<typeof RespondToAcmeChallengeResponseSchema>;
@@ -89,15 +85,6 @@ export type TPkiAcmeServiceFactory = {
jwk: JsonWebKey;
payload: TCreateAcmeAccountPayload;
}) => Promise<TAcmeResponse<TCreateAcmeAccountResponse>>;
- createAcmeOrder: ({
- profileId,
- accountId,
- payload
- }: {
- profileId: string;
- accountId: string;
- payload: TCreateAcmeOrderPayload;
- }) => Promise<TAcmeResponse<TCreateAcmeOrderResponse>>;
deactivateAcmeAccount: ({
profileId,
accountId,
@@ -107,13 +94,15 @@ export type TPkiAcmeServiceFactory = {
accountId: string;
payload?: TDeactivateAcmeAccountPayload;
}) => Promise<TAcmeResponse<TDeactivateAcmeAccountResponse>>;
- listAcmeOrders: ({
+ createAcmeOrder: ({
profileId,
- accountId
+ accountId,
+ payload
}: {
profileId: string;
accountId: string;
- }) => Promise<TAcmeResponse<TListAcmeOrdersResponse>>;
+ payload: TCreateAcmeOrderPayload;
+ }) => Promise<TAcmeResponse<TAcmeOrderResource>>;
getAcmeOrder: ({
profileId,
accountId,
@@ -122,7 +111,7 @@ export type TPkiAcmeServiceFactory = {
profileId: string;
accountId: string;
orderId: string;
- }) => Promise<TAcmeResponse<TGetAcmeOrderResponse>>;
+ }) => Promise<TAcmeResponse<TAcmeOrderResource>>;
finalizeAcmeOrder: ({
profileId,
accountId,
@@ -133,12 +122,21 @@ export type TPkiAcmeServiceFactory = {
accountId: string;
orderId: string;
payload: TFinalizeAcmeOrderPayload;
- }) => Promise<TAcmeResponse<TFinalizeAcmeOrderResponse>>;
+ }) => Promise<TAcmeResponse<TAcmeOrderResource>>;
+ listAcmeOrders: ({
+ profileId,
+ accountId
+ }: {
+ profileId: string;
+ accountId: string;
+ }) => Promise<TAcmeResponse<TListAcmeOrdersResponse>>;
downloadAcmeCertificate: ({
profileId,
+ accountId,
orderId
}: {
profileId: string;
+ accountId: string;
orderId: string;
}) => Promise<TAcmeResponse<string>>;
getAcmeAuthorization: ({