pub struct HandshakeResult {
pub local_pubkey: Vec<u8>,
pub remote_pubkey: Vec<u8>,
/* private fields */
}Expand description
Result of a Noise handshake, used for capability verification.
When using hypercore-protocol with hyperswarm, the Noise handshake is performed at the transport layer (hyperdht). This struct holds the information needed for capability verification when opening channels.
Fields§
§local_pubkey: Vec<u8>Local public key (32 bytes)
remote_pubkey: Vec<u8>Remote public key (32 bytes)
Implementations§
Source§impl HandshakeResult
impl HandshakeResult
Sourcepub fn from_pre_encrypted(
is_initiator: bool,
local_pubkey: [u8; 32],
remote_pubkey: [u8; 32],
handshake_hash: Vec<u8>,
) -> Self
pub fn from_pre_encrypted( is_initiator: bool, local_pubkey: [u8; 32], remote_pubkey: [u8; 32], handshake_hash: Vec<u8>, ) -> Self
Create a HandshakeResult for a pre-encrypted connection.
This is used when the Noise handshake was performed at a lower layer (e.g., hyperswarm/hyperdht) and we’re reusing the encrypted channel. The handshake_hash is used for capability verification.
§Arguments
is_initiator- Whether this peer initiated the connectionlocal_pubkey- This peer’s Noise public keyremote_pubkey- The remote peer’s Noise public keyhandshake_hash- The 64-byte handshake hash from the Noise handshake
Trait Implementations§
Source§impl Clone for HandshakeResult
impl Clone for HandshakeResult
Source§fn clone(&self) -> HandshakeResult
fn clone(&self) -> HandshakeResult
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 moreSource§impl Debug for HandshakeResult
impl Debug for HandshakeResult
Source§impl Default for HandshakeResult
impl Default for HandshakeResult
Source§fn default() -> HandshakeResult
fn default() -> HandshakeResult
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HandshakeResult
impl RefUnwindSafe for HandshakeResult
impl Send for HandshakeResult
impl Sync for HandshakeResult
impl Unpin for HandshakeResult
impl UnsafeUnpin for HandshakeResult
impl UnwindSafe for HandshakeResult
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