Skip to main content

Module handshake

Module handshake 

Source
Expand description

Mutual challenge-response handshake proving peer identity.

When Alice connects to Bob, she needs to know the peer answering is actually Bob and not an interposer. This module implements a minimal challenge-response: Alice sends a random Challenge naming a nonce; the responder signs a canonical message binding that nonce to its own DID with its ed25519 key and returns a ChallengeResponse. Alice verifies the signature against the embedded public key, then confirms the responder DID is the one she expected out-of-band (Bob’s known DID) via responder_is.

Signature scheme: ed25519 (ed25519-dalek v2). The signed message is domain-separated with the qhs1 tag (Qualia HandShake v1) so a signature made here cannot be replayed as some other ed25519 signature over unrelated bytes.

Pure: no filesystem, no network. All I/O of keys/signatures is via hex strings so the structs serialize cleanly with serde.

Structs§

Challenge
A connection challenge issued by the initiator (e.g. Alice).
ChallengeResponse
The responder’s answer, proving control of the key bound to responder_did.

Functions§

answer_challenge
Sign a challenge, producing a ChallengeResponse the initiator can verify.
make_challenge
Construct a challenge from the initiator’s DID and a caller-supplied nonce.
responder_is
The “actually Bob” check: does the response come from the DID we expected?
signed_message
Canonical, domain-separated message that the responder signs.
verify_response
Verify that a response answers the given challenge and carries a valid signature.