Skip to content

JWK Refactor#17

Merged
mpdavis merged 6 commits intomasterfrom
refactor-jwk
Jun 23, 2016
Merged

JWK Refactor#17
mpdavis merged 6 commits intomasterfrom
refactor-jwk

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.

jose/jwk.py Outdated

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