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
@@ -287,6 +287,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': 'リレーを有効にする',
'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': 'アクセストークンを含める(1回のスキャンでペアリング)',
'settings.remoteInstances.relay.pair.noTokenHint': 'トークンなしの場合、デバイスは接続後にこのサーバーのUIパスワードでサインインします。',
'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': '他のデバイスのOpenChamberアプリでこのQRコードをスキャンします。',
'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': '再接続',