Skip to content

Commit 6d42455

Browse files
authored
Merge pull request #162 from bthaqi/typo/construct-for-given-algorithm
Fixing small typos
2 parents f1fd717 + 577eb4d commit 6d42455

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

jose/jwk.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_key(algorithm):
3636

3737
def register_key(algorithm, key_class):
3838
if not issubclass(key_class, Key):
39-
raise TypeError("Key class not a subclass of jwk.Key")
39+
raise TypeError("Key class is not a subclass of jwk.Key")
4040
ALGORITHMS.KEYS[algorithm] = key_class
4141
ALGORITHMS.SUPPORTED.add(algorithm)
4242
return True
@@ -53,11 +53,11 @@ def construct(key_data, algorithm=None):
5353
algorithm = key_data.get('alg', None)
5454

5555
if not algorithm:
56-
raise JWKError('Unable to find a algorithm for key: %s' % key_data)
56+
raise JWKError('Unable to find an algorithm for key: %s' % key_data)
5757

5858
key_class = get_key(algorithm)
5959
if not key_class:
60-
raise JWKError('Unable to find a algorithm for key: %s' % key_data)
60+
raise JWKError('Unable to find an algorithm for key: %s' % key_data)
6161
return key_class(key_data, algorithm)
6262

6363

@@ -119,8 +119,11 @@ def __init__(self, key, algorithm):
119119

120120
def _process_jwk(self, jwk_dict):
121121
if not jwk_dict.get('kty') == 'oct':
122+
raise JWKError("Incorrect key type. Expected: 'oct', Received: %s" % jwk_dict.get('kty'))
123+
122124
raise JWKError("Incorrect key type. Expected: 'oct', Received: %s" % jwk_dict.get('kty'))
123125

126+
124127
k = jwk_dict.get('k')
125128
k = k.encode('utf-8')
126129
k = bytes(k)

0 commit comments

Comments
 (0)