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
@@ -1477,6 +1477,37 @@ export const settingsDict = {
'settings.remoteInstances.clientAuth.state.thisDevice': 'To urządzenie',
'settings.remoteInstances.clientAuth.lastUsed': 'Ostatnio użyto {date}',
'settings.remoteInstances.clientAuth.neverUsed': 'Nigdy nie użyto',
'settings.remoteInstances.relay.title': 'OpenChamber Relay',
'settings.remoteInstances.relay.description': 'Pozwól swoim innym urządzeniom łączyć się z dowolnego miejsca bez otwierania portów. Ruch jest szyfrowany od końca do końca — relay nie może go odczytać.',
'settings.remoteInstances.relay.enableHint': 'Nic nie jest udostępniane, dopóki nie włączysz relay na tym serwerze.',
'settings.remoteInstances.relay.actions.enable': 'Włącz Relay',
'settings.remoteInstances.relay.actions.disable': 'Wyłącz',
'settings.remoteInstances.relay.confirm.disable': 'Wyłączyć relay? Urządzenia połączone przez niego zostaną natychmiast rozłączone.',
'settings.remoteInstances.relay.state.loading': 'Sprawdzanie stanu relay...',
'settings.remoteInstances.relay.state.disabled': 'Wyłączony',
'settings.remoteInstances.relay.state.connecting': 'Łączenie',
'settings.remoteInstances.relay.state.connected': 'Połączono',
'settings.remoteInstances.relay.state.reconnecting': 'Ponowne łączenie',
'settings.remoteInstances.relay.state.error': 'Błąd',
'settings.remoteInstances.relay.status.clientsOne': '{count} urządzenie połączone',
'settings.remoteInstances.relay.status.clientsMany': 'Połączone urządzenia: {count}',
'settings.remoteInstances.relay.pair.title': 'Sparuj urządzenie',
'settings.remoteInstances.relay.pair.labelPlaceholder': 'Nazwa urządzenia (opcjonalnie)',
'settings.remoteInstances.relay.pair.includeToken': 'Dołącz token dostępu (parowanie jednym skanem)',
'settings.remoteInstances.relay.pair.noTokenHint': 'Bez tokenu urządzenie zaloguje się po połączeniu hasłem interfejsu tego serwera.',
'settings.remoteInstances.relay.pair.generate': 'Utwórz link parowania',
'settings.remoteInstances.relay.pair.requiresConnected': 'Parowanie będzie dostępne, gdy relay zostanie połączony.',
'settings.remoteInstances.relay.pair.linkLabel': 'Link parowania',
'settings.remoteInstances.relay.pair.warning': 'Ten link daje dostęp do tego serwera. Nie udostępniaj go.',
'settings.remoteInstances.relay.pair.qrAlt': 'Kod QR parowania relay',
'settings.remoteInstances.relay.pair.showQr': 'Pokaż kod QR',
'settings.remoteInstances.relay.pair.qrDialogTitle': 'Zeskanuj, aby sparować',
'settings.remoteInstances.relay.pair.qrDialogDescription': 'Zeskanuj ten kod QR aplikacją OpenChamber na drugim urządzeniu.',
'settings.remoteInstances.relay.pair.manageHint': 'Zarządzaj sparowanymi urządzeniami lub odbieraj im dostęp na liście „Połączenie z tym serwerem” powyżej.',
'settings.remoteInstances.relay.toast.enableFailed': 'Nie udało się włączyć relay',
'settings.remoteInstances.relay.toast.disableFailed': 'Nie udało się wyłączyć relay',
'settings.remoteInstances.relay.toast.offerFailed': 'Nie udało się utworzyć linku parowania',
'settings.remoteInstances.relay.toast.linkCopied': 'Skopiowano link parowania',
'settings.remoteInstances.sidebar.toast.retriedWithRandomPort': 'Ponowiono próbę z losowym lokalnym portem',
'settings.remoteInstances.sidebar.toast.retryFailed': 'Nie udało się ponowić połączenia',
'settings.remoteInstances.sidebar.total': 'Suma: {count}',