pub struct EthStore { /* private fields */ }
Expand description
Accounts store.
Implementations
sourceimpl EthStore
impl EthStore
sourcepub fn open(directory: Box<dyn KeyDirectory>) -> Result<Self, Error>
pub fn open(directory: Box<dyn KeyDirectory>) -> Result<Self, Error>
Open a new accounts store with given key directory backend.
sourcepub fn open_with_iterations(
directory: Box<dyn KeyDirectory>,
iterations: NonZeroU32
) -> Result<Self, Error>
pub fn open_with_iterations(
directory: Box<dyn KeyDirectory>,
iterations: NonZeroU32
) -> Result<Self, Error>
Open a new account store with given key directory backend and custom number of iterations.
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 EthStore
are taken into account.
Trait Implementations
sourceimpl SecretStore for EthStore
impl SecretStore for EthStore
sourcefn raw_secret(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueSecret, Error>
fn raw_secret(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueSecret, Error>
Returns a raw opaque Secret that can be later used to sign a message.
sourcefn import_presale(
&self,
vault: SecretVaultRef,
json: &[u8],
password: &Password
) -> Result<StoreAccountRef, Error>
fn import_presale(
&self,
vault: SecretVaultRef,
json: &[u8],
password: &Password
) -> Result<StoreAccountRef, Error>
Imports presale wallet
sourcefn import_wallet(
&self,
vault: SecretVaultRef,
json: &[u8],
password: &Password,
gen_id: bool
) -> Result<StoreAccountRef, Error>
fn import_wallet(
&self,
vault: SecretVaultRef,
json: &[u8],
password: &Password,
gen_id: bool
) -> Result<StoreAccountRef, Error>
Imports existing JSON wallet
sourcefn test_password(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<bool, Error>
fn test_password(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<bool, Error>
Checks if password matches given account.
sourcefn copy_account(
&self,
new_store: &dyn SimpleSecretStore,
new_vault: SecretVaultRef,
account: &StoreAccountRef,
password: &Password,
new_password: &Password
) -> Result<(), Error>
fn copy_account(
&self,
new_store: &dyn SimpleSecretStore,
new_vault: SecretVaultRef,
account: &StoreAccountRef,
password: &Password,
new_password: &Password
) -> Result<(), Error>
Copies account between stores and vaults.
sourcefn public(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<Public, Error>
fn public(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<Public, Error>
Returns a public key for given account.
sourcefn uuid(&self, account: &StoreAccountRef) -> Result<Uuid, Error>
fn uuid(&self, account: &StoreAccountRef) -> Result<Uuid, Error>
Returns uuid of an account.
sourcefn set_name(
&self,
account_ref: &StoreAccountRef,
name: String
) -> Result<(), Error>
fn set_name(
&self,
account_ref: &StoreAccountRef,
name: String
) -> Result<(), Error>
Modifies account metadata.
sourcefn set_meta(
&self,
account_ref: &StoreAccountRef,
meta: String
) -> Result<(), Error>
fn set_meta(
&self,
account_ref: &StoreAccountRef,
meta: String
) -> Result<(), Error>
Modifies account name.
sourcefn local_path(&self) -> PathBuf
fn local_path(&self) -> PathBuf
Returns local path of the store.
sourcefn sign_with_secret(
&self,
secret: &OpaqueSecret,
message: &Message
) -> Result<Signature, Error>
fn sign_with_secret(
&self,
secret: &OpaqueSecret,
message: &Message
) -> Result<Signature, Error>
Signs a message with raw secret.
sourceimpl SimpleSecretStore for EthStore
impl SimpleSecretStore for EthStore
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn 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. Read more
sourcefn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
Returns all accounts in this secret store.
sourcefn change_password(
&self,
account: &StoreAccountRef,
old_password: &Password,
new_password: &Password
) -> Result<(), Error>
fn change_password(
&self,
account: &StoreAccountRef,
old_password: &Password,
new_password: &Password
) -> Result<(), Error>
Changes accounts password.
sourcefn export_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueKeyFile, Error>
fn export_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueKeyFile, Error>
Exports key details for account.
sourcefn remove_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<(), Error>
fn remove_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<(), Error>
Entirely removes account from the store and underlying storage.
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn 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
sourcefn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>
fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>
Open vault with given password
sourcefn 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
sourcefn change_account_vault(
&self,
vault: SecretVaultRef,
account: StoreAccountRef
) -> Result<StoreAccountRef, Error>
fn change_account_vault(
&self,
vault: SecretVaultRef,
account: StoreAccountRef
) -> Result<StoreAccountRef, Error>
Cnage account’ vault
Auto Trait Implementations
impl !RefUnwindSafe for EthStore
impl Send for EthStore
impl Sync for EthStore
impl Unpin for EthStore
impl !UnwindSafe for EthStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more