Commit graph

248 commits

Author SHA1 Message Date
rust-dev
db208be05c
wallet: stored config (F7), WalletStatus snapshot, pay/tip readiness guard
The only input path for the wallet was env. Add the same three remote-mode
fields as stored config so the F7 screen can set them and headless runs read
one source of truth:

- `wallet_config` table in the encrypted store (one row; the login is sealed
  with the store data key under `onionwire/wallet-config/v1`, on top of
  SQLCipher). Empty URL clears it. `Store::load_wallet_config` /
  `save_wallet_config`.
- `WalletConfig { rpc_url, rpc_login: Zeroizing<String>, no_spend }` with a
  redacting `Debug`; `Wallet::from_config`, and `Wallet::for_boot` which
  prefers stored config, falls back to env, and refuses to dial a bad stored
  endpoint. Node::start* now reads the store before constructing the wallet.
- `WalletStatus { configured, connected, last_error, balance_line,
  receive_address }`: `connected` only ever comes from a probe
  (`Wallet::status`, get_address + get_balance); config alone leaves it false.
  `Node::wallet_status` is the cheap draw-path read, `wallet_refresh` the
  probe that folds into it.
- One-shot `Wallet::ping(rpc_url, rpc_login) -> PingResult { ok, status,
  error }` for the Test-connection button: same loopback/digest rules, errors
  redacted and capped.
- `readiness(configured, connected, no_spend, is_tip) -> Readiness` plus
  `Node::wallet_readiness` (async, block_on-friendly): not configured →
  NOT_CONFIGURED_MSG; /tip on a no-spend wallet → VIEW_ONLY_MSG before any
  dial; configured but not connected → NOT_CONNECTED_MSG; else ready.
- `Node::wallet_save_config` persists, validates first, then re-reads so the
  live wallet and snapshot follow a Save without a restart.
- `Node::wallet` is now a Mutex<Wallet> (cloned out before each await) so the
  wallet can be re-pointed mid-session.

Local-mode fields stay reserved: the child lifecycle is t_69ce8e46 and is not
wired here. docs/WALLET.md documents the stored config, boot precedence and
the exact guard copy.

Tests: 38 in tests/wallet.rs including exact-refusal-copy, boot precedence,
sealed-on-disk login, ping sanitization and connected-only-after-probe.
2026-09-18 09:28:11 -04:00
agent
bcf7ec31c1
wallet: app-owned child lifecycle + user-chosen ChainSource
The app now owns monero-wallet-rpc (and monerod when the chain source is
local) instead of requiring the user to start them and export
ONIONWIRE_WALLET_RPC.

- ChainSource enum: None / Local { monerod_bin, datadir } / Remote { host,
  port }. No default remote node; Remote is only constructed from explicit
  user input. A .onion Remote is refused without a SOCKS proxy (separate
  card).
- WalletChild in src/wallet_child.rs spawns monero-wallet-rpc with
  --rpc-bind-ip 127.0.0.1, a random free loopback port, generated
  --rpc-login, and --wallet-dir /wallet; monerod too for a
  local source. --trusted-daemon is never passed.
- Generated RPC creds are sealed in the encrypted SQLCipher store
  (wallet_child table, AEAD on top of whole-db encryption), never a
  plaintext file. The Wallet client is built from the generated loopback
  URL, not from_env.
- Readiness predicate: chain_ready() requires synchronized==true, height>0,
  height>=target_height; can_spend() and can_verify_receipts() gate on it.
  Unsynced -> receipts stay verified=0, spend refused with a clear message.
- Backend-aware timeouts: local management calls keep 5s; chain-dependent
  calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT),
  because a first sync or a remote daemon outlasts 5s and a 5s cap there
  is what left receipts permanently unverified.
- node.rs ingest_receipt gates on can_verify_receipts() instead of
  configured() alone.
- docs/WALLET.md rewritten for the child lifecycle + chain source.

