Struct cfxstore::CfxMultiStore
source · pub struct CfxMultiStore { /* private fields */ }
Expand description
Similar to CfxStore
but may store many accounts (with different passwords)
for the same Address
Implementations§
source§impl CfxMultiStore
impl CfxMultiStore
sourcepub fn open(directory: Box<dyn KeyDirectory>) -> Result<Self, Error>
pub fn open(directory: Box<dyn KeyDirectory>) -> Result<Self, Error>
Open new multi-accounts store with given key directory backend.
sourcepub fn open_with_iterations(
directory: Box<dyn KeyDirectory>,
iterations: u32
) -> Result<Self, Error>
pub fn open_with_iterations( directory: Box<dyn KeyDirectory>, iterations: u32 ) -> Result<Self, Error>
Open new multi-accounts store with given key directory backend and custom number of iterations for new keys.
sourcepub fn set_refresh_time(&self, time: Duration)
pub fn set_refresh_time(&self, time: Duration)
Modify account refresh timeout - how often they are re-read from
KeyDirectory
.
Setting this to low values (or 0) will cause new accounts to be picked up quickly, although it may induce heavy disk reads and is not recommended if you manage many keys (say over 10k).
By default refreshing is disabled, so only accounts created using this
instance of CfxStore
are taken into account.
Trait Implementations§
source§impl SimpleSecretStore for CfxMultiStore
impl SimpleSecretStore for CfxMultiStore
source§fn insert_account(
&self,
vault: SecretVaultRef,
secret: Secret,
password: &Password
) -> Result<StoreAccountRef, Error>
fn insert_account( &self, vault: SecretVaultRef, secret: Secret, password: &Password ) -> Result<StoreAccountRef, Error>
Inserts new accounts to the store (or vault) with given password.
source§fn insert_derived(
&self,
vault: SecretVaultRef,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation
) -> Result<StoreAccountRef, Error>
fn insert_derived( &self, vault: SecretVaultRef, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation ) -> Result<StoreAccountRef, Error>
Inserts new derived account to the store (or vault) with given password.
source§fn generate_derived(
&self,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation
) -> Result<Address, Error>
fn generate_derived( &self, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation ) -> Result<Address, Error>
Generates new derived account.
source§fn sign_derived(
&self,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation,
message: &Message
) -> Result<Signature, Error>
fn sign_derived( &self, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation, message: &Message ) -> Result<Signature, Error>
Sign a message with derived account.
source§fn account_ref(&self, address: &Address) -> Result<StoreAccountRef, Error>
fn account_ref(&self, address: &Address) -> Result<StoreAccountRef, Error>
Get reference to some account with given address.
This method could be removed if we will guarantee that there is max(1)
account for given address.
source§fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
Returns all accounts in this secret store.
source§fn remove_account(
&self,
account_ref: &StoreAccountRef,
password: &Password
) -> Result<(), Error>
fn remove_account( &self, account_ref: &StoreAccountRef, password: &Password ) -> Result<(), Error>
Entirely removes account from the store and underlying storage.
source§fn change_password(
&self,
account_ref: &StoreAccountRef,
old_password: &Password,
new_password: &Password
) -> Result<(), Error>
fn change_password( &self, account_ref: &StoreAccountRef, old_password: &Password, new_password: &Password ) -> Result<(), Error>
Changes accounts password.
source§fn export_account(
&self,
account_ref: &StoreAccountRef,
password: &Password
) -> Result<OpaqueKeyFile, Error>
fn export_account( &self, account_ref: &StoreAccountRef, password: &Password ) -> Result<OpaqueKeyFile, Error>
Exports key details for account.
source§fn sign(
&self,
account: &StoreAccountRef,
password: &Password,
message: &Message
) -> Result<Signature, Error>
fn sign( &self, account: &StoreAccountRef, password: &Password, message: &Message ) -> Result<Signature, Error>
Sign a message with given account.
source§fn decrypt(
&self,
account: &StoreAccountRef,
password: &Password,
shared_mac: &[u8],
message: &[u8]
) -> Result<Vec<u8>, Error>
fn decrypt( &self, account: &StoreAccountRef, password: &Password, shared_mac: &[u8], message: &[u8] ) -> Result<Vec<u8>, Error>
Decrypt a messages with given account.
source§fn agree(
&self,
account: &StoreAccountRef,
password: &Password,
other: &Public
) -> Result<Secret, Error>
fn agree( &self, account: &StoreAccountRef, password: &Password, other: &Public ) -> Result<Secret, Error>
Agree on shared key.
source§fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>
fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>
Create new vault with given password
source§fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>
fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>
Open vault with given password
source§fn change_vault_password(
&self,
name: &str,
new_password: &Password
) -> Result<(), Error>
fn change_vault_password( &self, name: &str, new_password: &Password ) -> Result<(), Error>
Change vault password
source§fn change_account_vault(
&self,
vault: SecretVaultRef,
account_ref: StoreAccountRef
) -> Result<StoreAccountRef, Error>
fn change_account_vault( &self, vault: SecretVaultRef, account_ref: StoreAccountRef ) -> Result<StoreAccountRef, Error>
Cnage account’ vault
Auto Trait Implementations§
impl !RefUnwindSafe for CfxMultiStore
impl Send for CfxMultiStore
impl Sync for CfxMultiStore
impl Unpin for CfxMultiStore
impl !UnwindSafe for CfxMultiStore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more