pub async fn perform_client_challenge_handshake(
send: SendStream,
recv: RecvStream,
server_public_key: &VerifyingKey,
key_pairs: &[&KeyPair],
) -> Result<(usize, Vec<ZoeChallengeWarning>), Error>Expand description
Performs the client side of the challenge-response handshake
This function implements the client side of the challenge protocol:
- Receives a challenge from the server
- Creates proofs for all provided keys
- Sends the response to the server
- Receives and processes the verification result
§Arguments
send- Stream for sending data to the serverrecv- Stream for receiving data from the serverkey_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);