pub enum Messages {
AuthChallenge(Challenge),
AuthResponse(Identity, ChallengeResponse),
GetRendevouz,
RendevouzInfo(RendevouzCode),
GetIdentity(RendevouzCode),
IdentityInfo {
fingerprint: IdentityFingerprint,
identity: Identity,
},
Send {
source: Option<IdentityFingerprint>,
destination: IdentityFingerprint,
payload: Vec<u8>,
},
}Expand description
Protocol messages exchanged between clients and the proxy server.
Messages flow through three distinct phases: authentication, optional rendezvous for peer discovery, and message routing between authenticated clients.
Variants§
AuthChallenge(Challenge)
Server sends a random challenge to a newly connected client.
The client must sign this challenge with its private key to authenticate. Sent immediately after WebSocket connection establishment.
AuthResponse(Identity, ChallengeResponse)
Client responds to authentication challenge with identity and signature.
Contains the client’s public Identity and a ChallengeResponse (signature).
The server verifies the signature to authenticate the client.
GetRendevouz
Client requests a temporary rendezvous code.
The server will generate a unique code (format: “ABC-DEF-GHI”) and send it back
via Messages::RendevouzInfo. The code expires after 5 minutes.
RendevouzInfo(RendevouzCode)
Server responds with the generated rendezvous code.
The code can be shared with other clients to enable them to discover
this client’s identity via Messages::GetIdentity.
GetIdentity(RendevouzCode)
Client looks up an identity using a rendezvous code.
If the code is valid and hasn’t expired, the server responds with
Messages::IdentityInfo. Codes are single-use and deleted after lookup.
IdentityInfo
Server responds with the identity associated with a rendezvous code.
Contains both the IdentityFingerprint (SHA256 hash) and full Identity
(public key). After sending this, the rendezvous code is deleted.
Fields
fingerprint: IdentityFingerprintSHA256 fingerprint of the identity’s public key
Send
A message routed from one client to another through the proxy.
When sent by clients, only contains destination and payload. The source is automatically set by the proxy based on the authenticated identity. When forwarded to recipients, includes the validated source fingerprint.
Fields
source: Option<IdentityFingerprint>The authenticated sender’s fingerprint (added by proxy)
destination: IdentityFingerprintThe recipient’s fingerprint