Type Alias Pair
pub type Pair = Pair<Pair, Pair<TinyBLS<Bls12<Config>, Config>>, sp_core::::paired_crypto::ecdsa_bls381::Pair::{constant#0}, sp_core::::paired_crypto::ecdsa_bls381::Pair::{constant#1}, EcdsaBls381Tag>;
Expand description
(ECDSA,BLS12-381) key-pair pair.
Aliased Type§
struct Pair { /* private fields */ }
Trait Implementations§
§impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> Clone for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> Clone for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>
§impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> Pair for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair,
RightPair: Pair,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> Pair for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair,
RightPair: Pair,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
§fn derive<Iter>(
&self,
path: Iter,
seed: Option<<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Seed>,
) -> Result<(Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>, Option<<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Seed>), DeriveError>where
Iter: Iterator<Item = DeriveJunction>,
fn derive<Iter>(
&self,
path: Iter,
seed: Option<<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Seed>,
) -> Result<(Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>, Option<<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Seed>), DeriveError>where
Iter: Iterator<Item = DeriveJunction>,
Derive a child key from a series of given junctions.
Note: if the LeftPair
and RightPair
crypto schemes differ in
seed derivation, derive
will drop the seed in the return.
§fn to_raw_vec(&self) -> Vec<u8> ⓘ
fn to_raw_vec(&self) -> Vec<u8> ⓘ
Get the seed/secret key for each key and then concatenate them.
§type Seed = [u8; 32]
type Seed = [u8; 32]
The type used to (minimally) encode the data required to securely create
a new key pair.
§type Public = CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>
type Public = CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>
The type which is used to encode a public key.
§type Signature = CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>
type Signature = CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>
The type used to represent a signature. Can be created from a key pair and a message
and verified with the message and a public key.
§fn from_seed_slice(
seed_slice: &[u8],
) -> Result<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>, SecretStringError>
fn from_seed_slice( seed_slice: &[u8], ) -> Result<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>, SecretStringError>
Make a new key pair from secret seed material. The slice must be the correct size or
an error will be returned. Read more
§fn public(
&self,
) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public
fn public( &self, ) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public
Get the public key.
§fn sign(
&self,
message: &[u8],
) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature
fn sign( &self, message: &[u8], ) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature
Sign a message.
§fn verify<Msg>(
sig: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature,
message: Msg,
public: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public,
) -> bool
fn verify<Msg>( sig: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature, message: Msg, public: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public, ) -> bool
Verify a signature on a message. Returns true if the signature is good.
§fn generate_with_phrase(password: Option<&str>) -> (Self, String, Self::Seed)
fn generate_with_phrase(password: Option<&str>) -> (Self, String, Self::Seed)
Generate new secure (random) key pair and provide the recovery phrase. Read more
§fn from_phrase(
phrase: &str,
password: Option<&str>,
) -> Result<(Self, Self::Seed), SecretStringError>
fn from_phrase( phrase: &str, password: Option<&str>, ) -> Result<(Self, Self::Seed), SecretStringError>
Returns the KeyPair from the English BIP39 seed
phrase
, or an error if it’s invalid.§fn from_string_with_seed(
s: &str,
password_override: Option<&str>,
) -> Result<(Self, Option<Self::Seed>), SecretStringError>
fn from_string_with_seed( s: &str, password_override: Option<&str>, ) -> Result<(Self, Option<Self::Seed>), SecretStringError>
Interprets the string
s
in order to generate a key Pair. Returns both the pair and an
optional seed, in the case that the pair can be expressed as a direct derivation from a seed
(some cases, such as Sr25519 derivations with path components, cannot). Read more§impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> ProofOfPossessionGenerator for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair + ProofOfPossessionGenerator,
RightPair: Pair + ProofOfPossessionGenerator,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> ProofOfPossessionGenerator for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair + ProofOfPossessionGenerator,
RightPair: Pair + ProofOfPossessionGenerator,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
§fn generate_proof_of_possession(
&mut self,
) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature
fn generate_proof_of_possession( &mut self, ) -> <Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature
Generate proof of possession. Read more
§impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> ProofOfPossessionVerifier for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair + ProofOfPossessionVerifier,
RightPair: Pair + ProofOfPossessionVerifier,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize, SubTag> ProofOfPossessionVerifier for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>where
LeftPair: Pair + ProofOfPossessionVerifier,
RightPair: Pair + ProofOfPossessionVerifier,
SubTag: PairedCryptoSubTagBound,
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag>: CryptoType,
CryptoBytes<PUBLIC_KEY_LEN, (PublicTag, (PairedCryptoTag, SubTag))>: Public,
CryptoBytes<SIGNATURE_LEN, (SignatureTag, (PairedCryptoTag, SubTag))>: Signature,
<LeftPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
<RightPair as Pair>::Seed: From<[u8; 32]> + Into<[u8; 32]>,
This requires that the proof_of_possession of LEFT is of LeftPair::Signature. This is the case for current implemented cases but does not holds in general.
§fn verify_proof_of_possession(
proof_of_possession: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature,
allegedly_possessed_pubkey: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public,
) -> bool
fn verify_proof_of_possession( proof_of_possession: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Signature, allegedly_possessed_pubkey: &<Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN, SubTag> as Pair>::Public, ) -> bool
Verify proof of possession. Read more