onionwire/docs/TUI.md
agent 4e13242a44
All checks were successful
ci / test (pull_request) Successful in 7m40s
ci / sdk (pull_request) Successful in 1m42s
tui: drop the F9 menu that restates F6 and F7
The Wallets & Settings screen only named keys that already work. F6 is the
wallet, F7 is the node, and p on the roster or chat opens peer payments.
Profile, backup and wipe stay composer commands, named in help.
2026-10-08 11:03:28 -04:00

13 KiB
Raw Permalink Blame History

OnionWire TUI

Operator map of the Linux terminal UI. Bindings live in src/tui.rs (function_key_for, parse_cmd, per-screen match arms). This is not a screenshot dump.

Run onionwire in a real terminal. ONIONWIRE_ASCII or NO_COLOR switches ASCII chrome.

Screens

enum Screen in src/tui.rs:

Screen How you get there What it is
Main boot Roster, chat, composer
Share F2 Invite string (onionwire:v1:…)
Paste F3 Paste a friend's invite
Approve paste of unknown k y accept / n reject
Rotate F4 Type ROTATE to change the onion locator
RotatePrekey F8 Type ROTATE to hard-cut the Noise static
Wipe /wipe or /wipe-all Type WIPE or WIPEALL
Profile /profile Edit name, bio, optional Monero address
ConfirmKeys / Passphrase /backup, /restore Type BACKUP/RESTORE, then passphrase
Wallet F6 Receive QR, balance, transfers
WalletSelect F6 w Saved wallets, pick one or create one
WalletSetup F6 c / i, or /wallet create / import Spend warning, seed, optional seed-offset passphrase, import
WalletSetupConfig F7 Node & wallet setup: RPC endpoint, chain source, start/stop, live node state
PeerPayments p on Main (roster or chat) Peer-scoped /pay / /tip history
Quit Ctrl-Q Type CLEAR or QUIT

Help (?) is an overlay, not a screen. /who / F5 is an overlay on Main.

Function keys that fire from Main are:

Key FunctionKey Action
F2 Share Invite
F3 Paste Paste invite
F4 Rotate Onion locator
F5 Who Selected friend's profile
F6 Wallet Wallet screen
F7 Setup Node & wallet setup: RPC endpoint, chain source, start/stop
F8 RotatePrekey Prekey hard cut

F7 also fires on the wallet screen, which prints it. There is no F9 and no /settings: that menu restated F6 and F7. A screen that does not name a function key does not answer one. Other screens handle their own keys (Esc back, typed confirms).

Main

Focus starts on the composer. Footer hints (main_footer_hints):

Tab  F2  F3  F4  F5  Ctrl-Q  F6  F7  ? help

Pane-specific (pane_footer_hints):

Pane Hint
Roster j k p pay F3 add F6 wallet F7 setup ? help
Chat j k g G p pay F6 wallet F7 setup ? help
Composer Enter send / commands F6 wallet F7 setup ? help

The status line is drawn from the focused pane's hint, and the compactor drops tokens from the front until the line fits, so a key that only appears in main_footer_hints never reaches an 80-column terminal. F6 and F7 are therefore named in both, at the tail. p is named only on roster and chat: the composer types the letter.

Key Action
Tab / Shift-Tab Cycle roster → chat → composer
1 / 2 / 3 Focus roster / chat / composer when not typing
j k / arrows Move or scroll the focused pane
g / G Top / bottom of the focused pane
Enter Send chat, or run a /command
Esc Close overlay / clear composer
? Help (except on Paste, so ? can be in a payload)
Ctrl-Q Quit prompt

Composer commands

parse_cmd (src/tui.rs). Unknown /foo is sent as chat if it does not match.

Command Effect
/who Same as F5
/profile Profile editor
/pay <xmr> [memo] Invoice (inv ), one-shot
/tip <xmr> [memo] Transfer + rcp + tip , one-shot
/file /path File send, 1 MiB, one-shot
/wallet create Same as F6 then c
/wallet import Same as F6 then i
/backup /path Encrypted identity export
/restore /path Overwrite self keys
/wipe Type WIPE — chat/payments/outbox; identity stays
/wipe-all Type WIPEALL — delete data dir; new person

