Commit graph onionwire/crates
Author SHA1 Message Date
rust-dev
e95f5e1390
deps: bump Arti crates 0.46 -> 0.49 (lockstep)
All checks were successful
ci / test (pull_request) Successful in 28m59s
ci / sdk (pull_request) Successful in 3m41s
android-ci / android (pull_request) Successful in 24m29s
arti-client, tor-cell, tor-hsservice and tor-rtcompat move together to
0.49.0 (Arti 2.9.0). The SDK's separate workspace gets the same
arti-client requirement and its own refreshed lockfile.

safelog goes 0.9 -> 0.10 with them: Arti 0.49 depends on safelog 0.10, and
HsId's DisplayRedacted impl comes from that crate, so the old direct pin
made `HsId::display_redacted` unusable ("multiple different versions of
crate safelog" in src/hs.rs).

MSRV: Arti 0.49 needs rustc 1.92 (0.46 needed 1.91). The repo floor stays
1.98 for the default cuprate-daemon graph; only the comments and
docs/ARTI_UPGRADE.md move.

Upstream changes that touch us: tor-hsservice 0.49 keeps
OVERALL_UPLOAD_TIMEOUT at 5 min (PUBLISH_WAIT 360s still covers it) and
`status::State` is unchanged, so every workaround in src/hs.rs still
holds. tor-config 0.49's `Listen` is still IP-only, so the `.onion` daemon
SOCKS child stays TCP loopback.
2026-12-02 02:19:45 -05:00
agent
c741b660e4
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
All checks were successful
ci / test (pull_request) Successful in 18m32s
android-ci / android (pull_request) Successful in 20m14s
ci / sdk (pull_request) Successful in 3m11s
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.

Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.

Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:55 -04:00
agent
7391c5b7a4
ci: build the default graph on Rust 1.98, not 1.91
All checks were successful
android-ci / android (pull_request) Successful in 12m6s
ci / test (pull_request) Successful in 30m41s
ci / sdk (pull_request) Successful in 14m52s
`cuprate-daemon` is a default feature, so `cargo test --locked` in the Pi CI
job compiles `tapes`. That crate calls `VecDeque::pop_front_if`, stable only
since 1.93. `rust:1.91-bookworm` dies with `error[E0658]: use of unstable
library feature 'vec_deque_pop_if'` after the rest of the graph has already
built. The Android workflows were already on 1.98 for this; ci.yml and
release.yml were left on 1.91 when the feature was off, and that is no longer
true.

`rust-version` moves with the image. cargo checks it before features, so a
1.91 compiler must be refused up front instead of fifteen minutes into
`tapes`. `--no-default-features` would still compile on 1.91; the declared
floor is the default build's floor, which is what CI and `cargo build` run.
2026-10-08 17:41:22 -04:00
agent
f6a7daf892
wallet: optional seed-offset passphrase on import
All checks were successful
ci / test (pull_request) Successful in 6m21s
ci / sdk (pull_request) Successful in 1m28s
android-ci / android (pull_request) Successful in 12m54s
ci / fuzz (pull_request) Successful in 18m31s
Monero's `restore_deterministic_wallet` takes a `seed_offset`: a second
spend secret mixed into the 25 words at restore time, so the same words
with a different offset open a different wallet. It is not the wallet-file
passphrase and must never be sealed, stored, logged or put on an argv.

- `Wallet::restore_wallet` gains `seed_offset: Option<&str>`: None, empty
  or whitespace-only leaves the field out of the JSON entirely; otherwise
  the ends are trimmed and it is sent beside the seed.
- `Node::wallet_restore` passes it through and still seals only the file
  passphrase.
- SDK: `import_wallet` keeps its signature (None) and
  `import_wallet_with_offset` is added (Kotlin `importWalletWithOffset`).
- TUI: a new `ImportOffset` step between the seed and the file passphrase
  (blank Enter skips, a real one is confirmed, a mismatch never dials), and
  `ImportOffsetSeen` after a successful import that used one -- Esc cannot
  leave it, only SEEN, and the offset is not drawn anywhere.
- Docs: WALLET.md, THREAT_MODEL.md, TUI.md, one README sentence.
2026-09-25 00:42:44 -04:00
agent
ed29131a67
wallet: actually open the wallet file, and remember its passphrase
All checks were successful
ci / test (pull_request) Successful in 6m14s
ci / sdk (pull_request) Successful in 1m44s
android-ci / android (pull_request) Successful in 12m56s
ci / fuzz (pull_request) Successful in 5m1s
`monero-wallet-rpc` starts with no wallet open and keeps one only for the
life of its process, so a restart, a Lock/unlock or a wallet re-point left
a live child answering `-13 No wallet file` to every read while the file
sat on disk. The app now opens the configured catalogue file itself
(`Wallet::open_wallet`, over RPC — never `--wallet-file`/`--password` on
argv, which `ps` exposes) after the child is up, and keeps the passphrase
that does it, sealed with the store data key beside the RPC creds under
its own AAD.

- core: `Wallet::open_wallet`, `WalletConfig::wallet_passphrase`
  (+ `with_wallet_passphrase`, redacted Debug, kept out of the endpoint
  config), `Error::is_unreachable` for the one retryable class (the port
  binds a moment after spawn; a timeout is not a start in progress).
- store: `wallet_config.sealed_passphrase` column (additive, AAD
  `onionwire-store-v1:wallet-passphrase`), read-modify-written so the
  endpoint/login survive; `wallet_save_config` keeps the stored one.
- node: `start_wallet_child` opens the file, `open_wallet_with_passphrase`
  opens a file with a passphrase the user just typed and seals it only
  once a live daemon accepted it, `wallet_status` grows `wallet_open` and
  `needs_passphrase`. A child the RPC refuses is stopped rather than left
  inert; an install with no stored passphrase still starts, and says so.
- tui: one-shot prompt (`WalletSetup::UnlockPass`) on a wallet that needs
  it, reachable from the saved-wallet picker and from `s`.
- sdk: `openWalletWithPassphrase`, the two status fields, README flow.
- docs: WALLET/THREAT_MODEL/README — the passphrase is kept, and the
  consequence (the store passphrase is sufficient to spend) is stated
  rather than implied.

Tests: 4 new node tests drive a real child lifecycle against a loopback
wallet RPC (open on restart, no open without a passphrase, refused
passphrase, sealed-on-success), a `tests/wallet.rs` test asserts the bytes
sent (`open_wallet` + filename + password), and `tests/store.rs` covers
the sealed column and the plaintext->encrypted upgrade with it set.
Mutation-checked: stubbing the two open paths fails all four.
2026-09-22 12:52:08 -04:00
sirius
5f19a56be3
sdk: expose the wallet catalogue, the open wallet's keys, and the self profile
Some checks failed
ci / test (pull_request) Successful in 5m59s
ci / sdk (pull_request) Successful in 1m35s
android-ci / android (pull_request) Successful in 12m42s
ci / fuzz (pull_request) Has been cancelled
The Android wallet/profile screens had nothing to call: the core could list
wallets, switch the child onto one, read its keys and read/write the self
profile, but none of it crossed UniFFI.

Core:
- Wallet::keys() -> WalletKeys { view_key, spend_key: Option<String> }: two
  query_key calls against the file the RPC has open. A view-only wallet's -29
  is spend_key: None, not an error. WalletKeys' Debug redacts both halves.
- Node::wallet_keys() mirrors wallet_create/wallet_seed; refuses locally when
  no wallet is configured.
- Node::active_wallet_filename() -> Option<String>: the file the child is
  pointed at, None until wallet-child settings exist, so a client can mark the
  open row.

SDK (UniFFI):
- records WalletRow / WalletKeys / SelfProfile, and Wire::{wallets,
  open_wallet, active_wallet_filename, wallet_keys, self_profile,
  set_self_profile, push_self_profile}.
- The rule the clients must express is in the docs: the seed and the private
  keys come from the OPEN wallet, so there is deliberately no accessor that
  reads another saved wallet's secrets without opening it.

docs/WALLET.md (catalogue + 'secrets belong to the open wallet'),
docs/THREAT_MODEL.md (the new on-demand-display exposure surface) and the SDK
README are updated in the same commit.
2026-09-22 00:25:33 -04:00
agent
511c9e921d
Merge PR #143: node -- remember a created wallet in the store catalogue 2026-09-21 12:11:19 -04:00
agent
0043fa0b34
node: remember a created wallet in the store's catalogue
All checks were successful
ci / test (pull_request) Successful in 5m53s
ci / sdk (pull_request) Successful in 1m35s
android-ci / android (pull_request) Successful in 12m30s
ci / fuzz (pull_request) Successful in 4m55s
A wallet created in-app was never remembered: `Node::wallet_create` called
the RPC and returned the seed, and the wallet file name was the one
hardcoded `wallet::DEFAULT_WALLET_FILENAME` ("onionwire"). A second create
reused that name, so the RPC refused it (or opened the first wallet's
file) and no row was ever written — the "cannot create a new wallet, and
nothing survives a restart" report.

Creation and import now go through the catalogue (t_64c9ba3c's
`Store::{create_wallet,list_wallets}`):

- each create/import gets its own file name, `onionwire-<n>` for the first
  `n` the catalogue does not hold, so several wallets coexist;
- the stored row (id, identity, locator, file, created_at) is returned:
  `Node::wallet_create` -> `CreatedWallet` (row + the one-time seed, with a
  redacting `Debug`), `Node::wallet_restore` -> `WalletRecord`;
- `Node::list_wallets` reads the catalogue without dialing;
- the child config is re-pointed at the new file (read-modify-write, so the
  sealed RPC creds survive) — a row the child never opens would still be a
  broken wallet.

The SDK keeps its UniFFI signature (`create_wallet -> String` seed,
`import_wallet -> ()`), so no Kotlin change: it unwraps `.seed`.

TDD: 5 new `src/node.rs` cases (row + list, two wallets + reopen, import,
wallet-off empty list, child re-pointed) over a loopback wallet-RPC mock.
`cargo test --locked` exit 0, `cargo clippy --locked --all-targets -- -D
warnings` clean, and the same two commands are clean in
`crates/onionwire-sdk`.
2026-09-21 10:57:55 -04:00
agent
145036fda8
wallet: expose an on-demand seed accessor over core + UniFFI
All checks were successful
ci / test (pull_request) Successful in 5m43s
ci / sdk (pull_request) Successful in 1m21s
android-ci / android (pull_request) Successful in 11m53s
ci / fuzz (pull_request) Successful in 4m53s
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.
2026-09-20 11:53:19 -04:00
rust-dev
db12f4838b
sdk: expose wallet_child_refresh — a live wallet-child probe over UniFFI
All checks were successful
ci / test (pull_request) Successful in 5m16s
ci / sdk (pull_request) Successful in 1m17s
android-ci / android (pull_request) Successful in 13m18s
ci / fuzz (pull_request) Successful in 18m36s
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.
2026-09-20 00:20:32 -04:00
onionwire
0a91744924
wallet: show the chain daemon's sync height and target on the child status
All checks were successful
ci / test (pull_request) Successful in 5m50s
ci / sdk (pull_request) Successful in 1m34s
ci / fuzz (pull_request) Successful in 4m54s
android-ci / android (pull_request) Successful in 12m39s
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).
2026-09-19 19:38:52 -04:00
agent
5080652e3b
feat(wallet): mainnet pruned and full on-device chain modes
All checks were successful
ci / test (pull_request) Successful in 5m45s
ci / sdk (pull_request) Successful in 1m34s
ci / fuzz (pull_request) Successful in 4m51s
android-ci / android (pull_request) Successful in 13m2s
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.
2026-09-19 12:54:35 -04:00
agent
0acf89a0b4
android: Start wallet no longer looks like a no-op while Cuprate launches
All checks were successful
ci / test (pull_request) Successful in 5m34s
ci / sdk (pull_request) Successful in 1m22s
android-ci / android (pull_request) Successful in 10m48s
ci / fuzz (pull_request) Successful in 4m52s
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.
2026-09-19 12:03:01 -04:00
agent
e89dd9eaee
sdk: expose the on-device Cuprate chain source (choice, lifecycle, node status)
All checks were successful
ci / test (pull_request) Successful in 5m5s
ci / sdk (pull_request) Successful in 1m4s
android-ci / android (pull_request) Successful in 8m31s
ci / fuzz (pull_request) Successful in 4m47s
ChainChoice gains InProcessCuprate, the SDK passes the core's cuprate-daemon
feature through as its own, and an empty monerod_datadir for that kind resolves
to $ONIONWIRE_HOME/chain so Kotlin never invents a path. wallet_status now
carries chain_in_process / node_available / node_state beside the core's five
state words; no second state machine, no timer, no env var.

