Struct identity_account::account::AccountBuilder
source · pub struct AccountBuilder<C = Arc<Client>>where
C: SharedPtr<Client>,{ /* private fields */ }
Expand description
An Account
builder for easy account configuration.
To reduce memory usage, accounts created from the same builder share the same Storage
used to store identities, and the same Client
used to publish identities to the Tangle.
The configuration on the other hand is cloned, and therefore unique for each built account. This means a builder can be reconfigured in-between account creations, without affecting the configuration of previously built accounts.
Implementations§
source§impl<C> AccountBuilder<C>where
C: SharedPtr<Client>,
impl<C> AccountBuilder<C>where C: SharedPtr<Client>,
sourcepub fn autopublish(self, value: bool) -> Self
pub fn autopublish(self, value: bool) -> Self
Sets the account auto-publish behaviour.
Sets the account storage adapter from a shared pointer.
sourcepub fn client(self, client: C) -> Self
pub fn client(self, client: C) -> Self
Sets the IOTA Tangle Client
, this determines the Network
used by the identity.
Accounts
created by the same AccountBuilder
will share the same Client
.
NOTE: this overwrites any ClientBuilder
previously set by
AccountBuilder::client_builder
.
sourcepub fn client_builder(self, client_builder: ClientBuilder) -> Self
pub fn client_builder(self, client_builder: ClientBuilder) -> Self
Sets the IOTA Tangle Client
, this determines the Network
used by the identity.
Accounts
created by the same AccountBuilder
will share the same Client
.
NOTE: this overwrites any Client
previously set by AccountBuilder::client
.
sourcepub async fn create_identity(
&mut self,
input: IdentitySetup
) -> Result<Account<C>>
pub async fn create_identity( &mut self, input: IdentitySetup ) -> Result<Account<C>>
Creates a new identity based on the builder configuration and returns
an Account
instance to manage it.
The identity is stored locally in the Storage
. The DID network is automatically determined
by the Client
used to publish it.
See IdentitySetup
to customize the identity creation.