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

JWK Refactor #17

Merged
merged 6 commits into from
Jun 23, 2016
Merged

JWK Refactor #17

merged 6 commits into from
Jun 23, 2016

Conversation

mpdavis
Copy link
Owner

@mpdavis mpdavis commented Mar 16, 2016

This is the beginning of a refactor of JWK objects so that can begin their journey to not being horrible. I am hoping that JWKs can be a first class object just like JWS and JWT are.

Still TODO:

  • process HMACKey JWKs
  • process ECKey JWKs
  • correctly process RSAKey JWKs to include private keys
  • to_jwk method to serialize Keys to a JWK dict
  • JWK documentation

The old way:

alg_obj = get_algorithm_object(algorithm)
key = alg_obj.prepare_key(key)
signature = alg_obj.sign(signing_input, key)

The new way:

key = jwk.construct(key_data, algorithm)
signature = key.sign(signing_input)

@crgk You input would be appreciated if you were interested.


if not jwk.get('kty') == 'RSA':
raise JWKError("Incorrect key type. Expected: 'RSA', Recieved: %s" % jwk.get('kty'))
def process_jwk(self, jwk_dict):
Copy link
Contributor

Choose a reason for hiding this comment

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

is this method meant to be used directly? I don't see how somebody would want/need to call this on an instance of RSAKey, since you have to prepare a key to get an instance.

Making it _process_jwk would indicate that it is an implementation detail more than an API, if that's your intent

@codecov-io
Copy link

codecov-io commented Apr 28, 2016

Current coverage is 95.37%

Merging #17 into master will decrease coverage by 0.18%

@@             master        #17   diff @@
==========================================
  Files             7          7          
  Lines           428        454    +26   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            409        433    +24   
- Misses           19         21     +2   
  Partials          0          0          

Powered by Codecov. Last updated by 9975866...ca8efcf

@mpdavis mpdavis force-pushed the refactor-jwk branch 4 times, most recently from 705475a to 3085f9a Compare June 23, 2016 04:40
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