-
Notifications
You must be signed in to change notification settings - Fork 238
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
Key.to_dict() now always returns JSON encodeable keys and values. #139
Conversation
Codecov Report
@@ Coverage Diff @@
## master #139 +/- ##
=======================================
Coverage 96.54% 96.54%
=======================================
Files 14 14
Lines 1071 1071
=======================================
Hits 1034 1034
Misses 37 37
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, just needs a few nitpicks fixed.
@@ -43,3 +43,7 @@ def test_to_dict(self): | |||
|
|||
assert 'k' in as_dict | |||
assert as_dict['k'] == encoded | |||
|
|||
# as_dict should be serializable to JSON | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nitpick here: import json
at the top of the module.
@@ -370,6 +370,10 @@ def assert_parameters(self, as_dict, private): | |||
assert 'dq' not in as_dict | |||
assert 'qi' not in as_dict | |||
|
|||
# as_dict should be serializable to JSON | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nitpick here: import json
at the top of the module.
@@ -194,6 +194,10 @@ def assert_parameters(self, as_dict, private): | |||
# Private parameters should be absent | |||
assert 'd' not in as_dict | |||
|
|||
# as_dict should be serializable to JSON | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: import json
at the top of the module.
@@ -138,5 +138,5 @@ def to_dict(self): | |||
return { | |||
'alg': self._algorithm, | |||
'kty': 'oct', | |||
'k': base64url_encode(self.prepared_key), | |||
'k': base64url_encode(self.prepared_key).decode('ascii'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I know that the encoding names get normalized anyway, but I'd prefer to have one style. ASCII
is capitalized everywhere else, so I'd like it capitalized here as well.
If this is merged, then a major version should be bumped as this change is somewhat backwards incompatible.
Fixes #137 and #127.