change app icon
This commit is contained in:
parent
1aecbbee72
commit
7ad3679b51
5 changed files with 405 additions and 1 deletions
|
|
@ -36,7 +36,7 @@
|
|||
android:allowBackup="false"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="false"
|
||||
android:icon="@mipmap/onionwire_app_icon.png"
|
||||
android:icon="@mipmap/onionwire_app_icon"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:supportsRtl="true"
|
||||
|
|
|
|||
99
docs/arti-socks-feasibility.md
Normal file
99
docs/arti-socks-feasibility.md
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# Arti SOCKS Feasibility Report
|
||||
|
||||
**Date:** 2026-09-13
|
||||
**Scope:** Can OnionWire's in-process `arti-client` 0.46.0 expose a SOCKS5 listener for an external process (monero-wallet-rpc child) to route its daemon traffic through Tor?
|
||||
**Verdict:** **Not directly.** The `arti-client` library does not expose a configurable SOCKS proxy listener. See options below.
|
||||
|
||||
---
|
||||
|
||||
## What the docs say
|
||||
|
||||
### `arti-client` is an outbound client library, not a SOCKS server
|
||||
|
||||
From [docs.rs/arti-client/0.46.0](https://docs.rs/arti-client/0.46.0/arti_client/):
|
||||
|
||||
- The crate's public API surface is `TorClient::connect()`, `resolve()`, `bootstrap()`, etc. — all **outbound** connection primitives.
|
||||
- There is no public `socks_port()`, `set_socks_listener()`, or equivalent configuration method on `TorClient` or `TorClientConfigBuilder`.
|
||||
- `TorClientConfigBuilder` exposes: `storage`, `tor_network`, `channel`, `bridges`, `preemptive_circuits`, `circuit_timing`, `address_filter`, `stream_timeouts`, `vanguards`, `system`, `path_rules`, `download_schedule`, `directory_tolerance`. **No SOCKS listener configuration.**
|
||||
- The crate's own overview explicitly says: *"If you are trying to glue Arti to some other programming language, right now your best bet is probably to spawn the [`arti` CLI](https://tpo.pages.torproject.net/core/doc/rust/arti/index.html) SOCKS proxy, as a subprocess."*
|
||||
|
||||
This is a deliberate architectural statement: the library does not expose a SOCKS listener for external consumers.
|
||||
|
||||
### The SOCKS functionality lives in the `arti` binary, not the library
|
||||
|
||||
- The `arti` CLI (separate crate from `arti-client`) has a `proxy` subcommand: `arti proxy -l debug -p 9150`. This opens a SOCKS5 listener on the given port.
|
||||
- `tor-socksproto` (a lower-level arti crate) implements the SOCKS protocol encode/decode, and the docs say it's *"only used to provide a SOCKS proxy over the Tor network"* — but it's a protocol implementation, not a ready-made listener you can slot into `arti-client`.
|
||||
- `tor-hsrproxy` is for the **reverse** direction (onion service → local ports), not relevant here.
|
||||
|
||||
### The one hint that SOCKS exists internally
|
||||
|
||||
The `TorClient` docs say: *"This ObjectID for this object can be used as the target of a SOCKS stream."* This confirms SOCKS routing exists inside the arti RPC system, but it's an **internal** detail, not a public listener API. There's no method to expose "here's a port, connect external processes to it."
|
||||
|
||||
### `isolated_client` is relevant but not a SOCKS solution
|
||||
|
||||
`TorClient::isolated_client()` creates a new handle that shares state/config but doesn't share circuits. This is useful if you want separate isolation domains, but it doesn't give you a SOCKS listener.
|
||||
|
||||
---
|
||||
|
||||
## Why this matters for OnionWire
|
||||
|
||||
The payment plan's Backend 2 (local wallet child + remote onion daemon) needs the wallet child (`monero-wallet-rpc`) to reach a `.onion` daemon through a SOCKS5 proxy. The wallet child speaks plain SOCKS5 to `127.0.0.1:<port>` via `--proxy`. It does not use Arti's `connect()` — it's an external binary that only knows SOCKS5.
|
||||
|
||||
OnionWire already runs `arti-client` in-process for the messenger. The question was: can we configure that same Arti instance to also listen on a SOCKS port, so the wallet child just points `--proxy 127.0.0.1:<that port>` and everything routes through the same Tor client?
|
||||
|
||||
**Answer: no, not through `arti-client` 0.46.0's public API.**
|
||||
|
||||
---
|
||||
|
||||
## Options
|
||||
|
||||
### Option A: Bundle the `arti` binary as a SOCKS subprocess
|
||||
|
||||
Run the `arti` CLI (not `arti-client`) as a child process with `arti proxy -p <port>`. The wallet child points `--proxy 127.0.0.1:<port>` at it. The messenger continues using in-process `arti-client`.
|
||||
|
||||
**Pros:** Uses the real arti SOCKS proxy. No custom protocol code.
|
||||
**Cons:** Now you have two Tor clients — in-process `arti-client` for the messenger, and a subprocess `arti` for SOCKS. They don't share state, circuits, or configuration unless you point them at the same state dir (which may or may not be safe/supported). More moving parts. On Android, this is a third binary to bundle (messenger uses in-process arti-client, SOCKS uses arti binary, wallet uses monero-wallet-rpc).
|
||||
|
||||
### Option B: Implement a SOCKS5 listener that forwards to in-process `arti-client::connect()`
|
||||
|
||||
Use `tor-socksproto` (or another SOCKS5 server crate) to accept SOCKS5 connections on a localhost port, parse the target address, and then use the in-process `arti-client`'s `connect()` to open the actual Tor stream, bridging the two byte streams.
|
||||
|
||||
**Pros:** One Tor client (in-process arti-client). No second binary. The wallet child talks SOCKS5 to localhost, your code translates that to `arti-client::connect()` calls.
|
||||
**Cons:** You're writing a SOCKS5 server. `tor-socksproto` gives you the protocol encode/decode, but you still need the accept-loop, the byte bridging, the stream lifecycle management, error handling, DNS-leak precautions (SOCKS4a vs SOCKS5 remote DNS), etc. This is real code. The docs note `tor-socksproto` *"does no networking code: it only implements the server (proxy) side of the SOCKS handshake by handling a series of bytes"* — so the networking glue is on you. Also, routing all the wallet child's daemon traffic through your own SOCKS bridge means you're responsible for circuit isolation, timeout handling, and not leaking the target address via local DNS resolution.
|
||||
|
||||
### Option C: Run a separate Tor daemon (C tor or arti binary) for SOCKS
|
||||
|
||||
Run a dedicated Tor SOCKS proxy (system tor, or bundled arti binary) listening on localhost. Wallet child points at it. Messenger uses in-process arti-client. Two Tor clients, but the SOCKS one is a known quantity.
|
||||
|
||||
**Pros:** Well-understood. The wallet child just works.
|
||||
**Cons:** Another binary on Android. Two Tor clients again.
|
||||
|
||||
### Option D: Skip the SOCKS indirection — make the wallet child use Arti directly
|
||||
|
||||
This isn't viable. `monero-wallet-rpc` is a C++ binary. It speaks plain TCP or SOCKS5. It does not link arti-client. You cannot make it use in-process Arti without a SOCKS shim.
|
||||
|
||||
---
|
||||
|
||||
## What I'd recommend
|
||||
|
||||
**For the feasibility proof:** try Option B first (a small SOCKS5 listener using `tor-socksproto` + `arti-client::connect()`), because if it works, it's the cleanest path — one Tor client, no second binary, and it directly answers the question "can the in-process Arti serve the wallet child's SOCKS needs?"
|
||||
|
||||
If Option B turns out to be more code than it's worth, fall back to Option A (bundle the `arti` binary as a SOCKS subprocess) — it's the known quantity, and the arti project itself points to this as the interop path.
|
||||
|
||||
Either way, the answer to "does arti-client 0.46.0 expose a SOCKS port we can use" is **no** — you have to build or bundle the SOCKS layer yourself.
|
||||
|
||||
---
|
||||
|
||||
## Things to verify during the proof
|
||||
|
||||
1. **`tor-socksproto` 0.46.0 API surface** — can you actually build a working SOCKS5 server with it in reasonable code, or is it too low-level? The crate docs say it handles the handshake bytes but no networking — confirm what's actually involved.
|
||||
2. **DNS leak handling** — SOCKS5 has a remote-DNS flag. The wallet child's daemon connection targets a `.onion` address, which is already a Tor address (not a DNS name), but verify the SOCKS handshake and the `arti-client::connect()` call handle it correctly and don't do local DNS on the target.
|
||||
3. **Two-Tor-client question for Option A** — if you go with bundled `arti` binary for SOCKS, confirm whether sharing the state dir with the in-process `arti-client` is safe or whether they need separate state.
|
||||
4. **Android thread/runtime constraints** — a SOCKS accept-loop bridging to `arti-client::connect()` runs in the app's Tokio runtime. Confirm it doesn't block or interfere with the messenger's Arti usage.
|
||||
5. **`monero-wallet-rpc` `--proxy` behavior** — confirm the wallet child actually honors `--proxy` for its daemon connection and speaks SOCKS5 (not just HTTP proxy or something else).
|
||||
|
||||
---
|
||||
|
||||
## Bottom line
|
||||
|
||||
`arti-client` 0.46.0 is an outbound Tor client library. It does **not** expose a SOCKS5 listener. The SOCKS proxy is a feature of the `arti` binary, not the library. For the wallet child to route its daemon traffic through the app's Tor, you either build a SOCKS shim on top of in-process `arti-client` (Option B), or you run a separate SOCKS-capable Tor process (Option A/C). The cleanest architectural fit is Option B if `tor-socksproto` is usable for it; the safest fallback is Option A.
|
||||
73
docs/option-a-recommendation.md
Normal file
73
docs/option-a-recommendation.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# Recommendation: Option A — bundle the `arti` binary as a SOCKS subprocess
|
||||
|
||||
## What Option A is
|
||||
|
||||
Run the `arti` CLI (not `arti-client`) as a child process doing `arti proxy -p <port>`. The wallet child points `--proxy 127.0.0.1:<port>` at it. The messenger continues using in-process `arti-client`. Two Tor clients in one app: one in-process for the messenger, one subprocess for SOCKS.
|
||||
|
||||
This is the path the arti project itself points to for interop with external processes, and it is the known quantity. It answers the Android wallet question with the least custom code.
|
||||
|
||||
## What makes it attractive
|
||||
|
||||
- **No custom SOCKS server.** You do not write a SOCKS5 accept-loop, byte bridge, DNS-leak handling, stream lifecycle, or error handling. The arti binary already does all of that.
|
||||
- **Wallet child just works.** `monero-wallet-rpc --proxy 127.0.0.1:<socks-port>` speaks plain SOCKS5. It does not need to know anything about Arti. This is the shape the wallet binary was built for.
|
||||
- **Smallest diff to the messenger code.** The in-process `arti-client` used for chat does not change. You add one child-process manager for the SOCKS proxy and one config knob for the wallet child's `--proxy` target. No change to the Noise/identity/store paths.
|
||||
|
||||
## The auth gap
|
||||
|
||||
This is the real trade-off and the reason the recommendation is not unconditional.
|
||||
|
||||
The app's `--password` enforcement lives in the in-process `arti-client` path: the messenger dials friends' onions through Arti, and the wallet child reaches a remote `.onion` monerod through the SOCKS proxy. With Option A, the SOCKS listener is a separate process on a localhost port. Any local process that can connect to `127.0.0.1:<socks-port>` can use it — including a wallet child that was started without the app's credentials, or any other local code.
|
||||
|
||||
Concretely: if the wallet child is the only local consumer of the SOCKS port, the gap is small. If the app ever runs other local processes, or if the wallet child can be started by something other than the app, the SOCKS port is an open Tor exit for anything on the device.
|
||||
|
||||
This is not a Tor anonymity failure in the usual sense — the SOCKS port is localhost, not a clearnet bridge. But it is an authorization gap: the app's `--password` gate does not cover traffic that enters Tor through the child's SOCKS port, because that traffic never passes through the app's Arti client.
|
||||
|
||||
## How to reduce the gap without abandoning Option A
|
||||
|
||||
The cleanest mitigation is to make the SOCKS port access-controlled at the process boundary, not at the Tor boundary:
|
||||
|
||||
1. **Bind the SOCKS listener to a Unix domain socket, not TCP.** If `arti proxy` can listen on a Unix socket, only processes that can open that socket can use it. On Android that path lives in app-private storage, so it is gated by the app sandbox. This is the strongest local control and removes the TCP localhost exposure entirely. Verify `arti proxy` supports a Unix socket listen target before committing; if it does not, this mitigation is unavailable and you are back to TCP localhost.
|
||||
2. **If TCP is the only option, bind to `127.0.0.1` only and treat the port as app-private.** Do not expose it on `0.0.0.0` or a LAN address. Document that the port is a local Tor entry point for the wallet child only, and that any other local process with user-level access can use it. This is honest, not a fix.
|
||||
3. **Gate the wallet child's start on the same credential material the app already owns.** If the app requires `--password` / a wallet passphrase / a host identity before it will start the wallet child, then the only process that can reach the SOCKS port is one the app launched. That is not a technical block on a hostile local process that somehow gets on the box, but it means the normal path is closed unless the user already authenticated to the app.
|
||||
4. **Keep the two Tor clients' state separated unless you have verified sharing is safe.** If you point the subprocess `arti` at the same state dir as the in-process client, confirm upstream whether that is supported and what the failure modes are. If it is not safe, run them with separate state and accept that they do not share circuits or cached data. Do not silently share state on the assumption that it works.
|
||||
|
||||
## What the wallet child's connection looks like under Option A
|
||||
|
||||
```
|
||||
Android app process
|
||||
├── in-process arti-client → friend onions (messenger)
|
||||
└── arti proxy subprocess → SOCKS5 on 127.0.0.1:<port> (Unix socket if supported)
|
||||
└── monero-wallet-rpc child --proxy 127.0.0.1:<port>
|
||||
└── ( 양파 ) remote .onion monerod :18089
|
||||
```
|
||||
|
||||
Wallet RPC itself stays loopback-local between the app and the wallet child. Only the chain traffic — the wallet child's `--daemon-address` connection to the remote `.onion` monerod — goes through the SOCKS proxy. That matches the existing rule: wallet RPC is loopback, chain traffic is Tor. The SOCKS proxy is the Tor entry point for the wallet child's chain connection.
|
||||
|
||||
## What to verify before committing to Option A
|
||||
|
||||
1. **Does `arti proxy` support a Unix domain socket listen target?** If yes, use it. If no, you are stuck with TCP localhost and the auth gap is real and must be documented.
|
||||
2. **State sharing between the in-process client and the subprocess.** Can they safely share a state dir, or must they have separate state? This affects disk use, startup time, and whether the SOCKS proxy can reuse circuits the messenger already built.
|
||||
3. **`monero-wallet-rpc --proxy` behavior.** Confirm the wallet child speaks SOCKS5 (not HTTP proxy), honors `--proxy` for its daemon connection, and does not do local DNS on the `.onion` target. The traffic is already a Tor address, so DNS is less of a leak than with a DNS name, but verify the handshake does not pre-resolve.
|
||||
4. **Child lifecycle on Android.** The SOCKS proxy and the wallet child are both long-running subprocesses. Android can kill them under memory pressure, during Doze, or when the app is backgrounded. Confirm the app restarts them on resume and that the wallet child reconnects to its daemon after a kill. This is the same lifecycle problem the messenger already has with in-process Arti, but now multiplied by two children.
|
||||
5. **APK size impact.** Bundling `arti` as a binary per ABI is additional APK weight. Quantify it before committing. If the binary is large and the SOCKS path is the only reason for it, that is a real cost against a feature that most users will not exercise (most will use receive-only or a remote wallet host, not a local chain connection through SOCKS).
|
||||
|
||||
## When Option A is the right call
|
||||
|
||||
Option A is right when:
|
||||
|
||||
- You want the wallet child to reach a remote `.onion` monerod and you do not want to write a SOCKS server.
|
||||
- You accept that the SOCKS port is a localhost Tor entry point and you either control access via a Unix socket or document the TCP-localhost reality.
|
||||
- You are willing to bundle `arti` as a subprocess binary and manage its lifecycle on Android.
|
||||
- The alternative — writing a SOCKS5 bridge on top of in-process `arti-client` — is more code than you want to own, or the bridge's DNS/circuit/stream handling is not worth the maintenance.
|
||||
|
||||
## When to reconsider
|
||||
|
||||
Reconsider toward Option B if:
|
||||
|
||||
- `arti proxy` cannot listen on a Unix socket and you are unwilling to accept an open TCP localhost SOCKS port as the authorization model.
|
||||
- Bundling `arti` as a binary is too heavy for the APK and the SOCKS path is not core enough to pay for it.
|
||||
- You want a single Tor client and a single state dir, and you are willing to own the SOCKS bridge code to get there.
|
||||
|
||||
## Bottom line
|
||||
|
||||
Option A is the pragmatic choice: it uses the real arti SOCKS proxy, requires the least custom code, and matches the shape the wallet child expects. The cost is a second Tor client and an authorization gap on the SOCKS port, which is best closed with a Unix domain socket listen if `arti proxy` supports it, and otherwise documented honestly as a localhost-only Tor entry point gated by the app's own process launch policy.
|
||||
224
docs/payment-integration-plan.md
Normal file
224
docs/payment-integration-plan.md
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
# OnionWire payment integration — next steps
|
||||
|
||||
**Audience:** dev profiles (rust-dev for core/SDK/TUI, apk-dev for Android), with CI as a cross-cutting concern.
|
||||
**Goal:** turn the existing `inv`/`rcp`/`tip` wire frames and the existing `monero-wallet-rpc` HTTP Digest client into a real in-app payment flow on both TUI and Android, with the wallet fully owned by the app (bundled binaries), chain backends opt-in (local pruned node, or remote onion daemon), clearnet refused, Tor for the messenger and for any remote-daemon chain traffic.
|
||||
|
||||
This is the plan for the payment half of "comms and payment terminal." Chat, identity, invites, QR, outbox, store encryption, and the Noise transport are pre-existing and in scope only where a payment feature touches them.
|
||||
|
||||
---
|
||||
|
||||
## 1. What exists today (don't rebuild)
|
||||
|
||||
- **Wire frames:** `src/pay.rs` — `Invoice`, `Receipt`, `Tip`, with encode/decode/sign/verify, domain-separated signatures (v2) and legacy v1 accept, `invoice_chat_line` / `receipt_chat_line` / `tip_chat_line` display helpers, `TIP_PREFIX`/`INV_PREFIX`/`RCP_PREFIX` dispatch.
|
||||
- **Wallet RPC client:** `src/wallet.rs` — `Wallet` struct, HTTP Digest to a `monero-wallet-rpc` on loopback, `get_address` / `create_address` / `get_transfers` / `get_balance` / `transfer`, view-only detection via `query_key spend_key → -29`, open-RPC refusal, loopback-only host check. This is the RPC client we keep; it does not change for the wallet-RPC path.
|
||||
- **Node wiring:** `src/node.rs` — `pay_invoice` (create subaddress or use profile `xmr_addr`, sign `inv`, send one-shot), `tip` (RPC `transfer`, sign `rcp` + `tip`, send both one-shot), `wallet_receive_address`, `wallet_balance`, `wallet_balance_line`, `wallet_recent_transfers`. These are the shapes to preserve; they already call the right `Wallet` methods and emit the right frames.
|
||||
- **Receipt verification:** `node.rs::ingest_receipt` — verify sig, insert payment row `verified=0`, then if wallet configured do a conjunctive `get_transfers` match on `(txid, amount, address)` and mark `verified=1` on exact match; RPC down/err → stays unverified. This logic stays; only the wallet backend behind it changes.
|
||||
- **QR / invite:** `src/qr.rs` — `QrPayload` encode/decode for the messenger invite. The wallet also has a receive address; the app will render that as a QR too (separate from the messenger invite QR). The `monero:` address path in the TUI already exists for the wallet screen — reuse/extend that, don't invent a new address representation.
|
||||
- **Threat model / wallet docs:** `docs/THREAT_MODEL.md`, `docs/WALLET.md` — read before changing anything wallet-related; the new backends are changes to those claims.
|
||||
|
||||
---
|
||||
|
||||
## 2. The architecture to build
|
||||
|
||||
### 2.1 One wallet surface, three chain backends
|
||||
|
||||
The `Wallet` client (loopback HTTP Digest) does not care where the wallet child's daemon lives. What changes is **how the app launches the wallet child and where the wallet child points its `--daemon-address`**. Build one abstraction that owns both binaries and their lifecycle, and exposes the same wallet ops through it.
|
||||
|
||||
Backends (opt-in, user chooses; not hidden defaults):
|
||||
|
||||
1. **Local pruned node (on-device).** Bundle both `monerod` and `monero-wallet-rpc`. App owns `<datadir>/chain` and `< datadir>/wallet`. Wallet child's `--daemon-address` = `127.0.0.1:<local-daemon-rpc-port>`. Both children are app subprocesses. This is the maximal on-device shape.
|
||||
2. **Local wallet + remote onion daemon.** Bundle `monero-wallet-rpc` only (or both — see §2.3). Wallet child's `--daemon-address` = `<remote-onion>.onion:18089`, and the wallet child reaches it through a SOCKS5 proxy the app provides on localhost. Chain traffic goes over Tor through that SOCKS hop; the wallet RPC itself stays loopback.
|
||||
3. **Remote clearnet daemon (explicit opt-in, warned, non-default).** Same as above but daemon address is a clearnet host. Document the trust shift. Do not make this the default or the implied path.
|
||||
|
||||
The messenger (Arti onion ↔ onion) is separate from the wallet backend in all three cases. Tor for the messenger is always on; Tor for chain traffic is only for backend 2 (and backend 3 if you allow it, though backend 3 is the one you don't center the design on).
|
||||
|
||||
### 2.2 Wrapper model (this is the product shape)
|
||||
|
||||
The app is a wrapper around the real binaries, specialized for messenger + payment. The binaries do the real Monero work; the app is the control plane + UI + the messenger on top. This is the xmr-pocket-node pattern: not a wallet rewrite, a managed-node wrapper.
|
||||
|
||||
The wrapper owns:
|
||||
|
||||
- **Binaries** — bundled per platform/ABI (and/or auto-fetched on first opt-in with verification).
|
||||
- **Data dirs** — chain dir, wallet file, both in the app's storage. TUI: `$ONIONWIRE_HOME/chain`, `$ONIONWIRE_HOME/wallet`. Android: app-private storage.
|
||||
- **Lifecycle** — start monerod, wait for ready, start wallet-rpc pointed at the daemon, watch both, restart on resume, stop on shutdown, tolerate kills. Do not assume long-running guarantees on Android.
|
||||
- **Sync state** — expose daemon sync progress to the UI; don't let the wallet act on a node that isn't ready enough. Don't lie about readiness.
|
||||
- **Controls** — start/stop daemon, sync-on-Wi-Fi-only, sync-while-charging-only, storage/sync honesty in the UI.
|
||||
- **RPC wiring** — wallet-rpc loopback with generated creds + random port; its daemon address points at local monerod (backend 1) or at the remote onion through SOCKS (backend 2).
|
||||
- **Spending opt-in** — wallet create/restore, seed backup + passphrase, spend-capable vs view-only, spend-authority warning.
|
||||
|
||||
### 2.3 The SOCKS question is the Android gating item
|
||||
|
||||
For backend 2 on Android, the wallet child is a SOCKS5 client that talks to a localhost SOCKS listener the app provides. The wallet child does **not** use Arti's `connect()` — it just speaks SOCKS5 to localhost.
|
||||
|
||||
- If the app's in-process Arti (the same one the messenger uses) exposes a usable SOCKS5 listener on localhost, backend 2 on Android is: bundle `monero-wallet-rpc`, configure it with `--proxy 127.0.0.1:<socks-port> --daemon-address <remote-onion>:18089`, wallet child speaks SOCKS5 to Arti's listener, chain traffic goes over Tor. No third binary.
|
||||
- If Arti 0.46 does **not** expose a usable SOCKS5 listener, backend 2 on Android needs a bundled Tor daemon for the SOCKS listener — a third binary, more APK weight, more lifecycle. At that point backend 2 on Android is "wallet child + bundled Tor + remote onion daemon," and the local-node option (backend 1, monerod on device) may be the cleaner on-device chain story.
|
||||
|
||||
**Verify this first, before committing backend 2 on Android.** Whether Arti gives you a SOCKS5 listener the wallet child can use decides a lot of the Android shape. Do not wire the Android remote-daemon path until this is known.
|
||||
|
||||
### 2.4 Pruned node — the honest on-device bargain
|
||||
|
||||
When the user opts into a local node on device, the realistic target is a pruned node in the ~50-60GB range (mainnet, current prune behavior), not a full archiving node. State this in the UI and gate it with a storage check.
|
||||
|
||||
Pruning has a real boundary the app must be honest about:
|
||||
|
||||
- Incoming transfers within the prune window: fine, daemon has them.
|
||||
- Incoming transfers older than the prune depth: the daemon may not be able to serve them from its own chain data. The wallet may still know about them from its own cache, but a daemon rescan of deep history is not available. Receipt verification and old-transfer queries can degrade past the prune window.
|
||||
- Receiving new funds: fine either way.
|
||||
- Send: needs current chain state and unspent outputs; a pruned node has those for current outputs.
|
||||
|
||||
Don't promise the local pruned node can rescan everything forever. State the prune-window boundary in the wallet UI and in the threat model.
|
||||
|
||||
### 2.5 Spend is opt-in, not default
|
||||
|
||||
- **View-only by default** — receive address, balance, receipt verification only. No seed, no spend.
|
||||
- **Spend-capable is an explicit choice** at wallet create/restore (seed-backed wallet). When the user creates a spend-capable wallet, show the spend-authority warning: this wallet file can spend; anyone with its passphrase or the RPC creds can spend; back up the seed; don't leave it on a box/host you don't trust. Make it unavoidable at creation time.
|
||||
- TUI and Android use the same spend-opt-in concept; the UI differs.
|
||||
|
||||
---
|
||||
|
||||
## 3. Proof order (do these before scaling)
|
||||
|
||||
### P1 — Arti SOCKS feasibility (Android backend 2 gate)
|
||||
|
||||
Determine whether the in-process Arti you bundle exposes a SOCKS5 listener the bundled `monero-wallet-rpc` can use as a `--proxy`. This is a read-the-Arti-config-surface / small-experiment task, not a full build. Outcome is a yes/no and, if yes, the exact config + port selection approach; if no, the fallback is "bundle a Tor daemon for SOCKS" or "Android backend 2 is not clean, local node is the on-device chain story."
|
||||
|
||||
### P2 — TUI local-node proof (the tractable on-device node proof)
|
||||
|
||||
On Linux, spawn a `monerod` child into a test chain dir, get it to start and make real sync progress, spawn a `monero-wallet-rpc` child pointed at that local monerod, and get the existing `Wallet` client to talk to it: `create_address`, `get_balance`, `get_transfers`. No messenger integration yet — just the local-node pipe working on-device on Linux. This proves the wrapper + on-device node shape and surfaces the real storage/sync/runtime behavior before Android carries it.
|
||||
|
||||
### P3 — Android wallet-child + remote onion daemon proof (if backend 2 is viable)
|
||||
|
||||
Bundle `monero-wallet-rpc` for one Android ABI, get it running on-device talking to a remote onion daemon through the SOCKS path (or through a bundled Tor if Arti SOCKS isn't viable). This is the Android "wallet in the binary, chain over Tor" proof, and it's lighter than bundling a full local node.
|
||||
|
||||
### P4 — Android local-node proof (if you want backend 1 on Android)
|
||||
|
||||
Bundle `monerod` too for Android, get it starting and syncing at least a little on-device, wallet child pointed at local monerod, same wallet ops through the same surface. This is the heavy proof — storage, sync, lifecycle. Gate it behind the storage check.
|
||||
|
||||
---
|
||||
|
||||
## 4. Work breakdown by profile
|
||||
|
||||
### rust-dev — core + SDK + TUI
|
||||
|
||||
**A. Chain + wallet lifecycle abstraction (shared core logic, platform runner differs).**
|
||||
|
||||
Build the concepts and the ops the app uses, implemented in core with platform-specific subprocess runners contributed by the platform layer:
|
||||
|
||||
- `ChainBackend` — `Local { datadir, binary, args }`, `RemoteOnion { onion, port, transport }`, with clearnet as an explicit opt-in shape if you keep it.
|
||||
- `WalletBackend` — `datadir, binary, rpc_port, creds, daemon_address`.
|
||||
- Subprocess manager ops: start node, start wallet, watch both, restart on resume, stop on shutdown, expose sync state.
|
||||
- Wallet ops through the existing `Wallet` client: `create_address`, `get_address`, `get_balance`, `get_transfers`, `transfer`, view-only detection — same shapes, now backed by whichever backend the app configured.
|
||||
- Random loopback port selection for wallet-rpc; generated HTTP Digest creds stored in the encrypted store (they're sensitive); wallet file + creds persisted so the app can restart the child without asking the user again. Wallet passphrase is the user's to provide at runtime or store — that choice affects the model and should be a deliberate app decision, not an accidental default.
|
||||
|
||||
**B. `wallet.rs` path — minimal change.**
|
||||
|
||||
Keep the HTTP Digest client and JSON-RPC parsing. The new bit is the app telling the wallet child where its daemon is:
|
||||
|
||||
- Local node: `--daemon-address 127.0.0.1:<local-daemon-rpc-port>` (no SOCKS needed).
|
||||
- Remote onion daemon: `--proxy 127.0.0.1:<socks-port> --daemon-address <remote-onion>:18089`, wallet child speaks SOCKS5 to the app's SOCKS listener.
|
||||
|
||||
Don't change the wallet client's loopback model. Don't make the wallet client speak Tor directly.
|
||||
|
||||
**C. TUI wallet + node UI.**
|
||||
|
||||
Wiring into the existing command/screen shapes:
|
||||
|
||||
- Wallet create/restore screen: seed generation, show seed for backup, passphrase, spend-capable vs view-only selection with the spend-authority warning.
|
||||
- Node control: start/stop local node, storage check + prune-target honesty, sync state, sync-on-Wi-Fi/charging options, daemon status.
|
||||
- Chain backend choice: local node vs remote onion daemon vs (explicit opt-in) remote clearnet, with the trust tradeoff stated for remote.
|
||||
- Balance, receive address + QR, recent transfers, send/tip flow that goes through the wallet child and emits the existing `inv`/`rcp`/`tip` frames.
|
||||
- Keep the existing messenger invite QR (F2/F3) and add a separate receive-address QR for the wallet screen. Don't conflate the two.
|
||||
|
||||
**D. TUI integration points to preserve.**
|
||||
|
||||
- `node.rs::pay_invoice`, `node.rs::tip`, `node.rs::ingest_receipt` stay the spines; the lifecycle abstraction feeds them a `Wallet` that points at whichever backend is active.
|
||||
- The outbox/one-shot frame sending for `rcp`/`tip` stays as-is.
|
||||
- Receipt verification conjunctive match stays as-is; only the daemon behind `get_transfers` changes.
|
||||
|
||||
### apk-dev — Android app + SDK surface
|
||||
|
||||
**A. Binary packaging for Android.**
|
||||
|
||||
Bundle `monero-wallet-rpc` per ABI now; bundle `monerod` per ABI for the local-node path (either from the start or as the heavier opt-in). This is what "in the binary" means. Include the CI for these binaries (see §5).
|
||||
|
||||
**B. Android subprocess lifecycle.**
|
||||
|
||||
Start/stop/restart the wallet child (and monerod for backend 1), random RPC port, creds in the encrypted store, wallet file + chain dir in app-private storage, restart on resume, kill on shutdown, tolerate the daemon being down. Don't promise "always running" on Android — it won't be.
|
||||
|
||||
**C. Android wallet UI.**
|
||||
|
||||
Same options as TUI, Android-shaped: local node or remote onion daemon (and explicit clearnet opt-in if you keep it), create/restore wallet with seed backup + passphrase, spend vs view-only with the warning, balance, receive address + QR, recent transfers, send flow through the on-device wallet child emitting the existing frames, sync/daemon state, daemon control, storage/sync honesty.
|
||||
|
||||
**D. Android SOCKS path for backend 2.**
|
||||
|
||||
If P1 confirms Arti SOCKS is viable, configure the wallet child with `--proxy` to the Arti listener and `--daemon-address` to the remote onion. If not, wire the bundled-Tor-SOCKS path or treat backend 2 on Android as not clean. Don't ship backend 2 on Android without knowing which SOCKS path you're using.
|
||||
|
||||
**E. SDK surface.**
|
||||
|
||||
Keep the UniFFI surface honest about wallet state: running/not running, balance, receive address, recent transfers, send outcome. The Android app owns the subprocess lifecycle; the SDK exposes wallet state and ops, not the binaries.
|
||||
|
||||
### CI (cross-cutting)
|
||||
|
||||
- **Native binary build + bundle pipeline** for `monerod` and `monero-wallet-rpc` for TUI assets and Android ABIs, kept current, with whatever verification you want on the bundle/download path. This is the make-or-break for "the bundle is the product." If the binaries aren't reliably built and shipped/current, the wrapper can't deliver.
|
||||
- **Verification of bundled binaries** — checksums, provenance, whatever you want to trust. Don't hand-wave "we bundled it" without a verification story.
|
||||
- **Cross-compilation toolchain** for the Monero binaries on CI (NDK for Android; whatever you use for TUI assets). This is heavier than a Rust-only CI.
|
||||
|
||||
---
|
||||
|
||||
## 5. Proof criteria (done means these work)
|
||||
|
||||
- **Local-node pipe works on TUI:** a spawned `monerod` child reaches a usable sync point; a spawned `monero-wallet-rpc` child pointed at it services `create_address`, `get_balance`, `get_transfers` through the existing `Wallet` client.
|
||||
- **Receipt verification works end to end on the local path:** an incoming `rcp` frame verifies against the local daemon's `get_transfers` conjunctive match, and the UI reflects verified/unverified correctly.
|
||||
- **Send/tip works end to end on the local path:** `/tip` (or the UI send path) calls the on-device wallet child's `transfer`, gets a txid, signs and sends `rcp` + `tip` one-shot, and the UI shows the result.
|
||||
- **Remote-onion-daemon pipe works (where viable):** wallet child reaches a remote onion daemon through the chosen SOCKS path and the same wallet ops work; the app surfaces that the chain backend is remote over Tor.
|
||||
- **Both backends go through the same wallet surface:** the app switches backend without the wallet ops or the payment frames changing shape.
|
||||
- **Android lifecycle tolerance:** killing the app/daemon and resuming restarts the children and recovers wallet state from disk; the UI reflects daemon-not-running / not-synced states honestly.
|
||||
- **Storage gate works on Android:** the local-node option is gated by free space vs the pruned target, with the number visible to the user; on a device that can't hold it, local node is off the table and the user gets remote daemon or receive-only.
|
||||
- **Spend opt-in is honest:** view-only works out of the box; spend requires an explicit seed-backed wallet creation with the spend-authority warning shown.
|
||||
|
||||
---
|
||||
|
||||
## 6. Documents that must change with the code
|
||||
|
||||
- **`docs/WALLET.md`** — new backends (local pruned node, remote onion daemon), the SOCKS path for remote daemon, the wrapper model, spend opt-in, the prune-window history boundary, clearnet opt-in if kept.
|
||||
- **`docs/THREAT_MODEL.md`** — local node on device (chain + wallet on device, spend key on device, device trust), remote onion daemon (host trust, Tor hides transport not host, daemon sees addresses), SOCKS path and what backs it, clearnet refusal and any explicit clearnet opt-in, Android lifecycle (process kills, daemon not always running), bundle trust (your binaries doing the work).
|
||||
- **`docs/PROTOCOL.md`** — only if a payment frame changes. The `inv`/`rcp`/`tip` frames stay; don't touch the protocol doc just because the wallet backend changed.
|
||||
- **`README.md`** — user-facing summary of the payment options (local node vs remote daemon, spend opt-in, storage/sync honesty) once the shapes are real.
|
||||
- **Skill `onionwire`** — update if the locks/shape change (e.g. the wallet backend abstraction becomes a hard constraint, or the SOCKS path becomes a lock). Don't over-update; only when the rule actually changes.
|
||||
|
||||
---
|
||||
|
||||
## 7. Out of scope for this plan (don't let them creep in)
|
||||
|
||||
- Rewriting Monero in Rust, or embedding the C++ wallet library in-process unless a maintained Rust binding is clearly production-ready for full tx construction (it isn't, as of this write). The wrapper model is the intended shape.
|
||||
- A full archiving node on mobile. Pruned is the on-device target; full node is not the mobile story.
|
||||
- Making the wallet RPC speak clearnet by default. Clearnet daemon is an explicit opt-in if kept, not the design center.
|
||||
- A server-side wallet or a hosted outbox. Still out of scope; the local outbox stays device-only.
|
||||
- Changing the messenger's Noise / invite / on onion transport for payment. Payment frames are additive; the transport is unchanged.
|
||||
|
||||
---
|
||||
|
||||
## 8. Key risks to flag in the card descriptions
|
||||
|
||||
- **Arti SOCKS feasibility on Android** — backend 2 on Android depends on it. Verify before committing the Android remote-daemon path.
|
||||
- **Pruned-node history boundary** — receipt verification and old-transfer queries past the prune window may degrade; state it and test it, don't let users assume infinite local history.
|
||||
- **First sync as the UX cliff** — on both platforms, opting into a local node is signing up for a sync. On a phone it's a lot. Make it visible and controllable; don't pretend it's instant.
|
||||
- **Android process kills** — the daemon and wallet child will be killed; design for restart-on-resume and honest "not running / not synced" states.
|
||||
- **Bundle trust + binary maintenance** — the user runs your bundled binaries; keep the CI and verification story real, and keep the binaries current.
|
||||
- **Spend-authority warning must be unavoidable at wallet creation** — a spend-capable wallet on device is a local spend authority; the warning isn't a tooltip, it's part of the create/restore flow.
|
||||
|
||||
---
|
||||
|
||||
## 9. Suggested card titles for the kanban
|
||||
|
||||
- `rust-dev`: Chain + wallet lifecycle abstraction (local node, remote onion daemon, clearnet opt-in) with shared wallet ops
|
||||
- `rust-dev`: TUI wallet + node UI — create/restore, spend opt-in, balance, receive + QR, send/tip, daemon control, storage/sync honesty
|
||||
- `rust-dev`: Wire local-node pipe on TUI (spawn monerod + wallet-rpc, prove create_address / get_balance / get_transfers through the existing Wallet client)
|
||||
- `rust-dev`: Wire remote-onion-daemon path through SOCKS (wallet child --proxy + --daemon-address), prove the same wallet ops
|
||||
- `apk-dev`: Bundle monero-wallet-rpc per Android ABI + subprocess lifecycle + wallet UI (wallet-in-binary, remote daemon via SOCKS)
|
||||
- `apk-dev`: Bundle monerod per Android ABI + local-node opt-in with storage gate + sync controls (full on-device node)
|
||||
- `apk-dev`: Android receive-address QR for wallet screen (separate from messenger invite QR)
|
||||
- `ci`: Native binary build + bundle + verification pipeline for monerod and monero-wallet-rpc (TUI assets + Android ABIs)
|
||||
- `docs`: Update WALLET.md + THREAT_MODEL.md for the new backends, SOCKS path, prune-window boundary, spend opt-in, Android lifecycle
|
||||
|
||||
Cut releases manually and batched as the repo policy already requires — don't let a payment feature land push a release. CI for the native binaries is part of the work, not a follow-up.
|
||||
|
|
@ -21,7 +21,11 @@ api_curl() {
|
|||
}
|
||||
|
||||
auth_json() {
|
||||
<<<<<<< Updated upstream
|
||||
api_curl -u "sirius:${FORGEJO_TOKEN}" -H "Content-Type: application/json" "$@"
|
||||
=======
|
||||
api_curl -u "sirius:${FORGEJO_TOKEN}" -H "Content-Type: application/json" "$@" | sed 's/\r$//'
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
tag="${1:?usage: publish-release.sh <tag> <name> <body-file> <asset>...}"
|
||||
|
|
@ -126,8 +130,12 @@ for a in json.load(sys.stdin):
|
|||
fi
|
||||
done
|
||||
up=$(api_curl -o /tmp/release-asset.json -w '%{http_code}' \
|
||||
<<<<<<< Updated upstream
|
||||
-X POST "$api/releases/$rid/assets?name=$asset" \
|
||||
-u "sirius:${FORGEJO_TOKEN}" \
|
||||
=======
|
||||
-X POST -u "sirius:${FORGEJO_TOKEN}" "$api/releases/$rid/assets?name=$asset" \
|
||||
>>>>>>> Stashed changes
|
||||
-F "attachment=@$f")
|
||||
if [ "$up" != "201" ]; then
|
||||
die_http "upload $asset" "$up" /tmp/release-asset.json
|
||||
|
|
|
|||
Loading…
Reference in a new issue