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>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):
- Write message 1 to responder (ephemeral + encrypted static)
- Read message 2 from responder (responder’s ephemeral)
- Handshake complete — derive transport keys
§Errors
Returns an error if the handshake fails or times out.