Check empty payload

This commit is contained in:
Fang-Pen Lin
2025-10-31 22:17:42 -07:00
parent a0c0bd6a40
commit 4bb19dd730
2 changed files with 10 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import {
CreateAcmeOrderBodySchema,
DeactivateAcmeAccountBodySchema,
DeactivateAcmeAccountResponseSchema,
DownloadAcmeCertificateBodySchema,
FinalizeAcmeOrderBodySchema,
GetAcmeAuthorizationResponseSchema,
GetAcmeDirectoryResponseSchema,
@@ -372,10 +373,12 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req, res) => {
const { profileId, accountId } = await validateExistingAccount({
req,
schema: FinalizeAcmeOrderBodySchema
const { profileId, accountId, payload } = await validateExistingAccount({
req
});
if (payload !== "") {
throw new AcmeMalformedError({ detail: "Payload should be empty" });
}
return sendAcmeResponse(
res,
profileId,

View File

@@ -603,11 +603,12 @@ export const pkiAcmeServiceFactory = ({
if (!order) {
throw new NotFoundError({ message: "ACME order not found" });
}
// FIXME: Implement ACME certificate download
// Return the certificate in PEM format
if (order.status !== AcmeOrderStatus.Valid) {
throw new AcmeOrderNotReadyError({ message: "ACME order is not valid" });
}
return {
status: 200,
body: "FIXME-certificate-pem",
body: order.certificateChain! + "\n" + order.certificate!,
headers: {
Location: buildUrl(profileId, `/orders/${orderId}/certificate`),
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`