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

Possible typo: JwksClient.getSigningKey() #74

Closed
wants to merge 2 commits into from
Closed

Possible typo: JwksClient.getSigningKey() #74

wants to merge 2 commits into from

Conversation

sjawhar
Copy link

@sjawhar sjawhar commented Dec 22, 2018

Purpose

I think there is a typo the JwksClient library. JwksClient.getSigningKey() is not defined as a class method according to ES6, but rather as a class property. Besides being inconsistent, it's making it harder for me to stub the method for tests :) This is because getSigningKey is not defined on JwksClient.prototype, but rather this.getSigningKey gets defined as a function in the constructor.

@QuantumLove
Copy link

👍

@stale
Copy link

stale bot commented Nov 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

@stale stale bot added the closed:stale Issue or PR has not seen activity recently label Nov 12, 2019
@sjawhar sjawhar requested a review from a team November 13, 2019 17:16
@stale stale bot removed the closed:stale Issue or PR has not seen activity recently label Nov 13, 2019
@lbalmaceda
Copy link
Contributor

Can you please evaluate @stevehobbsdev?

@stevehobbsdev
Copy link

stevehobbsdev commented Dec 9, 2019

Looks good at a glance but just in case, I cloned it to run the tests and they fail.

Turns out there's also a bit of logic in the constructor that overwrites what getSigningKey is and the main reason why getSigningKey was defined as a field function rather than a class method:

if (this.options.rateLimit) {
this.getSigningKey = rateLimitSigningKey(this, options);
}
if (this.options.cache) {
this.getSigningKey = cacheSigningKey(this, options);
}

This whole mechanism is a bit weird and I would encourage it to be rewritten to improve understanding. I can dedicate some cycles to doing it this week.

Copy link

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

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

Needs changed. Changing getSigningKey to a method without considering the wrapping mechanism causes tests to fail. I believe this mechanism needs to change.

@davidpatrick
Copy link
Contributor

@sjawhar because of the way the wrappers interact with getSigningKey, it will unfortunately not be as simple as turning it into a class property. Some more work will need to be done with how the rateLimit and cache wrappers interact with it. This work is welcome, but if you don't have the bandwidth for it we will close this PR until further notice.

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.

None yet

6 participants