Files
amethyst/amethyst
Claude 0186aad1f4 fix(cashu): audit fixes for wallet wizard
Three issues found in an adversarial audit of the wizard:

1. (correctness) recoverFromSeed bumped the NUT-13 counter only when
   unspent proofs remained, but nextCounterAfterScan reflects every slot
   the mint signed regardless of spent state. Adopting a fully-spent
   wallet on a fresh device would leave the counter at 0, so the next
   mint would reuse an already-signed slot and produce an unspendable
   proof. Now bumps past every signed slot (matches the old
   restoreFromMint behavior); the delta>0 check still no-ops when nothing
   was signed.

2. (UX trap) the wallet screen's auto-launch-into-wizard guard used
   `remember`, which resets when the screen leaves composition on
   forward navigation — so backing out of the wizard re-fired the effect
   and trapped the user in an inescapable loop. Switched to
   rememberSaveable so the guard survives the round trip.

3. (robustness) wrapped the wizard's analyze() in try/catch so an
   unexpected throw surfaces an error + retry instead of spinning on
   "Analyzing…" forever.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EqmMR2QiULS5QGosSgSQAe
2026-06-26 18:31:37 +00:00
..