pub struct AccountBuilder { /* private fields */ }
Expand description
Builder for Account
values
Create one via Account::builder()
or Account::builder_with_http()
.
Implementations§
Source§impl AccountBuilder
impl AccountBuilder
Sourcepub async fn from_credentials(
self,
credentials: AccountCredentials,
) -> Result<Account, Error>
pub async fn from_credentials( self, credentials: AccountCredentials, ) -> Result<Account, Error>
Restore an existing account from the given credentials
The AccountCredentials
type is opaque, but supports deserialization.
Sourcepub async fn create(
self,
account: &NewAccount<'_>,
directory_url: String,
external_account: Option<&ExternalAccountKey>,
) -> Result<(Account, AccountCredentials), Error>
pub async fn create( self, account: &NewAccount<'_>, directory_url: String, external_account: Option<&ExternalAccountKey>, ) -> Result<(Account, AccountCredentials), Error>
Create a new account on the directory_url
with the information in NewAccount
The returned AccountCredentials
can be serialized and stored for later use.
Use AccountBuilder::from_credentials()
to restore the account from the credentials.
Sourcepub async fn from_key(
self,
key: (Key, PrivateKeyDer<'static>),
directory_url: String,
) -> Result<(Account, AccountCredentials), Error>
pub async fn from_key( self, key: (Key, PrivateKeyDer<'static>), directory_url: String, ) -> Result<(Account, AccountCredentials), Error>
Load an existing account for the given private key
The returned AccountCredentials
can be serialized and stored for later use.
Use AccountBuilder::from_credentials()
to restore the account from the credentials.
Yields an error if no account matching the given key exists on the server.
Sourcepub async fn from_parts(
self,
id: String,
key_pkcs8_der: PrivatePkcs8KeyDer<'_>,
directory_url: String,
) -> Result<Account, Error>
pub async fn from_parts( self, id: String, key_pkcs8_der: PrivatePkcs8KeyDer<'_>, directory_url: String, ) -> Result<Account, 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.