Struct instant_acme::Account
source · 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.