mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-09 06:46:18 +08:00
[jwcrypto] Update to 1.5.7 (#15633)
* Replace some ABCs with concrete types or protocols. * Use `LiteralString` in some instances.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version = "1.5.*"
|
||||
version = "1.5.7"
|
||||
upstream-repository = "https://github.com/latchset/jwcrypto"
|
||||
dependencies = ["cryptography"]
|
||||
|
||||
@@ -3,6 +3,7 @@ from collections.abc import Mapping
|
||||
from typing import ClassVar
|
||||
|
||||
default_max_pbkdf2_iterations: int
|
||||
default_enforce_hmac_key_length: bool
|
||||
|
||||
class JWAAlgorithm(metaclass=ABCMeta):
|
||||
@property
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Mapping, Sequence
|
||||
from _typeshed import Incomplete, SupportsKeysAndGetItem
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import LiteralString, Self
|
||||
|
||||
from jwcrypto import common
|
||||
from jwcrypto.common import JWException, JWSEHeaderParameter, JWSEHeaderRegistry
|
||||
from jwcrypto.jwk import JWK, JWKSet
|
||||
|
||||
default_max_compressed_size: int
|
||||
JWEHeaderRegistry: Mapping[str, JWSEHeaderParameter]
|
||||
default_allowed_algs: Sequence[str]
|
||||
default_max_plaintext_size: int
|
||||
|
||||
JWEHeaderRegistry: dict[LiteralString, JWSEHeaderParameter]
|
||||
|
||||
default_allowed_algs: list[LiteralString]
|
||||
|
||||
class InvalidJWEData(JWException):
|
||||
def __init__(self, message: str | None = None, exception: BaseException | None = None) -> None: ...
|
||||
@@ -23,6 +26,7 @@ class JWE:
|
||||
objects: dict[str, Any]
|
||||
plaintext: bytes | None
|
||||
header_registry: JWSEHeaderRegistry
|
||||
flattened: bool
|
||||
cek: Incomplete
|
||||
decryptlog: list[str] | None
|
||||
def __init__(
|
||||
@@ -31,18 +35,23 @@ class JWE:
|
||||
protected: str | None = None,
|
||||
unprotected: str | None = None,
|
||||
aad: bytes | None = None,
|
||||
algs: list[str] | None = None,
|
||||
algs: list[LiteralString] | None = None,
|
||||
recipient: str | None = None,
|
||||
header: str | None = None,
|
||||
header_registry: Mapping[str, JWSEHeaderParameter] | None = None,
|
||||
header_registry: (
|
||||
SupportsKeysAndGetItem[LiteralString, JWSEHeaderParameter]
|
||||
| Iterable[tuple[LiteralString, JWSEHeaderParameter]]
|
||||
| None
|
||||
) = None,
|
||||
flattened: bool = True,
|
||||
) -> None: ...
|
||||
@property
|
||||
def allowed_algs(self) -> list[str]: ...
|
||||
def allowed_algs(self) -> list[LiteralString]: ...
|
||||
@allowed_algs.setter
|
||||
def allowed_algs(self, algs: list[str]) -> None: ...
|
||||
def allowed_algs(self, algs: list[LiteralString]) -> None: ...
|
||||
def add_recipient(self, key: JWK, header: dict[str, Any] | str | None = None) -> None: ...
|
||||
def serialize(self, compact: bool = False) -> str: ...
|
||||
def decrypt(self, key: JWK | JWKSet) -> None: ...
|
||||
def decrypt(self, key: JWK | JWKSet, max_plaintext: int = 0) -> None: ...
|
||||
def deserialize(self, raw_jwe: str | bytes, key: JWK | JWKSet | None = None) -> None: ...
|
||||
@property
|
||||
def payload(self) -> bytes: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ from _typeshed import Unused
|
||||
from collections.abc import Callable, Sequence
|
||||
from enum import Enum
|
||||
from typing import Any, Literal, NamedTuple, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
from typing_extensions import LiteralString, Self, TypeAlias, deprecated
|
||||
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import ec, rsa
|
||||
@@ -62,18 +62,18 @@ class JWKParameter(NamedTuple):
|
||||
required: bool | None
|
||||
type: ParmType | None
|
||||
|
||||
JWKValuesRegistry: dict[str, dict[str, JWKParameter]]
|
||||
JWKParamsRegistry: dict[str, JWKParameter]
|
||||
JWKEllipticCurveRegistry: dict[str, str]
|
||||
JWKValuesRegistry: dict[LiteralString, dict[LiteralString, JWKParameter]]
|
||||
JWKParamsRegistry: dict[LiteralString, JWKParameter]
|
||||
JWKEllipticCurveRegistry: dict[LiteralString, str]
|
||||
_JWKUseSupported: TypeAlias = Literal["sig", "enc"]
|
||||
JWKUseRegistry: dict[_JWKUseSupported, str]
|
||||
_JWKOperationSupported: TypeAlias = Literal[
|
||||
"sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits"
|
||||
]
|
||||
JWKOperationsRegistry: dict[_JWKOperationSupported, str]
|
||||
JWKpycaCurveMap: dict[str, str]
|
||||
JWKpycaCurveMap: dict[LiteralString, LiteralString]
|
||||
IANANamedInformationHashAlgorithmRegistry: dict[
|
||||
str,
|
||||
LiteralString,
|
||||
hashes.SHA256
|
||||
| hashes.SHA384
|
||||
| hashes.SHA512
|
||||
@@ -103,6 +103,7 @@ class InvalidJWKOperation(JWException):
|
||||
class InvalidJWKValue(JWException): ...
|
||||
|
||||
class JWK(dict[str, Any]):
|
||||
unsafe_skip_rsa_key_validation: bool
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
# `kty` and the other keyword arguments are passed as `params` to the called generator
|
||||
# function. The possible arguments depend on the value of `kty`.
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import LiteralString, Self
|
||||
|
||||
from jwcrypto.common import JWException, JWSEHeaderParameter
|
||||
from jwcrypto.jwa import JWAAlgorithm
|
||||
from jwcrypto.jwk import JWK, JWKSet
|
||||
|
||||
JWSHeaderRegistry: Mapping[str, JWSEHeaderParameter]
|
||||
default_allowed_algs: list[str]
|
||||
JWSHeaderRegistry: dict[LiteralString, JWSEHeaderParameter]
|
||||
default_allowed_algs: list[LiteralString]
|
||||
|
||||
class InvalidJWSSignature(JWException):
|
||||
def __init__(self, message: str | None = None, exception: BaseException | None = None) -> None: ...
|
||||
@@ -38,7 +37,7 @@ class JWSCore:
|
||||
def verify(self, signature: bytes) -> Literal[True]: ...
|
||||
|
||||
class JWS:
|
||||
objects: Incomplete
|
||||
objects: dict[str, Incomplete]
|
||||
verifylog: list[str] | None
|
||||
header_registry: Incomplete
|
||||
def __init__(self, payload=None, header_registry=None) -> None: ...
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, SupportsInt
|
||||
from typing_extensions import deprecated
|
||||
from typing_extensions import LiteralString, deprecated
|
||||
|
||||
from jwcrypto.common import JWException, JWKeyNotFound
|
||||
from jwcrypto.jwk import JWK, JWKSet
|
||||
|
||||
JWTClaimsRegistry: Mapping[str, str]
|
||||
JWTClaimsRegistry: dict[LiteralString, str]
|
||||
JWT_expect_type: bool
|
||||
|
||||
class JWTExpired(JWException):
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from typing import Final
|
||||
|
||||
__version__: Final[str]
|
||||
Reference in New Issue
Block a user