mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
Overhaul crypto (Schnorr/Ristretto, HDKD, BIP39) (#1795)
* Rijig to Ristretto * Rebuild wasm * adds compatibility test with the wasm module * Add Ed25519-BIP39 support * Bump subkey version * Update CLI output * New keys. * Standard phrase/password/path keys. * Subkey uses S-URI for secrets * Move everything to use new HDKD crypto. * Test fixes * Ignore old test vector. * fix the ^^ old test vector. * Fix tests * Test fixes * Cleanups * Fix broken key conversion logic in grandpa CC @rphmeier * Remove legacy Keyring usage * Traitify `Pair` * Replace Ed25519AuthorityId with ed25519::Public * Expunge Ed25519AuthorityId type! * Replace Sr25519AuthorityId with sr25519::Public * Remove dodgy crypto type-punning conversions * Fix some tests * Avoid trait * Deduplicate DeriveJunction string decode * Remove cruft code * Fix test * Minor removals * Build fix * Subkey supports sign and verify * Inspect works for public key URIs * Remove more crypto type-punning * Fix typo * Fix tests
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
pub use parity_codec as codec;
|
||||
// re-export hashing functions.
|
||||
pub use primitives::{
|
||||
blake2_256, twox_128, twox_256, ed25519, Blake2Hasher, sr25519
|
||||
blake2_256, twox_128, twox_256, ed25519, Blake2Hasher, sr25519,
|
||||
Pair
|
||||
};
|
||||
pub use tiny_keccak::keccak256 as keccak_256;
|
||||
// Switch to this after PoC-3
|
||||
@@ -163,6 +164,7 @@ pub fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option<H2
|
||||
}
|
||||
|
||||
/// A trie root formed from the enumerated items.
|
||||
// TODO: remove (just use `ordered_trie_root`)
|
||||
pub fn enumerated_trie_root<H>(input: &[&[u8]]) -> H::Out
|
||||
where
|
||||
H: Hasher,
|
||||
@@ -196,12 +198,12 @@ where
|
||||
|
||||
/// Verify a ed25519 signature.
|
||||
pub fn ed25519_verify<P: AsRef<[u8]>>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool {
|
||||
ed25519::verify(sig, msg, pubkey)
|
||||
ed25519::Pair::verify_weak(sig, msg, pubkey)
|
||||
}
|
||||
|
||||
/// Verify an sr25519 signature.
|
||||
pub fn sr25519_verify<P: AsRef<[u8]>>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool {
|
||||
sr25519::verify(sig, msg, pubkey)
|
||||
sr25519::Pair::verify_weak(sig, msg, pubkey)
|
||||
}
|
||||
|
||||
/// Verify and recover a SECP256k1 ECDSA signature.
|
||||
|
||||
Reference in New Issue
Block a user