start/stop stay the core's pass-through: one call launches the node and the
wallet child, one stops both, both idempotent.

Replayed onto main (25e029e): PR #111 was merged into the core branch
onionwire/t_04975420-cuprate-land-the-in-process-chain-source, not main, so
main had only the core half (from PR #110). This is the same tree change with
no core commits replayed.
2026-09-18 15:29:55 -04:00
agent
ffea4bf9df
wallet: land the in-process Cuprate chain source on main
All checks were successful
ci / test (pull_request) Successful in 5m39s
ci / sdk (pull_request) Successful in 1m22s
android-ci / android (pull_request) Successful in 8m58s
ci / fuzz (pull_request) Successful in 4m45s
`ChainSource::InProcessCuprate { datadir }` is the fourth chain source: P2P,
consensus and RandomX run inside the OnionWire process instead of as a spawned
`monerod`. The wallet layer does not move — the daemon binds the same loopback
unrestricted RPC (`127.0.0.1:18081`) that `WalletChild::daemon_address` already
returns for a local source, so `wallet_rpc_argv`, the RPC client, the payment
frames and the receipt-verification path are untouched.

- Cargo.toml: `cuprated` (git, rev 4f8fcd1b) + `toml`, both optional, behind the
  `cuprate-daemon` feature, OFF by default. `cuprated`'s own `arti` feature is
  disabled (`default-features = false`): its arti-client 0.44 cannot unify with
  this crate's 0.46, and the in-process daemon is clearnet-only. One Tor stack in
  the process. `Cargo.lock` gains the graph; a default build's
  `cargo tree --locked -e normal -i cuprated` still says "did not match any
  packages", and only `arti-client v0.46.0` is in the lock.
- src/cuprate.rs (new): `CuprateNode` builds the cuprated config as TOML
  (testnet, unrestricted RPC on loopback, restricted RPC disabled, inbound P2P
  off), launches it on a runtime it owns, and owns the node. `launch` is
  synchronous on purpose: `WalletChild::start` is sync (the TUI calls it from its
  blocking thread, UniFFI calls it from an async context) and a runtime cannot be
  started from inside a runtime, so the launch runs on a thread of its own and
  the node + its runtime come back over a channel. Dropping the value asks the
  node to shut down and `shutdown_background`s the runtime, which is the only
  exit that cannot panic when the value is dropped inside another runtime.
  The type exists in every build (feature off: `launch` fails with the feature
  name), so the chain-source type, its stored record and its copy do not fork on
  a cargo feature.
- src/wallet.rs: the variant, its label (`in-process node`), and the chain-daemon
  client the wallet line carried (typed `WalletError`, de-chunked HTTP,
  `get_height` over the URI endpoint, an above-the-tip height as one typed
  error). Cuprate answers those three differently from monerod and the
  in-process source is what makes them the *local* case.
- src/wallet_child.rs: launches/holds/stops the node, `chain_datadir` for the
  free-space/ownership question, the honest `chain_copy` line, `kind =
  "cuprate"` in the sealed record, and `ChildConfig::validate` for it.
- src/tui.rs: the wallet screen's chain line carries the testnet caveat when the
  configured source is the in-process one. It computes the line at draw time, so
  `Screen::Wallet`'s shape (which tests construct) does not change.
- docs/WALLET.md, docs/THREAT_MODEL.md, docs/cuprate-android-spike.md: the
  feature flag and how to enable it, where the (fjall) chain store lives, the
  **measured** +11.8 MiB delta, the pre-production/testnet caveat, and the
  in-repo aarch64-linux-android proof with exit codes.

Scope deviations, stated plainly:
- `src/cuprate.rs` and its one `src/lib.rs` module line are not in the card's
  allowed list; the card's own deliverable describes the module's behaviour.
- `crates/onionwire-sdk/src/lib.rs` is forbidden, but adding a variant to a
  `pub enum` that the SDK matches exhaustively breaks the SDK workspace, and the
  root CI `sdk` job runs on every PR. One variant plus two match arms land here
  so the SDK keeps compiling (`cargo test --locked` + clippy clean); the SDK card
  owns the rest — feature passthrough, the config field's semantics, the label
  and its tests, and the Android check.
- `tests/wallet.rs` carries the launch test. `tests/tui_frames.rs` is untouched:
  main has no `ChainChoice` to pin (the chain-source picker is the unmerged F7
  work, and `docs/WALLET.md` says so rather than describing a picker that does
  not exist).

Proof (all on this tree):
- Default build: `cargo test --locked --target x86_64-unknown-linux-gnu` → 345
  passed / 0 failed across 33 suites, exit 0; `cargo clippy --locked
  --all-targets --target x86_64-unknown-linux-gnu -- -D warnings` exit 0.
- Feature on: `cargo test --locked --features cuprate-daemon --target
  x86_64-unknown-linux-gnu` → 347 passed / 0 failed, exit 0; same clippy with
  `--features cuprate-daemon` exit 0. The two extra tests are the real thing:
  `wallet_child::tests::in_process_source_launches_a_daemon_and_stop_shuts_it_down`
  and `tests/wallet.rs::an_in_process_cuprate_node_answers_the_typed_daemon_client`
  — the latter launches the node, drives `get_info` / `get_height` / `get_block`
  through the typed client, checks the above-the-tip 500 maps to
  `DaemonHeightOutOfRange`, checks the chain store is under the chain datadir,
  and checks the listener dies with the node.
- aarch64: `cargo check --locked --release --target aarch64-linux-android
  --features cuprate-daemon` exit 0 (1m 50s), and the full link exit 0
  (`cargo rustc ... --bin onionwire -- <NDK C++ runtime / compiler-rt link
  args>`) producing `ELF 64-bit LSB pie executable, ARM aarch64, for Android 26,
  built by NDK r28c`.
- Size: stripped aarch64 release binary, 24,725,704 bytes without the feature and
  37,053,472 with it — +12,327,768 bytes (≈ +11.8 MiB), the figure
  `docs/WALLET.md` now quotes.
2026-09-18 13:45:59 -04:00
agent
d8a2ee35aa
sdk: expose the wallet-child lifecycle over UniFFI
ChainConfig / ChainChoice / WalletChildStatus records and
set_chain_source(config) / chain_source() / start_wallet_child() /
stop_wallet_child() / wallet_status(). Android passes absolute binary paths
from nativeLibraryDir; the core never resolves a binary the caller named.
2026-09-18 09:28:11 -04:00
Hermes rust-dev
69672809ab
tls: default to Arti's rustls backend (drop OpenSSL from TLS)
All checks were successful
ci / test (pull_request) Successful in 6m47s
android-ci / android (pull_request) Successful in 8m21s
ci / sdk (pull_request) Successful in 1m25s
Arti's TLS backends are non-additive; the root crate defaulted to
`native-tls` (OpenSSL). Switch `default = ["rustls"]` and pin the `rustls`
crate with its `ring` feature — `tor-rtcompat` pulls rustls in with
`default-features = false`, so without that pin the backend compiles with no
`CryptoProvider` and the first TLS config fails (same reason already recorded
in crates/onionwire-sdk/Cargo.toml).

`native-tls` stays as an opt-in feature. SQLCipher still builds vendored
OpenSSL (`bundled-sqlcipher-vendored-openssl`); that is unrelated to TLS.

- tests/tls_backend.rs: compile-time pin that the default features select
  rustls, plus a runtime check that rustls resolves a provider with no manual
  install.
- ci.yml: the root `test` job no longer installs pkg-config/libssl-dev (the
  SDK job keeps it).
- docs: README build deps, ARTI_UPGRADE backend table, release-body and the
  SDK README now describe the rustls default; the false "binaries link
  libssl.so.3 dynamically" claim is corrected.
- crates/onionwire-sdk/Cargo.lock: regenerated for the root crate's new
  dependency (separate workspace, --locked would otherwise fail).
2026-09-17 20:48:05 -04:00
agent
69a15fe909
chat: send and receive as ratchet frames through the outbox payload
All checks were successful
ci / test (pull_request) Successful in 4m36s
ci / sdk (pull_request) Successful in 1m15s
android-ci / android (pull_request) Successful in 9m25s
Chat plaintext is ratchet-encrypted once, before the first delivery attempt,
and the frame is what the outbox stores and retries, so a retried message
re-sends identical bytes instead of advancing the sending chain twice.

- dispatch: Kind::Ratchet for the `rat ` prefix, matched before the unknown
  [a-z]{3} prefix rule
- node: encode_chat_frame / ingest_chat_frame (the wire halves of Node::send
  and handle_incoming), bootstrap derived from the peers' static prekey DH
  because the Noise handshake is frozen and carries no ratchet key
- outbox: nullable outbox.payload + Outbox::send_payload; NULL payload keeps
  the previous row-for-row behaviour
- store: additive outbox.payload migration, enqueue_outbox_payload,
  OutboxEntry::payload
- add_friend_payload: a changed prekey clears the (prekey-bound) ratchet state

tests/ratchet_wire.rs (5) covers one frame per send, byte-identical retries,
out-of-order delivery, replay, tampering and fresh-friend both directions.

tests/tui_spec.rs and crates/onionwire-sdk/src/lib.rs only gained a
`payload: None` field in their OutboxEntry test fixtures: the card's required
field on a pub struct cannot be added without it.
2026-09-16 19:02:52 -04:00
agent
8b2e834616
ratchet: Double Ratchet state machine for chat frames
All checks were successful
ci / sdk (pull_request) Successful in 1m25s
android-ci / android (pull_request) Successful in 9m12s
ci / test (pull_request) Successful in 4m35s
New wire-independent `src/ratchet.rs` + `tests/ratchet.rs`: KDF_RK/KDF_CK as in
the Signal spec, symmetric ratchet, DH ratchet, skipped-key store with the
MAX_SKIP / MAX_SKIPPED_KEYS bounds, versioned state serialization and zeroize
of every superseded secret.

Initiation gate: per-direction chains seeded by ratchet-key ordering (option
(a)), so both peers can build a sending chain before either has received, and a
single deterministic tie-break (lower ratchet key rotates first) keeps exactly
one rotation in flight. Documented under "Initiation and convergence" and
covered by both_peers_send_first_converges, which fails on a crossing rotation.

Adds hkdf 0.12 + hmac 0.12 (0.13 pulls digest 0.11 and will not build against
sha2 0.10) and regenerates crates/onionwire-sdk/Cargo.lock.
2026-09-16 18:05:39 -04:00
agent
96d582153a
feat(sdk): sign/encode/decode/verify invoice, receipt and tip frames
All checks were successful
ci / test (pull_request) Successful in 4m24s
android-ci / android (pull_request) Successful in 8m53s
ci / sdk (pull_request) Successful in 1m17s
The SDK could already send an invoice or a tip through Node::pay_invoice /
Node::tip, but it could not touch the payment frames themselves: pay::sign_*
take the ed25519 identity secret and Node exposed only identity_pk(), so the
signing half lived nowhere the SDK could reach.

Add the signing surface to the node instead of exporting the key:

  * Node::sign_invoice / sign_receipt / sign_tip sign with the node's own
    identity key and return the core frame struct. The secret never leaves
    the process and there is no API that hands it out.
  * pay_invoice and tip now call those methods rather than signing inline, so
    there is one signing path, not two.

SDK (crates/onionwire-sdk), all backward compatible:

  * Records Invoice, Receipt, Tip mirroring src/pay.rs, sig as raw bytes so a
    frame re-encodes byte-for-byte.
  * Wire::sign_invoice / sign_receipt / sign_tip (async, over the node).
  * Free functions encode_invoice / encode_receipt / encode_tip,
    decode_invoice / decode_receipt / decode_tip (None on a foreign or
    truncated frame), verify_invoice / verify_receipt / verify_tip against
    the sender's pubkey hex (false on a bad key, never a panic).

Tests: 8 new SDK unit tests (record round-trips through the core encoders,
signer-key-only verification, tamper rejection, foreign/truncated frame,
typed Stopped error after shutdown). SDK 27 passed, 0 failed; SDK clippy
--all-targets -D warnings clean; root clippy --all-targets -D warnings
clean; root lib tests 14 passed; tests/pay.rs 11 passed.
2026-09-15 12:45:49 -04:00
Lance Walters
cf0a517cd2
wallet: create/import in-app (no key paste on create) + opt-in spend
All checks were successful
ci / test (pull_request) Successful in 4m15s
ci / sdk (pull_request) Successful in 1m12s
/ wallet create generates a wallet on the RPC and shows the 25-word seed
once for backup; /wallet import is the only path that takes an existing
seed, and it is collected on a dedicated screen so it never reaches the
composer line or chat history.

Threat model now states the real policy: payments are opt-in, default is
no spend key, spend is a local authority at create/restore, and the chain
source is the user's choice (spawned local monerod or a daemon address
they supply). WALLET.md and README follow.

