Trait cfxstore::SimpleSecretStore
source · pub trait SimpleSecretStore: Send + Sync {
Show 21 methods
// Required methods
fn insert_account(
&self,
vault: SecretVaultRef,
secret: Secret,
password: &Password
) -> Result<StoreAccountRef, Error>;
fn insert_derived(
&self,
vault: SecretVaultRef,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation
) -> Result<StoreAccountRef, Error>;
fn change_password(
&self,
account: &StoreAccountRef,
old_password: &Password,
new_password: &Password
) -> Result<(), Error>;
fn export_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<OpaqueKeyFile, Error>;
fn remove_account(
&self,
account: &StoreAccountRef,
password: &Password
) -> Result<(), Error>;
fn generate_derived(
&self,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation
) -> Result<Address, Error>;
fn sign(
&self,
account: &StoreAccountRef,
password: &Password,
message: &Message
) -> Result<Signature, Error>;
fn sign_derived(
&self,
account_ref: &StoreAccountRef,
password: &Password,
derivation: Derivation,
message: &Message
) -> Result<Signature, Error>;
fn decrypt(
&self,
account: &StoreAccountRef,
password: &Password,
shared_mac: &[u8],
message: &[u8]
) -> Result<Vec<u8>, Error>;
fn agree(
&self,
account: &StoreAccountRef,
password: &Password,
other: &Public
) -> Result<Secret, Error>;
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>;
fn account_ref(&self, address: &Address) -> Result<StoreAccountRef, Error>;
fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
fn close_vault(&self, name: &str) -> Result<(), Error>;
fn list_vaults(&self) -> Result<Vec<String>, Error>;
fn list_opened_vaults(&self) -> Result<Vec<String>, Error>;
fn change_vault_password(
&self,
name: &str,
new_password: &Password
) -> Result<(), Error>;
fn change_account_vault(
&self,
vault: SecretVaultRef,
account: StoreAccountRef
) -> Result<StoreAccountRef, Error>;
fn get_vault_meta(&self, name: &str) -> Result<String, Error>;
fn set_vault_meta(&self, name: &str, meta: &str) -> Result<(), Error>;
}
Expand description
Simple Secret Store API
Required Methods§
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 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 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 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 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 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 accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>
Returns all accounts in this secret store.
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.
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