1- from _typeshed import Incomplete
2- from collections .abc import Mapping , Sequence
1+ from _typeshed import Incomplete , SupportsKeysAndGetItem
2+ from collections .abc import Iterable
33from typing import Any
4- from typing_extensions import Self
4+ from typing_extensions import LiteralString , Self
55
66from jwcrypto import common
77from jwcrypto .common import JWException , JWSEHeaderParameter , JWSEHeaderRegistry
88from jwcrypto .jwk import JWK , JWKSet
99
1010default_max_compressed_size : int
11- JWEHeaderRegistry : Mapping [str , JWSEHeaderParameter ]
12- default_allowed_algs : Sequence [str ]
11+ default_max_plaintext_size : int
12+
13+ JWEHeaderRegistry : dict [LiteralString , JWSEHeaderParameter ]
14+
15+ default_allowed_algs : list [LiteralString ]
1316
1417class InvalidJWEData (JWException ):
1518 def __init__ (self , message : str | None = None , exception : BaseException | None = None ) -> None : ...
@@ -23,6 +26,7 @@ class JWE:
2326 objects : dict [str , Any ]
2427 plaintext : bytes | None
2528 header_registry : JWSEHeaderRegistry
29+ flattened : bool
2630 cek : Incomplete
2731 decryptlog : list [str ] | None
2832 def __init__ (
@@ -31,18 +35,23 @@ class JWE:
3135 protected : str | None = None ,
3236 unprotected : str | None = None ,
3337 aad : bytes | None = None ,
34- algs : list [str ] | None = None ,
38+ algs : list [LiteralString ] | None = None ,
3539 recipient : str | None = None ,
3640 header : str | None = None ,
37- header_registry : Mapping [str , JWSEHeaderParameter ] | None = None ,
41+ header_registry : (
42+ SupportsKeysAndGetItem [LiteralString , JWSEHeaderParameter ]
43+ | Iterable [tuple [LiteralString , JWSEHeaderParameter ]]
44+ | None
45+ ) = None ,
46+ flattened : bool = True ,
3847 ) -> None : ...
3948 @property
40- def allowed_algs (self ) -> list [str ]: ...
49+ def allowed_algs (self ) -> list [LiteralString ]: ...
4150 @allowed_algs .setter
42- def allowed_algs (self , algs : list [str ]) -> None : ...
51+ def allowed_algs (self , algs : list [LiteralString ]) -> None : ...
4352 def add_recipient (self , key : JWK , header : dict [str , Any ] | str | None = None ) -> None : ...
4453 def serialize (self , compact : bool = False ) -> str : ...
45- def decrypt (self , key : JWK | JWKSet ) -> None : ...
54+ def decrypt (self , key : JWK | JWKSet , max_plaintext : int = 0 ) -> None : ...
4655 def deserialize (self , raw_jwe : str | bytes , key : JWK | JWKSet | None = None ) -> None : ...
4756 @property
4857 def payload (self ) -> bytes : ...
0 commit comments