Tests: canned-RPC create/restore, slash parse, help overlay.
2026-09-13 23:25:25 -04:00
agent
7cf98bb9fe
feat(android): wallet screen and SDK payment surface
Some checks failed
ci / test (pull_request) Failing after 4m1s
ci / sdk (pull_request) Successful in 1m27s
Expose wallet balance/address/transfers plus one-shot invoice and tip on
the UniFFI SDK. Wire a Compose wallet route (QR, composers) without dropping
wipe-chat. Ignore machine-local android/.cargo NDK paths.
2026-09-13 15:27:57 -04:00
rust-dev
7b68cb4a9f
feat(sdk): ChatMessage.id — join a chat row to its outbox row
`OutboxRow::message_id` documents itself as *the* join key (the
`messages.id` a `ChatMessage` belongs to), but the record carried no id,
so the Android client could only pair the two lists positionally.

Add `ChatMessage.id: i64` as the first field, copied straight from the
`messages.id` the store already selects. Additive over UniFFI: Kotlin
consumers only gain a constructor field and the bindings regenerate.

The id mapping moves into a `chat_message` helper so the join property is
testable without a Node: the new test builds a real store, queues an
outbox row for a message, and asserts the id on the message equals the
`message_id` the outbox row reports for that same row.

# Conflicts:
#	crates/onionwire-sdk/src/lib.rs
2026-09-12 19:16:45 -04:00
rust-dev (hermes)
56bd8845e7
feat(sdk): expose the outbox rows behind a queued chat message
The TUI can say why a queued row is still queued ('queued (try n/8,
retry 45s)') because it reads OutboxEntry::attempts and next_attempt_at
directly. The SDK exposed neither: ChatMessage.delivery is a flat
'queued'/'sending'/'failed: <reason>' string and Wire had no outbox
accessor, so an Android chat row could only invent a countdown.

