diff --git a/src/cryptojwt/jwk/ec.py b/src/cryptojwt/jwk/ec.py index 4acf9d9..9334922 100644 --- a/src/cryptojwt/jwk/ec.py +++ b/src/cryptojwt/jwk/ec.py @@ -113,7 +113,7 @@ def __init__(self, kty="EC", alg="", use="", kid="", crv="", x="", y="", d="", * def deserialize(self): """ Starting with information gathered from the on-the-wire representation - of an elliptic curve key (a JWK) initiate an + of an elliptic curve key (a JWK) initiate a cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey or EllipticCurvePrivateKey instance. So we have to get from having:: diff --git a/src/cryptojwt/jws/dsa.py b/src/cryptojwt/jws/dsa.py index 59f6604..6ddedcf 100644 --- a/src/cryptojwt/jws/dsa.py +++ b/src/cryptojwt/jws/dsa.py @@ -85,7 +85,7 @@ def verify(self, msg, sig, key): def _cross_check(self, pub_key): """ In Ecdsa, both the key and the algorithm define the curve. - Therefore, we must cross check them to make sure they're the same. + Therefore, we must crosscheck them to make sure they're the same. :param key: :raises: ValueError is the curves are not the same diff --git a/src/cryptojwt/key_bundle.py b/src/cryptojwt/key_bundle.py index 0fde736..0708d0e 100755 --- a/src/cryptojwt/key_bundle.py +++ b/src/cryptojwt/key_bundle.py @@ -235,7 +235,7 @@ def __init__( :param keys: A dictionary or a list of dictionaries with the keys ["kty", "key", "alg", "use", "kid"] - :param source: Where the key set can be fetch from + :param source: Where the key set can be fetched from :param fileformat: For a local file either "jwks" or "der" :param keytype: Iff local file and 'der' format what kind of key it is. presently 'rsa' and 'ec' are supported. @@ -467,7 +467,7 @@ def _do_remote(self, set_keys=True): if self.ignore_errors_until and time.time() < self.ignore_errors_until: LOGGER.warning( - "Not reading remote JWKS from %s (in error holddown until %s)", + "Not reading remote JWKS from %s (in error hold down until %s)", self.source, datetime.fromtimestamp(self.ignore_errors_until), ) diff --git a/src/cryptojwt/key_issuer.py b/src/cryptojwt/key_issuer.py index 1151edc..08e540a 100755 --- a/src/cryptojwt/key_issuer.py +++ b/src/cryptojwt/key_issuer.py @@ -91,7 +91,7 @@ def add_url(self, url, **kwargs): if not url: raise KeyError("No url given") - logger.debug("httpc_params: %s", self.httpc_params) + logger.debug(f"add_url: httpc_params: {self.httpc_params}") if "/localhost:" in url or "/localhost/" in url: _params = self.httpc_params.copy() @@ -433,7 +433,7 @@ def mark_all_keys_as_inactive(self): self._bundles = kbl - def key_summary(self): + def key_summary(self) -> str: """ Return a text representation of all the keys. diff --git a/src/cryptojwt/key_jar.py b/src/cryptojwt/key_jar.py index f3716b0..2bec768 100755 --- a/src/cryptojwt/key_jar.py +++ b/src/cryptojwt/key_jar.py @@ -324,10 +324,10 @@ def load_keys(self, issuer_id, jwks_uri="", jwks=None, replace=False): :param jwks: A dictionary representation of a JWKS :param issuer_id: The provider URL :param replace: If all previously gathered keys from this provider - should be replace. + should be replaced. :return: Dictionary with usage as key and keys as values """ - logger.debug("Initiating key bundle for issuer: %s" % issuer_id) + logger.debug(f"Initiating key bundle for issuer: {issuer_id}") _issuer = self.return_issuer(issuer_id) if replace: diff --git a/src/cryptojwt/simple_jwt.py b/src/cryptojwt/simple_jwt.py index c0ec92f..fbdaf2b 100644 --- a/src/cryptojwt/simple_jwt.py +++ b/src/cryptojwt/simple_jwt.py @@ -75,7 +75,7 @@ def pack(self, parts=None, headers=None): else: headers = {"alg": "none"} - logging.debug("JWT header: {}".format(headers)) + logging.debug("(pack) JWT header: {}".format(headers)) if not parts: return ".".join([a.decode() for a in self.b64part]) diff --git a/tests/test_04_key_jar.py b/tests/test_04_key_jar.py index 5f00243..c2d9d2d 100755 --- a/tests/test_04_key_jar.py +++ b/tests/test_04_key_jar.py @@ -853,7 +853,7 @@ def test_key_summary(): kj.add_kb("C", KeyBundle(JWK2["keys"])) out = kj.key_summary("Alice") - assert out + assert out == "RSA::abc" PUBLIC_FILE = "{}/public_jwks.json".format(BASEDIR) diff --git a/tests/test_09_jwt.py b/tests/test_09_jwt.py index c8ec65c..452ee8c 100755 --- a/tests/test_09_jwt.py +++ b/tests/test_09_jwt.py @@ -244,7 +244,7 @@ class DummyMsg(object): def __init__(self, **kwargs): for key, val in kwargs.items(): setattr(self, key, val) - self.jws_headers = {} + self.jws_header = {} def verify(self, **kwargs): return True diff --git a/tests/test_40_serialize.py b/tests/test_40_serialize.py index 4c7dbb9..f83b9f6 100644 --- a/tests/test_40_serialize.py +++ b/tests/test_40_serialize.py @@ -1,10 +1,6 @@ import os -from cryptojwt.jwk.hmac import SYMKey -from cryptojwt.jwk.rsa import RSAKey -from cryptojwt.jwk.rsa import import_rsa_key_from_cert_file from cryptojwt.key_bundle import keybundle_from_local_file -from cryptojwt.key_bundle import rsa_init from cryptojwt.key_issuer import KeyIssuer from cryptojwt.serialize import item