Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pachewise committed Sep 12, 2024
1 parent 95c3004 commit 4d45193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jwt/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,9 @@ def __init__(self, **kwargs: Any) -> None:
pass

def prepare_key(self, key: AllowedOKPKeys | str | bytes) -> AllowedOKPKeys:
if isinstance(key, self._crypto_key_types):
return key
if not isinstance(key, (str, bytes)):
self.check_crypto_key_type(key)
return cast("AllowedOKPKeys", key)

key_str = key.decode("utf-8") if isinstance(key, bytes) else key
key_bytes = key.encode("utf-8") if isinstance(key, str) else key
Expand Down

0 comments on commit 4d45193

Please sign in to comment.