mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Application Crypto and BEEFY Support for paired (ECDSA,BLS) crypto (#1815)
Next step in process of making BEEFY being able to generate both ECDSA and BLS signature after #1705. It allows BEEFY to use a pair of ECDSA and BLS key as a AuthorityId. --------- Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
This commit is contained in:
@@ -106,7 +106,7 @@ use sp_core::{
|
||||
};
|
||||
|
||||
#[cfg(feature = "bls-experimental")]
|
||||
use sp_core::bls377;
|
||||
use sp_core::{bls377, ecdsa_bls377};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use sp_trie::{LayoutV0, LayoutV1, TrieConfiguration};
|
||||
@@ -1207,6 +1207,25 @@ pub trait Crypto {
|
||||
.expect("`bls377_generate` failed")
|
||||
}
|
||||
|
||||
/// Generate an `(ecdsa,bls12-377)` key for the given key type using an optional `seed` and
|
||||
/// store it in the keystore.
|
||||
///
|
||||
/// The `seed` needs to be a valid utf8.
|
||||
///
|
||||
/// Returns the public key.
|
||||
#[cfg(feature = "bls-experimental")]
|
||||
fn ecdsa_bls377_generate(
|
||||
&mut self,
|
||||
id: KeyTypeId,
|
||||
seed: Option<Vec<u8>>,
|
||||
) -> ecdsa_bls377::Public {
|
||||
let seed = seed.as_ref().map(|s| std::str::from_utf8(s).expect("Seed is valid utf8!"));
|
||||
self.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!")
|
||||
.ecdsa_bls377_generate_new(id, seed)
|
||||
.expect("`ecdsa_bls377_generate` failed")
|
||||
}
|
||||
|
||||
/// Generate a `bandersnatch` key pair for the given key type using an optional
|
||||
/// `seed` and store it in the keystore.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user