Adds OutboxRow { message_id, status, attempts, next_attempt_at,
last_error } and Wire::outbox(pubkey_hex) over Node::outbox_pending, plus
outbox_max_attempts() so the client renders 'try n/8' against the core's
own budget instead of a hardcoded 8. Additive: Wire::send() and
ChatMessage.delivery are untouched.

# Conflicts:
#	crates/onionwire-sdk/src/lib.rs
2026-09-12 19:16:45 -04:00
agent
f2dcd79d5c
fix(sdk): surface Sent/Queued on send(), and build the SDK in CI
All checks were successful
ci / test (pull_request) Successful in 3m56s
ci / sdk (pull_request) Successful in 53s
Node::send() became Result<OutboxStatus, String> in the local-outbox work,
which broke crates/onionwire-sdk — and nothing noticed, because the SDK is a
separate cargo workspace that root CI never compiles.

- Wire::send() returns WResult<SendState> (Sent | Queued)
- ChatMessage.delivery for outgoing rows
- New sdk job in ci.yml (own target volume; rustls workspace)
- Refresh SDK Cargo.lock + README (SQLCipher / outbox facts)

Rebased onto main after #50/#54: no src/node.rs changes (WAL checkpoint lives
in Store now). README at-rest claims kept from #55.
2026-09-12 19:16:42 -04:00
agent
48c06df2cf
docs(sdk): Wire::shutdown doc said the second call returns Ok; it returns Stopped
All checks were successful
ci / test (pull_request) Successful in 4m22s
The handle-level call takes the node out on the first shutdown, so a second
call reports the typed `WireError::Stopped` (covered by
`calls_after_shutdown_are_typed_errors_not_panics`). Only the node-level
`Node::shutdown()` is Ok-idempotent. The rustdoc claimed otherwise.
2026-09-12 15:26:17 -04:00
apk-dev
38fde75d40
feat(core,sdk): explicit Tor lifecycle — stop, flush, observable state
A node had no way to stop. `Wire` was a bare handle over a `Node`: dropping the
Kotlin reference left Arti's client, the hosted v3 onion service, the outbox
retry worker and the sqlite connection alive, and there was no way to ask where
the onion service was. On Android the process is killed without warning by Doze
and the background-process killer, so "drop everything when the process dies" is
not a lifecycle.

