1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! Protocol message types for client-relay communication.
//!
//! This module defines the message types used in the three-phase protocol:
//!
//! # Message Flow
//!
//! ## Phase 1: Authentication
//! 1. Server → Client: [`Messages::AuthChallenge`] - Random challenge for the client to sign
//! 2. Client → Server: [`Messages::AuthResponse`] - Client's identity and signature
//!
//! ## Phase 2: Rendezvous (Optional)
//! 3. Client → Server: [`Messages::GetRendezvous`] - Request a temporary code
//! 4. Server → Client: [`Messages::RendezvousInfo`] - The generated code (e.g., "ABC-DEF-GHI")
//! 5. Client → Server: [`Messages::GetIdentity`] - Look up identity by code
//! 6. Server → Client: [`Messages::IdentityInfo`] - The identity associated with the code
//!
//! ## Phase 3: Messaging
//! 7. Client → Server: [`Messages::Send`] - Client sends message (destination + payload only)
//! 8. Server → Client: [`Messages::Send`] - Server forwards with validated source added
//!
//! All messages are serialized as JSON over WebSocket connections.
use crate::;
use ;
/// Protocol messages exchanged between clients and the relay server.
///
/// Messages flow through three distinct phases: authentication, optional rendezvous
/// for peer discovery, and message routing between authenticated clients.