Share / paste / rotate

  • F2. Full invite. C copies it (OSC 52). Esc back.
  • F3. Paste buffer, Enter submits. Unknown k → Approve (y/n). Same k updates locator and prekey only.
  • F4. Type ROTATE. Identity fingerprint unchanged. Online friends get loc ; offline friends must F3-paste the new invite.
  • F8. Type ROTATE. Prekey is the Noise static and the ratchet bootstrap seed. Every friend must F3-paste the new invite. Status: prekey rotated · friends must F3-paste your new invite.

Wallet (F6)

The wallet, not the node: receive, balance, transfers, and create/import. Chain and node configuration is F7 (Configures the wallet RPC endpoint and the chain source), named in the footer so the key is findable from here.

Footer:

c create  i import  r qr  w wallets  F7 node  Esc back  ? help
Key Effect
r or Enter Toggle receive-address QR
w Saved wallets (WalletSelect)
c Create wallet (SPEND then seed once, type SEEN)
i Import 25-word seed
F7 Node & wallet setup (WalletSetupConfig)
Esc Back to Main

The child's state and the chain source are shown here, but they are set on F7: the start/stop/probe keys and the 1/2/3 in-process picker that used to live on this screen are gone, so there is one place that configures the chain.

The chain line for an in-process source always carries testnet only — mainnet is unvalidated (cuprate::TESTNET_ONLY). The default binary includes the in-process daemon. A build compiled without that feature still shows the rebuild message on the chain row, and start fails with that feature name only on such a build.

Create/import require the wallet RPC started with --wallet-dir. Filename: onionwire. Seed is never collected on the composer.

Saved wallets (F6 then w)

WalletSelect. One row per persisted wallet — name, identity prefix, locator prefix, creation day — plus the selected row's full identity and locator under the table. j/k or arrows select, Enter opens the selection, Esc back to Main. Footer: Esc back j k select Enter open ? help.

The last item is not a wallet: + create new wallet starts the same create flow as F6 c, so an empty list still has a way forward. An unlabelled wallet (NULL in the store) reads (unlabelled); a wallet whose onion service is not published yet reads -; an unknown creation time reads unknown. A read that failed is named on the screen — that is a different state from no saved wallets yet, and the two never share copy.

Rows are plain display data (WalletRow), built by the caller from Node::list_wallets; the render path never reads the store. Selection is by row index, not by identity key (two records may share one).

The list is read when the screen opens — from the start screen and from F6 w — so a wallet created or imported in this session is offered the next time the screen opens, with no restart. Enter on a wallet row re-points the app-owned wallet child at that row's wallet_filename (Node::open_wallet, a read-modify-write of the sealed record, so the generated RPC creds survive); a running child is restarted onto the new file, and an idle one picks the change up on its next start.

Start screen. An install with at least one saved wallet opens on WalletSelect; a fresh install (empty catalogue) opens on the create flow (WalletSetup::CreateWarn), so the first run has no dead empty list. The stored identity and locator are catalogue columns, not session state: a locator rotates (F4) and identity is the roster key the node already holds, so the live header keeps reading them from the node.

Node & wallet setup (F7)

