Trait sc_keystore::Keystore
pub trait Keystore: Send + Sync {
Show 29 methods
// Required methods
fn sr25519_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>>;
fn sr25519_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, Error>;
fn sr25519_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>>, Error>;
fn sr25519_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
data: &VrfSignData,
) -> Result<Option<VrfSignature>, Error>;
fn sr25519_vrf_pre_output(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
input: &VrfTranscript,
) -> Result<Option<VrfPreOutput>, Error>;
fn ed25519_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>>;
fn ed25519_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>, Error>;
fn ed25519_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::ed25519::Signature::{constant#0}, (SignatureTag, Ed25519Tag)>>, Error>;
fn ecdsa_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>>;
fn ecdsa_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>, Error>;
fn ecdsa_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>;
fn ecdsa_sign_prehashed(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>,
msg: &[u8; 32],
) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>;
fn bandersnatch_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>>;
fn bandersnatch_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, Error>;
fn bandersnatch_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::bandersnatch::Signature::{constant#0}, (SignatureTag, BandersnatchTag)>>, Error>;
fn bandersnatch_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfSignData,
) -> Result<Option<VrfSignature>, Error>;
fn bandersnatch_vrf_pre_output(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfInput,
) -> Result<Option<VrfPreOutput>, Error>;
fn bandersnatch_ring_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfSignData,
prover: &RingProver<Fp<MontBackend<FrConfig, 4>, 4>, KZG<Bls12<Config<HostHooks>>>, BandersnatchConfig<HostHooks>>,
) -> Result<Option<RingVrfSignature>, Error>;
fn bls381_public_keys(
&self,
id: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>;
fn ecdsa_bls381_public_keys(
&self,
id: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>>;
fn bls381_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>, Error>;
fn ecdsa_bls381_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>, Error>;
fn bls381_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::bls::Signature::{constant#0}, (SignatureTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>, Error>;
fn ecdsa_bls381_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>;
fn ecdsa_bls381_sign_with_keccak256(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>;
fn insert(
&self,
key_type: KeyTypeId,
suri: &str,
public: &[u8],
) -> Result<(), ()>;
fn keys(&self, key_type: KeyTypeId) -> Result<Vec<Vec<u8>>, Error>;
fn has_keys(&self, public_keys: &[(Vec<u8>, KeyTypeId)]) -> bool;
// Provided method
fn sign_with(
&self,
id: KeyTypeId,
crypto_id: CryptoTypeId,
public: &[u8],
msg: &[u8],
) -> Result<Option<Vec<u8>>, Error> { ... }
}
Expand description
Something that generates, stores and provides access to secret keys.
Required Methods§
fn sr25519_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>>
fn sr25519_public_keys( &self, key_type: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>>
Returns all the sr25519 public keys for the given key type.
fn sr25519_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, Error>
fn sr25519_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, Error>
Generate a new sr25519 key pair for the given key type and an optional seed.
Returns an sr25519::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn sr25519_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>>, Error>
fn sr25519_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>>, Error>
Generate an sr25519 signature for a given message.
Receives [KeyTypeId
] and an [sr25519::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [sr25519::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn sr25519_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
data: &VrfSignData,
) -> Result<Option<VrfSignature>, Error>
fn sr25519_vrf_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, data: &VrfSignData, ) -> Result<Option<VrfSignature>, Error>
Generate an sr25519 VRF signature for the given data.
Receives [KeyTypeId
] and an [sr25519::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns None
if the given key_type
and public
combination doesn’t
exist in the keystore or an Err
when something failed.
fn sr25519_vrf_pre_output(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>,
input: &VrfTranscript,
) -> Result<Option<VrfPreOutput>, Error>
fn sr25519_vrf_pre_output( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, input: &VrfTranscript, ) -> Result<Option<VrfPreOutput>, Error>
Generate an sr25519 VRF pre-output for a given input data.
Receives [KeyTypeId
] and an [sr25519::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns None
if the given key_type
and public
combination doesn’t
exist in the keystore or an Err
when something failed.
fn ed25519_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>>
fn ed25519_public_keys( &self, key_type: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>>
Returns all ed25519 public keys for the given key type.
fn ed25519_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>, Error>
fn ed25519_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>, Error>
Generate a new ed25519 key pair for the given key type and an optional seed.
Returns an ed25519::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn ed25519_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::ed25519::Signature::{constant#0}, (SignatureTag, Ed25519Tag)>>, Error>
fn ed25519_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::ed25519::Signature::{constant#0}, (SignatureTag, Ed25519Tag)>>, Error>
Generate an ed25519 signature for a given message.
Receives [KeyTypeId
] and an [ed25519::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [ed25519::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn ecdsa_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>>
fn ecdsa_public_keys( &self, key_type: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>>
Returns all ecdsa public keys for the given key type.
fn ecdsa_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>, Error>
fn ecdsa_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>, Error>
Generate a new ecdsa key pair for the given key type and an optional seed.
Returns an ecdsa::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn ecdsa_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>
fn ecdsa_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>
Generate an ecdsa signature for a given message.
Receives [KeyTypeId
] and an [ecdsa::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [ecdsa::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn ecdsa_sign_prehashed(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>,
msg: &[u8; 32],
) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>
fn ecdsa_sign_prehashed( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>, msg: &[u8; 32], ) -> Result<Option<CryptoBytes<sp_core::::ecdsa::Signature::{constant#0}, (SignatureTag, EcdsaTag)>>, Error>
Generate an ecdsa signature for a given pre-hashed message.
Receives [KeyTypeId
] and an [ecdsa::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [ecdsa::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn bandersnatch_public_keys(
&self,
key_type: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>>
fn bandersnatch_public_keys( &self, key_type: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>>
Returns all the bandersnatch public keys for the given key type.
fn bandersnatch_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, Error>
fn bandersnatch_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, Error>
Generate a new bandersnatch key pair for the given key type and an optional seed.
Returns an bandersnatch::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn bandersnatch_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::bandersnatch::Signature::{constant#0}, (SignatureTag, BandersnatchTag)>>, Error>
fn bandersnatch_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::bandersnatch::Signature::{constant#0}, (SignatureTag, BandersnatchTag)>>, Error>
Generate an bandersnatch signature for a given message.
Receives [KeyTypeId
] and an [bandersnatch::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [bandersnatch::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn bandersnatch_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfSignData,
) -> Result<Option<VrfSignature>, Error>
fn bandersnatch_vrf_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, input: &VrfSignData, ) -> Result<Option<VrfSignature>, Error>
Generate a bandersnatch VRF signature for the given data.
Receives [KeyTypeId
] and an [bandersnatch::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns None
if the given key_type
and public
combination doesn’t
exist in the keystore or an Err
when something failed.
fn bandersnatch_vrf_pre_output(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfInput,
) -> Result<Option<VrfPreOutput>, Error>
fn bandersnatch_vrf_pre_output( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, input: &VrfInput, ) -> Result<Option<VrfPreOutput>, Error>
Generate a bandersnatch VRF pre-output for a given input data.
Receives [KeyTypeId
] and an [bandersnatch::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns None
if the given key_type
and public
combination doesn’t
exist in the keystore or an Err
when something failed.
fn bandersnatch_ring_vrf_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>,
input: &VrfSignData,
prover: &RingProver<Fp<MontBackend<FrConfig, 4>, 4>, KZG<Bls12<Config<HostHooks>>>, BandersnatchConfig<HostHooks>>,
) -> Result<Option<RingVrfSignature>, Error>
fn bandersnatch_ring_vrf_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>, input: &VrfSignData, prover: &RingProver<Fp<MontBackend<FrConfig, 4>, 4>, KZG<Bls12<Config<HostHooks>>>, BandersnatchConfig<HostHooks>>, ) -> Result<Option<RingVrfSignature>, Error>
Generate a bandersnatch ring-VRF signature for the given data.
Receives [KeyTypeId
] and an [bandersnatch::Public
] key to be able to map
them to a private key that exists in the keystore.
Also takes a [bandersnatch::ring_vrf::RingProver
] instance obtained from
a valid [bandersnatch::ring_vrf::RingContext
].
The ring signature is verifiable if the public key corresponding to the
signing [bandersnatch::Pair
] is part of the ring from which the
[bandersnatch::ring_vrf::RingProver
] has been constructed.
If not, the produced signature is just useless.
Returns None
if the given key_type
and public
combination doesn’t
exist in the keystore or an Err
when something failed.
fn bls381_public_keys(
&self,
id: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>
fn bls381_public_keys( &self, id: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>
Returns all bls12-381 public keys for the given key type.
fn ecdsa_bls381_public_keys(
&self,
id: KeyTypeId,
) -> Vec<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>>
fn ecdsa_bls381_public_keys( &self, id: KeyTypeId, ) -> Vec<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>>
Returns all (ecdsa,bls12-381) paired public keys for the given key type.
fn bls381_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>, Error>
fn bls381_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>, Error>
Generate a new bls381 key pair for the given key type and an optional seed.
Returns an bls381::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn ecdsa_bls381_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>, Error>
fn ecdsa_bls381_generate_new( &self, key_type: KeyTypeId, seed: Option<&str>, ) -> Result<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>, Error>
Generate a new (ecdsa,bls381) key pair for the given key type and an optional seed.
Returns an ecdsa_bls381::Public
key of the generated key pair or an Err
if
something failed during key generation.
fn bls381_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::bls::Signature::{constant#0}, (SignatureTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>, Error>
fn bls381_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::bls::Public::{constant#0}, (PublicTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::bls::Signature::{constant#0}, (SignatureTag, (BlsTag, TinyBLS<Bls12<Config>, Config>))>>, Error>
Generate a bls381 signature for a given message.
Receives [KeyTypeId
] and a [bls381::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [bls381::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn ecdsa_bls381_sign(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>
fn ecdsa_bls381_sign( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>
Generate a (ecdsa,bls381) signature pair for a given message.
Receives [KeyTypeId
] and a [ecdsa_bls381::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [ecdsa_bls381::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn ecdsa_bls381_sign_with_keccak256(
&self,
key_type: KeyTypeId,
public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>,
msg: &[u8],
) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>
fn ecdsa_bls381_sign_with_keccak256( &self, key_type: KeyTypeId, public: &CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Public::{constant#0}, (PublicTag, (PairedCryptoTag, EcdsaBls381Tag))>, msg: &[u8], ) -> Result<Option<CryptoBytes<sp_core::::paired_crypto::ecdsa_bls381::Signature::{constant#0}, (SignatureTag, (PairedCryptoTag, EcdsaBls381Tag))>>, Error>
Hashes the message
using keccak256 and then signs it using ECDSA
algorithm. It does not affect the behavior of BLS12-381 component. It generates
BLS12-381 Signature according to IETF standard.
Receives [KeyTypeId
] and a [ecdsa_bls381::Public
] key to be able to map
them to a private key that exists in the keystore.
Returns an [ecdsa_bls381::Signature
] or None
in case the given key_type
and public
combination doesn’t exist in the keystore.
An Err
will be returned if generating the signature itself failed.
fn insert(
&self,
key_type: KeyTypeId,
suri: &str,
public: &[u8],
) -> Result<(), ()>
fn insert( &self, key_type: KeyTypeId, suri: &str, public: &[u8], ) -> Result<(), ()>
Insert a new secret key.
Provided Methods§
fn sign_with(
&self,
id: KeyTypeId,
crypto_id: CryptoTypeId,
public: &[u8],
msg: &[u8],
) -> Result<Option<Vec<u8>>, Error>
fn sign_with( &self, id: KeyTypeId, crypto_id: CryptoTypeId, public: &[u8], msg: &[u8], ) -> Result<Option<Vec<u8>>, Error>
Convenience method to sign a message using the given key type and a raw public key for secret lookup.
The message is signed using the cryptographic primitive specified by crypto_id
.
Schemes supported by the default trait implementation:
- sr25519
- ed25519
- ecdsa
- bandersnatch
- bls381
- (ecdsa,bls381) paired keys
To support more schemes you can overwrite this method.
Returns the SCALE encoded signature if key is found and supported, None
if the key doesn’t
exist or an error when something failed.