Skip to content

Add --hd-path flag to keys add --secure-store #2536

@fnando

Description

@fnando

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions