pub struct Keypair(/* private fields */);
Expand description
An Ed25519 keypair.
(We do not provide a separate “private key only” type.)
See [ed25519_dalek::SigningKey
] for more information.
Implementations§
Source§impl Keypair
impl Keypair
Sourcepub fn generate<R: RngCore + CryptoRng>(csprng: &mut R) -> Self
pub fn generate<R: RngCore + CryptoRng>(csprng: &mut R) -> Self
Generate a new random ed25519 keypair.
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
Construct an ed25519 keypair from the byte representation of its secret key.
Sourcepub fn as_bytes(&self) -> &[u8; 32]
pub fn as_bytes(&self) -> &[u8; 32]
Return a reference to the byte representation of the secret key in this keypair.
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Return to the byte representation of the secret key in this keypair.
Sourcepub fn verifying_key(&self) -> PublicKey
pub fn verifying_key(&self) -> PublicKey
Return the public key in this keypair.
Trait Implementations§
Source§impl Ed25519PublicKey for Keypair
impl Ed25519PublicKey for Keypair
Source§fn public_key(&self) -> PublicKey
fn public_key(&self) -> PublicKey
Get the Ed25519
PublicKey
.Source§impl Ed25519SigningKey for Keypair
impl Ed25519SigningKey for Keypair
Source§impl<'a> From<&'a Keypair> for ExpandedKeypair
impl<'a> From<&'a Keypair> for ExpandedKeypair
Source§fn from(kp: &'a Keypair) -> ExpandedKeypair
fn from(kp: &'a Keypair) -> ExpandedKeypair
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Keypair
impl RefUnwindSafe for Keypair
impl Send for Keypair
impl Sync for Keypair
impl Unpin for Keypair
impl UnwindSafe for Keypair
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more