diff --git a/stubs/python-jose/@tests/stubtest_allowlist.txt b/stubs/python-jose/@tests/stubtest_allowlist.txt index 35fe14b40..efd6e0e11 100644 --- a/stubs/python-jose/@tests/stubtest_allowlist.txt +++ b/stubs/python-jose/@tests/stubtest_allowlist.txt @@ -4,6 +4,3 @@ jose.backends.CryptographyECKey jose.backends.CryptographyHMACKey jose.backends.CryptographyRSAKey jose.backends.ECDSAECKey - -# See https://github.com/mpdavis/python-jose/pull/372 -jose.jwt.utc_now diff --git a/stubs/python-jose/METADATA.toml b/stubs/python-jose/METADATA.toml index 42901e47e..fe3ccd39f 100644 --- a/stubs/python-jose/METADATA.toml +++ b/stubs/python-jose/METADATA.toml @@ -1,3 +1,3 @@ -version = "3.4.*" +version = "3.5.*" upstream_repository = "https://github.com/mpdavis/python-jose" requires = ["types-pyasn1"] # excluding pyrsa, cryptography until typing is available diff --git a/stubs/python-jose/jose/backends/__init__.pyi b/stubs/python-jose/jose/backends/__init__.pyi index 3a02b5f35..9aae87f03 100644 --- a/stubs/python-jose/jose/backends/__init__.pyi +++ b/stubs/python-jose/jose/backends/__init__.pyi @@ -1,5 +1,3 @@ -from collections.abc import Callable - from .base import DIRKey as DIRKey from .cryptography_backend import ( CryptographyAESKey as CryptographyAESKey, @@ -8,7 +6,7 @@ from .cryptography_backend import ( CryptographyRSAKey as CryptographyRSAKey, ) from .ecdsa_backend import ECDSAECKey as ECDSAECKey -from .native import HMACKey as NativeHMACKey +from .native import HMACKey as NativeHMACKey, get_random_bytes as get_random_bytes from .rsa_backend import RSAKey as BackendRSAKey # python-jose relies on importing from cryptography_backend @@ -18,4 +16,3 @@ AESKey: type[CryptographyAESKey] | None HMACKey: type[CryptographyHMACKey | NativeHMACKey] RSAKey: type[CryptographyRSAKey | BackendRSAKey] | None ECKey: type[CryptographyECKey | ECDSAECKey] -get_random_bytes: Callable[[int], bytes] diff --git a/stubs/python-jose/jose/backends/cryptography_backend.pyi b/stubs/python-jose/jose/backends/cryptography_backend.pyi index 02937a429..dce249e54 100644 --- a/stubs/python-jose/jose/backends/cryptography_backend.pyi +++ b/stubs/python-jose/jose/backends/cryptography_backend.pyi @@ -1,9 +1,8 @@ from typing import Any, ClassVar +from . import get_random_bytes as get_random_bytes from .base import Key -def get_random_bytes(num_bytes: int) -> bytes: ... - # Enable when we can use stubs from installed dependencies: # from cryptography.hazmat import backends class CryptographyECKey(Key): diff --git a/stubs/python-jose/jose/jws.pyi b/stubs/python-jose/jose/jws.pyi index 777770ae6..3f8194f6f 100644 --- a/stubs/python-jose/jose/jws.pyi +++ b/stubs/python-jose/jose/jws.pyi @@ -1,4 +1,4 @@ -from collections.abc import Container, Mapping +from collections.abc import Container, Iterable, Mapping from typing import Any from .backends.base import Key @@ -13,7 +13,7 @@ def sign( ) -> str: ... def verify( token: str | bytes, - key: str | bytes | Mapping[str, Any] | Key, + key: str | bytes | Mapping[str, Any] | Key | Iterable[str], # Callers of this function, like jwt.decode(), and functions called internally, # like jws._verify_signature(), use and accept algorithms=None algorithms: str | Container[str] | None, diff --git a/stubs/python-jose/jose/jwt.pyi b/stubs/python-jose/jose/jwt.pyi index e0286fa2d..1f4254ac4 100644 --- a/stubs/python-jose/jose/jwt.pyi +++ b/stubs/python-jose/jose/jwt.pyi @@ -1,8 +1,11 @@ from collections.abc import Container, Iterable, Mapping, MutableMapping +from datetime import timezone from typing import Any from .backends.base import Key +UTC: timezone + def encode( claims: MutableMapping[str, Any], # Internally it calls jws.sign() that expects a key dict instance instead of Mapping @@ -13,7 +16,7 @@ def encode( ) -> str: ... def decode( token: str | bytes, - key: str | bytes | Mapping[str, Any] | Key, + key: str | bytes | Mapping[str, Any] | Key | Iterable[str], algorithms: str | Container[str] | None = None, options: Mapping[str, Any] | None = None, audience: str | None = None,