refactor(client): check name validation for keys add|import|rename#18950
Conversation
WalkthroughThe recent changes involve enhancing the validation of user input for key management operations within a CLI application. Specifically, the updates ensure that the "name" variable for keys is not empty after any leading or trailing whitespace is removed. This validation has been added to the addition and import commands, and error handling has been implemented for renaming keys, particularly for private keys stored on a ledger device. The associated tests have been updated to cover these new validation scenarios. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
keys add|import|renamekeys add|import|rename
keys add|import|renamekeys add|import|rename
keys add|import|renamekeys add|import|rename
|
@julienrbrt Hi sir, suggestion changes addressed |
Awesome, can we get a changelog? |
Done 😀 |
|
@Mergifyio backport release/v0.53.x |
✅ Backports have been createdDetails
|
Motivation
When I set the $name variable by mistake, and after running
keys add $namecommand, it created a key with the empty name.This looks odd when I ran

keys listto check the created key, see the screenshot below. I'm confused about the name, is it empty or just the""itself.Also, an unnormal name isn't friendly to
keys delete,keys show, andkeys exportsubcommand.So I think we should prevent from creating a key with an unnormal name