Base: feat/wallet-create-import (PR #66). Do not rebase onto main.

Co-Authored-By: Hermes Agent <agent@local>
2026-09-18 09:28:11 -04:00
462b5765bd Merge pull request 'ci: nightly fuzz job for fuzz/ (PR #103 harness) - fix build+run container' (#106) from wt/t_16e835ef into main
Reviewed-on: #106
2026-09-18 11:09:13 +00:00
4623f78a69 Merge branch 'main' into wt/t_16e835ef 2026-09-18 11:08:51 +00:00
agent
518ef30232
Revert "ci: crash-test — inject panic in qr_decode to prove the fuzz job fails on a crash (REVERT BEFORE MERGE)"
All checks were successful
ci / test (pull_request) Successful in 4m51s
ci / sdk (pull_request) Successful in 58s
ci / fuzz (pull_request) Successful in 4m34s
This reverts commit b76bf46100.
2026-09-17 23:28:32 -04:00
agent
99a941b437
fix(ci): merge fuzz build+run into one container so cargo-fuzz persists
All checks were successful
ci / test (push) Successful in 4m46s
ci / sdk (push) Successful in 57s
ci / fuzz (push) Successful in 4m30s
The fuzz job's two CI steps ran in separate Docker containers, so the
cargo-fuzz binary installed in step 1 was gone by step 2: run-fuzz.sh
failed with 'error: no such command: fuzz'. Merge the nightly toolchain
install, cargo-fuzz install, fuzz build, fuzz list, and run-fuzz.sh into
a single container step so the installed binary and built targets survive.

Carry the /target/tmp mkdir from 1b2c63b (rustup self-update needs TMPDIR
to exist before its temp dir creation).
Co-authored-by: agent <agent@local>
2026-09-17 23:13:34 -04:00
agent
8949da1213
fix(ci): merge fuzz build+run into one container so cargo-fuzz persists
Some checks failed
ci / test (pull_request) Successful in 4m54s
ci / sdk (pull_request) Successful in 1m5s
ci / fuzz (pull_request) Failing after 5m56s
The fuzz job's two CI steps ran in separate Docker containers, so the
cargo-fuzz binary installed in step 1 was gone by step 2: `bash
/scripts/run-fuzz.sh` failed with "error: no such command: `fuzz`".

Merge the nightly toolchain + cargo-fuzz install + `cargo fuzz build` +
`cargo fuzz list` + `bash run-fuzz.sh` into a single container step so
the installed binary and the built targets survive across the run.

Also keep the /target/tmp mkdir from 1b2c63b (rustup needs it for its
temp dir when TMPDIR=/target/tmp).

Co-authored-by: agent <agent@local>
2026-09-17 23:10:08 -04:00
agent
1b2c63b9b6
fix(ci): create /target/tmp before rustup/cargo-fuzz in Docker jobs
Some checks failed
ci / test (push) Successful in 4m42s
ci / sdk (push) Successful in 57s
ci / fuzz (push) Failing after 17m18s
All CI Docker jobs set TMPDIR=/target/tmp (via -e), but the directory
was never created inside the container before rustup ran. The /target
volume mount doesn't include a tmp/ subdir, so rustup's temp dir
creation failed with ENOENT.

Fix: add /target/tmp to the mkdir -p in all four Docker shell commands
(test, sdk, fuzz-build, fuzz-run).
2026-09-17 22:16:25 -04:00
2f6f737106 Merge pull request 'fuzz: cargo-fuzz harness for the ratchet/qr/dispatch/file parsers' (#103) from wt/t_1265efb2 into main
Some checks failed
ci / test (push) Successful in 4m49s
ci / sdk (push) Successful in 57s
ci / fuzz (push) Failing after 1m7s
Reviewed-on: #103
2026-09-18 02:00:33 +00:00
2b7a306d43 Merge pull request 'store: widen payments.kind to accept 'tip' (tips were never stored)' (#102) from wt/t_ecf204ad into main
Some checks failed
android-ci / android (push) Successful in 8m57s
ci / test (push) Successful in 4m40s
ci / sdk (push) Successful in 56s
ci / fuzz (push) Failing after 49s
Reviewed-on: #102
2026-09-18 01:53:26 +00:00
agent
186ec7436d
store: widen payments.kind to accept 'tip' so tips are stored
Some checks failed
android-ci / android (pull_request) Successful in 8m6s
ci / test (pull_request) Successful in 4m43s
ci / sdk (pull_request) Successful in 57s
ci / fuzz (pull_request) Failing after 31s
insert_payment has allowed kind = "tip" since the tip path landed, but the
payments table's CHECK only permitted invoice/receipt, so every tip insert
failed ("CHECK constraint failed: kind IN ('invoice','receipt')"). That made
the outbound tip row impossible and silently broke the inbound path too:
ingest_tip returned early and neither the row nor the [tip] chat line was
written.

- recreate the table with the widened CHECK on open, copying rows verbatim
  (new stores get it from the schema directly)
- outbound tip() records kind = "tip" with the tip's memo, matching ingest_tip
- tests: outbound row, inbound round trip, pre-tip store migration

Refs kanban t_ecf204ad
2026-09-17 21:46:57 -04:00
24b5c93c43 Merge pull request 't_2fb507c6: F8 rotate prekey (Node::rotate_prekey + invite re-encode)' (#101) from wt/t_2fb507c6 into main
Some checks failed
android-ci / android (push) Successful in 8m28s
ci / test (push) Has been cancelled
ci / sdk (push) Has been cancelled
ci / fuzz (push) Has been cancelled
Reviewed-on: #101
2026-09-18 01:21:45 +00:00
724e0427b0 Merge pull request 'tls: default to Arti's rustls backend (drop OpenSSL from TLS)' (#100) from wt/t_17e3d3cf-rustls-default into main
Some checks failed
android-ci / android (push) Successful in 9m42s
ci / test (push) Successful in 4m42s
ci / sdk (push) Successful in 1m1s
ci / fuzz (push) Failing after 59s
Reviewed-on: #100
2026-09-18 01:20:35 +00:00
049b612169 Merge branch 'main' into wt/t_17e3d3cf-rustls-default
Some checks failed
android-ci / android (pull_request) Successful in 8m17s
ci / test (pull_request) Successful in 4m50s
ci / sdk (pull_request) Successful in 1m6s
ci / fuzz (pull_request) Failing after 58s
2026-09-18 01:05:55 +00:00
agent
b76bf46100
ci: crash-test — inject panic in qr_decode to prove the fuzz job fails on a crash (REVERT BEFORE MERGE) 2026-09-17 21:04:45 -04:00
rust-dev
2cf9e8c7c6
fuzz: cargo-fuzz harness for the ratchet/qr/dispatch/file parsers
Four pure parsers eat untrusted peer input and had no structured fuzzing:

- ratchet_frame  -> RatchetState::from_bytes + RatchetState::decrypt
                    (the 'rat ' frame parser: prefix, version, length,
                    N/PN bounds, DH step, AEAD open)
- qr_decode      -> qr::decode on pasted/scanned invite strings
- dispatch_classify -> dispatch::classify on raw decrypted plaintext,
                    including the 'rat ' -> Kind::Ratchet routing arm
- file_decode    -> file::decode on 'fil ' chunk frames

No src/ change: every target calls the shipped public API. The fuzz crate is
its own workspace (empty [workspace] table), so no root Cargo.toml dependency
is added and cargo build/test at the root never compiles it.

Seeds in fuzz/seeds/ are committed and copied into the gitignored working
corpus by scripts/run-fuzz.sh; each target asserts properties a panic-free
decode must hold (a rejected ratchet frame leaves the state byte-identical,
a decoded invite is 32/32/onion-shaped, a decoded chunk re-encodes).

Verified: cargo +nightly fuzz list -> 4 targets; scripts/run-fuzz.sh with
FUZZ_SECS=60 FUZZ_JOBS=4 -> exit 0, oom/timeout/crash: 0/0/0 for all four,
fuzz/artifacts/* empty.
2026-09-17 21:04:20 -04:00
407b11f2f8 Merge pull request 'docs+tui: reachability stance (no sealed mailbox) and peer-unreachable queued footer' (#99) from wt/t_d662c8a6 into main
Some checks failed
android-ci / android (push) Successful in 8m31s
ci / test (push) Successful in 4m57s
ci / sdk (push) Successful in 1m5s
ci / fuzz (push) Failing after 36s
Reviewed-on: #99
2026-09-18 01:02:21 +00:00
deaa8a7cfa Merge pull request 'ci: nightly cargo-fuzz job for fuzz/ (PR #103 harness)' (#104) from wt/t_16e835ef into main
Some checks failed
ci / test (push) Successful in 4m41s
ci / sdk (push) Successful in 58s
ci / fuzz (push) Failing after 1m11s
Reviewed-on: #104
2026-09-18 01:00:39 +00:00
agent
bfbbdbf14f
ci: nightly cargo-fuzz job for fuzz/ (PR #103 harness)
Some checks failed
ci / test (pull_request) Successful in 4m47s
ci / sdk (pull_request) Successful in 57s
ci / fuzz (pull_request) Failing after 1m8s
Add a  job to .forgejo/workflows/ci.yml that builds the four
libFuzzer targets on nightly (ratchet_frame, qr_decode,
dispatch_classify, file_decode) and runs each for 15s. Own registry
and target volumes (onionwire-cargo-registry-fuzz /
onionwire-target-ci-fuzz), TMPDIR=/target/tmp, own concurrency group
(onionwire-ci-pi-fuzz) so the ~12min cold build does not serialize the
test/sdk jobs. Path allowlist extended with fuzz/** and
scripts/run-fuzz.sh so fuzz-only PRs actually trigger it.

Job is a no-op until PR #103 lands on main; the fuzz/ crate is a
detached workspace that root cargo test/clippy never sees.
2026-09-17 20:57:50 -04:00
rust-dev
bcee6a72a6
fuzz: cargo-fuzz harness for the ratchet/qr/dispatch/file parsers
Four pure parsers eat untrusted peer input and had no structured fuzzing:

- ratchet_frame  -> RatchetState::from_bytes + RatchetState::decrypt
                    (the 'rat ' frame parser: prefix, version, length,
                    N/PN bounds, DH step, AEAD open)
- qr_decode      -> qr::decode on pasted/scanned invite strings
- dispatch_classify -> dispatch::classify on raw decrypted plaintext,
                    including the 'rat ' -> Kind::Ratchet routing arm
- file_decode    -> file::decode on 'fil ' chunk frames

No src/ change: every target calls the shipped public API. The fuzz crate is
its own workspace (empty [workspace] table), so no root Cargo.toml dependency
is added and cargo build/test at the root never compiles it.

Seeds in fuzz/seeds/ are committed and copied into the gitignored working
corpus by scripts/run-fuzz.sh; each target asserts properties a panic-free
decode must hold (a rejected ratchet frame leaves the state byte-identical,
a decoded invite is 32/32/onion-shaped, a decoded chunk re-encodes).

Verified: cargo +nightly fuzz list -> 4 targets; scripts/run-fuzz.sh with
FUZZ_SECS=60 FUZZ_JOBS=4 -> exit 0, oom/timeout/crash: 0/0/0 for all four,
fuzz/artifacts/* empty.
2026-09-17 20:52:44 -04:00
4a06d794f1 Merge pull request 'ratchet: freeze the v1 state/frame wire format with guard tests' (#98) from wt/t_0ffa68d2 into main
All checks were successful
ci / test (push) Successful in 4m50s
ci / sdk (push) Successful in 55s
Reviewed-on: #98
2026-09-18 00:50:37 +00:00
ba3c39cfe1 Merge branch 'main' into wt/t_0ffa68d2
All checks were successful
ci / test (pull_request) Successful in 4m59s
ci / sdk (pull_request) Successful in 1m7s
2026-09-18 00:50:24 +00:00
fa53237968 Merge pull request 'tests: assert the DH ratchet step in lockstep on a bidirectional burst' (#97) from wt/t_d686a78c into main
Some checks failed
ci / test (push) Has been cancelled
ci / sdk (push) Has been cancelled
Reviewed-on: #97
2026-09-18 00:49:29 +00:00
rust-dev
6827b87a29
tui: F8 rotate prekey + Node::rotate_prekey (hard cut, drops ratchet state)
All checks were successful
ci / test (pull_request) Successful in 5m0s
ci / sdk (pull_request) Successful in 1m11s
android-ci / android (pull_request) Successful in 8m36s
The signed prekey was set at invite creation and never rotated: a long-lived
static is a long-lived forward-secrecy window. F8 now rotates it.

- Node::rotate_prekey(): new X25519 keypair, written through the existing
  replace_identity_keys prekey columns (no store change needed), live Keys
  updated, new pubkey returned for the invite re-encode. Identity untouched.
- It drops every stored ratchet session: the bootstrap epoch is derived from
  the prekey DH, so each friend has to F3-paste the new invite. Nothing is
  pushed to peers \u2014 there is no in-band prekey update.
- TUI: F8 on Main opens the confirm screen (type ROTATE, same prompt as F4),
  then re-opens the F2 share path with the new invite; help overlay + footer
  hint list it.
- Docs: THREAT_MODEL gains a section on the F8 hard cut and the prekey-bound
  epoch bullet; README key table and PROTOCOL 'Roles and keys' follow.

Tests: node-level rotation test (identity/pk/stored row/ratchet drop/invite),
tests/rotate.rs screen text + prompt, tui_chrome help needs F8.
2026-09-17 20:48:10 -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
dff37fe00e
docs+tui: reachability stance (no sealed mailbox) and peer-unreachable queued footer
Some checks failed
ci / test (pull_request) Has been cancelled
ci / sdk (pull_request) Has been cancelled
android-ci / android (pull_request) Has been cancelled
Add a Reachability section to docs/THREAT_MODEL.md: no sealed mailbox or
server-side message store, the chat outbox is local-device retry only, and
there is no mutual-online indicator — a send is a one-shot Noise IK session
and an unanswered dial queues locally with the retry clock shown.

OutboxSummary now carries the outstanding row's attempt count and soonest
retry, so the footer reads 'peer unreachable, queued (n/8, retry 45s)'
instead of a bare 'n queued'. Tests updated to the real outbox wording; the
Android KDoc note stops claiming the footer copy is mirrored (Android shows
per-row 'queued (try n/8, retry …)' via OutboxDetail).
2026-09-17 20:44:28 -04:00
agent
1aec007601
ratchet: freeze the v1 state/frame wire format with guard tests
All checks were successful
ci / test (pull_request) Successful in 4m47s
ci / sdk (pull_request) Successful in 57s
The persisted ratchet state had a version byte and typed errors but no
test that a format change would actually be caught. Add two dedicated
guards to tests/ratchet.rs that assert the frozen shape as literals
(0x01, 210-byte prefix) rather than via STATE_VERSION, so a bump breaks
them visibly, and pin that any foreign version byte is rejected with
Error::UnsupportedStateVersion before any field is read.

Document the frozen v1 state layout, the rat frame layout, and the
migration path a v2 must follow in references/ratchet-wire-frozen.md.

Verified by flipping STATE_VERSION to 2: both guards fail
("the frozen version byte changed"), then revert.
2026-09-17 20:43:31 -04:00
agent
6f267a6aba
tests: assert the DH ratchet step in lockstep on a bidirectional burst
All checks were successful
ci / test (pull_request) Successful in 4m51s
ci / sdk (pull_request) Successful in 58s
`round_trip_across_two_dh_ratchet_steps` only asserts that neither sending
ratchet key stayed put; it would still pass if the two sides stepped onto
unconnected epochs, and it never checks that either peer adopted the key the
other advertised. The new test reads dh_pub out of the wire header and pins the
adoption per step across an A->B / B->A burst:

- round 1 rotates only the lower-key (establishing) peer, so one round cannot
  lockstep both sides -- the intermediate state is asserted, not assumed;
- rounds 2 and 3 step each side in turn, asserting each receiver adopts exactly
  the key the frame advertised;
- the three-frame burst each way asserts chain reads (not extra steps), zero
  skipped keys, and that the peer that received last is keyed to the other's
  current key.

tests/ratchet.rs only; no src change, no new dependency.
2026-09-17 20:41:48 -04:00
ad1b994c08 Merge pull request 'onionwire: outbound tip() appends the sender's own [tip] chat line' (#96) from wt/t_c8441534 into main
All checks were successful
ci / test (push) Successful in 4m45s
ci / sdk (push) Successful in 58s
android-ci / android (push) Successful in 8m30s
Reviewed-on: #96
2026-09-17 21:27:04 +00:00
rust-dev
2ec88b0ce5
onionwire: outbound tip() appends the sender's own [tip] chat line
All checks were successful
ci / test (pull_request) Successful in 5m0s
ci / sdk (pull_request) Successful in 1m9s
android-ci / android (pull_request) Successful in 8m44s
The outbound tip path signed and sent a receipt frame and a tip frame and
logged the receipt line, but never the tip line, so the payer's own chat
showed only `[receipt] 0.5 XMR` — the recipient's view — for what they
had just spent. Append `pay::tip_chat_line(atomic, memo, false)` after the
receipt line so the sender sees `[tip] 0.5 XMR — memo (pending)`.

Test: outbound_tip_appends_the_senders_own_tip_chat_line in src/node.rs's
`#[cfg(test)] mod tests` — the only place a `Node` can be built offline
(Node::start bootstraps Tor). It drives the shipped tip() against a mock
wallet child (Digest challenge + one transfer) and asserts both chat rows.
2026-09-17 17:05:56 -04:00
918fa4d8a8 Merge pull request 'docs: Cuprate cross-compiles for Android aarch64 (NDK r28c, minSdk 26)' (#93) from wt/cuprate-android-crosscompile-spike into main
Reviewed-on: #93
2026-09-17 04:08:28 +00:00
rust-dev
e0bd4e4218
docs: Cuprate cross-compiles for Android aarch64 (NDK r28c, minSdk 26)
Spike evidence for the Phase 1 Android question: cargo check --release --target
aarch64-linux-android exits 0 and the PoC binary links as an Android 26 aarch64 ELF.
Documents the env recipe, the four link args the C++ RandomX build needs, the
cargo-ndk linker-wrapper bug, and the RANDOMX_DIR/DARCH no-op.
2026-09-16 23:58:25 -04:00
564036813a Merge pull request 'docs: Cuprate in-process launch spike A (testnet launch + RPC/sync evidence)' (#92) from wt/cuprate-testnet-spike into main
Reviewed-on: #92
2026-09-17 03:42:42 +00:00
agent
12db06b2ed
docs: Cuprate in-process launch spike A — testnet launch, RPC and sync evidence
Spike A of the Cuprate exploration: Node::launch(config).await runs a real
testnet chain daemon in-process (no monerod, no subprocess). Unrestricted RPC
on 127.0.0.1:18089 answers get_info, /get_height and get_block (heights 0, 1, 2,
1000) with monerod-shaped payloads, and clearnet P2P synced 0 -> 23,758 testnet
blocks in ~120s. Verdict VALIDATED with four parity gaps recorded:
out-of-range get_block returns a bare HTTP 500 with an empty body (monerod
returns a JSON-RPC error object), get_info reports zero peers while syncing,
restricted get_info returns placeholder database_size/version, and the version
label is 0.1.0-preview-release.
2026-09-16 23:39:12 -04:00
agent
c090f16dab
docs: add Cuprate phased integration strategy to payment plan
Adds strategic recommendation: Phase 1 (Cuprate in-process for chain +
monero-wallet-rpc subprocess pointing at it) and Phase 2 (monero-wallet
crate for full in-process wallet). Includes RPC compatibility note,
binary size comparison (+5.6 MB vs ~52 MB monerod), and version
conflict resolution confirmation.

See references/cuprate-integration.md and Obsidian notes for full details.
2026-09-16 23:15:55 -04:00
598270b519 Merge pull request 'ratchet: reject frames under MIN_FRAME_LEN before indexing the version byte (fixes peer-reachable panic)' (#90) from wt/t_c0566260 into main
All checks were successful
ci / test (push) Successful in 4m45s
ci / sdk (push) Successful in 56s
android-ci / android (push) Successful in 7m55s
Reviewed-on: #90
2026-09-17 02:46:17 +00:00
agent
7ba07f84ea
docs: add Cuprate in-process daemon exploration to payment plan
Adds §7a documenting the alternative approach of embedding Cuprate's
crates directly into the OnionWire binary instead of spawning monerod
as a subprocess. Includes PoC results (cargo check passed with both
arti-client 0.44 and 0.46), the wallet-layer gap, dependency bloat
assessment, and exploration card titles.

Does not change any locks — the subprocess wrapper model remains the
default path. See references/cuprate-integration.md for full test log.
2026-09-16 22:47:17 -04:00
8bedf45e53 Merge branch 'main' into wt/t_c0566260
All checks were successful
ci / test (pull_request) Successful in 5m10s
ci / sdk (pull_request) Successful in 1m14s
android-ci / android (pull_request) Successful in 8m5s
2026-09-17 02:46:03 +00:00
agent
3c78cd3e39
ratchet: reject frames under MIN_FRAME_LEN before indexing the version byte
All checks were successful
ci / test (pull_request) Successful in 4m46s
ci / sdk (pull_request) Successful in 56s
android-ci / android (pull_request) Successful in 9m54s
Frame::parse checked the prefix, then indexed frame[4] for the version byte,
then checked the length. A 4-byte `rat ` frame is a prefix hit, so it
panicked with 'index out of bounds: the len is 4 but the index is 4' instead
of being rejected. dispatch::classify routes any `rat `-prefixed message to
Kind::Ratchet, so this is reachable from any authenticated peer.

Move the MIN_FRAME_LEN check ahead of the version match: a frame that cannot
hold a header, nonce and tag is 'truncated' whatever its version byte says,
and nothing past the prefix is indexed until the length is known good. Wire
format unchanged.

Tests: tests/ratchet.rs short_frames_are_rejected_without_panicking (bare
prefix, empty slice, partial prefix, prefix + 5 bytes, MIN_FRAME_LEN - 1) and
a_wrong_frame_version_is_rejected (73-byte frame with version 2 is
BadFrame("version"); a short one is a length error). Both assert the state
stays byte-identical after every rejection.
2026-09-16 19:50:36 -04:00
cf77116143 Merge pull request 'docs: ratchet wire spec + forward-secrecy/PCS threat-model claims' (#89) from wt/t_29a71a55 into main
Reviewed-on: #89
2026-09-16 23:45:59 +00:00
agent
7f3ef8c3fc
docs: ratchet wire spec + forward-secrecy/PCS threat-model claims
PROTOCOL.md gains a 'Ratchet (v1 chat layer)' section written so a second
implementation can interoperate from the text alone: byte-exact frame layout
(rat , 0x01, dh_pub||N||PN as header and AAD, 12-byte nonce,
ChaCha20-Poly1305), the KDF_RK/KDF_CK constructions and the role-separated
epoch rule, the derived bootstrap epoch, the receive and DH-step rules, the
MAX_SKIP/MAX_SKIPPED_KEYS bounds with the replay rule, the SQLCipher
ratchet_sessions row, and what stays unratcheted.

THREAT_MODEL.md gains the corresponding gains (per-chain forward secrecy, PCS
after a DH step, header not on the wire) and honest limits (skipped-key
window, the prekey-bound bootstrap epoch, no deniability, no one-time
prekeys, compromised endpoint out of scope, no metadata gain, the no-server-
outbox lock untouched) plus the amended transport wording.

README.md documents the operator-visible consequence: no reset command yet,
prekey change / invite re-paste is the only recovery, /wipe keeps the state,
and a desync is currently stderr-only.
2026-09-16 19:40:40 -04:00
1c998e9472 Merge pull request 'ratchet verify: end-to-end + adversarial tests on the wired chat path' (#88) from wt/t_95ff7563 into main
All checks were successful
ci / test (push) Successful in 4m41s
ci / sdk (push) Successful in 57s
android-ci / android (push) Successful in 9m32s
Reviewed-on: #88
2026-09-16 23:31:23 +00:00
rust-dev
3620e4f38f
ratchet: end-to-end and adversarial tests on the wired send/receive path
All checks were successful
ci / test (pull_request) Successful in 4m54s
ci / sdk (pull_request) Successful in 1m0s
android-ci / android (pull_request) Successful in 9m26s
Drives the shipped chat ratchet offline against real SQLCipher stores and
the real encode/decode pair Node::send and Node::handle_incoming call, with
a capture-and-release Deliverer so arrival order and drops are controlled.

tests/ratchet_e2e.rs: full exchange, out-of-order arrival, a dropped frame,
a retried frame re-sent byte-identically, and a restart of both peers.

tests/ratchet_adversarial.rs: a frame claiming a jump past MAX_SKIP, a
post-compromise snapshot across a DH step, an unknown friend, a retired
epoch after an invite refresh, and five corruption shapes. Every rejected
frame is asserted to leave the persisted ratchet blob byte-identical.

src/node.rs gains a test-only module that builds a Node with an
unbootstrapped Tor client and drives Node::send plus the real receive path
(Noise IK handshake over an in-memory stream into handle_incoming).
2026-09-16 19:30:39 -04:00
4e8d8c0f25 Merge pull request 'Chat over the Double Ratchet: dispatch Kind::Ratchet + outbox payload' (#87) from wt/t_dcafd1c8 into main
All checks were successful
ci / sdk (push) Successful in 58s
ci / test (push) Successful in 4m18s
android-ci / android (push) Successful in 8m46s
Reviewed-on: #87
2026-09-16 23:08:21 +00: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
14fccd5396 Merge pull request 'store: persist per-peer ratchet session state in the SQLCipher store' (#86) from wt/t_657d57c1 into main
All checks were successful
android-ci / android (push) Successful in 8m3s
ci / test (push) Successful in 4m6s
ci / sdk (push) Successful in 59s
Reviewed-on: #86
2026-09-16 22:35:11 +00:00
agent
34c257dab5
store: persist per-peer ratchet session state in the SQLCipher store
All checks were successful
android-ci / android (pull_request) Successful in 9m3s
ci / test (pull_request) Successful in 4m11s
ci / sdk (pull_request) Successful in 59s
New additive ratchet_sessions table (friend_id PK -> friends(id) ON DELETE
CASCADE, state BLOB, updated_at), plus load/save/clear_ratchet on Store. The
blob is the opaque versioned RatchetState::to_bytes output; the store never
parses or re-serializes it. wipe_messages deliberately keeps sessions: wiping
history is not a session reset.
2026-09-16 18:30:32 -04:00
5a36338178 Merge pull request 'ratchet: Double Ratchet state machine (symmetric + DH ratchet, bounded skipped keys)' (#85) from wt/t_85aaf5a6 into main
All checks were successful
ci / sdk (push) Successful in 55s
android-ci / android (push) Successful in 9m11s
ci / test (push) Successful in 4m2s
Reviewed-on: #85
2026-09-16 22:17:10 +00: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
3eee27fd09 Merge pull request 'tui: extract pub ColorMode/TokenStyles/tokens_for for testable colour tokens' (#80) from wt/t_49b7c2b1 into main
All checks were successful
android-ci / android (push) Successful in 8m27s
ci / sdk (push) Successful in 57s
ci / test (push) Successful in 3m55s
Reviewed-on: #80
2026-09-15 21:51:15 +00:00