feat: connect through the OpenChamber private relay
A server can now be added by pasting an openchamber://connect pairing link. The one-time secret is redeemed over the first reachable candidate (direct addresses first, then the relay), and the device token is stored with the connection, so later launches reconnect without the link. The relay candidate carries the relay WebSocket URL, the host's routing id and its P-256 public key. The new transport opens one encrypted tunnel to the relay: P-256 ECDH + HKDF-SHA256 derive one AES-256-GCM key per direction; frames carry a version, a 12-byte IV and the GCM tag; a small mux carries HTTP, SSE and WebSocket sub-streams with fragmentation and ping/pong. Every request and the terminal socket ride it; WebSocket upgrades first mint the short-lived oc_url_token over the tunnel, since upgrades cannot send headers. Only the host's legacy path is negotiated (no batching, downstream flow control or body gzip). Pairing while connected switches servers like picking one in the list, which exposed and fixes a ChatScreen crash when app.chat is cleared during the switch. 0.4.4 (404).
This commit is contained in:
1 parent
a7bc380ac0
commit
902f1e18bb
20 files changed
+1918
-75
No files matched your search
@@ -43,7 +43,11 @@ class ChatScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ChatScreenState extends State<ChatScreen> {
|
||||
ChatState get chat => widget.app.chat!;
|
||||
/// The chat this page shows. Held rather than read from `app.chat` each
|
||||
/// time: switching servers clears `app.chat` while this widget is still on
|
||||
/// screen for one frame, and its timers and dispose must not trip on that.
|
||||
late final ChatState _chat;
|
||||
ChatState get chat => _chat;
|
||||
final TextEditingController _draftCtrl = TextEditingController();
|
||||
final FocusNode _inputFocus = FocusNode();
|
||||
final ScrollController _scroll = ScrollController();
|
||||
@@ -71,6 +75,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_chat = widget.app.chat!;
|
||||
chat.addListener(_onChat);
|
||||
_inputFocus.addListener(_onFocusChanged);
|
||||
if (chat.running) _startClock();
|
||||
|
||||
Reference in new issue
Block a user