Skip to content

WalletConnect: the connector capsule owns its sessions, relay and signing (#575) - #597

Draft
andersalm wants to merge 144 commits into
developfrom
feat/575-walletconnect-runtime
Draft

andersalm wants to merge 144 commits into
developfrom
feat/575-walletconnect-runtime

Conversation

@andersalm

@andersalm andersalm commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Deepen notes

  1. Expert view: Trace access decisions through the open window and SDK cleanup; prove recovery with the real SDK while preserving revision and launch fences.
  2. Raw material: Pinned f6b2562fd: capsules/wallet-walletconnect/browser/wallet-walletconnect.js:40-63, walletconnect-client.mjs:82-134, elastos/crates/elastos-server/src/api/gateway_walletconnect.rs:410-425,507-564; installed A/B HTTP recordings preceded edits. The original walk recovered in newly opened windows.
  3. Methods: Replay the retained Home, record stale If-Match and exact HTTP bodies, inspect pinned SDK and Git history, run fail-before/pass-after window/client and real-route tests.
  4. Independent check: Local head 6f7c1d9f0, tree e9866480afce8b7bfc8e158bbe75b1fb76df0af6: 188/188 narrow cases with 186 unchanged names and two stronger return assertions; 110/110 product-data cases; syntax, format and launch smoke PASS. Exact-head Linux format, all-target server Clippy and WalletConnect tests PASS (438 s). Final return/launch checks PASS 20/20, including a held off-state reply across Allow. Current local development and adversarial source reviews PASS. Fresh installed acceptance and publication remain with Main.

Earlier implementation notes (through round 13)

These notes retain the broader feature context and earlier evidence. Current-candidate verification is above.

Deepen notes

  1. Expert view: trace every async admission and listing caller, and preserve the other connectors' behavior through both success and error paths.
  2. Raw material: pinned round-12 head e5772eaa5, capsules/wallet/browser/wallet-requests.js:179, elastos/crates/elastos-server/src/api/gateway_wallet_connectors.rs:307-413, and the complete Fable and Opus round-12 reviews.
  3. Methods: merge current develop; import real JS modules; test cache reads, worker identity, poisoned-lock recovery and a parent-directory swap; run Clippy, the shared-lease Mac gates, and both slot-4 Linux checks on committed HEAD.
  4. Independent check: the new regression guards fail without their fixes and pass with them. The complete Mac gate (all 17 browser smokes, Wallet smokes, source/behavior, Rust, JS, formatting and Clippy) and standard/full Linux checks pass on local 1c9cf51852 (tree 897053a22f). Main holds the private receipts and owns current-head review and hosted CI after publication. The round-12 Fable/Opus PASS verdicts cover e5772eaa5.

Draft: not for merge yet

Open as a draft so CI runs and the work is visible. Before it is ready: Irzhy's review of the network and session boundary (#575 says this comes first), the independent review of the latest commits, and Anders's trial with a real phone wallet.

What changes

  • The SDK runs only in the connector capsule, in an opaque-origin frame. Each Home keeps its own pairing and session keys in Runtime storage.
  • The connector's own launch authorizes its storage, relay admission and signing. Home-wide authority no longer works on those routes; Inbox, expired and revoked launches are refused.
  • Consent as for Browser (Browser uses this computer's internet only after the owner grants it, as a revocable capability #559): one Inbox approval with the passkey after sign-in, and Turn Off in the same Inbox entry, which fences storage, admission and open sockets.
  • Egress: only the two WalletConnect relay hosts on port 443, through the Home's local Exit, with per-Home socket, heartbeat and idle limits. The WalletConnect backend cannot shadow Browser's, and a refused WalletConnect configuration leaves Browser's Exit running.
  • WebKit: the resource guard admits only a real WebSocket handshake to the exact relay path at the opaque origin; documents, frames, scripts and other origins stay refused, and the single-use ticket stays the authority.
  • Signing: each request is bound to principal, connector, state, expiry, payload hash and signer. Typed-data requests are refused before approval (the pinned adapter does not negotiate that method).
  • Project ID: supplied only through a private file; the release step writes the secret to an owner-only file for the one step that needs it.
  • Installed by default, hidden until configured: Home installs the connector and its pinned adapter by default (WalletConnect: connect a phone wallet from the desktop app (finish the existing connector) #575). With no project configured it is not offered and cannot be launched; the setup smokes now prove installed, then hidden and refused, then offered once configured.
  • After the Inbox approval, Home reopens the connector in its own bounded window. Inbox may ask Home to open only that one target, with an empty query, and gets no wallet authority.
  • Which Exit carries the relay: Browser's backend when its helper runs (existing matching order kept); WalletConnect's own backend when it does not.
  • Unfinished approved sends stay visible in Wallet's Activity and the owner can dismiss them with Dismiss, which releases the slot. The phone wallet owns any transaction it has broadcast.

Proven

  • Scripted wallet on the real relay, through the real Exit binaries, in Chromium and WebKit: QR, pairing, reload and a fresh gateway restart keep the same session.
  • Headless installed Mac Home in both engines: passkey sign-up, QR, pairing, signed link, reload, restart and disconnect.

Known limits

  • In WebKit, after a whole Home restart, the connector frame alone does not recover the session; refreshing Home does.
  • Not yet tried on an installed Home: the transaction approval card, account and network changes, Turn Off in Inbox, and a real phone wallet.
  • Open for Irzhy: guests relay on the owner's consent while Browser internet is owner-only; unadmitted sockets share one pool of 16; an old connector window can still record the hash of an already approved send after Turn Off, within the same session.
  • Wallet sign-up at first run is not in this change (Sign-in and recovery: one identity across devices and Homes (design question) #574).

Part of #575.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant