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:
drskalman
2023-10-24 18:37:34 +00:00
committed by GitHub
parent 8a79fb22db
commit fbd5777118
11 changed files with 273 additions and 17 deletions
+25 -1
View File
@@ -22,7 +22,7 @@ use crate::{Error, Keystore, KeystorePtr};
#[cfg(feature = "bandersnatch-experimental")]
use sp_core::bandersnatch;
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};
use sp_core::{bls377, bls381, ecdsa_bls377};
use sp_core::{
crypto::{ByteArray, KeyTypeId, Pair, VrfSecret},
ecdsa, ed25519, sr25519,
@@ -322,6 +322,30 @@ impl Keystore for MemoryKeystore {
self.sign::<bls377::Pair>(key_type, public, msg)
}
#[cfg(feature = "bls-experimental")]
fn ecdsa_bls377_public_keys(&self, key_type: KeyTypeId) -> Vec<ecdsa_bls377::Public> {
self.public_keys::<ecdsa_bls377::Pair>(key_type)
}
#[cfg(feature = "bls-experimental")]
fn ecdsa_bls377_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<ecdsa_bls377::Public, Error> {
self.generate_new::<ecdsa_bls377::Pair>(key_type, seed)
}
#[cfg(feature = "bls-experimental")]
fn ecdsa_bls377_sign(
&self,
key_type: KeyTypeId,
public: &ecdsa_bls377::Public,
msg: &[u8],
) -> Result<Option<ecdsa_bls377::Signature>, Error> {
self.sign::<ecdsa_bls377::Pair>(key_type, public, msg)
}
fn insert(&self, key_type: KeyTypeId, suri: &str, public: &[u8]) -> Result<(), ()> {
self.keys
.write()