acumen/finalize_order

Finalize an ACME order with a Certificate Signing Request.

After all authorizations are valid (order status is Ready), submit a CSR to finalize the order and trigger certificate issuance.

Example

import acumen
import acumen/finalize_order
import acumen/order

// Generate a CSR from the order
let assert Ok(csr) = order.to_ec_csr(ready_order, cert_key)

let assert Ok(#(resp, ctx)) = acumen.execute(
  ctx,
  build: finalize_order.build(ready_order.finalize_url, _, registered_key, csr:),
  send: httpc.send,
)

let assert Ok(finalized) = finalize_order.response(resp, ready_order.url)

Values

pub fn build(
  url: url.Url,
  context: acumen.Context,
  key: acumen.RegisteredKey,
  csr csr: BitArray,
) -> Result(request.Request(String), acumen.AcmeError)

Builds the HTTP request to finalize an order with a CSR.

The csr must be in DER format; the library handles base64url encoding.

pub fn response(
  resp: response.Response(String),
  order_url order_url: url.Url,
) -> Result(order.Order, acumen.AcmeError)

Parses the finalize response.

Returns the order, typically in Processing or Valid status. Pass the order_url directly since the finalize response does not include a Location header.

Search Document