Check empty payload

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:19:54 -08:00
parent a0c0bd6a40
commit 4bb19dd730
2 changed files with 10 additions and 6 deletions
+6 -3
View File
@@ -10,6 +10,7 @@ import {
CreateAcmeOrderBodySchema, CreateAcmeOrderBodySchema,
DeactivateAcmeAccountBodySchema, DeactivateAcmeAccountBodySchema,
DeactivateAcmeAccountResponseSchema, DeactivateAcmeAccountResponseSchema,
DownloadAcmeCertificateBodySchema,
FinalizeAcmeOrderBodySchema, FinalizeAcmeOrderBodySchema,
GetAcmeAuthorizationResponseSchema, GetAcmeAuthorizationResponseSchema,
GetAcmeDirectoryResponseSchema, GetAcmeDirectoryResponseSchema,
@@ -372,10 +373,12 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
} }
}, },
handler: async (req, res) => { handler: async (req, res) => {
const { profileId, accountId } = await validateExistingAccount({ const { profileId, accountId, payload } = await validateExistingAccount({
req, req
schema: FinalizeAcmeOrderBodySchema
}); });
if (payload !== "") {
throw new AcmeMalformedError({ detail: "Payload should be empty" });
}
return sendAcmeResponse( return sendAcmeResponse(
res, res,
profileId, profileId,
@@ -603,11 +603,12 @@ export const pkiAcmeServiceFactory = ({
if (!order) { if (!order) {
throw new NotFoundError({ message: "ACME order not found" }); throw new NotFoundError({ message: "ACME order not found" });
} }
// FIXME: Implement ACME certificate download if (order.status !== AcmeOrderStatus.Valid) {
// Return the certificate in PEM format throw new AcmeOrderNotReadyError({ message: "ACME order is not valid" });
}
return { return {
status: 200, status: 200,
body: "FIXME-certificate-pem", body: order.certificateChain! + "\n" + order.certificate!,
headers: { headers: {
Location: buildUrl(profileId, `/orders/${orderId}/certificate`), Location: buildUrl(profileId, `/orders/${orderId}/certificate`),
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"` Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`