perform_client_challenge_handshake

Function perform_client_challenge_handshake 

Source
pub async fn perform_client_challenge_handshake(
    send: SendStream,
    recv: RecvStream,
    server_public_key: &VerifyingKey,
    key_pairs: &[&KeyPair],
) -> Result<(usize, Vec<ZoeChallengeWarning>)>
Expand description

Performs the client side of the challenge-response handshake

This function implements the client side of the challenge protocol:

  1. Receives a challenge from the server
  2. Creates proofs for all provided keys
  3. Sends the response to the server
  4. Receives and processes the verification result

§Arguments

  • send - Stream for sending data to the server
  • recv - Stream for receiving data from the server
  • key_pairs - Slice of signing keys to prove possession of

§Returns

The number of keys that were successfully verified by the server

§Errors

Returns an error if:

  • Network I/O fails
  • Serialization/deserialization fails
  • All key proofs fail verification
  • Server response is malformed or too large

§Example

use zoe_client::challenge::perform_client_challenge_handshake;

let verified_count = perform_client_challenge_handshake(
    send_stream,
    recv_stream,
    &[&personal_key, &work_key]
).await?;

debug!("Successfully verified {} out of {} keys", verified_count, 2);