diff options
Diffstat (limited to 'jwt/api_jwk.py')
-rw-r--r-- | jwt/api_jwk.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/jwt/api_jwk.py b/jwt/api_jwk.py index aae2cf1..bbd8a9e 100644 --- a/jwt/api_jwk.py +++ b/jwt/api_jwk.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import json from .algorithms import get_default_algorithms @@ -74,15 +76,15 @@ class PyJWK: class PyJWKSet: - def __init__(self, keys): + def __init__(self, keys: list[dict]) -> None: self.keys = [] - if not keys or not isinstance(keys, list): - raise PyJWKSetError("Invalid JWK Set value") - - if len(keys) == 0: + if not keys: raise PyJWKSetError("The JWK Set did not contain any keys") + if not isinstance(keys, list): + raise PyJWKSetError("Invalid JWK Set value") + for key in keys: try: self.keys.append(PyJWK(key)) |