Struct ethcore::account_provider::AccountProvider
[−]
[src]
pub struct AccountProvider { /* fields omitted */ }
Account management. Responsible for unlocking accounts.
Methods
impl AccountProvider
[src]
fn new(sstore: Box<SecretStore>) -> Self
Creates new account provider.
fn transient_provider() -> Self
Creates not disk backed provider.
fn new_account(&self, password: &str) -> Result<Address, Error>
Creates new random account.
fn new_account_and_public(&self,
password: &str)
-> Result<(Address, Public), Error>
password: &str)
-> Result<(Address, Public), Error>
Creates new random account and returns address and public key
fn insert_account(&self,
secret: Secret,
password: &str)
-> Result<Address, Error>
secret: Secret,
password: &str)
-> Result<Address, Error>
Inserts new account into underlying store. Does not unlock account!
fn import_presale(&self,
presale_json: &[u8],
password: &str)
-> Result<Address, Error>
presale_json: &[u8],
password: &str)
-> Result<Address, Error>
Import a new presale wallet.
fn import_wallet(&self, json: &[u8], password: &str) -> Result<Address, Error>
Import a new presale wallet.
fn has_account(&self, address: Address) -> Result<bool, Error>
Checks whether an account with a given address is present.
fn accounts(&self) -> Result<Vec<Address>, Error>
Returns addresses of all accounts.
fn set_new_dapps_whitelist(&self,
accounts: Option<Vec<Address>>)
-> Result<(), Error>
accounts: Option<Vec<Address>>)
-> Result<(), Error>
Sets a whitelist of accounts exposed for unknown dapps.
None
means that all accounts will be visible.
fn new_dapps_whitelist(&self) -> Result<Option<Vec<Address>>, Error>
Gets a whitelist of accounts exposed for unknown dapps.
None
means that all accounts will be visible.
fn recent_dapps(&self) -> Result<HashMap<DappId, u64>, Error>
Gets a list of dapps recently requesting accounts.
fn note_dapp_used(&self, dapp: DappId) -> Result<(), Error>
Marks dapp as recently used.
fn dapps_addresses(&self, dapp: DappId) -> Result<Vec<Address>, Error>
Gets addresses visile for dapp.
fn default_address(&self, dapp: DappId) -> Result<Address, Error>
Returns default account for particular dapp falling back to other allowed accounts if necessary.
fn set_dapps_addresses(&self,
dapp: DappId,
addresses: Vec<Address>)
-> Result<(), Error>
dapp: DappId,
addresses: Vec<Address>)
-> Result<(), Error>
Sets addresses visile for dapp.
fn addresses_info(&self) -> Result<HashMap<Address, AccountMeta>, Error>
Returns each address along with metadata.
fn set_address_name(&self, account: Address, name: String) -> Result<(), Error>
Returns each address along with metadata.
fn set_address_meta(&self, account: Address, meta: String) -> Result<(), Error>
Returns each address along with metadata.
fn remove_address(&self, addr: Address) -> Result<(), Error>
Removes and address from the addressbook
fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error>
Returns each account along with name and meta.
fn account_meta(&self, address: Address) -> Result<AccountMeta, Error>
Returns each account along with name and meta.
fn set_account_name(&self, address: Address, name: String) -> Result<(), Error>
Returns each account along with name and meta.
fn set_account_meta(&self, address: Address, meta: String) -> Result<(), Error>
Returns each account along with name and meta.
fn test_password(&self,
address: &Address,
password: &str)
-> Result<bool, Error>
address: &Address,
password: &str)
-> Result<bool, Error>
Returns true
if the password for account
is password
. false
if not.
fn kill_account(&self, address: &Address, password: &str) -> Result<(), Error>
Permanently removes an account.
fn change_password(&self,
account: &Address,
password: String,
new_password: String)
-> Result<(), Error>
account: &Address,
password: String,
new_password: String)
-> Result<(), Error>
Changes the password of account
from password
to new_password
. Fails if incorrect password
given.
fn unlock_account_permanently(&self,
account: Address,
password: String)
-> Result<(), Error>
account: Address,
password: String)
-> Result<(), Error>
Unlocks account permanently.
fn unlock_account_temporarily(&self,
account: Address,
password: String)
-> Result<(), Error>
account: Address,
password: String)
-> Result<(), Error>
Unlocks account temporarily (for one signing).
fn unlock_account_timed(&self,
account: Address,
password: String,
duration_ms: u32)
-> Result<(), Error>
account: Address,
password: String,
duration_ms: u32)
-> Result<(), Error>
Unlocks account temporarily with a timeout.
fn is_unlocked(&self, address: Address) -> bool
Checks if given account is unlocked
fn sign(&self,
address: Address,
password: Option<String>,
message: Message)
-> Result<Signature, SignError>
address: Address,
password: Option<String>,
message: Message)
-> Result<Signature, SignError>
Signs the message. If password is not provided the account must be unlocked.
fn sign_with_token(&self,
address: Address,
token: String,
message: Message)
-> Result<(Signature, String), SignError>
address: Address,
token: String,
message: Message)
-> Result<(Signature, String), SignError>
Signs given message with supplied token. Returns a token to use in next signing within this session.
fn decrypt_with_token(&self,
address: Address,
token: String,
shared_mac: &[u8],
message: &[u8])
-> Result<(Vec<u8>, String), SignError>
address: Address,
token: String,
shared_mac: &[u8],
message: &[u8])
-> Result<(Vec<u8>, String), SignError>
Decrypts a message with given token. Returns a token to use in next operation for this account.
fn decrypt(&self,
address: Address,
password: Option<String>,
shared_mac: &[u8],
message: &[u8])
-> Result<Vec<u8>, SignError>
address: Address,
password: Option<String>,
shared_mac: &[u8],
message: &[u8])
-> Result<Vec<u8>, SignError>
Decrypts a message. If password is not provided the account must be unlocked.
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address>
Returns the underlying SecretStore
reference if one exists.
fn import_geth_accounts(&self,
desired: Vec<Address>,
testnet: bool)
-> Result<Vec<Address>, Error>
desired: Vec<Address>,
testnet: bool)
-> Result<Vec<Address>, Error>
Returns the underlying SecretStore
reference if one exists.