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.

https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.3

Implementations§

source§

impl Order

source

pub async fn authorizations(&mut self) -> Result<Vec<Authorization>, Error>

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:

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.

source

pub fn key_authorization(&self, challenge: &Challenge) -> KeyAuthorization

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.

source

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.

source

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.

source

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.

source

pub async fn challenge( &mut self, challenge_url: &str ) -> Result<Challenge, Error>

Get the current state of the given challenge

source

pub async fn refresh(&mut self) -> Result<&OrderState, Error>

Refresh the current state of the order

source

pub fn state(&mut self) -> &OrderState

Get the last known state of the order

Call refresh() to get the latest state from the server.

source

pub fn url(&self) -> &str

Get the URL of the order

Auto Trait Implementations§

§

impl !RefUnwindSafe for Order

§

impl Send for Order

§

impl Sync for Order

§

impl Unpin for Order

§

impl !UnwindSafe for Order

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more