pub struct PrivateKey(/* private fields */);Expand description
secp256k1 private key (ECDSA) backed by sp_core::ecdsa::Pair.
Implementations§
Source§impl PrivateKey
impl PrivateKey
pub fn random() -> PrivateKey
pub fn from_suri( suri: &str, password: Option<&str>, ) -> Result<PrivateKey, SignerError>
pub fn from_phrase( phrase: &str, password: Option<&str>, ) -> Result<PrivateKey, SignerError>
pub fn from_pair_seed(seed: <Pair as Pair>::Seed) -> PrivateKey
pub fn from_seed(seed: [u8; 32]) -> Result<PrivateKey, SignerError>
pub fn to_bytes(&self) -> [u8; 32]
pub fn public_key(&self) -> PublicKey
pub fn as_pair(&self) -> &Pair
pub fn seed(&self) -> <Pair as Pair>::Seed
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrivateKey
impl Debug for PrivateKey
Source§impl<'de> Deserialize<'de> for PrivateKey
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PrivateKey
Available on crate feature
serde only.Source§fn deserialize<D>(d: D) -> Result<PrivateKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<PrivateKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PrivateKey
impl Display for PrivateKey
impl Eq for PrivateKey
Source§impl From<&PrivateKey> for PublicKey
impl From<&PrivateKey> for PublicKey
Source§fn from(private_key: &PrivateKey) -> PublicKey
fn from(private_key: &PrivateKey) -> PublicKey
Converts to this type from the input type.
Source§impl From<Pair> for PrivateKey
impl From<Pair> for PrivateKey
Source§fn from(value: Pair) -> PrivateKey
fn from(value: Pair) -> PrivateKey
Converts to this type from the input type.
Source§impl From<PrivateKey> for PublicKey
impl From<PrivateKey> for PublicKey
Source§fn from(private_key: PrivateKey) -> PublicKey
fn from(private_key: PrivateKey) -> PublicKey
Converts to this type from the input type.
Source§impl FromStr for PrivateKey
impl FromStr for PrivateKey
Source§type Err = SignerError
type Err = SignerError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<PrivateKey, <PrivateKey as FromStr>::Err>
fn from_str(s: &str) -> Result<PrivateKey, <PrivateKey as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
Source§fn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for PrivateKey
Available on crate feature serde only.
impl Serialize for PrivateKey
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnsafeUnpin for PrivateKey
impl UnwindSafe for PrivateKey
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
impl<T> JsonSchemaMaybe for T
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeRefUnwindSafe for Twhere
T: RefUnwindSafe,
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.