Struct vapcore_accounts::AccountProvider[][src]

pub struct AccountProvider { /* fields omitted */ }

Account management. Responsible for unlocking accounts.

Implementations

impl AccountProvider[src]

pub fn new(
    sstore: Box<dyn SecretStore>,
    settings: AccountProviderSettings
) -> Self
[src]

Creates new account provider.

pub fn transient_provider() -> Self[src]

Creates not disk backed provider.

pub fn new_account(&self, password: &Password) -> Result<Address, Error>[src]

Creates new random account.

pub fn new_account_and_public(
    &self,
    password: &Password
) -> Result<(Address, Public), Error>
[src]

Creates new random account and returns address and public key

pub fn insert_account(
    &self,
    secret: Secret,
    password: &Password
) -> Result<Address, Error>
[src]

Inserts new account into underlying store. Does not unlock account!

pub fn derive_account(
    &self,
    address: &Address,
    password: Option<Password>,
    derivation: Derivation,
    save: bool
) -> Result<Address, SignError>
[src]

Generates new derived account based on the existing one If password is not provided, account must be unlocked New account will be created with the same password (if save: true)

pub fn import_presale(
    &self,
    presale_json: &[u8],
    password: &Password
) -> Result<Address, Error>
[src]

Import a new presale wallet.

pub fn import_wallet(
    &self,
    json: &[u8],
    password: &Password,
    gen_id: bool
) -> Result<Address, Error>
[src]

Import a new wallet.

pub fn has_account(&self, address: Address) -> bool[src]

Checks whether an account with a given address is present.

pub fn accounts(&self) -> Result<Vec<Address>, Error>[src]

Returns addresses of all accounts.

pub fn default_account(&self) -> Result<Address, Error>[src]

Returns the address of default account.

pub fn addresses_info(&self) -> HashMap<Address, AccountMeta>[src]

Returns each address along with metadata.

pub fn set_address_name(&self, account: Address, name: String)[src]

Returns each address along with metadata.

pub fn set_address_meta(&self, account: Address, meta: String)[src]

Returns each address along with metadata.

pub fn remove_address(&self, addr: Address)[src]

Removes and address from the address book

pub fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error>[src]

Returns each account along with name and meta.

pub fn account_meta(&self, address: Address) -> Result<AccountMeta, Error>[src]

Returns each account along with name and meta.

pub fn account_public(
    &self,
    address: Address,
    password: &Password
) -> Result<Public, Error>
[src]

Returns account public key.

pub fn set_account_name(
    &self,
    address: Address,
    name: String
) -> Result<(), Error>
[src]

Returns each account along with name and meta.

pub fn set_account_meta(
    &self,
    address: Address,
    meta: String
) -> Result<(), Error>
[src]

Returns each account along with name and meta.

pub fn test_password(
    &self,
    address: &Address,
    password: &Password
) -> Result<bool, Error>
[src]

Returns true if the password for account is password. false if not.

pub fn kill_account(
    &self,
    address: &Address,
    password: &Password
) -> Result<(), Error>
[src]

Permanently removes an account.

pub fn change_password(
    &self,
    address: &Address,
    password: Password,
    new_password: Password
) -> Result<(), Error>
[src]

Changes the password of account from password to new_password. Fails if incorrect password given.

pub fn export_account(
    &self,
    address: &Address,
    password: Password
) -> Result<KeyFile, Error>
[src]

Exports an account for given address.

pub fn unlock_account_permanently(
    &self,
    account: Address,
    password: Password
) -> Result<(), Error>
[src]

Unlocks account permanently.

pub fn unlock_account_temporarily(
    &self,
    account: Address,
    password: Password
) -> Result<(), Error>
[src]

Unlocks account temporarily (for one signing).

pub fn unlock_account_timed(
    &self,
    account: Address,
    password: Password,
    duration: Duration
) -> Result<(), Error>
[src]

Unlocks account temporarily with a timeout.

pub fn is_unlocked(&self, address: &Address) -> bool[src]

Checks if given account is unlocked

pub fn is_unlocked_permanently(&self, address: &Address) -> bool[src]

Checks if given account is unlocked permanently

pub fn sign(
    &self,
    address: Address,
    password: Option<Password>,
    message: Message
) -> Result<Signature, SignError>
[src]

Signs the message. If password is not provided the account must be unlocked.

pub fn sign_derived(
    &self,
    address: &Address,
    password: Option<Password>,
    derivation: Derivation,
    message: Message
) -> Result<Signature, SignError>
[src]

Signs message using the derived secret. If password is not provided the account must be unlocked.

pub fn sign_with_token(
    &self,
    address: Address,
    token: Password,
    message: Message
) -> Result<(Signature, Password), SignError>
[src]

Signs given message with supplied token. Returns a token to use in next signing within this session.

pub fn decrypt_with_token(
    &self,
    address: Address,
    token: Password,
    shared_mac: &[u8],
    message: &[u8]
) -> Result<(Vec<u8>, Password), SignError>
[src]

Decrypts a message with given token. Returns a token to use in next operation for this account.

pub fn decrypt(
    &self,
    address: Address,
    password: Option<Password>,
    shared_mac: &[u8],
    message: &[u8]
) -> Result<Vec<u8>, SignError>
[src]

Decrypts a message. If password is not provided the account must be unlocked.

pub fn agree(
    &self,
    address: Address,
    password: Option<Password>,
    other_public: &Public
) -> Result<Secret, SignError>
[src]

Agree on shared key.

pub fn list_gvap_accounts(&self, testnet: bool) -> Vec<Address>[src]

Returns the underlying SecretStore reference if one exists.

pub fn import_gvap_accounts(
    &self,
    desired: Vec<Address>,
    testnet: bool
) -> Result<Vec<Address>, Error>
[src]

Returns the underlying SecretStore reference if one exists.

pub fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>[src]

Create new vault.

pub fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>[src]

Open existing vault.

pub fn close_vault(&self, name: &str) -> Result<(), Error>[src]

Close previously opened vault.

pub fn list_vaults(&self) -> Result<Vec<String>, Error>[src]

List all vaults

pub fn list_opened_vaults(&self) -> Result<Vec<String>, Error>[src]

List all currently opened vaults

pub fn change_vault_password(
    &self,
    name: &str,
    new_password: &Password
) -> Result<(), Error>
[src]

Change vault password.

pub fn change_vault(
    &self,
    address: Address,
    new_vault: &str
) -> Result<(), Error>
[src]

Change vault of the given address.

pub fn get_vault_meta(&self, name: &str) -> Result<String, Error>[src]

Get vault metadata string.

pub fn set_vault_meta(&self, name: &str, meta: &str) -> Result<(), Error>[src]

Set vault metadata string.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,