Skip to content

Commit 8531800

Browse files
authored
Merge pull request #155 from IdentityPython/sdjwt2
Editorial changes
2 parents 06c4cda + 29116aa commit 8531800

File tree

9 files changed

+11
-15
lines changed

9 files changed

+11
-15
lines changed

src/cryptojwt/jwk/ec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(self, kty="EC", alg="", use="", kid="", crv="", x="", y="", d="", *
113113
def deserialize(self):
114114
"""
115115
Starting with information gathered from the on-the-wire representation
116-
of an elliptic curve key (a JWK) initiate an
116+
of an elliptic curve key (a JWK) initiate a
117117
cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey
118118
or EllipticCurvePrivateKey instance. So we have to get from having::
119119

src/cryptojwt/jws/dsa.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def verify(self, msg, sig, key):
8585
def _cross_check(self, pub_key):
8686
"""
8787
In Ecdsa, both the key and the algorithm define the curve.
88-
Therefore, we must cross check them to make sure they're the same.
88+
Therefore, we must crosscheck them to make sure they're the same.
8989
9090
:param key:
9191
:raises: ValueError is the curves are not the same

src/cryptojwt/key_bundle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def __init__(
235235
236236
:param keys: A dictionary or a list of dictionaries
237237
with the keys ["kty", "key", "alg", "use", "kid"]
238-
:param source: Where the key set can be fetch from
238+
:param source: Where the key set can be fetched from
239239
:param fileformat: For a local file either "jwks" or "der"
240240
:param keytype: Iff local file and 'der' format what kind of key it is.
241241
presently 'rsa' and 'ec' are supported.
@@ -467,7 +467,7 @@ def _do_remote(self, set_keys=True):
467467

468468
if self.ignore_errors_until and time.time() < self.ignore_errors_until:
469469
LOGGER.warning(
470-
"Not reading remote JWKS from %s (in error holddown until %s)",
470+
"Not reading remote JWKS from %s (in error hold down until %s)",
471471
self.source,
472472
datetime.fromtimestamp(self.ignore_errors_until),
473473
)

src/cryptojwt/key_issuer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def add_url(self, url, **kwargs):
9191
if not url:
9292
raise KeyError("No url given")
9393

94-
logger.debug("httpc_params: %s", self.httpc_params)
94+
logger.debug(f"add_url: httpc_params: {self.httpc_params}")
9595

9696
if "/localhost:" in url or "/localhost/" in url:
9797
_params = self.httpc_params.copy()
@@ -433,7 +433,7 @@ def mark_all_keys_as_inactive(self):
433433

434434
self._bundles = kbl
435435

436-
def key_summary(self):
436+
def key_summary(self) -> str:
437437
"""
438438
Return a text representation of all the keys.
439439

src/cryptojwt/key_jar.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,10 @@ def load_keys(self, issuer_id, jwks_uri="", jwks=None, replace=False):
324324
:param jwks: A dictionary representation of a JWKS
325325
:param issuer_id: The provider URL
326326
:param replace: If all previously gathered keys from this provider
327-
should be replace.
327+
should be replaced.
328328
:return: Dictionary with usage as key and keys as values
329329
"""
330-
logger.debug("Initiating key bundle for issuer: %s" % issuer_id)
330+
logger.debug(f"Initiating key bundle for issuer: {issuer_id}")
331331

332332
_issuer = self.return_issuer(issuer_id)
333333
if replace:

src/cryptojwt/simple_jwt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def pack(self, parts=None, headers=None):
7575
else:
7676
headers = {"alg": "none"}
7777

78-
logging.debug("JWT header: {}".format(headers))
78+
logging.debug("(pack) JWT header: {}".format(headers))
7979

8080
if not parts:
8181
return ".".join([a.decode() for a in self.b64part])

tests/test_04_key_jar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ def test_key_summary():
853853
kj.add_kb("C", KeyBundle(JWK2["keys"]))
854854

855855
out = kj.key_summary("Alice")
856-
assert out
856+
assert out == "RSA::abc"
857857

858858

859859
PUBLIC_FILE = "{}/public_jwks.json".format(BASEDIR)

tests/test_09_jwt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class DummyMsg(object):
244244
def __init__(self, **kwargs):
245245
for key, val in kwargs.items():
246246
setattr(self, key, val)
247-
self.jws_headers = {}
247+
self.jws_header = {}
248248

249249
def verify(self, **kwargs):
250250
return True

tests/test_40_serialize.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import os
22

3-
from cryptojwt.jwk.hmac import SYMKey
4-
from cryptojwt.jwk.rsa import RSAKey
5-
from cryptojwt.jwk.rsa import import_rsa_key_from_cert_file
63
from cryptojwt.key_bundle import keybundle_from_local_file
7-
from cryptojwt.key_bundle import rsa_init
84
from cryptojwt.key_issuer import KeyIssuer
95
from cryptojwt.serialize import item
106

0 commit comments

Comments
 (0)