Generic keystore (#3008)

* Add KeyTypeId.

* Implement clone for sr25519::Pair.

* Extend Pair with to_raw_vec.

* Implement TypedKey for Signature and Pair.

* Add trait Public.

* Make keystore generic.

* Fixup clone.

* Fix tests.

* Update service.

* Fix imports.

* Fix build.

* Fix babe build.

* Fix subkey build.

* Make authority setup generic.

* Update node-template.

* Fix build.

* Remove unsafe code.

* Fix tests.
This commit is contained in:
David Craven
2019-07-04 13:14:55 +02:00
committed by GitHub
parent 336053f7ae
commit 51e345c901
15 changed files with 279 additions and 122 deletions
+1 -1
View File
@@ -18,7 +18,7 @@
use std::{collections::HashMap, ops::Deref};
use lazy_static::lazy_static;
use substrate_primitives::{ed25519::{Pair, Public, Signature}, Pair as PairT, H256};
use substrate_primitives::{ed25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
pub use substrate_primitives::ed25519;
/// Set of test accounts.
+2 -2
View File
@@ -19,7 +19,7 @@
use std::collections::HashMap;
use std::ops::Deref;
use lazy_static::lazy_static;
use substrate_primitives::{sr25519::{Pair, Public, Signature}, Pair as PairT, H256};
use substrate_primitives::{sr25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
pub use substrate_primitives::sr25519;
/// Set of test accounts.
@@ -68,7 +68,7 @@ impl Keyring {
}
pub fn to_raw_public_vec(self) -> Vec<u8> {
Public::from(self).into_raw_vec()
Public::from(self).to_raw_vec()
}
pub fn sign(self, msg: &[u8]) -> Signature {