Files
routstrd/tests/wallet
redshift 66b5f6ac59 feat: ensure wallet exists before deriving auth identity in remote flow
routstrd remote now runs the same ensure-wallet sequence as init (stop
legacy cocod, migrate a legacy cocod wallet so its mnemonic wins, then
initialize a fresh wallet) before deriving the NIP-98 identity, so the
operator nsec is mnemonic-derived and recoverable from the wallet backup
regardless of which command runs first. This avoids shadowing a legacy
wallet with a fresh mnemonic, which would have made later migration fail
on divergent wallets. An already-configured nsec is never replaced.

- extract ensureLocalWallet() shared by init and remote
- move initializeWallet into wallet-config.ts, return created status,
  handle concurrent-initializer EEXIST races
- warn (but still derive) when the wallet mnemonic fails BIP-39 checksum
  validation, keeping auth/NPC/wallet identities self-consistent
- relocate initializeWallet tests next to wallet-config, add
  ensure-wallet integration tests (fresh, idempotent, legacy migration,
  divergent-wallets refusal)
2026-08-17 08:24:33 +01:00
..