Class X402::Tasks::WalletSetup ¶
Inherits: Object
Interactive wallet setup task — backing implementation for +rake x402:wallet:setup+.
Behaviour: - Checks BSV_WALLET_DIR/wallet.key (default ~/.bsv-wallet/wallet.key) - If exists: prints identity key, reports dir, exits cleanly. Never overwrites. Set FORCE=1 to replace an existing wallet. - If absent: offers [1] create new / [2] restore from WIF / [3] cancel - New wallets get a random PrivateKey. WIF written with mode 0600. - Parent directory created with mode 0700.
Designed for dependency injection in tests: pass custom stdin, stdout, dir, and random_wif to the constructor.
Constants¶
FORCE_ENV_VAR ¶
Not documented.
Public Instance Methods¶
initialize(stdin: = $stdin, stdout: = $stdout, dir: = nil, random_wif: = nil) ¶
- @param
stdin[IO] input stream (default +$stdin+) - @param
stdout[IO] output stream (default +$stdout+) - @param
dir[String, nil] wallet directory override (default +BSV_WALLET_DIR+ env or +~/.bsv-wallet+) - @param
random_wif[#call, nil] lambda returning a WIF string. Injectable for tests. Defaults to +BSV::Primitives::PrivateKey.generate.to_wif+. - @return [WalletSetup] a new instance of WalletSetup
run() ¶
Not documented.