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

Decouple NewKeyringFromDir() from sdk.GetConfig() #5547

Merged
merged 10 commits into from
Jan 22, 2020

Conversation

alessio
Copy link
Contributor

@alessio alessio commented Jan 21, 2020

NewKeyringFromDir() takes only a keyring service name, which
becomes a component of the directory used as keyring's storage.


For contributor use:

  • 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.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

Alessio Treglia added 2 commits January 21, 2020 18:04
NewKeyringFromDir() takes only a keyring service name, which
becomes a component of the directory used as keyring's storage.
@alessio
Copy link
Contributor Author

alessio commented Jan 21, 2020

No changelog entry is required as the kerying hasn't been released yet

@alessio alessio marked this pull request as ready for review January 21, 2020 18:44
@alessio alessio added R4R C:Keys Keybase, KMS and HSMs labels Jan 21, 2020
Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing this PR has me thinking that the constructors as they are now may not make the most sense, namely, NewKeyring*, which internally makes some use of viper.

I would propose we instead have a single constructor:

NewKeyring(svcName, backend, rootDir string, input io.Reader, opts ...keys.KeybaseOption)

Force the upstream caller to provide svcName, backend, rootDir. The caller may then use viper and sdk.GetConfig() as they wish. Thoughts?

@alessio
Copy link
Contributor Author

alessio commented Jan 21, 2020

I like it @alexanderbez! Do you mind if I do this change in an ensuing PR?

@jackzampolin
Copy link
Member

I think thats a great idea @alexanderbez and one that we should follow through on. This PR seems a good venue to deal with that.

@alexanderbez
Copy link
Contributor

I like it @alexanderbez! Do you mind if I do this change in an ensuing PR?

Mhhh, may I ask why? It would undo the work in this PR essentially. In addition, the changes would be pretty minimal and trivial.

crypto/keys/keyring.go Outdated Show resolved Hide resolved
client/keys/utils.go Outdated Show resolved Hide resolved
client/keys/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 🎉

@alessio alessio merged commit 415eab7 into master Jan 22, 2020
@alessio alessio deleted the alessio/decouple-keyring-from-config branch January 22, 2020 17:54
@codecov
Copy link

codecov bot commented Jan 22, 2020

Codecov Report

Merging #5547 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5547      +/-   ##
==========================================
+ Coverage   54.15%   54.16%   +0.01%     
==========================================
  Files         313      313              
  Lines       18960    18960              
==========================================
+ Hits        10268    10270       +2     
+ Misses       7894     7892       -2     
  Partials      798      798
Impacted Files Coverage Δ
x/mock/app.go 64.18% <0%> (+1.35%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants