pub struct PeerIdentityKey { /* private fields */ }Expand description
A long-term X25519 keypair for peer identity
Used to establish E2EE sessions with other peers. The public key can be shared freely; the secret key must be kept private.
Implementations§
Source§impl PeerIdentityKey
impl PeerIdentityKey
Sourcepub fn from_secret_bytes(bytes: [u8; 32]) -> Self
pub fn from_secret_bytes(bytes: [u8; 32]) -> Self
Create from an existing secret key bytes
Sourcepub fn public_key_bytes(&self) -> [u8; 32]
pub fn public_key_bytes(&self) -> [u8; 32]
Get the public key bytes (safe to share)
Sourcepub fn public_key(&self) -> &PublicKey
pub fn public_key(&self) -> &PublicKey
Get a reference to the public key
Sourcepub fn exchange(&self, peer_public: &PublicKey) -> SharedSecret
pub fn exchange(&self, peer_public: &PublicKey) -> SharedSecret
Perform X25519 key exchange with a peer’s public key
Returns a shared secret that both parties will derive identically.
Sourcepub fn exchange_with_bytes(&self, peer_public_bytes: &[u8; 32]) -> SharedSecret
pub fn exchange_with_bytes(&self, peer_public_bytes: &[u8; 32]) -> SharedSecret
Perform key exchange with peer’s public key bytes
Trait Implementations§
Source§impl Clone for PeerIdentityKey
impl Clone for PeerIdentityKey
Source§fn clone(&self) -> PeerIdentityKey
fn clone(&self) -> PeerIdentityKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PeerIdentityKey
impl RefUnwindSafe for PeerIdentityKey
impl Send for PeerIdentityKey
impl Sync for PeerIdentityKey
impl Unpin for PeerIdentityKey
impl UnwindSafe for PeerIdentityKey
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