-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement ipfs key {rm, rename} #3892
Conversation
License: MIT Signed-off-by: Michael Muré <[email protected]>
core/commands/keystore.go
Outdated
Tagline: "Remove a keypair", | ||
}, | ||
Arguments: []cmds.Argument{ | ||
cmds.StringArg("name", true, false, "name of key to remove"), |
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.
This command should allow for StdIn handling and multiple argument handling. Then it would be possible to remove multiple keys at the same time easily.
See also codeclimate errors. No need to export this command definition. We are switching to not exporting them where not needed. |
License: MIT Signed-off-by: Michael Muré <[email protected]>
License: MIT Signed-off-by: Michael Muré <[email protected]>
469e7db
to
bd96f71
Compare
core/commands/keystore.go
Outdated
Tagline: "Remove a keypair", | ||
}, | ||
Arguments: []cmds.Argument{ | ||
cmds.StringArg("name", true, true, "names of keys to remove"), |
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.
Call on the return value of StringArg
.EnableStdin()
to enable stdin handling for it.
License: MIT Signed-off-by: Michael Muré <[email protected]>
License: MIT Signed-off-by: Michael Muré <[email protected]>
License: MIT Signed-off-by: Michael Muré <[email protected]>
License: MIT Signed-off-by: Michael Muré <[email protected]>
@Kubuxu @whyrusleeping I added an implementation of ipfs key rename, because why not. |
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.
One request on the implementation of Has
, otherwise LGTM, very clean code :)
keystore/keystore.go
Outdated
func (ks *FSKeystore) Has(name string) bool { | ||
kp := filepath.Join(ks.dir, name) | ||
|
||
_, err := os.Stat(kp) |
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.
Has should probably also return an error. If we run into some permissions issue, this will report that the key doesnt exist. use os.IsErrNotExist
to check for file existence, otherwise the error is a real error
License: MIT Signed-off-by: Michael Muré <[email protected]>
I would add a test that makes sure you cant rename self to something else. Then codeclimate has three issues to fix. After that, good to merge |
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.
after what @whyrusleeping pointed out
(Regarding CodeClimate, we introduced this requirement recently to incrementally improve our codebase).
License: MIT Signed-off-by: Michael Muré <[email protected]>
License: MIT Signed-off-by: Michael Muré <[email protected]>
@whyrusleeping It should be good now, can you merge ? |
Thanks @MichaelMure :) |
@whyrusleeping So you don't waste time before implementing the good encryption stuff ;)
License: MIT
Signed-off-by: Michael Muré [email protected]