Struct libp2p_noise::Keypair
source · pub struct Keypair<T: Zeroize> { /* private fields */ }
Expand description
DH keypair.
Implementations§
source§impl Keypair<X25519>
impl Keypair<X25519>
sourcepub fn from_identity(id_keys: &Keypair) -> Option<AuthenticKeypair<X25519>>
pub fn from_identity(id_keys: &Keypair) -> Option<AuthenticKeypair<X25519>>
Creates an X25519 Keypair
from an identity::Keypair
, if possible.
The returned keypair will be associated with the given identity keypair.
Returns None
if the given identity keypair cannot be used as an X25519 keypair.
Note: If the identity keypair is already used in the context of other cryptographic protocols outside of Noise, it should be preferred to create a new static X25519 keypair for use in the Noise protocol.
See also:
source§impl Keypair<X25519Spec>
impl Keypair<X25519Spec>
sourcepub fn new() -> Keypair<X25519Spec>
pub fn new() -> Keypair<X25519Spec>
Create a new X25519 keypair.
source§impl<T: Zeroize> Keypair<T>
impl<T: Zeroize> Keypair<T>
sourcepub fn into_authentic(
self,
id_keys: &Keypair
) -> Result<AuthenticKeypair<T>, NoiseError>where
T: AsRef<[u8]> + Protocol<T>,
pub fn into_authentic( self, id_keys: &Keypair ) -> Result<AuthenticKeypair<T>, NoiseError>where T: AsRef<[u8]> + Protocol<T>,
Turn this DH keypair into a AuthenticKeypair
, i.e. a DH keypair that
is authentic w.r.t. the given identity keypair, by signing the DH public key.
Trait Implementations§
source§impl Default for Keypair<X25519Spec>
impl Default for Keypair<X25519Spec>
source§impl From<SecretKey<X25519Spec>> for Keypair<X25519Spec>
impl From<SecretKey<X25519Spec>> for Keypair<X25519Spec>
Promote a X25519 secret key into a keypair.
source§fn from(secret: SecretKey<X25519Spec>) -> Keypair<X25519Spec>
fn from(secret: SecretKey<X25519Spec>) -> Keypair<X25519Spec>
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> RefUnwindSafe for Keypair<T>where T: RefUnwindSafe,
impl<T> Send for Keypair<T>where T: Send,
impl<T> Sync for Keypair<T>where T: Sync,
impl<T> Unpin for Keypair<T>where T: Unpin,
impl<T> UnwindSafe for Keypair<T>where T: 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