Subkey supports 24-word phrases (#2827)

* Revamp crypto API and make seeds work better in subkey

* Final tweaks

* Update tests

* line spacing

* Avoid escapes in hex constants

* Fix build

* Another fix

* More fixes

* Minor nits
This commit is contained in:
Gavin Wood
2019-06-13 11:06:30 +02:00
committed by GitHub
parent 68f4d11df3
commit f4afdd2f0b
11 changed files with 204 additions and 211 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ impl Store {
/// Generate a new key, placing it into the store.
pub fn generate(&self, password: &str) -> Result<Pair> {
let (pair, phrase) = Pair::generate_with_phrase(Some(password));
let (pair, phrase, _) = Pair::generate_with_phrase(Some(password));
let mut file = File::create(self.key_file_path(&pair.public()))?;
::serde_json::to_writer(&file, &phrase)?;
file.flush()?;
@@ -95,7 +95,7 @@ impl Store {
let file = File::open(path)?;
let phrase: String = ::serde_json::from_reader(&file)?;
let pair = Pair::from_phrase(&phrase, Some(password))
let (pair, _) = Pair::from_phrase(&phrase, Some(password))
.ok().ok_or(Error::InvalidPhrase)?;
if &pair.public() != public {
return Err(Error::InvalidPassword);