Core (`src/node.rs`, `src/hs.rs`):

* `Node::shutdown()` — bounded outbox drain (10s), stop the onion service (the
  rendezvous task is aborted and the RunningOnionService dropped), abort the
  retry worker, checkpoint the sqlite WAL. Idempotent at this level: the flag is
  swapped first, so a racing second call is a no-op.
* `Node::flush() -> FlushOutcome { attempted, delivered, remaining }` — one
  delivery attempt for every queued outbox row, ignoring backoff, then a WAL
  checkpoint. Bounded by 30s because a dead peer's onion holds a dial for ~20s
  and the caller is a UI thread. A timeout leaves rows in `sending`;
  `Outbox::reset_stale` requeues them on the next unlock, same as a process that
  died mid-attempt.
* `Node::tor_state() -> TorState` (`Bootstrapping` / `Published` /
  `DegradedReachable` / `Stopped`) and `hs::tor_state_of(state, stopped,
  reachable)`, which mirrors `hs_is_ready` exactly instead of re-deriving
  readiness.
* Every network entry point (`send`, `send_once`, `connect_onion`, `rotate`,
  `flush`) fails with a typed error after the node stops, rather than dialing a
  dead client.
* `checkpoint_wal` reaches the database through a short-lived second connection:
  `Store` owns the write connection and does not lend it out, and a checkpoint is
  a property of the database, not of one connection. Best effort — WAL replay on
  open recovers anything committed.

