Repository navigation
docs: add the web screens protocol spec - #3537
vpetersson-bot wants to merge 10 commits into
Conversation
Web screens are TVs that only open tv.anthias.io, pair by showing a code that the operator types into a controller, and are then managed over a direct WebRTC data channel on the LAN. This spec is what the relay, the controller and the web client get built against: the relay REST and WebSocket API, the signed signalling envelope, the check code, the data-channel messages and media transfer, and the boundary of the new anthias-webrtc process. It includes test vectors. No code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
aiortc was run in a container on Docker's default bridge network, with UDP 40000-40049 published and the host candidates rewritten to the host's LAN address. Kiosk Chrome on a public origin connected with no Local Network Access prompt, at 35-39 MB/s against 38-41 MB/s for aiortc running on the host. Without the change to the candidates it did not connect at all. The spec now records that aioice needs a small override for both the port range and the advertised address, that ports are freed when a session closes (so 50 is a cap on concurrent sessions), that candidates are IPv4 only in v1, and that aiortc must be given an empty ICE server list explicitly, because its default uses a public STUN server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
An independent review found that the trust lifecycle and several recovery rules weren't tight enough to build against. This revision: - gates pairing on operator verification: a commitment-based SAS with fresh randomness on both sides, typed by the operator, and nothing released until both sides are verified; - makes relay notices advisory, so only a revocation signed by the pinned peer can unpair, and adds a co-signed binding statement that restores bindings after relay data loss; - documents the supported browser matrix and the risk of Chrome bringing WebRTC under Local Network Access; - makes /reset non-destructive on load, refuses it in a frame, and requires a controller token or a tv_id prefix; - treats DTLS certificates as per-session, authenticated by the signed SDP, so they can rotate freely; - addresses media by SHA-256, ends files with an in-band end frame, and finishes a download only once the full range is flushed and hashed; - lengthens pairing codes to 10 symbols, adds global abuse limits, replaces timestamp windows with wake challenges, and adds a durable event outbox, per-TV media authorisation and message-size limits; - records failure behaviour, a threat model, release gates, and a reference deployment of the relay in Rust on Fly.io. Test vectors are regenerated for every changed derivation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
The verification code in the previous revision could be computed by whoever claimed the TV, so typing it proved nothing to the TV. Pairing now follows the Magic Wormhole pattern instead. The TV shows a 12-symbol code: a 4-symbol lookup that goes to the relay, and an 8-symbol secret that never leaves the screen. The controller and TV run SPAKE2 with the secret as the password, bound to both identity keys and the pairing id, and finish with key confirmation, controller first. The TV allows one attempt per code. python-spake2 0.9 and the RustCrypto spake2 0.4 crate were checked to interoperate before naming them. Also: - the relay no longer stores or delivers revocations, and orphaned bindings expire; - restoring a binding needs fresh signed consent from both peers over a relay challenge, never an old statement alone, and never overwrites a different current binding; - envelopes carry a negotiation number, with explicit rules for the initial offer and for ICE restarts; - split ctl messages are sized by encoded bytes, with limits on open assemblies, their total size and their lifetime; - section 12 states the online guessing bound under a global claim cap. Test vectors are updated for the new code format, key confirmation, envelopes and restore consent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
The guessing bound in section 12 relied on the relay enforcing its own global claim cap, and on a 10-minute code lifetime that doesn't limit attempts once a failure burns the code and issues a new one. Each TV now keeps a persistent count of failed PAKE runs. After the k-th consecutive failure it waits min(5 s * 2^k, 15 min) before asking for a new code, and it accepts at most 48 failed runs in any rolling 24 hours before pausing pairing. A success or a local reset clears the count. Section 12 now states the per-TV bound, 48 * 2^-40 per day, which holds even against a malicious relay, and labels the fleet-wide estimate as assuming an honest relay. Gate G6 tests the counter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
tv.anthias.io is deployed with the existing Pages workflow in the Anthias-Web repo, and GitHub Pages can't send response headers. The spec stops relying on them: - framing is refused by the app itself (it does nothing when window.top isn't window.self), since frame-ancestors only works as a header; /reset still needs a token or the typed tv_id prefix; - the CSP becomes a meta element, listed in full, with 'wasm-unsafe-eval' for the SPAKE2 WebAssembly, and with what a meta CSP can't enforce spelled out; - without COOP/COEP there is no SharedArrayBuffer, which nothing in the protocol needs, and dependencies that need it are ruled out; - client routes rely on the existing 404.html copy and the service worker, with reset parameters kept in the fragment; - deploy access in the threat model becomes the GitHub repo and org: branch protection, a protected github-pages environment, who can change the custom domain, and verifying anthias.io in the org. Section 14 now covers both reference deployments, and gate G6 tests the CSP and the framing check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
The reference relay moves from Rust on Fly.io to TypeScript on Cloudflare Workers with Durable Objects, in the account that holds the anthias.io DNS. - Section 14.1 describes the objects: one per controller, holding the controller's socket and its TVs' sockets; one per unpaired TV, since an object holds at most 32,768 hibernated sockets; and a registry for lookups, the global caps and failed-claim limits. All of them use the WebSocket Hibernation API and SQLite storage. - Deploys use deferred code updates, so hibernated sockets stay connected and there is no fleet-wide socket drop. - Losing relay storage is now described as unlikely; restore by fresh consent still applies. - Ping and pong are byte-exact so the relay can answer them without waking an object. - Sockets carry their own id as an untrusted routing hint, and close code 4302 asks a client to reconnect at once after routing changes, for example right after a claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
The socket routing hint is untrusted, so anyone who knows a controller_id could open sockets into that controller's Durable Object. The Worker now rate-limits unauthenticated connections per IP before routing, each object allows at most 64 sockets waiting to authenticate (close 4503) with a 10 s deadline (close 4408), and waiting sockets are kept out of the object's state so it can still hibernate. Gate G6 tests a flood against a controller's bound TVs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
The managed client is served from web.anthias.io rather than tv.anthias.io. No signed test vector or label includes the origin, so none change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
web.anthias.io now deploys only through deploy-cloudflare.yml, so response headers are available again. The CSP is served from the _headers file, with frame-ancestors 'none' as the primary guard against framing; the meta copy stays as a fallback and the window.top check stays as defence in depth. connect-src now names the Google Analytics and Sentry endpoints the client already uses. Routing uses the _redirects rewrite instead of the 404.html copy. The threat model's deploy access becomes the Cloudflare account and the repo's deploy token, the GitHub domain-verification note is gone, and gate G6 checks the headers on the deployed response. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
|



What this adds
docs/web-screens-protocol.md, a draft v1 protocol spec for web screens. A web screen is a TV or kiosk that only openshttps://web.anthias.io:This PR is documentation only. No code changes.
Why a spec first
Three components will be built against it in parallel:
anthias-webrtcprocess;All three need the same wire formats, state machines, signing rules and test vectors first.
What it covers
spake20.4 crate as WASM on the TV), bound to both identity keys, with key confirmation./resetis non-destructive when loaded, refuses to run in a frame, and needs a controller token or the TV's id prefix. Replace screen covers a TV that has lost its storage.anthias-webrtcprocess: what it owns, its internal API, a durable event outbox, and how it works with bridge networking (a published UDP range, and host candidates rewritten from the host agent'sip_addresses).frame-ancestorsserved as response headers), release gates, and test vectors.How it was checked
cryptographyfrom fixed private scalars, and every signature was verified after generation.fetch()to the LAN address was held by a Local Network Access prompt; the WebRTC data channel was not.🤖 Generated with Claude Code