server_handshake

Function server_handshake 

Source
pub async fn server_handshake<R, W>(
    reader: &mut R,
    writer: &mut W,
    server_keypair: &Keypair,
    local_creds: &PeerCredentials,
    remote_creds: &PeerCredentials,
) -> Result<NoiseTransport>
where R: AsyncRead + Unpin, W: AsyncWrite + Unpin,
Expand description

Perform the server-side (responder) Noise IK handshake.

Called after stream.into_split() and extract_ucred(), before the read/write loops. The server’s static keypair was generated at startup and the client’s identity is verified via the Noise handshake + UCred prologue binding.

IK handshake (responder perspective):

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

§Errors

Returns an error if the handshake fails or times out.