The `WorkerHandle` moved into a `Mutex<Option<...>>` so the teardown can *abort*
the retry worker instead of only dropping it when the whole `Node` dies.

SDK (`crates/onionwire-sdk/src/lib.rs`):

* `Wire.shutdown()`, `Wire.flush(): FlushOutcome`, `Wire.torState(): TorState`.
  `Wire` now holds `Mutex<Option<Arc<Node>>>`, so teardown drops the last
  reference to the Tor client and the store instead of keeping them alive behind
  a JNI handle.
* `WireError::Stopped` — a second flat variant, so "you must unlock again" is a
  typed `WireException.Stopped` in Kotlin, not a string match on `Failed`.
* No `unwrap()` on a poisoned mutex anywhere: a poisoned handle reports
  `Stopped`, which is the correct recovery (unlock again).
* Fixes the crate not compiling on this base at all: `Node::send` has returned
  `Result<OutboxStatus, String>` since the outbox landed, and the SDK still
  mapped it to `Result<(), String>` (E0308). CI's path allowlist excludes
  `crates/**` from the Rust job, which is why it stayed green.

The live Tor test found a real bug in the first version of `tor_state`: Arti's
combined status is still `Bootstrapping` after a *successful* probe of our own
onion (that mismatch is what the 360s publish wait exists for), and a freshly
launched service reports `Shutdown` before its publish reactor starts — so a
node that was live and reachable reported `Bootstrapping`, and briefly
`Stopped`, right after unlock. `Node` now tracks an `onion_reachable` flag set
when the publish bar is crossed and cleared when `rotate` hard-cuts the service,
and `Shutdown`/`Broken` on a live node read `Bootstrapping` (transient) rather
than terminal.
2026-09-12 15:10:29 -04:00
Sirius DevOps
22b3a0062a
docs: add PROTOCOL.md and retire the stale audit writeup
All checks were successful
ci / test (pull_request) Successful in 3m7s
Wire format lives in docs/PROTOCOL.md so the handshake, invite, and
frames can be read without the Rust. Threat model points at it. The
in-house audit notes are a finding-status table, not a third-party
audit. SDK README no longer claims the legacy concat invite signature
is what we encode.
2026-09-11 13:15:51 -04:00
Sirius DevOps
d2d3b0c827
fix(sdk): enable rustls' ring provider and install it in the init path
All checks were successful
ci / test (pull_request) Successful in 3m30s
GREEN. rustls 0.23 selects its CryptoProvider from its own 'ring' /
'aws-lc-rs' crate features. Arti reaches rustls through tor-rtcompat with
default-features = false and nothing in this workspace turned a provider
feature on, so rustls was compiled with zero providers and the first TLS
config built from the process default panicked:

    Could not automatically determine the process-level CryptoProvider from
    Rustls crate features. ...

