Struct instant_acme::Order
source · pub struct Order { /* private fields */ }
Expand description
An ACME order as described in RFC 8555 (section 7.1.3)
An order is created from an Account
by calling Account::new_order()
. The Order
type represents the stable identity of an order, while the Order::state()
method
gives you access to the current state of the order according to the server.
Implementations§
source§impl Order
impl Order
Retrieve the authorizations for this order
An order will contain one authorization to complete per identifier in the order. After creating an order, you’ll need to retrieve the authorizations so that you can set up a challenge response for each authorization.
For each authorization, you’ll need to:
- Select which
ChallengeType
you want to complete - Create a
KeyAuthorization
for thatChallenge
- Call
Order::set_challenge_ready()
for that challenge
After the challenges have been set up, check the Order::state()
to see
if the order is ready to be finalized (or becomes invalid). Once it is
ready, call Order::finalize()
to get the certificate.
Create a KeyAuthorization
for the given Challenge
Signs the challenge’s token with the account’s private key and use the
value from KeyAuthorization::as_str()
as the challenge response.
sourcepub async fn finalize(&mut self, csr_der: &[u8]) -> Result<(), Error>
pub async fn finalize(&mut self, csr_der: &[u8]) -> Result<(), Error>
Request a certificate from the given Certificate Signing Request (CSR)
Creating a CSR is outside of the scope of instant-acme. Make sure you pass in a
DER representation of the CSR in csr_der
. Call certificate()
to retrieve the
certificate chain once the order is in the appropriate state.
sourcepub async fn certificate(&mut self) -> Result<Option<String>, Error>
pub async fn certificate(&mut self) -> Result<Option<String>, Error>
Get the certificate for this order
If the cached order state is in ready
or processing
state, this will poll the server
for the latest state. If the order is still in processing
state after that, this will
return Ok(None)
. If the order is in valid
state, this will attempt to retrieve
the certificate from the server and return it as a String
. If the order contains
an error or ends up in any state other than valid
or processing
, return an error.
sourcepub async fn set_challenge_ready(
&mut self,
challenge_url: &str
) -> Result<(), Error>
pub async fn set_challenge_ready( &mut self, challenge_url: &str ) -> Result<(), Error>
Notify the server that the given challenge is ready to be completed
challenge_url
should be the Challenge::url
field.
sourcepub async fn challenge(
&mut self,
challenge_url: &str
) -> Result<Challenge, Error>
pub async fn challenge( &mut self, challenge_url: &str ) -> Result<Challenge, Error>
Get the current state of the given challenge
sourcepub async fn refresh(&mut self) -> Result<&OrderState, Error>
pub async fn refresh(&mut self) -> Result<&OrderState, Error>
Refresh the current state of the order
sourcepub fn state(&mut self) -> &OrderState
pub fn state(&mut self) -> &OrderState
Get the last known state of the order
Call refresh()
to get the latest state from the server.