Validate dapps accounts with address book (#4407)

* Parametrize address book

* Improving types in account_provider

* Filtering dapps_accounts

* Fixing RPC tests
This commit is contained in:
Tomasz Drwięga
2017-02-03 13:56:48 +01:00
committed by Gav Wood
parent acf41d6f27
commit 853aae2b92
9 changed files with 89 additions and 65 deletions

View File

@@ -16,6 +16,7 @@
use std::collections::{BTreeMap, HashMap};
use std::mem;
use std::path::PathBuf;
use parking_lot::{Mutex, RwLock};
use crypto::KEY_ITERATIONS;
@@ -164,8 +165,8 @@ impl SecretStore for EthStore {
self.store.update(account_ref, old, safe_account)
}
fn local_path(&self) -> String {
self.store.dir.path().map(|p| p.to_string_lossy().into_owned()).unwrap_or_else(|| String::new())
fn local_path(&self) -> PathBuf {
self.store.dir.path().cloned().unwrap_or_else(PathBuf::new)
}
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address> {

View File

@@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::hash::{Hash, Hasher};
use std::path::PathBuf;
use ethkey::{Address, Message, Signature, Secret, Public};
use Error;
use json::Uuid;
@@ -73,7 +74,7 @@ pub trait SecretStore: SimpleSecretStore {
fn set_name(&self, account: &StoreAccountRef, name: String) -> Result<(), Error>;
fn set_meta(&self, account: &StoreAccountRef, meta: String) -> Result<(), Error>;
fn local_path(&self) -> String;
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>;
}