mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user