feat: add private relay for end-to-end-encrypted remote access (#2087)

Adds OpenChamber Relay — an opt-in way to reach an instance from a phone,
browser, or another desktop from anywhere, with no open inbound ports, no
tunnel, and no shared LAN. The instance dials outbound to a relay; all app
traffic (HTTP, the event stream, terminal, dictation) is multiplexed and
encrypted through a single connection per client, so the relay only ever
forwards opaque ciphertext.

Transport
- End-to-end-encrypted channel over WebCrypto (ECDH P-256 -> HKDF ->
  AES-256-GCM) with a capability-negotiated handshake and a small
  HTTP/SSE/WebSocket multiplexing protocol. A byte-compatible JS host mirror
  is cross-checked by tests.
- Host: outbound connection manager, per-client tunnel dispatcher to the local
  server over loopback, reuse of the existing instance identity key, and
  management routes. Disabled by default; explicit opt-in.
- Client: plugs into the existing runtime layer (runtime-fetch/-url/-switch/
  -auth, event pipeline, terminal, dictation) so features work over the relay
  unchanged; direct-URL and Electron realtime-proxy paths are untouched.

Pairing & UX
- Relay section in Settings -> Remote Instances (live status, QR/link pairing,
  revocation via the existing client-token list) and the mobile connect flow.
- Frame batching and idle-gated keepalive keep tunnel message volume low
  without affecting streaming smoothness.

Security
- The tunnel is transport only; the server authenticates every tunneled
  request exactly as for a direct remote client.
  fragments only. The relay stores no keys, tokens, or payloads.

Operability
- The endpoint can be pinned to a self-hosted rel
  paired clients inherit it from the offer automatically.
- Relay module DOCUMENTATION.md and a relay-trans
  invariants that future WebSocket/streaming changes must follow.

The relay transport is complete and tested; the UI for enabling and pairing
is gated behind openchamber_relay_gate and stays
This commit is contained in:
Bohdan Triapitsyn
2026-07-08 03:44:02 +03:00
committed by GitHub
parent 42e470cefa
commit 859b4529da
74 changed files with 7768 additions and 99 deletions
@@ -254,6 +254,37 @@ export const settingsDict = {
"settings.remoteInstances.clientAuth.state.thisDevice": "Цей пристрій",
"settings.remoteInstances.clientAuth.lastUsed": "Останнє використання {date}",
"settings.remoteInstances.clientAuth.neverUsed": "Ще не використовувався",
"settings.remoteInstances.relay.title": "OpenChamber Relay",
"settings.remoteInstances.relay.description": "Дозволяє вашим іншим пристроям підключатися звідки завгодно без відкриття портів. Трафік шифрується наскрізно — релей не може його прочитати.",
"settings.remoteInstances.relay.enableHint": "Нічого не передається, доки ви не увімкнете релей на цьому сервері.",
"settings.remoteInstances.relay.actions.enable": "Увімкнути Relay",
"settings.remoteInstances.relay.actions.disable": "Вимкнути",
"settings.remoteInstances.relay.confirm.disable": "Вимкнути релей? Пристрої, підключені через нього, будуть негайно відключені.",
"settings.remoteInstances.relay.state.loading": "Перевірка стану релею...",
"settings.remoteInstances.relay.state.disabled": "Вимкнено",
"settings.remoteInstances.relay.state.connecting": "Підключення",
"settings.remoteInstances.relay.state.connected": "Підключено",
"settings.remoteInstances.relay.state.reconnecting": "Повторне підключення",
"settings.remoteInstances.relay.state.error": "Помилка",
"settings.remoteInstances.relay.status.clientsOne": "Підключено пристроїв: {count}",
"settings.remoteInstances.relay.status.clientsMany": "Підключено пристроїв: {count}",
"settings.remoteInstances.relay.pair.title": "Спарувати пристрій",
"settings.remoteInstances.relay.pair.labelPlaceholder": "Назва пристрою (необов'язково)",
"settings.remoteInstances.relay.pair.includeToken": "Додати токен доступу (спарювання одним скануванням)",
"settings.remoteInstances.relay.pair.noTokenHint": "Без токена пристрій після підключення входить за паролем інтерфейсу цього сервера.",
"settings.remoteInstances.relay.pair.generate": "Створити посилання для спарювання",
"settings.remoteInstances.relay.pair.requiresConnected": "Спарювання стане доступним після підключення релею.",
"settings.remoteInstances.relay.pair.linkLabel": "Посилання для спарювання",
"settings.remoteInstances.relay.pair.warning": "Це посилання надає доступ до цього сервера. Не діліться ним.",
"settings.remoteInstances.relay.pair.qrAlt": "QR-код спарювання релею",
"settings.remoteInstances.relay.pair.showQr": "Показати QR-код",
"settings.remoteInstances.relay.pair.qrDialogTitle": "Скануйте для спарювання",
"settings.remoteInstances.relay.pair.qrDialogDescription": "Відскануйте цей QR-код застосунком OpenChamber на іншому пристрої.",
"settings.remoteInstances.relay.pair.manageHint": "Керуйте спареними пристроями або відкликайте їх у списку «Підключення до цього сервера» вище.",
"settings.remoteInstances.relay.toast.enableFailed": "Не вдалося увімкнути релей",
"settings.remoteInstances.relay.toast.disableFailed": "Не вдалося вимкнути релей",
"settings.remoteInstances.relay.toast.offerFailed": "Не вдалося створити посилання для спарювання",
"settings.remoteInstances.relay.toast.linkCopied": "Посилання для спарювання скопійовано",
"settings.remoteInstances.sidebar.phase.ready": "Готово",
"settings.remoteInstances.sidebar.phase.error": "Помилка",
"settings.remoteInstances.sidebar.phase.reconnect": "Повторне підключення",