Crypto fixes/improvements (#2008)

* Crypto fixes:

- Use schnorrkel's HDKD derive
- Assume all key URIs beginning with `/` are prefixed with public
  root phrase.

* Remove commented code.

* Update README

* Update core/primitives/src/ed25519.rs

Co-Authored-By: gavofyork <github@gavwood.com>
This commit is contained in:
Gav Wood
2019-03-15 13:53:09 +01:00
committed by GitHub
parent ae1351cb79
commit 03d52fdbeb
10 changed files with 70 additions and 38 deletions
+1 -6
View File
@@ -22,11 +22,6 @@ use lazy_static::lazy_static;
use substrate_primitives::{ed25519::{Pair, Public, Signature}, Pair as _Pair, H256};
pub use substrate_primitives::ed25519;
/// The root phrase for our test keys.
///
/// This is the same phrase that's in node::cli, but shouldn't need to be.
pub const DEV_PHRASE: &str = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
/// Set of test accounts.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum Keyring {
@@ -81,7 +76,7 @@ impl Keyring {
}
pub fn pair(self) -> Pair {
Pair::from_string(&format!("{}//{}", DEV_PHRASE, <&'static str>::from(self)), None)
Pair::from_string(&format!("//{}", <&'static str>::from(self)), None)
.expect("static values are known good; qed")
}
}
+1 -6
View File
@@ -22,11 +22,6 @@ use lazy_static::lazy_static;
use substrate_primitives::{sr25519::{Pair, Public, Signature}, Pair as _Pair, H256};
pub use substrate_primitives::sr25519;
/// The root phrase for our test keys.
///
/// This is the same phrase that's in node::cli, but shouldn't need to be.
pub const DEV_PHRASE: &str = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
/// Set of test accounts.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum Keyring {
@@ -81,7 +76,7 @@ impl Keyring {
}
pub fn pair(self) -> Pair {
Pair::from_string(&format!("{}//{}", DEV_PHRASE, <&'static str>::from(self)), None)
Pair::from_string(&format!("//{}", <&'static str>::from(self)), None)
.expect("static values are known good; qed")
}
}