Skip to content
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

Merged
merged 10 commits into from
May 18, 2017
Merged

Conversation

MichaelMure
Copy link
Contributor

@whyrusleeping So you don't waste time before implementing the good encryption stuff ;)

License: MIT
Signed-off-by: Michael Muré [email protected]

License: MIT
Signed-off-by: Michael Muré <[email protected]>
Tagline: "Remove a keypair",
},
Arguments: []cmds.Argument{
cmds.StringArg("name", true, false, "name of key to remove"),
Copy link
Member

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.

@Kubuxu
Copy link
Member

Kubuxu commented May 1, 2017

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]>
Tagline: "Remove a keypair",
},
Arguments: []cmds.Argument{
cmds.StringArg("name", true, true, "names of keys to remove"),
Copy link
Member

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]>
@MichaelMure MichaelMure changed the title Implement ipfs key rm Implement ipfs key {rm, rename} May 4, 2017
@MichaelMure
Copy link
Contributor Author

@Kubuxu @whyrusleeping I added an implementation of ipfs key rename, because why not.

Copy link
Member

@whyrusleeping whyrusleeping left a 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 :)

func (ks *FSKeystore) Has(name string) bool {
kp := filepath.Join(ks.dir, name)

_, err := os.Stat(kp)
Copy link
Member

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

@whyrusleeping
Copy link
Member

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

@whyrusleeping whyrusleeping added this to the Ipfs 0.4.10 milestone May 13, 2017
Copy link
Member

@Kubuxu Kubuxu left a 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]>
@MichaelMure
Copy link
Contributor Author

@whyrusleeping It should be good now, can you merge ?

@whyrusleeping whyrusleeping merged commit 0780a4f into ipfs:master May 18, 2017
@whyrusleeping
Copy link
Member

Thanks @MichaelMure :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants