More test cases

This commit is contained in:
Fang-Pen Lin
2025-11-12 09:12:26 -08:00
parent d7cf4388fe
commit 4150035fcd
4 changed files with 52 additions and 19 deletions
@@ -139,7 +139,7 @@ export class AcmeAccountDoesNotExistError extends AcmeError {
super({
type: AcmeErrorType.AccountDoesNotExist,
message,
status: 400,
status: 404,
error
});
this.name = "AcmeAccountDoesNotExistError";
@@ -165,7 +165,7 @@ export const pkiAcmeServiceFactory = ({
throw new AcmeBadPublicKeyError({ message: "Invalid JWS payload" });
}
logger.error(error, "Unexpected error while verifying JWS payload");
throw new AcmeServerInternalError({ message: "Failed to verify JWS payload" });
throw new AcmeMalformedError({ message: "Failed to verify JWS payload" });
}
const { protectedHeader: rawProtectedHeader, payload: rawPayload } = result;
try {
@@ -257,7 +257,7 @@ export const pkiAcmeServiceFactory = ({
}
const accountId = extractAccountIdFromKid(protectedHeader.kid, profileId);
if (expectedAccountId && accountId !== expectedAccountId) {
throw new NotFoundError({ message: "ACME resource not found" });
throw new AcmeAccountDoesNotExistError({ message: "ACME resource not found" });
}
const account = await acmeAccountDAL.findByProjectIdAndAccountId(profile.id, accountId);
if (!account) {