Skip to content

Carry a paired phone's HTTP over its encrypted socket on the local network - #6767

Merged
hurttlocker merged 1 commit into
mainfrom
feat/mobile-lan-encrypted-http
Nov 24, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
feat/mobile-lan-encrypted-http

Conversation

@hurttlocker

Copy link
Copy Markdown
Collaborator

What changes

A paired phone on the local network can send its HTTP requests over its existing end-to-end encrypted WebSocket instead of plain HTTP.

  • A device socket that completed the encrypted handshake may send http-req frames. They are replayed to the local API exactly like relay frames: the request is stamped as remote, never as loopback, so the device bearer is gated by the same device route list.
  • The bearer in a frame must belong to the socket's own device; any other bearer gets 403 device_mismatch.
  • Operator sockets and sockets that have not finished the handshake get 403 encrypted_device_socket_required and nothing reaches the API.
  • e2ee-ready now carries data: { http: 1 }, so a phone build can tell this desktop supports it and fall back to direct HTTP on an older desktop.
  • Open requests are aborted when the socket closes.

Nothing changes for current phone builds. A follow-up phone change uses this path; after a phone build with it is released, a later change can refuse device bearers on plain non-loopback HTTP.

Tests

  • tests/mobile-lan-encrypted-http-real-path.test.ts starts the real WebSocket server on a non-loopback address with a seeded device, completes the encrypted handshake, and checks:

    • e2ee-ready advertises http: 1;
    • an encrypted http-req reaches the local API as a remote request with the device's own bearer and comes back as an encrypted http-res;
    • a different bearer gets 403 and never reaches the API.

    Against main's server it fails on the missing advertisement.

  • src/lib/mobile/lan-encrypted-http.test.ts: operator sockets, a socket mid-handshake and an unencrypted device socket are refused without a fetch.

  • npm run typecheck:fast, npm run verify:ci.

🤖 Generated with Claude Code

…n the local network

A device socket that finished the encrypted handshake can now send http-req
frames, which are replayed to the local API the same way relay frames are.
The bearer in the frame must belong to the socket's own device. e2ee-ready
advertises the capability as data.http = 1 so a phone build can choose it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/L Pull request with L diff size label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

🔍 PR Review Bot

Metric Value
Files changed 5
Additions +332
Deletions -1
New files 3

Automated review — CI workflow

@hurttlocker
hurttlocker added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit a58bfbd Nov 24, 2026
34 checks passed
@hurttlocker
hurttlocker deleted the feat/mobile-lan-encrypted-http branch November 24, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Pull request with L diff size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant