feat: add an ant-core-powered direct browser client - #186
Conversation
Adopt browser protocol v5 and manifest v6. Validate upload nodes against chain ID and payment contracts while leaving RPC provider selection to browser applications.
|
Independent review of this PR at head The quote path is the strongest part of the stack. The browser independently verifies the ML-DSA-65 quote signature, recomputes the EVM quote hash, binds peer and content, and checks the commitment sidecar envelope against its encoded form (ant-core/src/browser/payment.rs:76-155, 167-217), so a hostile node cannot make a browser pay against a hash the node will later reject. Every fetched record is BLAKE3-verified against the requested address. The drift guards deserve a specific mention. The portable crate necessarily duplicates the quote signing layout, the price curve and the commitment encoding, and ant-core/src/browser/payment.rs:336-390 asserts This PR has never run CI
That matters more than it would for a browser-only change, because this is not a browser-only change. The new I compared the extracted logic against the base line by line and found no reachable behavioural change to quote collection width, witness quorum, upper-median selection, already-stored majority, PUT ordering, payment amounts, retry counts and delays, or transfer-failure classification. The refactor looks faithful. But nothing executes it, including the drift guards above, and those guards are the reason a reader would trust the portable crate at all. A browser upload can pay and lose the moneyIn ant-core/src/browser/wasm_transport.rs:2080-2110, after
The public API's only recourse is to call it again, which re-quotes and pays a second time. The native client is explicitly built to avoid this. ant-core/src/data/client/file.rs:2044, 2235, 2281 maintain a resumable receipt cache so that a mid-upload failure "leaves a resumable receipt" and a retry "hits the receipt before paying again". Grepping the whole One hostile responder can suppress the trusted seedsant-core/src/browser/wasm_transport.rs:1145-1152 inserts every returned candidate carrying a let mut initial_candidates = self.routing.borrow().values().cloned().collect::<Vec<_>>();
if initial_candidates.is_empty() {
initial_candidates = join_all(seed_futures).await...;
}Seeds are consulted only when the routing map is empty. One responder returning up to Worth fixing before this shipsThe compiled-in trust anchor does not exist. ant-node's ADR-0009 states that the web client contains a constant list of bootstrap Transfer deadlines use the adjustable wall clock. wasm_transport.rs:2846, 2873 and 3006 build every send and receive deadline from The response deadline does not allow for node processing time. The shared module models transfer time only. The node's write deadline starts when it begins writing; the browser's starts when it begins waiting and is initialised from the request frame size (wasm_transport.rs:522, 551). For a small Staged descriptors are not tied back to the stored DataMap. wasm_transport.rs:2596-2626 checks only that the last record's address and size match the declared DataMap record. It does not decode that DataMap and compare There is no spend ceiling. The policy accepts one to seven quotes and pays 3x the upper median with no caller-supplied maximum or deviation limit, and a quote's ADR-0003 documents protocol v4 while the code ships v5. Lines 68, 154 and 192 specify v4 and say v4 clients and node listeners must be deployed together. The shipped constants are Smaller things
Test fidelity
These are good client-policy tests. They do not prove browser-to-node interoperability, and there is no test anywhere in the four repos that runs a real browser against a real node. The Playwright suite that did exist, What I could not checkNothing was built or run. Private key lifetime, wallet provider behaviour, IndexedDB durability, workers and service workers live in the separate SDK repo. The PR conflicts with main, so the eventual resolution was not reviewable. |
Summary
Adds a direct Autonomi browser client powered by ant-core compiled to WebAssembly.
The browser connects to storage nodes over WebRTC Direct, authenticates their ANT identities, establishes a fresh post-quantum application session, performs iterative closest-node lookup, verifies quotes, pays once, uploads content-addressed records, resolves public DataMaps, downloads/reconstructs files, and serves seekable media ranges without an application gateway.
Compatibility-sensitive behavior stays in Rust. JavaScript is limited to browser-owned boundaries: DOM interaction, file/save handles, worker and IndexedDB integration, service-worker messaging, and submitting an ant-core-verified payment plan through the wallet provider.
Companion node implementation: ant-node#220
ant-core architecture
The native facade is unchanged. Existing Rust desktop applications and ant-cli continue to use the native QUIC client without source changes; only browser-wasm selects the WebRTC adapter.
Post-quantum WebRTC application session
Browser protocol v4 replaces the former plaintext v3 RPC channel and standalone ML-DSA HELLO challenge:
The handshake, key derivation, replay protection, sequence handling, outer framing, and bounds all come from the shared ant-protocol module. JavaScript contains no parallel cryptographic protocol.
WebRTC still supplies certificate-pinned DTLS, ICE, SCTP, and DataChannel transport. The application session protects RPC and chunk plaintext against later compromise of only the classical DTLS key exchange, but it does not hide transport metadata, lengths, timing, or make the WebRTC stack itself post-quantum secure.
Browser workflows
Paid uploads
Public downloads
Random-access streaming
Compatibility and rollout
Coordinated draft stack
Draft dependencies are pinned by immutable Git SHA so CI does not depend on sibling worktrees.
Risk tier
Reason: the client implements a new public transport/RPC surface and performs quote, payment, and storage operations while deliberately preserving existing native and stored-data formats.
Test evidence
Current-head protocol-v4 validation:
Earlier headless-Chromium and public-testnet results validated WebRTC connectivity, decentralized lookup, range streaming, and paid uploads under protocol v3. They are useful transport evidence but do not validate the new v4 record layer. A real browser run against a matching deployed v4 node fleet remains required.
New dependencies
Rust/WASM surface:
ADR
The browser architecture is covered by ADR-0003. The node-side transport and v4 cryptographic design are covered by ant-node ADR-0009.
Mitigation / rollback
Do not build or ship browser-wasm, and keep using the default native feature. Native ant-core, ant-cli, QUIC networking, and existing stored data remain available independently.
Remaining draft work