Trait cfxstore::SecretStore
source · pub trait SecretStore: SimpleSecretStore {
Show 14 methods
// Required methods
fn raw_secret(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueSecret, Error>;
fn import_wallet(
&self,
vault: SecretVaultRef,
json: &[u8],
password: &Password,
gen_id: bool
) -> Result<StoreAccountRef, Error>;
fn copy_account(
&self,
new_store: &dyn SimpleSecretStore,
new_vault: SecretVaultRef,
account: &StoreAccountRef,
password: &Password,
new_password: &Password
) -> Result<(), Error>;
fn test_password(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<bool, Error>;
fn public(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<Public, Error>;
fn uuid(&self, account: &StoreAccountRef) -> Result<Uuid, Error>;
fn name(&self, account: &StoreAccountRef) -> Result<String, Error>;
fn meta(&self, account: &StoreAccountRef) -> Result<String, Error>;
fn set_name(
&self,
account: &StoreAccountRef,
name: String
) -> Result<(), Error>;
fn set_meta(
&self,
account: &StoreAccountRef,
meta: String
) -> Result<(), Error>;
fn local_path(&self) -> PathBuf;
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address>;
fn import_geth_accounts(
&self,
vault: SecretVaultRef,
desired: Vec<Address>,
testnet: bool
) -> Result<Vec<StoreAccountRef>, Error>;
// Provided method
fn sign_with_secret(
&self,
secret: &OpaqueSecret,
message: &Message
) -> Result<Signature, Error> { ... }
}
Expand description
Secret Store API
Required Methods§
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_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 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 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 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: &StoreAccountRef, name: String) -> Result<(), Error>
fn set_name(&self, account: &StoreAccountRef, name: String) -> Result<(), Error>
Modifies account metadata.
sourcefn set_meta(&self, account: &StoreAccountRef, meta: String) -> Result<(), Error>
fn set_meta(&self, account: &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 list_geth_accounts(&self, testnet: bool) -> Vec<Address>
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address>
Lists all found geth accounts.
sourcefn import_geth_accounts(
&self,
vault: SecretVaultRef,
desired: Vec<Address>,
testnet: bool
) -> Result<Vec<StoreAccountRef>, Error>
fn import_geth_accounts( &self, vault: SecretVaultRef, desired: Vec<Address>, testnet: bool ) -> Result<Vec<StoreAccountRef>, Error>
Imports geth accounts to the store/vault.
Provided Methods§
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.