Footer: Esc back Enter save Ctrl-T test (plus the status line's own ? help). The compactor drops tokens from the front, and at 80 columns the status line leaves about 25 cells, so the tail is what the default terminal shows. Tab and ? are universal; the node's own keys (ctrl-s, ctrl-x, ctrl-r) and Ctrl-U are named in the body, on the row they act on. Live from Main and from the wallet screen, which prints F7 node. Body is WalletSetupConfigState, a snapshot taken when the screen opens — the render path never reads the store.

This is the only screen that sets up the chain: the wallet RPC endpoint, and the node that serves it.

Row Kind Notes
url text the wallet RPC endpoint
login text user:pass. Never rendered back: the row reads hidden · set or (none)
view-only toggle no_spend; /tip is refused before any dial
chain picker space cycles receive-only, local node, remote daemon, in-process
daemon text host:port, for the remote daemon
monerod text the binary this box spawns for a local node
datadir text where the chain is stored. Prefilled with the path already in use; an empty one is refused rather than silently defaulted
prune toggle local and in-process sources
network picker in-process source: space cycles mainnet (unvalidated) and testnet

Under them, a NODE section: the live Node::wallet_child_status line (state, chain source, sync h/t once a daemon reports numbers, the last error) and the last save/test answer. The live row is the node's answer, never the draft above it, and it is re-read by Ctrl-R.

Enter saves and answers on the status row: saved · not dialled yet — ctrl-s starts it, ctrl-t tests the endpoint, or, when a half is refused, not saved · wallet config: <why> · chain source: <why> — one line shape either way round, and the half that did write says so. Both halves are attempted even when one is refused: a wallet-RPC refusal must not silently drop a chain source the user just picked. The endpoint's own validator is Node::wallet_save_config (Wallet::from_config behind it) — loopback host, login required — and a rejected form is rejected before it is written: nothing in the sealed record moves and a running wallet is not re-dialled.

The one exception is an app-owned chain source (local monerod, in-process Cuprate) with an empty url: the child the app spawns generates its own creds and picks its own port (creds() / pick_port(), Node::start_wallet_child_with replaces the stored client after the spawn), so the url/login rows describe no endpoint the app dials and an empty pair must not veto the save. A typed endpoint with no login is still refused — that is the externally run RPC path (ONIONWIRE_WALLET_RPC), where the refusal is true.

Ctrl-T dials the endpoint and answers with the sanitized PingResult line (never the password). Ctrl-U clears the focused field, which is how a hidden login gets replaced.

Ctrl-S saves and then starts the wallet child — the daemon and, for a local source, monerod — so the setup screen is also the key that brings the node up. A start that lands on a wallet file with no stored passphrase moves the app to the unlock prompt. Ctrl-X stops the child. Both go through the same Node::start_wallet_child / stop_wallet_child the app's own lifecycle uses.

The chain row is written only when it was changed. An untouched row leaves the stored source alone, so opening F7 to fix a port cannot silently undo an in-process Cuprate choice or move a chain datadir. Picking a remote daemon says so in the same frame — a daemon you do not run sees this wallet's chain traffic — because that is the pick that moves chain trust off this box. The address must parse as host:port first.

The default onionwire binary includes the in-process daemon. A build without that feature says so on the chain row, where the choice is made, rather than offering it and refusing at start: the in-process wording is followed by NO_FEATURE_MSG (clamped to the frame width). The pick is still offered — a stored in-process source must still be readable — and that rebuild line appears only on a build that left the feature out.

Esc is the single exit and wipes the login buffer (Zeroizing<String>).

/profile, /backup, /restore, /wipe and /wipe-all stay composer commands. They are named in help (?). There is no settings menu that restates them, and no F9.

Peer payments (p on Main)

Peer-scoped signed invoices and tips, not the wallet's own transfer list. p opens it from the roster or the chat (the composer types the letter). With no friend selected the screen says no friend selected. j/k or arrows select. Esc back. Footer: Esc back up/down select ? help.

Delivery markers (chat)

Row state Marker
delivered ✓
queued ◷ queued (try n/8, retry …)
sending » sending
failed ✗ failed: …
inbound no marker

Footer {n} queued while anything is outstanding. File transfer and payments have no queue — outcome is a status note (invoice sent, tip sent, send failed: …).

Size

Floor 80×24. Target 120×40. Frame dumps:

cargo test --locked --test tui_spec -- --nocapture dump_spec_frames
cargo test --locked --lib f6_and_f7_frames_fit -- --nocapture
cargo test --locked --test tui_select -- --nocapture wallet_select_frame_dumps