mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +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:
@@ -37,7 +37,7 @@ use sp_core::bandersnatch;
|
||||
}
|
||||
|
||||
sp_keystore::bls_experimental_enabled! {
|
||||
use sp_core::{bls377, bls381};
|
||||
use sp_core::{bls377, bls381, ecdsa_bls377};
|
||||
}
|
||||
|
||||
use crate::{Error, Result};
|
||||
@@ -366,6 +366,31 @@ impl Keystore for LocalKeystore {
|
||||
) -> std::result::Result<Option<bls377::Signature>, TraitError> {
|
||||
self.sign::<bls377::Pair>(key_type, public, msg)
|
||||
}
|
||||
|
||||
fn ecdsa_bls377_public_keys(&self, key_type: KeyTypeId) -> Vec<ecdsa_bls377::Public> {
|
||||
self.public_keys::<ecdsa_bls377::Pair>(key_type)
|
||||
}
|
||||
|
||||
/// Generate a new pair of paired-keys compatible with the '(ecdsa,bls377)' signature scheme.
|
||||
///
|
||||
/// If `[seed]` is `Some` then the key will be ephemeral and stored in memory.
|
||||
fn ecdsa_bls377_generate_new(
|
||||
&self,
|
||||
key_type: KeyTypeId,
|
||||
seed: Option<&str>,
|
||||
) -> std::result::Result<ecdsa_bls377::Public, TraitError> {
|
||||
self.generate_new::<ecdsa_bls377::Pair>(key_type, seed)
|
||||
}
|
||||
|
||||
fn ecdsa_bls377_sign(
|
||||
&self,
|
||||
key_type: KeyTypeId,
|
||||
public: &ecdsa_bls377::Public,
|
||||
msg: &[u8],
|
||||
) -> std::result::Result<Option<ecdsa_bls377::Signature>, TraitError> {
|
||||
self.sign::<ecdsa_bls377::Pair>(key_type, public, msg)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user