Skip to content

Commit

Permalink
fix: default return for get_key
Browse files Browse the repository at this point in the history
  • Loading branch information
rglauco committed Mar 12, 2024
1 parent a06b7b8 commit 215e0a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spid_cie_oidc/entity/jwks.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def public_pem_from_jwk(jwk_dict: dict):
def serialize_rsa_key(rsa_key, kind="public", hash_func="SHA-256"):
"""
rsa_key can be
cryptography.hazmat.backends.openssl.rsa._RSAPublicKey
cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey
or
cryptography.hazmat.backends.openssl.rsa._RSAPrivateKey
cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey
"""
data = {}
if isinstance(rsa_key, rsa.RSAPublicKey):
Expand Down
3 changes: 1 addition & 2 deletions spid_cie_oidc/entity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@


def get_key(jwks, use=KeyUsage.signature):
selected_jwk = jwks[0]
for jwk in jwks:
if jwk['use'] == use:
return jwk

return jwks[0]
def iat_now() -> int:
return int(datetime.datetime.now().timestamp())

Expand Down

0 comments on commit 215e0a6

Please sign in to comment.