Skip to content

Commit

Permalink
Merge pull request #155 from IdentityPython/sdjwt2
Browse files Browse the repository at this point in the history
Editorial changes
  • Loading branch information
rohe authored Jan 17, 2024
2 parents 06c4cda + 29116aa commit 8531800
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/cryptojwt/jwk/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
2 changes: 1 addition & 1 deletion src/cryptojwt/jws/dsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cryptojwt/key_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
)
Expand Down
4 changes: 2 additions & 2 deletions src/cryptojwt/key_issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/cryptojwt/key_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/cryptojwt/simple_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_04_key_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_09_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/test_40_serialize.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 8531800

Please sign in to comment.