pub struct Account { /* private fields */ }Expand description
An ACME account as described in RFC 8555 (section 7.1.2)
Create an Account with Account::create() or restore it from serialized data
by passing deserialized AccountCredentials to Account::from_credentials().
The Account type is cheap to clone.
Implementations§
Source§impl Account
impl Account
Sourcepub async fn from_credentials(
credentials: AccountCredentials,
) -> Result<Self, Error>
pub async fn from_credentials( credentials: AccountCredentials, ) -> Result<Self, Error>
Restore an existing account from the given credentials
The AccountCredentials type is opaque, but supports deserialization.
Sourcepub async fn from_credentials_and_http(
credentials: AccountCredentials,
http: Box<dyn HttpClient>,
) -> Result<Self, Error>
pub async fn from_credentials_and_http( credentials: AccountCredentials, http: Box<dyn HttpClient>, ) -> Result<Self, Error>
Restore an existing account from the given credentials and HTTP client
The AccountCredentials type is opaque, but supports deserialization.
Sourcepub async fn from_parts(
id: String,
key_pkcs8_der: &[u8],
directory_url: &str,
http: Box<dyn HttpClient>,
) -> Result<Self, Error>
pub async fn from_parts( id: String, key_pkcs8_der: &[u8], directory_url: &str, http: Box<dyn HttpClient>, ) -> Result<Self, Error>
Restore an existing account from the given ID, private key, server URL and HTTP client
The key must be provided in DER-encoded PKCS#8. This is usually how ECDSA keys are encoded in PEM files. Use a crate like rustls-pemfile to decode from PEM to DER.
Sourcepub async fn create(
account: &NewAccount<'_>,
server_url: &str,
external_account: Option<&ExternalAccountKey>,
) -> Result<(Account, AccountCredentials), Error>
pub async fn create( account: &NewAccount<'_>, server_url: &str, external_account: Option<&ExternalAccountKey>, ) -> Result<(Account, AccountCredentials), Error>
Create a new account on the server_url with the information in NewAccount
The returned AccountCredentials can be serialized and stored for later use.
Use Account::from_credentials() to restore the account from the credentials.
Sourcepub async fn create_with_http(
account: &NewAccount<'_>,
server_url: &str,
external_account: Option<&ExternalAccountKey>,
http: Box<dyn HttpClient>,
) -> Result<(Account, AccountCredentials), Error>
pub async fn create_with_http( account: &NewAccount<'_>, server_url: &str, external_account: Option<&ExternalAccountKey>, http: Box<dyn HttpClient>, ) -> Result<(Account, AccountCredentials), Error>
Create a new account with a custom HTTP client
The returned AccountCredentials can be serialized and stored for later use.
Use Account::from_credentials() to restore the account from the credentials.
Sourcepub async fn new_order(&self, order: &NewOrder<'_>) -> Result<Order, Error>
pub async fn new_order(&self, order: &NewOrder<'_>) -> Result<Order, Error>
Create a new order based on the given NewOrder
Returns an Order instance. Use the Order::state() method to inspect its state.
Sourcepub async fn order(&self, url: String) -> Result<Order, Error>
pub async fn order(&self, url: String) -> Result<Order, Error>
Fetch the order state for an existing order based on the given url
This might fail if the given URL’s order belongs to a different account.
Returns an Order instance. Use the Order::state method to inspect its state.