Add type for passwords. (#8920)

* Add type for passwords.

* Fix test.

* Simplify `Drop` impls of `Password` and `Memzero`.

* Spaces to tabs.

* Custom `Drop` impl for `Password`.
This commit is contained in:
Toralf Wittner
2018-06-22 15:09:15 +02:00
committed by David
parent c473ab97c7
commit 41348dead4
61 changed files with 550 additions and 457 deletions

View File

@@ -31,7 +31,7 @@ use bytes::Bytes;
use parking_lot::{Mutex, RwLock};
use stats::Corpus;
use ethkey::Signature;
use ethkey::{Password, Signature};
use sync::LightSync;
use ethcore::ids::BlockId;
use ethcore::client::BlockChainClient;
@@ -560,15 +560,15 @@ impl Future for ProspectiveSigner {
}
/// Single-use account token.
pub type AccountToken = String;
pub type AccountToken = Password;
/// Values used to unlock accounts for signing.
#[derive(Debug, Clone, PartialEq)]
#[derive(Clone, PartialEq)]
pub enum SignWith {
/// Nothing -- implies the account is already unlocked.
Nothing,
/// Unlock with password.
Password(String),
Password(Password),
/// Unlock with single-use token.
Token(AccountToken),
}
@@ -584,8 +584,7 @@ impl SignWith {
}
/// A value, potentially accompanied by a signing token.
#[derive(Debug)]
pub enum WithToken<T: Debug> {
pub enum WithToken<T> {
/// No token.
No(T),
/// With token.

View File

@@ -27,6 +27,7 @@ use jsonrpc_core::Result;
use v1::helpers::errors;
use v1::traits::ParityAccounts;
use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, DappId, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo};
use ethkey::Password;
/// Account management (personal) rpc implementation.
pub struct ParityAccountsClient {
@@ -74,21 +75,21 @@ impl ParityAccounts for ParityAccountsClient {
Ok(accounts)
}
fn new_account_from_phrase(&self, phrase: String, pass: String) -> Result<RpcH160> {
fn new_account_from_phrase(&self, phrase: String, pass: Password) -> Result<RpcH160> {
let brain = Brain::new(phrase).generate().unwrap();
self.accounts.insert_account(brain.secret().clone(), &pass)
.map(Into::into)
.map_err(|e| errors::account("Could not create account.", e))
}
fn new_account_from_wallet(&self, json: String, pass: String) -> Result<RpcH160> {
fn new_account_from_wallet(&self, json: String, pass: Password) -> Result<RpcH160> {
self.accounts.import_presale(json.as_bytes(), &pass)
.or_else(|_| self.accounts.import_wallet(json.as_bytes(), &pass, true))
.map(Into::into)
.map_err(|e| errors::account("Could not create account.", e))
}
fn new_account_from_secret(&self, secret: RpcH256, pass: String) -> Result<RpcH160> {
fn new_account_from_secret(&self, secret: RpcH256, pass: Password) -> Result<RpcH160> {
let secret = Secret::from_unsafe_slice(&secret.0)
.map_err(|e| errors::account("Could not create account.", e))?;
self.accounts.insert_account(secret, &pass)
@@ -96,7 +97,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e))
}
fn test_password(&self, account: RpcH160, password: String) -> Result<bool> {
fn test_password(&self, account: RpcH160, password: Password) -> Result<bool> {
let account: Address = account.into();
self.accounts
@@ -104,7 +105,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e))
}
fn change_password(&self, account: RpcH160, password: String, new_password: String) -> Result<bool> {
fn change_password(&self, account: RpcH160, password: Password, new_password: Password) -> Result<bool> {
let account: Address = account.into();
self.accounts
.change_password(&account, password, new_password)
@@ -112,7 +113,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e))
}
fn kill_account(&self, account: RpcH160, password: String) -> Result<bool> {
fn kill_account(&self, account: RpcH160, password: Password) -> Result<bool> {
let account: Address = account.into();
self.accounts
.kill_account(&account, &password)
@@ -209,14 +210,14 @@ impl ParityAccounts for ParityAccountsClient {
Ok(into_vec(self.accounts.list_geth_accounts(false)))
}
fn create_vault(&self, name: String, password: String) -> Result<bool> {
fn create_vault(&self, name: String, password: Password) -> Result<bool> {
self.accounts
.create_vault(&name, &password)
.map_err(|e| errors::account("Could not create vault.", e))
.map(|_| true)
}
fn open_vault(&self, name: String, password: String) -> Result<bool> {
fn open_vault(&self, name: String, password: Password) -> Result<bool> {
self.accounts
.open_vault(&name, &password)
.map_err(|e| errors::account("Could not open vault.", e))
@@ -242,7 +243,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not list vaults.", e))
}
fn change_vault_password(&self, name: String, new_password: String) -> Result<bool> {
fn change_vault_password(&self, name: String, new_password: Password) -> Result<bool> {
self.accounts
.change_vault_password(&name, &new_password)
.map_err(|e| errors::account("Could not change vault password.", e))
@@ -269,7 +270,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true)
}
fn derive_key_index(&self, addr: RpcH160, password: String, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160> {
fn derive_key_index(&self, addr: RpcH160, password: Password, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into();
self.accounts
.derive_account(
@@ -282,7 +283,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e))
}
fn derive_key_hash(&self, addr: RpcH160, password: String, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160> {
fn derive_key_hash(&self, addr: RpcH160, password: Password, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into();
self.accounts
.derive_account(
@@ -295,7 +296,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e))
}
fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile> {
fn export_account(&self, addr: RpcH160, password: Password) -> Result<KeyFile> {
let addr = addr.into();
self.accounts
.export_account(
@@ -306,7 +307,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not export account.", e))
}
fn sign_message(&self, addr: RpcH160, password: String, message: RpcH256) -> Result<RpcH520> {
fn sign_message(&self, addr: RpcH160, password: Password, message: RpcH256) -> Result<RpcH520> {
self.accounts
.sign(
addr.into(),

View File

@@ -119,7 +119,7 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
}
fn set_engine_signer(&self, address: H160, password: String) -> Result<bool> {
self.miner.set_author(address.into(), Some(password)).map_err(Into::into).map_err(errors::password)?;
self.miner.set_author(address.into(), Some(password.into())).map_err(Into::into).map_err(errors::password)?;
Ok(true)
}

View File

@@ -77,7 +77,7 @@ impl<D: Dispatcher + 'static> PersonalClient<D> {
Box::new(dispatcher.fill_optional_fields(request.into(), default, false)
.and_then(move |filled| {
let condition = filled.condition.clone().map(Into::into);
dispatcher.sign(accounts, filled, SignWith::Password(password))
dispatcher.sign(accounts, filled, SignWith::Password(password.into()))
.map(|tx| tx.into_value())
.map(move |tx| PendingTransaction::new(tx, condition))
.map(move |tx| (tx, dispatcher))
@@ -95,7 +95,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
}
fn new_account(&self, pass: String) -> Result<RpcH160> {
self.accounts.new_account(&pass)
self.accounts.new_account(&pass.into())
.map(Into::into)
.map_err(|e| errors::account("Could not create account.", e))
}
@@ -117,14 +117,14 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
};
let r = match (self.allow_perm_unlock, duration) {
(false, None) => store.unlock_account_temporarily(account, account_pass),
(false, None) => store.unlock_account_temporarily(account, account_pass.into()),
(false, _) => return Err(errors::unsupported(
"Time-unlocking is only supported in --geth compatibility mode.",
Some("Restart your client with --geth flag or use personal_sendTransaction instead."),
)),
(true, Some(0)) => store.unlock_account_permanently(account, account_pass),
(true, Some(d)) => store.unlock_account_timed(account, account_pass, Duration::from_secs(d.into())),
(true, None) => store.unlock_account_timed(account, account_pass, Duration::from_secs(300)),
(true, Some(0)) => store.unlock_account_permanently(account, account_pass.into()),
(true, Some(d)) => store.unlock_account_timed(account, account_pass.into(), Duration::from_secs(d.into())),
(true, None) => store.unlock_account_timed(account, account_pass.into(), Duration::from_secs(300)),
};
match r {
Ok(_) => Ok(true),
@@ -140,7 +140,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
Box::new(dispatch::from_rpc(payload, account.into(), &dispatcher)
.and_then(|payload| {
dispatch::execute(dispatcher, accounts, payload, dispatch::SignWith::Password(password))
dispatch::execute(dispatcher, accounts, payload, dispatch::SignWith::Password(password.into()))
})
.map(|v| v.into_value())
.then(|res| match res {

View File

@@ -29,6 +29,7 @@ use v1::helpers::secretstore::{generate_document_key, encrypt_document,
decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak};
use v1::traits::SecretStore;
use v1::types::{H160, H256, H512, Bytes, EncryptedDocumentKey};
use ethkey::Password;
/// Parity implementation.
pub struct SecretStoreClient {
@@ -44,36 +45,36 @@ impl SecretStoreClient {
}
/// Decrypt public key using account' private key
fn decrypt_key(&self, address: H160, password: String, key: Bytes) -> Result<Vec<u8>> {
fn decrypt_key(&self, address: H160, password: Password, key: Bytes) -> Result<Vec<u8>> {
self.accounts.decrypt(address.into(), Some(password), &DEFAULT_MAC, &key.0)
.map_err(|e| errors::account("Could not decrypt key.", e))
}
/// Decrypt secret key using account' private key
fn decrypt_secret(&self, address: H160, password: String, key: Bytes) -> Result<Secret> {
fn decrypt_secret(&self, address: H160, password: Password, key: Bytes) -> Result<Secret> {
self.decrypt_key(address, password, key)
.and_then(|s| Secret::from_unsafe_slice(&s).map_err(|e| errors::account("invalid secret", e)))
}
}
impl SecretStore for SecretStoreClient {
fn generate_document_key(&self, address: H160, password: String, server_key_public: H512) -> Result<EncryptedDocumentKey> {
fn generate_document_key(&self, address: H160, password: Password, server_key_public: H512) -> Result<EncryptedDocumentKey> {
let account_public = self.accounts.account_public(address.into(), &password)
.map_err(|e| errors::account("Could not read account public.", e))?;
generate_document_key(account_public, server_key_public.into())
}
fn encrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
fn encrypt(&self, address: H160, password: Password, key: Bytes, data: Bytes) -> Result<Bytes> {
encrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into)
}
fn decrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
fn decrypt(&self, address: H160, password: Password, key: Bytes, data: Bytes) -> Result<Bytes> {
decrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into)
}
fn shadow_decrypt(&self, address: H160, password: String, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes> {
fn shadow_decrypt(&self, address: H160, password: Password, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes> {
let mut shadows = Vec::with_capacity(decrypt_shadows.len());
for decrypt_shadow in decrypt_shadows {
shadows.push(self.decrypt_secret(address.clone(), password.clone(), decrypt_shadow)?);
@@ -87,7 +88,7 @@ impl SecretStore for SecretStoreClient {
Ok(ordered_servers_keccak(servers_set))
}
fn sign_raw_hash(&self, address: H160, password: String, raw_hash: H256) -> Result<Bytes> {
fn sign_raw_hash(&self, address: H160, password: Password, raw_hash: H256) -> Result<Bytes> {
self.accounts
.sign(address.into(), Some(password), raw_hash.into())
.map(|s| Bytes::new((*s).to_vec()))

View File

@@ -169,7 +169,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
-> BoxFuture<ConfirmationResponse>
{
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass))
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass.into()))
}).map(|v| v.into_value()))
}
@@ -177,7 +177,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
-> BoxFuture<ConfirmationResponseWithToken>
{
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token))
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token.into()))
}).and_then(|v| match v {
WithToken::No(_) => Err(errors::internal("Unexpected response without token.", "")),
WithToken::Yes(response, token) => Ok(ConfirmationResponseWithToken {

View File

@@ -317,7 +317,7 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{
fn eth_transaction_count() {
let secret = "8a283037bb19c4fed7b1c569e40c7dcff366165eb869110a1b11532963eb9cb2".parse().unwrap();
let tester = EthTester::from_spec(Spec::load(&env::temp_dir(), TRANSACTION_COUNT_SPEC).expect("invalid chain spec"));
let address = tester.accounts.insert_account(secret, "").unwrap();
let address = tester.accounts.insert_account(secret, &"".into()).unwrap();
tester.accounts.unlock_account_permanently(address, "".into()).unwrap();
let req_before = r#"{

View File

@@ -35,6 +35,7 @@ use miner::pool::{verifier, VerifiedTransaction, QueueStatus};
use parking_lot::{RwLock, Mutex};
use transaction::{self, UnverifiedTransaction, SignedTransaction, PendingTransaction};
use txpool;
use ethkey::Password;
/// Test miner service.
pub struct TestMinerService {
@@ -49,7 +50,7 @@ pub struct TestMinerService {
/// Next nonces.
pub next_nonces: RwLock<HashMap<Address, U256>>,
/// Password held by Engine.
pub password: RwLock<String>,
pub password: RwLock<Password>,
authoring_params: RwLock<AuthoringParams>,
}
@@ -62,7 +63,7 @@ impl Default for TestMinerService {
local_transactions: Mutex::new(BTreeMap::new()),
pending_receipts: Mutex::new(BTreeMap::new()),
next_nonces: RwLock::new(HashMap::new()),
password: RwLock::new(String::new()),
password: RwLock::new("".into()),
authoring_params: RwLock::new(AuthoringParams {
author: Address::zero(),
gas_range_target: (12345.into(), 54321.into()),
@@ -119,7 +120,7 @@ impl MinerService for TestMinerService {
self.authoring_params.read().clone()
}
fn set_author(&self, author: Address, password: Option<String>) -> Result<(), AccountError> {
fn set_author(&self, author: Address, password: Option<Password>) -> Result<(), AccountError> {
self.authoring_params.write().author = author;
if let Some(password) = password {
*self.password.write() = password;

View File

@@ -328,7 +328,7 @@ fn rpc_eth_submit_hashrate() {
fn rpc_eth_sign() {
let tester = EthTester::default();
let account = tester.accounts_provider.insert_account(Secret::from([69u8; 32]), "abcd").unwrap();
let account = tester.accounts_provider.insert_account(Secret::from([69u8; 32]), &"abcd".into()).unwrap();
tester.accounts_provider.unlock_account_permanently(account, "abcd".into()).unwrap();
let _message = "0cc175b9c0f1b6a831c399e26977266192eb5ffee6ae2fec3ad71c777531578f".from_hex().unwrap();
@@ -362,11 +362,11 @@ fn rpc_eth_author() {
assert_eq!(tester.io.handle_request_sync(req), Some(make_res(Address::zero())));
// Account set - return first account
let addr = tester.accounts_provider.new_account("123").unwrap();
let addr = tester.accounts_provider.new_account(&"123".into()).unwrap();
assert_eq!(tester.io.handle_request_sync(req), Some(make_res(addr)));
for i in 0..20 {
let addr = tester.accounts_provider.new_account(&format!("{}", i)).unwrap();
let addr = tester.accounts_provider.new_account(&format!("{}", i).into()).unwrap();
tester.miner.set_author(addr.clone(), None).unwrap();
assert_eq!(tester.io.handle_request_sync(req), Some(make_res(addr)));
@@ -394,7 +394,7 @@ fn rpc_eth_gas_price() {
#[test]
fn rpc_eth_accounts() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("").unwrap();
let address = tester.accounts_provider.new_account(&"".into()).unwrap();
tester.accounts_provider.set_new_dapps_addresses(None).unwrap();
tester.accounts_provider.set_address_name(1.into(), "1".into());
tester.accounts_provider.set_address_name(10.into(), "10".into());
@@ -804,7 +804,7 @@ fn rpc_eth_estimate_gas_default_block() {
#[test]
fn rpc_eth_send_transaction() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("").unwrap();
let address = tester.accounts_provider.new_account(&"".into()).unwrap();
tester.accounts_provider.unlock_account_permanently(address, "".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -855,7 +855,7 @@ fn rpc_eth_send_transaction() {
#[test]
fn rpc_eth_sign_transaction() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("").unwrap();
let address = tester.accounts_provider.new_account(&"".into()).unwrap();
tester.accounts_provider.unlock_account_permanently(address, "".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -912,7 +912,7 @@ fn rpc_eth_sign_transaction() {
#[test]
fn rpc_eth_send_transaction_with_bad_to() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("").unwrap();
let address = tester.accounts_provider.new_account(&"".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
@@ -934,7 +934,7 @@ fn rpc_eth_send_transaction_with_bad_to() {
#[test]
fn rpc_eth_send_transaction_error() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("").unwrap();
let address = tester.accounts_provider.new_account(&"".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
@@ -972,7 +972,7 @@ fn rpc_eth_send_raw_transaction_error() {
#[test]
fn rpc_eth_send_raw_transaction() {
let tester = EthTester::default();
let address = tester.accounts_provider.new_account("abcd").unwrap();
let address = tester.accounts_provider.new_account(&"abcd".into()).unwrap();
tester.accounts_provider.unlock_account_permanently(address, "abcd".into()).unwrap();
let t = Transaction {

View File

@@ -122,7 +122,7 @@ fn rpc_parity_accounts_info() {
let deps = Dependencies::new();
let io = deps.default_client();
deps.accounts.new_account("").unwrap();
deps.accounts.new_account(&"".into()).unwrap();
let accounts = deps.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
@@ -155,7 +155,7 @@ fn rpc_parity_default_account() {
assert_eq!(io.handle_request_sync(request), Some(response));
// With account
deps.accounts.new_account("").unwrap();
deps.accounts.new_account(&"".into()).unwrap();
let accounts = deps.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];

View File

@@ -64,7 +64,7 @@ fn setup_with_vaults_support(temp_path: &str) -> ParityAccountsTester {
#[test]
fn should_be_able_to_get_account_info() {
let tester = setup();
tester.accounts.new_account("").unwrap();
tester.accounts.new_account(&"".into()).unwrap();
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
@@ -82,7 +82,7 @@ fn should_be_able_to_get_account_info() {
#[test]
fn should_be_able_to_set_name() {
let tester = setup();
tester.accounts.new_account("").unwrap();
tester.accounts.new_account(&"".into()).unwrap();
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
@@ -103,7 +103,7 @@ fn should_be_able_to_set_name() {
#[test]
fn should_be_able_to_set_meta() {
let tester = setup();
tester.accounts.new_account("").unwrap();
tester.accounts.new_account(&"".into()).unwrap();
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
@@ -224,7 +224,7 @@ fn rpc_parity_recent_dapps() {
#[test]
fn should_be_able_to_kill_account() {
let tester = setup();
tester.accounts.new_account("password").unwrap();
tester.accounts.new_account(&"password".into()).unwrap();
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
@@ -282,7 +282,7 @@ fn rpc_parity_new_vault() {
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
assert!(tester.accounts.close_vault("vault1").is_ok());
assert!(tester.accounts.open_vault("vault1", "password1").is_ok());
assert!(tester.accounts.open_vault("vault1", &"password1".into()).is_ok());
}
#[test]
@@ -290,7 +290,7 @@ fn rpc_parity_open_vault() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
assert!(tester.accounts.close_vault("vault1").is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_openVault", "params":["vault1", "password1"], "id": 1}"#;
@@ -304,7 +304,7 @@ fn rpc_parity_close_vault() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_closeVault", "params":["vault1"], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
@@ -317,7 +317,7 @@ fn rpc_parity_change_vault_password() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_changeVaultPassword", "params":["vault1", "password2"], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
@@ -330,8 +330,8 @@ fn rpc_parity_change_vault() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
let (address, _) = tester.accounts.new_account_and_public("root_password").unwrap();
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
let (address, _) = tester.accounts.new_account_and_public(&"root_password".into()).unwrap();
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
let request = format!(r#"{{"jsonrpc": "2.0", "method": "parity_changeVault", "params":["0x{:x}", "vault1"], "id": 1}}"#, address);
let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
@@ -344,9 +344,9 @@ fn rpc_parity_vault_adds_vault_field_to_acount_meta() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
let (address1, _) = tester.accounts.new_account_and_public("root_password1").unwrap();
let (address1, _) = tester.accounts.new_account_and_public(&"root_password1".into()).unwrap();
let uuid1 = tester.accounts.account_meta(address1.clone()).unwrap().uuid.unwrap();
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
assert!(tester.accounts.change_vault(address1, "vault1").is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_allAccountsInfo", "params":[], "id": 1}"#;
@@ -368,8 +368,8 @@ fn rpc_parity_list_vaults() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault2", "password2").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
assert!(tester.accounts.create_vault("vault2", &"password2".into()).is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_listVaults", "params":[], "id": 1}"#;
let response1 = r#"{"jsonrpc":"2.0","result":["vault1","vault2"],"id":1}"#;
@@ -385,9 +385,9 @@ fn rpc_parity_list_opened_vaults() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault2", "password2").is_ok());
assert!(tester.accounts.create_vault("vault3", "password3").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
assert!(tester.accounts.create_vault("vault2", &"password2".into()).is_ok());
assert!(tester.accounts.create_vault("vault3", &"password3".into()).is_ok());
assert!(tester.accounts.close_vault("vault2").is_ok());
let request = r#"{"jsonrpc": "2.0", "method": "parity_listOpenedVaults", "params":[], "id": 1}"#;
@@ -404,7 +404,7 @@ fn rpc_parity_get_set_vault_meta() {
let tempdir = TempDir::new("").unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", "password1").is_ok());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
// when no meta set
let request = r#"{"jsonrpc": "2.0", "method": "parity_getVaultMeta", "params":["vault1"], "id": 1}"#;
@@ -441,7 +441,7 @@ fn derive_key_hash() {
let hash = tester.accounts
.insert_account(
"0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a".parse().unwrap(),
"password1")
&"password1".into())
.expect("account should be inserted ok");
assert_eq!(hash, "c171033d5cbff7175f29dfd3a63dda3d6f8f385e".parse().unwrap());
@@ -461,7 +461,7 @@ fn derive_key_index() {
let hash = tester.accounts
.insert_account(
"0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a".parse().unwrap(),
"password1")
&"password1".into())
.expect("account should be inserted ok");
assert_eq!(hash, "c171033d5cbff7175f29dfd3a63dda3d6f8f385e".parse().unwrap());
@@ -478,7 +478,7 @@ fn should_export_account() {
// given
let tester = setup();
let wallet = r#"{"id":"6a186c80-7797-cff2-bc2e-7c1d6a6cc76e","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"a1c6ff99070f8032ca1c4e8add006373"},"ciphertext":"df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815"},"mac":"3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d"},"address":"0042e5d2a662eeaca8a7e828c174f98f35d8925b","name":"parity-export-test","meta":"{\"passwordHint\":\"parity-export-test\",\"timestamp\":1490017814987}"}"#;
tester.accounts.import_wallet(wallet.as_bytes(), "parity-export-test", false).unwrap();
tester.accounts.import_wallet(wallet.as_bytes(), &"parity-export-test".into(), false).unwrap();
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
@@ -525,7 +525,7 @@ fn should_sign_message() {
let hash = tester.accounts
.insert_account(
"0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a".parse().unwrap(),
"password1")
&"password1".into())
.expect("account should be inserted ok");
assert_eq!(hash, "c171033d5cbff7175f29dfd3a63dda3d6f8f385e".parse().unwrap());

View File

@@ -178,7 +178,7 @@ fn rpc_parity_set_engine_signer() {
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
assert_eq!(miner.authoring_params().author, Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap());
assert_eq!(*miner.password.read(), "password".to_string());
assert_eq!(*miner.password.read(), "password".into());
}
#[test]

View File

@@ -74,7 +74,7 @@ fn setup() -> PersonalTester {
#[test]
fn accounts() {
let tester = setup();
let address = tester.accounts.new_account("").unwrap();
let address = tester.accounts.new_account(&"".into()).unwrap();
let request = r#"{"jsonrpc": "2.0", "method": "personal_listAccounts", "params": [], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":[""#.to_owned() + &format!("0x{:x}", address) + r#""],"id":1}"#;
@@ -99,7 +99,7 @@ fn new_account() {
fn invalid_password_test(method: &str)
{
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -122,7 +122,7 @@ fn invalid_password_test(method: &str)
#[test]
fn sign() {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let data = vec![5u8];
let request = r#"{
@@ -148,7 +148,7 @@ fn sign() {
#[test]
fn sign_with_invalid_password() {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -188,7 +188,7 @@ fn sign_and_send_transaction() {
fn sign_and_send_test(method: &str) {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -241,7 +241,7 @@ fn sign_and_send_test(method: &str) {
#[test]
fn ec_recover() {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let data = vec![5u8];
let hash = eth_data_hash(data.clone());
@@ -287,7 +287,7 @@ fn ec_recover_invalid_signature() {
#[test]
fn should_unlock_not_account_temporarily_if_allow_perm_is_disabled() {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",
@@ -308,7 +308,7 @@ fn should_unlock_not_account_temporarily_if_allow_perm_is_disabled() {
#[test]
fn should_unlock_account_permanently() {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let address = tester.accounts.new_account(&"password123".into()).unwrap();
let request = r#"{
"jsonrpc": "2.0",

View File

@@ -57,7 +57,7 @@ fn rpc_secretstore_encrypt_and_decrypt() {
// insert new account
let secret = "c1f1cfe279a5c350d13795bce162941967340c8a228e6ba175489afc564a5bef".parse().unwrap();
deps.accounts.insert_account(secret, "password").unwrap();
deps.accounts.insert_account(secret, &"password".into()).unwrap();
// execute encryption request
let encryption_request = r#"{"jsonrpc": "2.0", "method": "secretstore_encrypt", "params":[
@@ -87,7 +87,7 @@ fn rpc_secretstore_shadow_decrypt() {
// insert new account
let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap();
deps.accounts.insert_account(secret, "password").unwrap();
deps.accounts.insert_account(secret, &"password".into()).unwrap();
// execute decryption request
let decryption_request = r#"{"jsonrpc": "2.0", "method": "secretstore_shadowDecrypt", "params":[
@@ -131,7 +131,7 @@ fn rpc_secretstore_sign_raw_hash() {
// insert new account
let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap();
let key_pair = KeyPair::from_secret(secret).unwrap();
deps.accounts.insert_account(key_pair.secret().clone(), "password").unwrap();
deps.accounts.insert_account(key_pair.secret().clone(), &"password".into()).unwrap();
// execute signing request
let signing_request = r#"{"jsonrpc": "2.0", "method": "secretstore_signRawHash", "params":[
@@ -154,7 +154,7 @@ fn rpc_secretstore_generate_document_key() {
// insert new account
let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap();
let key_pair = KeyPair::from_secret(secret).unwrap();
deps.accounts.insert_account(key_pair.secret().clone(), "password").unwrap();
deps.accounts.insert_account(key_pair.secret().clone(), &"password".into()).unwrap();
// execute generation request
let generation_request = r#"{"jsonrpc": "2.0", "method": "secretstore_generateDocumentKey", "params":[

View File

@@ -178,7 +178,7 @@ fn should_not_remove_sign_if_password_is_invalid() {
fn should_confirm_transaction_and_dispatch() {
//// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let recipient = Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::SendTransaction(FilledTransactionRequest {
from: address,
@@ -247,7 +247,7 @@ fn should_alter_the_sender_and_nonce() {
data: vec![]
};
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let signature = tester.accounts.sign(address, Some("test".into()), t.hash(None)).unwrap();
let t = t.with_signature(signature, None);
@@ -274,7 +274,7 @@ fn should_alter_the_sender_and_nonce() {
fn should_confirm_transaction_with_token() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let recipient = Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::SendTransaction(FilledTransactionRequest {
from: address,
@@ -305,7 +305,7 @@ fn should_confirm_transaction_with_token() {
let request = r#"{
"jsonrpc":"2.0",
"method":"signer_confirmRequestWithToken",
"params":["0x1", {"gasPrice":"0x1000"}, ""#.to_owned() + &token + r#""],
"params":["0x1", {"gasPrice":"0x1000"}, ""#.to_owned() + token.as_str() + r#""],
"id":1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"result":""#.to_owned() +
@@ -323,7 +323,7 @@ fn should_confirm_transaction_with_token() {
fn should_confirm_transaction_with_rlp() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let recipient = Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::SendTransaction(FilledTransactionRequest {
from: address,
@@ -370,7 +370,7 @@ fn should_confirm_transaction_with_rlp() {
fn should_return_error_when_sender_does_not_match() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let recipient = Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::SendTransaction(FilledTransactionRequest {
from: Address::default(),
@@ -417,7 +417,7 @@ fn should_return_error_when_sender_does_not_match() {
fn should_confirm_sign_transaction_with_rlp() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let recipient = Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::SignTransaction(FilledTransactionRequest {
from: address,
@@ -482,7 +482,7 @@ fn should_confirm_sign_transaction_with_rlp() {
fn should_confirm_data_sign_with_signature() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::EthSignMessage(
address,
vec![1, 2, 3, 4].into(),
@@ -512,7 +512,7 @@ fn should_confirm_data_sign_with_signature() {
fn should_confirm_decrypt_with_phrase() {
// given
let tester = signer_tester();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
let _confirmation_future = tester.signer.add_request(ConfirmationPayload::Decrypt(
address,
vec![1, 2, 3, 4].into(),

View File

@@ -212,7 +212,7 @@ fn should_sign_if_account_is_unlocked() {
// given
let tester = eth_signing();
let data = vec![5u8];
let acc = tester.accounts.insert_account(Secret::from([69u8; 32]), "test").unwrap();
let acc = tester.accounts.insert_account(Secret::from([69u8; 32]), &"test".into()).unwrap();
tester.accounts.unlock_account_permanently(acc, "test".into()).unwrap();
// when
@@ -275,7 +275,7 @@ fn should_add_transaction_to_queue() {
fn should_add_sign_transaction_to_the_queue() {
// given
let tester = eth_signing();
let address = tester.accounts.new_account("test").unwrap();
let address = tester.accounts.new_account(&"test".into()).unwrap();
assert_eq!(tester.signer.requests().len(), 0);
@@ -354,7 +354,7 @@ fn should_add_sign_transaction_to_the_queue() {
fn should_dispatch_transaction_if_account_is_unlock() {
// given
let tester = eth_signing();
let acc = tester.accounts.new_account("test").unwrap();
let acc = tester.accounts.new_account(&"test".into()).unwrap();
tester.accounts.unlock_account_permanently(acc, "test".into()).unwrap();
let t = Transaction {
@@ -393,7 +393,7 @@ fn should_decrypt_message_if_account_is_unlocked() {
let mut tester = eth_signing();
let parity = parity::Dependencies::new();
tester.io.extend_with(parity.client(None).to_delegate());
let (address, public) = tester.accounts.new_account_and_public("test").unwrap();
let (address, public) = tester.accounts.new_account_and_public(&"test".into()).unwrap();
tester.accounts.unlock_account_permanently(address, "test".into()).unwrap();
// First encrypt message

View File

@@ -18,6 +18,7 @@
use std::collections::BTreeMap;
use jsonrpc_core::Result;
use ethkey::Password;
use ethstore::KeyFile;
use v1::types::{H160, H256, H520, DappId, DeriveHash, DeriveHierarchical, ExtAccountInfo};
@@ -31,32 +32,32 @@ build_rpc_trait! {
/// Creates new account from the given phrase using standard brainwallet mechanism.
/// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromPhrase")]
fn new_account_from_phrase(&self, String, String) -> Result<H160>;
fn new_account_from_phrase(&self, String, Password) -> Result<H160>;
/// Creates new account from the given JSON wallet.
/// Second parameter is password for the wallet and the new account.
#[rpc(name = "parity_newAccountFromWallet")]
fn new_account_from_wallet(&self, String, String) -> Result<H160>;
fn new_account_from_wallet(&self, String, Password) -> Result<H160>;
/// Creates new account from the given raw secret.
/// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromSecret")]
fn new_account_from_secret(&self, H256, String) -> Result<H160>;
fn new_account_from_secret(&self, H256, Password) -> Result<H160>;
/// Returns true if given `password` would unlock given `account`.
/// Arguments: `account`, `password`.
#[rpc(name = "parity_testPassword")]
fn test_password(&self, H160, String) -> Result<bool>;
fn test_password(&self, H160, Password) -> Result<bool>;
/// Changes an account's password.
/// Arguments: `account`, `password`, `new_password`.
#[rpc(name = "parity_changePassword")]
fn change_password(&self, H160, String, String) -> Result<bool>;
fn change_password(&self, H160, Password, Password) -> Result<bool>;
/// Permanently deletes an account.
/// Arguments: `account`, `password`.
#[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, String) -> Result<bool>;
fn kill_account(&self, H160, Password) -> Result<bool>;
/// Permanently deletes an address from the addressbook
/// Arguments: `address`
@@ -132,11 +133,11 @@ build_rpc_trait! {
/// Create new vault.
#[rpc(name = "parity_newVault")]
fn create_vault(&self, String, String) -> Result<bool>;
fn create_vault(&self, String, Password) -> Result<bool>;
/// Open existing vault.
#[rpc(name = "parity_openVault")]
fn open_vault(&self, String, String) -> Result<bool>;
fn open_vault(&self, String, Password) -> Result<bool>;
/// Close previously opened vault.
#[rpc(name = "parity_closeVault")]
@@ -152,7 +153,7 @@ build_rpc_trait! {
/// Change vault password.
#[rpc(name = "parity_changeVaultPassword")]
fn change_vault_password(&self, String, String) -> Result<bool>;
fn change_vault_password(&self, String, Password) -> Result<bool>;
/// Change vault of the given address.
#[rpc(name = "parity_changeVault")]
@@ -169,21 +170,21 @@ build_rpc_trait! {
/// Derive new address from given account address using specific hash.
/// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressHash")]
fn derive_key_hash(&self, H160, String, DeriveHash, bool) -> Result<H160>;
fn derive_key_hash(&self, H160, Password, DeriveHash, bool) -> Result<H160>;
/// Derive new address from given account address using
/// hierarchical derivation (sequence of 32-bit integer indices).
/// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressIndex")]
fn derive_key_index(&self, H160, String, DeriveHierarchical, bool) -> Result<H160>;
fn derive_key_index(&self, H160, Password, DeriveHierarchical, bool) -> Result<H160>;
/// Exports an account with given address if provided password matches.
#[rpc(name = "parity_exportAccount")]
fn export_account(&self, H160, String) -> Result<KeyFile>;
fn export_account(&self, H160, Password) -> Result<KeyFile>;
/// Sign raw hash with the key corresponding to address and password.
#[rpc(name = "parity_signMessage")]
fn sign_message(&self, H160, String, H256) -> Result<H520>;
fn sign_message(&self, H160, Password, H256) -> Result<H520>;
/// Send a PinMatrixAck to a hardware wallet, unlocking it
#[rpc(name = "parity_hardwarePinMatrixAck")]

View File

@@ -18,6 +18,7 @@
use std::collections::BTreeSet;
use jsonrpc_core::Result;
use ethkey::Password;
use v1::types::{H160, H256, H512, Bytes, EncryptedDocumentKey};
@@ -27,22 +28,22 @@ build_rpc_trait! {
/// Generate document key to store in secret store.
/// Arguments: `account`, `password`, `server_key_public`.
#[rpc(name = "secretstore_generateDocumentKey")]
fn generate_document_key(&self, H160, String, H512) -> Result<EncryptedDocumentKey>;
fn generate_document_key(&self, H160, Password, H512) -> Result<EncryptedDocumentKey>;
/// Encrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_encrypt")]
fn encrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
fn encrypt(&self, H160, Password, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_decrypt")]
fn decrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
fn decrypt(&self, H160, Password, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with shadow key, received from secret store.
/// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`.
#[rpc(name = "secretstore_shadowDecrypt")]
fn shadow_decrypt(&self, H160, String, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes>;
fn shadow_decrypt(&self, H160, Password, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes>;
/// Calculates the hash (keccak256) of servers set for using in ServersSetChange session.
/// Returned hash must be signed later by using `secretstore_signRawHash` method.
@@ -54,6 +55,6 @@ build_rpc_trait! {
/// Passed hash is treated as an input to the `sign` function (no prefixes added, no hash function is applied).
/// Arguments: `account`, `password`, `raw_hash`.
#[rpc(name = "secretstore_signRawHash")]
fn sign_raw_hash(&self, H160, String, H256) -> Result<Bytes>;
fn sign_raw_hash(&self, H160, Password, H256) -> Result<Bytes>;
}
}

View File

@@ -23,6 +23,7 @@ use bytes::ToPretty;
use v1::types::{U256, TransactionRequest, RichRawTransaction, H160, H256, H520, Bytes, TransactionCondition, Origin};
use v1::helpers;
use ethkey::Password;
/// Confirmation waiting in a queue
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
@@ -149,12 +150,12 @@ impl Serialize for ConfirmationResponse {
}
/// Confirmation response with additional token for further requests
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Clone, PartialEq, Serialize)]
pub struct ConfirmationResponseWithToken {
/// Actual response
pub result: ConfirmationResponse,
/// New token
pub token: String,
pub token: Password,
}
/// Confirmation payload, i.e. the thing to be confirmed