Summary
stellar keys generate --secure-store accepts a --hd-path flag, but stellar keys add --secure-store does not. The add command always implicitly uses HD path 0 (or whatever the default ends up being). The two commands should support the same set of derivation paths so users can import a seed phrase and immediately use a non-default account index.
Context
Spotted by @leighmcculloch during review of #2533:
In #2533 the call site in cmd/soroban-cli/src/commands/keys/add.rs passes None for hd_path because the flag isn't wired up yet — that's the placeholder this issue would replace.
Proposed change
- Add a
--hd-path <usize> flag to keys add (mirroring the one on keys generate at cmd/soroban-cli/src/commands/keys/generate.rs:55).
- Thread it through to the
secure_store::save_secret(...) call so the derived public key cached in the identity TOML matches the requested path.
- Document the flag in the help text consistently with
generate.
Summary
stellar keys generate --secure-storeaccepts a--hd-pathflag, butstellar keys add --secure-storedoes not. Theaddcommand always implicitly uses HD path0(or whatever the default ends up being). The two commands should support the same set of derivation paths so users can import a seed phrase and immediately use a non-default account index.Context
Spotted by @leighmcculloch during review of #2533:
In #2533 the call site in
cmd/soroban-cli/src/commands/keys/add.rspassesNoneforhd_pathbecause the flag isn't wired up yet — that's the placeholder this issue would replace.Proposed change
--hd-path <usize>flag tokeys add(mirroring the one onkeys generateatcmd/soroban-cli/src/commands/keys/generate.rs:55).secure_store::save_secret(...)call so the derived public key cached in the identity TOML matches the requested path.generate.