client_handshake

Function client_handshake 

Source
pub async fn client_handshake<R, W>(
    reader: &mut R,
    writer: &mut W,
    server_public_key: &[u8; 32],
    client_keypair: &Keypair,
    local_creds: &PeerCredentials,
    remote_creds: &PeerCredentials,
) -> Result<NoiseTransport>
where R: AsyncRead + Unpin, W: AsyncWrite + Unpin,
Expand description

Perform the client-side (initiator) Noise IK handshake.

Called after UnixStream::connect() and into_split(), before the read/write loops. The client generates an ephemeral static keypair and pre-loads the server’s public key (the “K” in IK).

IK handshake (initiator perspective):

  1. Write message 1 to responder (ephemeral + encrypted static)
  2. Read message 2 from responder (responder’s ephemeral)
  3. Handshake complete — derive transport keys

§Errors

Returns an error if the handshake fails or times out.