pub struct Keypair<T> where
T: Zeroize, { /* private fields */ }
Expand description
DH keypair.
Implementations
sourceimpl 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, e.g. for signing in the
secio
protocol, it should be preferred to create a new static X25519 keypair for use in the Noise protocol.See also:
sourceimpl Keypair<X25519Spec>
impl Keypair<X25519Spec>
sourcepub fn new() -> Keypair<X25519Spec>
pub fn new() -> Keypair<X25519Spec>
Create a new X25519 keypair.
sourceimpl<T> Keypair<T> where
T: Zeroize,
impl<T> Keypair<T> where
T: Zeroize,
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
sourceimpl From<SecretKey<X25519Spec>> for Keypair<X25519Spec>
impl From<SecretKey<X25519Spec>> for Keypair<X25519Spec>
Promote a X25519 secret key into a keypair.
sourcepub fn from(secret: SecretKey<X25519Spec>) -> Keypair<X25519Spec>
pub fn from(secret: SecretKey<X25519Spec>) -> Keypair<X25519Spec>
Performs the conversion.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more