Wallet::create_wallet returned the 25-word seed exactly once and nothing
could reach it afterwards, so a seed that was never backed up at creation
was unrecoverable. Add Wallet::mnemonic() (one query_key mnemonic call on
the open wallet file), Node::wallet_seed() mirroring wallet_create, and the
additive UniFFI export Wire::wallet_seed() -> Kotlin Wire.walletSeed().
No existing signature changes. The refusals stay leak-free: an unconfigured
wallet gets NOT_CONFIGURED_MSG without a dial, a watch-only wallet keeps the
RPC's -29 view-only mapping, and no error string carries the RPC login.
Tests (tests/wallet.rs) drive the per-connection Digest mock: the words come
back verbatim, a JSON-RPC error surfaces without the login or endpoint, a
rejected digest refusal does not leak the password, and an unconfigured
wallet is refused without dialing.
monero-wallet-rpc (epee) keeps its Digest nonce per TCP connection: the
`http_server_auth` lives inside `http_custom_handler`, which is created per
connection, so its nonce starts empty and any request without a valid
`Authorization` field mints a fresh one. The client opened a *second* connection
for the authenticated retry, presenting a nonce that socket never issued — so a
real wallet RPC answered 401 forever, however correct the login was. That is the
`wallet RPC HTTP HTTP/1.1 401 Unauthorized` the TUI and Android showed; the
canned mocks replayed the challenge on any socket, so they stayed green.
- `post_digest`/`http_digest`: one `TcpStream` for the challenge and the retry,
no `Connection: close` on the challenge (epee closes the socket with the 401
when the request asks for it), `read_one_response` honouring `Content-Length`
(a keep-alive response never ends in EOF; with no length the body ends at EOF,
which is what keeps the 1 MiB cap meaningful for an open RPC).
- A 401 after our *own* challenge now reads: the login does not match the
child's `--rpc-login`.
- Mocks in `tests/wallet.rs` and `src/node.rs` model the per-connection nonce:
`serve_one_conn`/`serve_rpc_conns`. Two tests pin it — one RPC call uses one
connection, and a nonce presented on another connection is refused.
- `docs/WALLET.md`: what a 401 means and why it is not the flow.
Verified end-to-end against `monero-wallet-rpc` v0.18.5.1 (`--rpc-login`,
`--offline`, real wallet open): unfixed tree → `wallet RPC HTTP HTTP/1.1 401
Unauthorized`; fixed tree → `connected: true` with the wallet's real address.
#135 merged against fa0e4b2-era docs that said the loop was still
wallet_status. #134 already landed: first paint is cached, every later
tick is Wire::wallet_child_refresh.
android/README.md, CUPRATE_DAEMON.md and MONERO_BINARIES.md were the
half PR #133 left out. Releases are two manual dispatches, not a push
to main; the APK version comes from the tag android-release checks out;
the layout now includes wallet/ and keepalive/; the status line's
sync h/t is documented; the APK poller still calls wallet_status, not
wallet_child_refresh.
The wallet screen's 2s loop read Wire::wallet_status, which only re-reads the
snapshot the last probe left in the store — so the `sync h/t` segment sat frozen
until a chain-mode tap ran start_wallet_child (which probes on its way out).
The loop now paints once from the cached read (non-dialing, so the screen has a
record immediately) and then calls Wire::wallet_child_refresh for every tick:
one live probe of the child's loopback wallet RPC, and of the configured local
daemon's get_info when that RPC does not answer. Same 2s cadence, same
Dispatchers.IO, same sticky walletChildError, same one-poller guarantee.
The loop is a top-level function taking its two reads as parameters, which is
the only seam a JVM test has — requireWire() is NodeHost.requireOpen(), a
process-global only a real Arti bootstrap sets. WalletChildRefreshLoopTest pins
that the cached read paints exactly once and every tick after it is the live
probe, that a probe slower than the tick is never overlapped, and that
cancelling the loop (leaving the screen) stops the dialing.
Audit the operator docs against the source: pin downloads to v0.14.0,
document the real CLI/flags/env/F-keys (including F9, no F7), keep 18081
as the app-owned daemon port, describe the local chat outbox vs a
server-side one, and stop implying SECURITY_AUDIT.md is a third-party
audit. Spike reports stay; they get a status header only.
Wire::wallet_status() is the cheap cached read (no dial); only
Node::wallet_child_refresh() writes state/height/target_height, and it was
reachable over UniFFI from exactly one place — start_wallet_child. An Android
refresh loop polling wallet_status() therefore shows a frozen sync line.
Add the additive export, reusing the existing child_status mapper so the record
is the same shape as wallet_status(), and the core probe as the only probe
path. Docs: one sentence in docs/WALLET.md, which enumerates the SDK
wallet-child surface.
Tests: SDK-level (a Wire cannot be built offline in this crate — open_wire
bootstraps Arti): the unprobed child maps to the same 'off' record both reads
report, pinned with an exhaustive record literal; and the probe on a stopped
handle is a typed WireError.Stopped.
The SDK surface from the rust-dev parent (#129) carries `WalletChildStatus.height`
and `target_height` (Rust `u64` → generated Kotlin `ULong`), so the wallet status
line can say how far the chain daemon has got instead of only naming it.
* `WalletChildInput` mirrors both fields as `ULong` — checked against the
generated `uniffi.onionwire_sdk.WalletChildStatus`, not assumed. Defaults stay
`0uL` so every existing fixture is unchanged.
* `walletChildLine` appends ` · sync h/t` after the source and the `node` segment,
before the error em-dash, and only when either value is non-zero: `0/0` is
unknown (probe failed, daemon not up), not `0%`, and a zero target still prints
as `/0`. No percent, no progress bar, no ETA.
* `WalletScreen.toInput()` copies both fields field-for-field; the status row's
screen-reader sentence moved into `walletChildStatusDescription`, which carries
the same `sync h/t` the eye reads. One line, still no second widget.
* Tests cover the three sync cases plus the spoken row; the old exact-line
assertions (`off · receive-only`, `connecting · local node`,
`ready · remote onion daemon`) are untouched. `:app:testDebugUnitTest`: 114
tests, 0 failures.
* `android/CUPRATE_DAEMON.md` no longer claims the record has no height field.
The user watching an in-process Cuprate node on Android saw only a phase
word (connecting, with 'wallet connect: Connection refused (os error
111)') and asked to see height vs tip.
- WalletChildStatus gains height / target_height, and line() appends
'sync h/t' when a probe read either number. No percentage is invented
when the daemon reports no target (h/0 is honest), and an off/exited
child reports 0/0.
- Node::wallet_child_refresh fills them: one wallet-RPC get_info now
answers both the readiness gate and the numbers (Wallet::chain_info,
with chain_ready built on the same parse), and when the wallet RPC is
down while the chain source is local/in-process, the loopback daemon
is asked directly (ChildConfig::daemon_probe_addr). A refused daemon
stays 0/0 — unknown, not caught up. Only refresh dials; the draw path
reads two atomics.
- UniFFI WalletChildStatus carries the same two u64 fields so Android can
show them; SDK test covers the round trip.
Tests: cargo test --locked --target x86_64-unknown-linux-gnu (all
green), clippy -D warnings clean; crates/onionwire-sdk cargo test
--locked + clippy clean (separate workspace).
Cuprate's serde defaults call ArtiConfig::default, which unwraps
dirs::data_dir(). On Android HOME is unset and dirs-sys has no
getpwuid fallback, so the first Start panics and a retry reports
"LazyLock instance has previously been poisoned". Point XDG at the
chain datadir before parse and set tor.arti.directory_path in TOML.
Android's default pthread stack is ~1 MiB. Cuprate+RandomX overflow it,
the launch thread dies before tx.send, and the UI only says "the launch
thread died before answering". Catch unwind so a Rust panic is the error
string, and size the launch thread plus tokio workers at 8 MiB.
Selecting mainnet pruned only persisted ChainConfig, so the screen
updated the storage line and nothing else. Store, then Start when the
storage floor allows. Filled button is the stored choice.
Cuprate in-process and TUI keys 1/2/3 pick mainnet pruned, mainnet
full, or experimental testnet. Datadirs are split so a prune store
cannot mix with a full one. Android storage floors scale with the
choice. Cuprate remains pre-production; mainnet is unvalidated.
Tapping Start held the SQLCipher mutex for the whole in-process Node::launch
and blocked the UniFFI tokio worker, so wallet_status stayed off with no
error. Drop the store lock until creds are needed, spawn_blocking the sync
start, and show that Start is in flight.
The APK still runs Cuprate testnet only; this does not add mainnet or prune.
The same defect as the peer-payments fixture, one screen over: after the
clean-look chrome redesign (now merged) `App::draw` renders the F9 menu's one
status line with `status_footer_phased` and the hint from `footer_hints`, while
`tests/tui_spec.rs::render_menu` still built a phase-free `status_footer` from a
hand-copied hint string — so every menu frame in the PR body showed a footer the
app does not draw (no Tor phase).
- `wallets_settings_footer_hint()` is now the single source for that hint, the
way `peer_payments_footer_hint()` is for the history screen.
- `render_menu` makes the app's own two calls, `TorPhase::Ready` for the
healthy-wallet state the fixture describes.
- `wallets_settings_menu_frame_shows_the_shipped_footer` pins the dumped frame's
last line to the shipped one (RED first: the fixture's line read
`TOR me:… Esc back c copy ? help`, the app's `✓ TOR ready me:…`).
`cargo test --locked` 384 passed / 0 failed, clippy clean.
The merge commit cbe8890 got a green ci/test and ci/sdk, but its android-ci run
(actions/runs/458) was cancelled by the runner 19 seconds in, which Forgejo
records as a failure on the commit. Nothing in this commit changes the tree;
it exists so the android job runs against the same content.
`openWire` segfaults at `dlopen` on every ABI, so the app dies the moment the
passphrase is submitted and the onion never publishes. The tombstone:
signal 11 (SIGSEGV), fault addr 0x0
#00 libonionwire_sdk.so (getauxval+21)
#01 libonionwire_sdk.so (__cxa_atexit+604)
#02 libonionwire_sdk.so (_GLOBAL__sub_I_superscalar.cpp+891)
#06 libjnidispatch.so (Java_com_sun_jna_Native_open+68)
#42 uniffi.onionwire_sdk.Onionwire_sdkKt.openWire+0
`_GLOBAL__sub_I_superscalar.cpp` is RandomX's, and RandomX arrived with the
`cuprate-daemon` feature (#113). It calls `getauxval` from a static
initializer — and `libonionwire_sdk.so` had linked bionic **statically**, so
that `getauxval` read an auxv vector only the dynamic linker ever fills in.
The first SDK call is the first `dlopen`, which is the first time anything
touches the library: the crash lands exactly on "user typed the password".
The static libc came in with the same commit that added the C++ link flags.
`linkFlags()` passes `-L<ndk>/sysroot/usr/lib/<triple>` for the libc++
archives; that directory also holds the static `libc.a`, while the dynamic
`libc.so` stub lives in the per-API subdirectory that cargo-ndk's linker
wrapper normally supplies — and that wrapper is bypassed on purpose here, so
the per-API directory was no longer on the search path at all and `-lc`
resolved to `libc.a`. Both directories are now passed, the per-API one first,
and `verifyDynamicLibc` fails the build if `libc.so` ever leaves DT_NEEDED
again.
before (v0.9.0 arm64): NEEDED liblog.so only, local getauxval/__cxa_atexit
after: NEEDED libstdc++.so, libdl, liblog, libm, libc.so, no local libc
Also: the keep-alive notice is re-announced with the locator once the node
publishes. It is anchored at the Open tap with an empty onion (so the shade
does not claim a reachable node while Tor bootstraps), and only the
POST_NOTIFICATIONS callback ever replaced it — on a device that already
granted notifications there is no callback at all, so the notice claimed
"OnionWire is starting" forever.
main moved under this PR when #120 (clean-look chrome redesign) landed, which
touched the same three files (src/tui.rs, tests/tui_spec.rs, docs/TUI.md) and
left PR #121 unmergeable.
- docs/TUI.md: both sections kept — the peer-payment-history section from this
branch, then #120's chrome-redesign section.
- tests/tui_spec.rs: #120's `fit_cells` flake relaxation kept (it is a superset
of the one on this branch: same cut point plus the ellipsis assertion).
- src/tui.rs merged cleanly; `cargo test --locked` 383 passed / 0 failed and
`cargo clippy --locked --all-targets -- -D warnings` clean afterwards.
The peer-payments frames are byte-identical after the merge, so the dumps in
this PR body still hold.
Review round 1 on the F9 `payments` row found two false affordances.
1. `footer_hints(Screen::PeerPayments)` prints `F9 menu`, and docs/TUI.md says
F9 reopens the menu, but the `KeyCode::F(9)` arm opened it only from
`Screen::Main`, so pressing F9 on the peer history did nothing.
The function keys are now routed through one table, `function_key_for(screen,
code)`, and the F9 arm no longer has the Main-only guard: it opens (or
reopens) the menu from `Main`, `WalletsSettings` and `PeerPayments`. A screen
that names a key has to answer it while it is open — that is what the table
encodes, and `mod function_key_tests` locks it, including a test that reads
the screen's own hint and asserts every `F<n>` it names is answered there.
2. The PR's frame dumps passed `"Esc back up/down select ? help"` to
`status_footer` by hand, so every dumped frame showed a footer the app never
renders. `peer_payments_footer_hint()` is now the single source both
`footer_hints` and the fixture read, and
`peer_payments_frame_shows_the_shipped_footer` pins the dumped frame's last
line to the shipped one.
Also restores the rustfmt-only reflow of unrelated tests in `tests/tui_spec.rs`
(`queued_row`, a `failed_row` call, `rgb_tokens_…`, `alert_line_…`), keeping this
card's real edits there.
Presentation only: no wire, store, session, send-path or `Node` change.
Mouse-selecting the invite copied the pane border: draw_share rendered the
payload inside themed_block, which is Borders::ALL, so every wrapped row sat
between a leading and a trailing glyph. OnionWire enables no mouse capture,
so the terminal's own drag-select is the copy path and it picks up chrome.
The payload now has its own region — flush at column 0, full frame width,
no block, no title, no gutter on any row it occupies — with the block
(title, fp, onion, copy hint) above it. Measured in cells, not chars.
Also add C: OSC 52 hand the payload to the terminal clipboard (same
sequence the F9 menu uses), with the key named on the screen and the mouse
selection named as the fallback for terminals that block the sequence.
Regression tests reconstruct the payload out of the rendered frame at
80x24, 120x40, 200x60 and 60x20 (they fail on base: the leading border
column) and assert no payload row carries a border glyph.
The F9 / `/settings` menu's only payment row showed the wallet's own transfer
list (`Node::wallet_recent_transfers`, F6). The signed `/pay` invoices and
`/tip` receipts a peer sent live in the `payments` table and had no path from
the TUI, so they were invisible. `Node::list_payments` (PR #119) closes that
gap; this wires it into a screen.
- `Screen::PeerPayments { state }` + `PeerPaymentsState` /
`PeerPaymentRow`, built by `PeerPaymentsState::from_payments` from
`Node::list_payments`' rows (newest first: the store returns `payments.id`
ascending, the screen windows the vector).
- Key handler: `p` on the F9 screen opens it (`open_peer_payments`); `up`/`down`
(or `k`/`j`) move the selection, `Esc` goes back, `F9` reopens the menu.
- Rows carry direction, kind, amount (`pay::atomic_to_xmr_str`, the same
piconero formatter the chat lines use), memo (sanitized at draw time) and the
receipt's `verified` / `unverified` word; the focused row is marked with `>`
and bold. The selected row's txid and address sit under the rows — the
address wrapped over two lines rather than clipped.
- States: populated, `no payments with {peer}`, `could not read payments`, and
a menu row that refuses when no friend is selected. An empty history is a
state, never an error.
- Menu: the wallet's own list is retitled `transfers` (F6, unchanged), and the
new `payments` row (key `p`) names the peer and the count. Two histories, two
rows, no ambiguity.
- Widths are measured in cells (`Span::width`); trailing columns are dropped
before they can wrap, so the body fits 80x24 (20 inner rows of 21) as well as
120x40 and 200x60.
Tests: new `tests/tui_payments.rs` (11 tests) dumps and asserts the screen at
80x24, 120x40 and 200x60 including the empty history, asserts a memo carrying
ESC/BEL/C1/bidi/newline bytes never reaches the frame buffer, and asserts the
window/column invariants for every width from 20 to 200.
Also relaxes one width assertion in `tests/tui_spec.rs`: `fit_cells` was
asserted to start with `"abcdef"`, which only holds when another test's
in-flight `ONIONWIRE_ASCII` mutation is not visible — the suite mutates env vars
without a global lock, so that test flaked (it also fails on an unmodified tree,
1 run in 2). It now accepts either chrome's cut point, which is what the comment
already claimed.
Docs: `docs/TUI.md` gains the screen's section, the retitled/replaced rows and
the updated row count; the "peer payment history" gap entry is closed.
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected]>
Store::list_payments existed but only the node's own tests called it, so the
signed /pay invoices and /tip receipts a peer sent were unreachable from the
app. Add the thinnest read-only accessor next to list_messages/friend_profile:
lock the store, map the error to String, no new state, no new schema, no dial.
Payment rows come back as stored; a renderer sanitizes memo with
sanitize::display_text at draw time, the same way it does for message bodies.