Get all authorizations

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:18:24 -08:00
parent 80904b1dd1
commit d880c4c6c9
@@ -260,21 +260,23 @@ export const pkiAcmeServiceFactory = ({
accountId: account.id, accountId: account.id,
status: AcmeOrderStatus.Pending status: AcmeOrderStatus.Pending
}); });
payload.identifiers.forEach(async (identifier) => { const authorizations = await Promise.all(
if (identifier.type === AcmeIdentifierType.DNS) { payload.identifiers.map(async (identifier) => {
// TODO: reuse existing authorizations for this identifier if they exist if (identifier.type === AcmeIdentifierType.DNS) {
const auth = await acmeAuthDAL.create({ // TODO: reuse existing authorizations for this identifier if they exist
accountId: account.id, return await acmeAuthDAL.create({
status: AcmeAuthStatus.Pending, accountId: account.id,
identifierType: identifier.type, status: AcmeAuthStatus.Pending,
identifierValue: identifier.value, identifierType: identifier.type,
// TODO: read config from the profile to get the expiration time instead identifierValue: identifier.value,
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000) // TODO: read config from the profile to get the expiration time instead
}); expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000)
} else { });
throw new AcmeMalformedError({ detail: "Only DNS identifiers are supported" }); } else {
} throw new AcmeMalformedError({ detail: "Only DNS identifiers are supported" });
}); }
})
);
// FIXME: Implement ACME new order creation // FIXME: Implement ACME new order creation
const orderId = "FIXME-order-id"; const orderId = "FIXME-order-id";