zer0-secret-stream · handshake
Source declarations, signatures and documentation for handshake.
Source: sigil/weave/network/zer0-secret-stream/src/handshake.rs. SHA-256: 94a015264c63b29d3d3ae41591de2ae5e5d0d8507a2466c0c42ee3b18e17e504.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
handshake::HandshakeError
Errors that can occur during handshake
#[derive(Error, Debug)]
pub enum HandshakeError {
#[error("Noise protocol error: {0}")]
Noise(#[from] snow::Error),
#[error("Invalid handshake state")]
InvalidState,
#[error("Handshake already complete")]
AlreadyComplete,
#[error("Missing remote public key")]
MissingRemoteKey,
#[error("Noise handshake hash is shorter than the frozen 32-byte rule")]
InvalidHandshakeHashLength,
}Source line: 11.
handshake::HandshakePattern
Supported handshake patterns
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HandshakePattern {
/// XX pattern - both parties exchange keys
XX,
/// IK pattern - initiator knows responder's key
IK,
/// IX pattern - responder knows initiator's key
IX,
/// KK pattern - both parties know each other's keys
KK,
}Source line: 30.
handshake::HandshakeResult
Result of a handshake operation
#[derive(Debug)]
pub struct HandshakeResult {
/// Data to send to remote (if any)
pub data: Option<Bytes>,
/// Noise-authenticated payload received from the remote peer.
pub remote_payload: Bytes,
/// The transport state, containing cipher states for sending and receiving.
pub transport: Option<TransportState>,
/// Handshake hash (if complete)
pub hash: Option<[u8; 32]>,
/// Remote public key (if available)
pub remote_public_key: Option<[u8; 32]>
}Source line: 54.
handshake::Handshake
Noise protocol handshake state
pub struct Handshake {
}Source line: 68.
handshake::Handshake::new
Create a new handshake
pub fn new(
is_initiator: bool,
key_pair: KeyPair,
remote_public_key: Option<[u8; 32]>,
pattern: HandshakePattern,
) -> Self;Source line: 81.
handshake::Handshake::send
Send a handshake message
pub fn send(&mut self) -> Result<HandshakeResult, HandshakeError>;Source line: 126.
handshake::Handshake::send_with_payload
Send a handshake message with a Noise-authenticated payload.
pub fn send_with_payload(&mut self, payload: &[u8]) -> Result<HandshakeResult, HandshakeError>;Source line: 131.
handshake::Handshake::recv
Receive a handshake message
pub fn recv(&mut self, data: &[u8]) -> Result<HandshakeResult, HandshakeError>;Source line: 174.
handshake::Handshake::recv_with_payload
Receive a handshake message and place response_payload in any response
generated by this Noise state transition.
pub fn recv_with_payload(
&mut self,
data: &[u8],
response_payload: &[u8],
) -> Result<HandshakeResult, HandshakeError>;Source line: 180.
handshake::Handshake::complete
Check if handshake is complete
pub fn complete(&self) -> bool;Source line: 292.
handshake::Handshake::destroy
Destroy the handshake state
pub fn destroy(&mut self);Source line: 297.