acumen/fetch_certificate

Fetch an issued certificate from the ACME server.

After an order reaches the Valid status, use the certificate URL from order.Valid(certificate_url) to download the certificate chain in PEM format.

Example

import acumen
import acumen/fetch_certificate
import acumen/order

// After the order is valid...
let assert order.Valid(certificate_url) = completed_order.status

let assert Ok(#(resp, ctx)) = acumen.execute(
  ctx,
  build: fetch_certificate.build(certificate_url, _, registered_key),
  send: httpc.send,
)

let assert Ok(pem_chain) = fetch_certificate.response(resp)

Values

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

Builds a POST-as-GET request to fetch an issued certificate.

pub fn response(
  resp: response.Response(String),
) -> Result(String, acumen.AcmeError)

Parses the certificate fetch response.

Returns the certificate chain in PEM format.

Search Document