feat: add WebRTC-Direct support - #220
Conversation
9f6b794 to
d757795
Compare
Advertise chain ID and payment contracts in protocol v5 and browser manifest v6. Resolve custom chain IDs privately at listener startup and cover credential privacy with encrypted HELLO and manifest regressions.
|
Independent review of this PR at head The server-side work is solid where it counts. The PQ handshake is genuinely unbypassable: I also classified every The listener is enabled by default, and its failure stops the node
Four things make that hard to back out of:
Certificate persistence is also not atomic: Worth knowing on the dependency side: Two CI checks are redThe ADR governance job fails because Relatedly, the MSRV move from 1.75 to 1.91 exists to allow Worth fixing before this shipsThe derived port is not stable by default. A valid A partial config section inverts the default. [webrtc_direct]
max_connections = 48
Storage errors reach anonymous browsers. src/web_rtc.rs:1503 returns Per-IP limits do not aggregate IPv6.
Test fidelity and validation gapsThe five-node devnet test is valuable native interoperability coverage, but it is not browser coverage and does not test the browser client. Three more specific gaps:
ADR-0009 is admirably candid that there is no automated real-browser v5 flow and that Chrome, Firefox and Safari interop remain unmet acceptance criteria rather than claimed results. That is the right way to write it up. The tension is that an explicitly unmet acceptance criterion currently ships enabled by default. For operations, what exists is startup logging, an endpoint file, static resource knobs, fail-fast startup and shutdown ordering. There is no listener health or readiness metric, no DHT reachability probe, no saturation alert, no runtime disable flag, no certificate backup or rotation procedure, no child-readiness handshake in the upgrader, no browser-aware rollback test and no firewall or NAT verification workflow. Smaller things
What I could not checkNothing was built or run: the pinned cross-repo revisions are not in a local cargo cache here. No real browser, no NAT or firewall path, no mixed-version fleet, and no measurement of the resource envelope under load. |
Summary
Adds a direct, gateway-free browser endpoint to ant-node.
Browser clients can cold-bootstrap from one self-contained WebRTC Direct multiaddress, authenticate the node's persistent ML-DSA identity, establish a fresh ML-KEM-derived application session, walk the DHT themselves, read immutable chunks, obtain signed storage quotes, and submit paid immutable writes directly to closest storage nodes.
The HTTP manifest used by the local demo carries bootstrap metadata only. It never proxies file bytes, performs lookup for the browser, or receives wallet secrets.
Companion browser client: ant-client#186
Architecture
Direct browser transport
Shared post-quantum application session
Browser protocol v4 removes the former plaintext v3 RPC channel and standalone ML-DSA HELLO challenge.
Before reading any RPC, the listener:
Every later request and response, including HELLO, FIND_NODE, GET_CHUNK, QUOTE_CHUNK, PUT_CHUNK, errors, headers, and raw chunk bytes, is protected with ordered ChaCha20-Poly1305 records. Per-direction 64-bit sequences reject replay and reordering. Malformed handshakes, wrong identities, modified ciphertext, unexpected sequences, and authentication failures close the association.
The client and node use the same ant-protocol handshake, key derivation, encrypted-record, framing, and bounds implementation. ant-node owns only the RPC adapter and request admission logic.
Security boundary
The multiaddress certificate fingerprint still authenticates the WebRTC DTLS connection. The application session independently authenticates the ANT peer ID and protects RPC plaintext with post-quantum-derived keys.
This means compromise of only the classical DTLS key is insufficient to impersonate the ANT node or decrypt captured application records. It does not make ICE, DTLS, SCTP, certificate handling, packet lengths, timing, availability, or the WebRTC stack itself post-quantum secure.
The session authenticates the node to the browser, not the browser user to the node. Client authority remains method-specific; paid storage still requires the normal wallet transaction and verifiable payment proof.
Browser RPC surface
The versioned browser protocol remains deliberately narrow:
The node reuses native quote, commitment, pricing, payment-proof, content-address verification, and PUT admission behavior. Browser sessions are not inserted into routing tables and cannot invoke arbitrary DHT operations.
Endpoint discovery and deployment
Coordinated draft stack
Draft dependencies are pinned by immutable Git SHA so this branch builds outside the sibling-worktree development setup.
Risk tier
Reason: this adds a public node transport/protocol and V2 DHT endpoint-discovery path. It intentionally reuses existing stored-data and payment formats.
Compatibility
Test evidence
Current-head protocol-v4 validation:
Earlier headless-Chromium and independently deployed public-testnet tests validated WebRTC connectivity, multi-node lookup, range streaming, and paid uploads under protocol v3. They remain useful transport evidence but do not validate v4. A matching v4 testnet must be deployed for the next real-browser run.
ADR
ADR-0009: Direct browser clients over WebRTC Direct now records:
The ADR remains Proposed pending human review.
New dependencies
Mitigation / rollback
Disable webrtc_direct.enabled or build without the default WebRTC feature. Native QUIC, existing ant-core/ant-cli clients, payment behavior, and stored data remain usable independently.
Remaining draft work