-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R4R: Add keys new
and keys mnemonic
commands
#2155
Conversation
Two notes about this PR:
|
Codecov Report
@@ Coverage Diff @@
## develop #2155 +/- ##
===========================================
+ Coverage 63.62% 63.69% +0.07%
===========================================
Files 136 136
Lines 8270 8325 +55
===========================================
+ Hits 5262 5303 +41
- Misses 2652 2660 +8
- Partials 356 362 +6 |
keys new
and keys mnemonic
commandskeys new
and keys mnemonic
commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mslipper thanks for contribution! I left some feedback. Also, a pending log update needs to be added.
I have yet to test this, once other reviews have been added and addressed, I'll test.
Also, we should probably mark the old command as deprecated in the short/long text, no?
client/keys/mnemonic.go
Outdated
func mnemonicCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "mnemonic", | ||
Short: "Creates a new mnemonic for use in key generation. Uses system entropy by default.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Generate a mnemonic from system or user-supplied entropy
wording is slightly better here.
client/keys/mnemonic.go
Outdated
) | ||
|
||
const ( | ||
flagEntropy = "user" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to flagUserEntropy
?
client/keys/mnemonic.go
Outdated
return outputMnemonic(kb, nil) | ||
} | ||
|
||
stdin := client.BufferStdin() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having all this signal handling and go-routine handling seems a bit off to have here. Why not have a helper function in client/input.go
that utilizes GetString
or some variant? This would cleanup the command handler a lot.
client/keys/mnemonic.go
Outdated
}() | ||
|
||
go func() { | ||
fmt.Println("Please provide entropy using your keyboard and press enter.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the prompt can be simplified down to: Please provide entropy:
, no?
crypto/keys/bip39/wordcodec.go
Outdated
return NewMnemonicWithEntropy(len, nil) | ||
} | ||
|
||
func NewMnemonicWithEntropy(sLen ValidSentenceLen, providedEntropy []byte) ([]string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing godoc.
is this still WIP? |
keys new
and keys mnemonic
commandskeys new
and keys mnemonic
commands
@rigelrozanski it's good to go from my perspective. |
Sorry, maybe I didn't communicate it well enough, but I tackled this in #2090 |
Want to take a look at that and see if there's anything from here we should bring over? There's a few other refactors/pkg movement there |
@ebuchman Retrospective - I think that it would have been more clear if your PR was tackling 2091 to use the language "Closing" instead of "Ref" |
++ |
Closes #2091.
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: