Struct sp_core::paired_crypto::Pair
source · pub struct Pair<LeftPair: PairT, RightPair: PairT, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> { /* private fields */ }
Expand description
A key pair.
Trait Implementations§
source§impl<LeftPair: Clone + PairT, RightPair: Clone + PairT, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Clone for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>
impl<LeftPair: Clone + PairT, RightPair: Clone + PairT, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Clone for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>
source§impl<LeftPair: PairT, RightPair: PairT, const LEFT_PLUS_RIGHT_PUBLIC_LEN: usize, const SIGNATURE_LEN: usize> From<Pair<LeftPair, RightPair, LEFT_PLUS_RIGHT_PUBLIC_LEN, SIGNATURE_LEN>> for Public<LEFT_PLUS_RIGHT_PUBLIC_LEN>where
Pair<LeftPair, RightPair, LEFT_PLUS_RIGHT_PUBLIC_LEN, SIGNATURE_LEN>: PairT<Public = Public<LEFT_PLUS_RIGHT_PUBLIC_LEN>>,
impl<LeftPair: PairT, RightPair: PairT, const LEFT_PLUS_RIGHT_PUBLIC_LEN: usize, const SIGNATURE_LEN: usize> From<Pair<LeftPair, RightPair, LEFT_PLUS_RIGHT_PUBLIC_LEN, SIGNATURE_LEN>> for Public<LEFT_PLUS_RIGHT_PUBLIC_LEN>where Pair<LeftPair, RightPair, LEFT_PLUS_RIGHT_PUBLIC_LEN, SIGNATURE_LEN>: PairT<Public = Public<LEFT_PLUS_RIGHT_PUBLIC_LEN>>,
source§impl<LeftPair: PairT, RightPair: PairT, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Pair for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where
Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>: CryptoType,
LeftPair::Signature: SignatureBound,
RightPair::Signature: SignatureBound,
Public<PUBLIC_KEY_LEN>: CryptoType,
LeftPair::Seed: From<[u8; 32]> + Into<[u8; 32]>,
RightPair::Seed: From<[u8; 32]> + Into<[u8; 32]>,
impl<LeftPair: PairT, RightPair: PairT, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Pair for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>: CryptoType, LeftPair::Signature: SignatureBound, RightPair::Signature: SignatureBound, Public<PUBLIC_KEY_LEN>: CryptoType, LeftPair::Seed: From<[u8; 32]> + Into<[u8; 32]>, RightPair::Seed: From<[u8; 32]> + Into<[u8; 32]>,
source§fn derive<Iter: Iterator<Item = DeriveJunction>>(
&self,
path: Iter,
seed: Option<Self::Seed>
) -> Result<(Self, Option<Self::Seed>), DeriveError>
fn derive<Iter: Iterator<Item = DeriveJunction>>( &self, path: Iter, seed: Option<Self::Seed> ) -> Result<(Self, Option<Self::Seed>), DeriveError>
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.
source§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 Signature = Signature<SIGNATURE_LEN>
type Signature = Signature<SIGNATURE_LEN>
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.
source§fn from_seed_slice(seed_slice: &[u8]) -> Result<Self, SecretStringError>
fn from_seed_slice(seed_slice: &[u8]) -> Result<Self, 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
source§fn verify<M: AsRef<[u8]>>(
sig: &Self::Signature,
message: M,
public: &Self::Public
) -> bool
fn verify<M: AsRef<[u8]>>( sig: &Self::Signature, message: M, public: &Self::Public ) -> bool
Verify a signature on a message. Returns true if the signature is good.
source§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
source§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.source§fn from_seed(seed: &Self::Seed) -> Self
fn from_seed(seed: &Self::Seed) -> Self
Generate new key pair from the provided
seed
. Read moresource§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 moresource§fn from_string(
s: &str,
password_override: Option<&str>
) -> Result<Self, SecretStringError>
fn from_string( s: &str, password_override: Option<&str> ) -> Result<Self, SecretStringError>
Interprets the string
s
in order to generate a key pair. Read moreAuto Trait Implementations§
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> RefUnwindSafe for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where LeftPair: RefUnwindSafe, RightPair: RefUnwindSafe,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Send for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where LeftPair: Send, RightPair: Send,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Sync for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where LeftPair: Sync, RightPair: Sync,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> Unpin for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where LeftPair: Unpin, RightPair: Unpin,
impl<LeftPair, RightPair, const PUBLIC_KEY_LEN: usize, const SIGNATURE_LEN: usize> UnwindSafe for Pair<LeftPair, RightPair, PUBLIC_KEY_LEN, SIGNATURE_LEN>where LeftPair: UnwindSafe, RightPair: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.