feat: add user confirmation for keys rm command#2452
Conversation
|
This is a breaking change, so I think we should hold it until the next protocol release. |
There was a problem hiding this comment.
Pull request overview
Adds a safety confirmation step to stellar keys rm to prevent accidental identity deletion, with a --force escape hatch for non-interactive use. This aligns CLI behavior with the request in #2420 for destructive-action confirmation.
Changes:
- Add interactive confirmation handling to
keys rm, plus a new--forceflag to skip confirmation. - Add integration tests covering confirmation-required behavior and
--force. - Update user-facing docs/help to mention
--forceand reflect the new behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cookbook/stellar-keys.mdx | Updates the “Remove the Identity” example command. |
| cmd/soroban-cli/src/commands/keys/rm.rs | Implements confirmation prompt + --force flag for key removal. |
| cmd/crates/soroban-test/tests/it/integration/keys.rs | Adds integration tests for confirmation and --force. |
| FULL_HELP_DOCS.md | Documents the new --force option in generated help. |
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| ```bash | ||
| stellar keys rm carol | ||
| stellar keys rm carol --force |
| if stdin.is_terminal() { | ||
| print.warnln(format!( | ||
| "Are you sure you want to remove the key '{}'? This action cannot be undone. (y/N)", | ||
| self.name | ||
| )); |
leighmcculloch
left a comment
There was a problem hiding this comment.
One ask otherwise lgtm.
| if stdin.is_terminal() { | ||
| print.warnln(format!( | ||
| "Are you sure you want to remove the key '{}'? This action cannot be undone. (y/N)", | ||
| self.name |
There was a problem hiding this comment.
Is it possible to show the key path?
We show the key path during key creation and I think it would be helpful to follow suit here too. For example:
✅ Key saved with alias asdfasdf in "/Users/leighmcculloch/.config/stellar/identity/asdfasdf.toml"
What
Add a confirmation prompt when deleting keys. The confirmation prompt can be bypassed with a
--forceflag. Confirmation also works by pipingyintostdin.$ stellar keys rm rmtest --force ℹ️ Removing the key's cli config fileWhy
Closes: #2420
Known limitations
None