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).
- Challenge
Response - The responder’s answer, proving control of the key bound to
responder_did.
Functions§
- answer_
challenge - Sign a challenge, producing a
ChallengeResponsethe 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.