mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-06 04:38:23 +00:00
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)