That is the 'Failed to start' screen on the unlock path. The 'ring' crate
being present in the graph (via snow, for Noise) never had anything to do
with it.

'ring', not 'aws-lc-rs': aws-lc-rs wants CMake and a C toolchain for the
NDK and fights the cross-compile.

Belt and braces: open_wire() now calls install_crypto_provider() before
Node::start_with_passphrase, a OnceLock-guarded
ring::default_provider().install_default() with the already-installed Err
ignored. That keeps the cdylib correct regardless of how a consumer's
feature graph resolves rustls.

aws-lc-rs is absent from the lock, so there is no two-provider conflict to
report.

Evidence:
  cargo test --release --test provider_resolution
    before: panicked at rustls-0.23.44/src/crypto/mod.rs:249 (device message)
    after:  1 passed
  cargo tree -f '{p} [{f}]' -p rustls
    rustls v0.23.44 [log,logging,ring,std,tls12]
2026-09-10 22:03:40 -04:00
Sirius DevOps
411194a8b2
test(sdk): reproduce rustls CryptoProvider panic from the device
RED. The APK builds, installs and opens, but the first rustls config built
from the process default panics one call deep inside Arti's rustls backend:

    Could not automatically determine the process-level CryptoProvider from
    Rustls crate features.
    Call CryptoProvider::install_default() before this point ...

rustls 0.23 picks its provider from its own 'ring' / 'aws-lc-rs' crate
features, not from which crypto crates happen to be linked. Arti reaches
rustls via tor-rtcompat with default-features = false, so neither provider
feature is on and rustls compiles with zero providers. 'ring' does appear in
cargo tree, pulled in by snow for Noise -- unrelated and irrelevant.

This commit adds rustls as an explicit dependency with no provider feature
(no behaviour change: it is already in the graph that way) so the test can
name the type, plus the regression test. On the host it reproduces the
device's panic verbatim.

The SDK lockfile is resynced with the root Cargo.toml on main (onionwire
0.2.1, rpassword, md-5, rtoolbox) in the same commit so the test build is
against a consistent lock.
2026-09-10 22:02:02 -04:00
apk-dev
672f2c9990
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
All checks were successful
ci / test (pull_request) Successful in 3m22s
Adds the Android product alongside the existing Linux TUI, in one repo.

SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).

android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.

Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.

Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00