SecretStore: secretstore_signRawHash RPC
This commit is contained in:
@@ -28,7 +28,7 @@ use v1::helpers::errors;
|
||||
use v1::helpers::accounts::unwrap_provider;
|
||||
use v1::helpers::secretstore::{encrypt_document, decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak};
|
||||
use v1::traits::SecretStore;
|
||||
use v1::types::{H160, H512, Bytes};
|
||||
use v1::types::{H160, H256, H512, Bytes};
|
||||
|
||||
/// Parity implementation.
|
||||
pub struct SecretStoreClient {
|
||||
@@ -84,12 +84,15 @@ impl SecretStore for SecretStoreClient {
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
fn sign_servers_set(&self, address: H160, password: String, servers_set: BTreeSet<H512>) -> Result<Bytes> {
|
||||
let servers_set_keccak_value = ordered_servers_keccak(servers_set);
|
||||
fn servers_set_hash(&self, servers_set: BTreeSet<H512>) -> Result<H256> {
|
||||
Ok(ordered_servers_keccak(servers_set))
|
||||
}
|
||||
|
||||
fn sign_raw_hash(&self, address: H160, password: String, raw_hash: H256) -> Result<Bytes> {
|
||||
let store = self.account_provider()?;
|
||||
store
|
||||
.sign(address.into(), Some(password), servers_set_keccak_value.into())
|
||||
.sign(address.into(), Some(password), raw_hash.into())
|
||||
.map(|s| Bytes::new((*s).to_vec()))
|
||||
.map_err(|e| errors::account("Could not sign servers set.", e))
|
||||
.map_err(|e| errors::account("Could not sign raw hash.", e))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user