1212 GeneralJSONSerialization ,
1313 FlattenedJSONSerialization ,
1414)
15- from ..registry import Header
1615from ..util import (
1716 to_bytes ,
1817 to_str ,
3332
3433
3534def represent_general_json (obj : GeneralJSONEncryption ) -> GeneralJSONSerialization :
36- data = __represent_json_serialization (obj )
35+ data : GeneralJSONSerialization = __represent_json_serialization (obj )
3736 recipients = []
3837 for recipient in obj .recipients :
3938 item : JSONRecipientDict = {}
@@ -43,22 +42,22 @@ def represent_general_json(obj: GeneralJSONEncryption) -> GeneralJSONSerializati
4342 item ["encrypted_key" ] = to_str (urlsafe_b64encode (recipient .encrypted_key ))
4443 recipients .append (item )
4544 data ["recipients" ] = recipients
46- return data # type: ignore[no-any-return]
45+ return data
4746
4847
4948def represent_flattened_json (obj : FlattenedJSONEncryption ) -> FlattenedJSONSerialization :
50- data = __represent_json_serialization (obj )
49+ data : FlattenedJSONSerialization = __represent_json_serialization (obj )
5150 recipient = obj .recipients [0 ]
5251 assert recipient is not None
5352 if recipient .header :
5453 data ["header" ] = recipient .header
5554 if recipient .encrypted_key :
5655 data ["encrypted_key" ] = to_str (urlsafe_b64encode (recipient .encrypted_key ))
57- return data # type: ignore[no-any-return]
56+ return data
5857
5958
60- def __represent_json_serialization (obj : BaseJSONEncryption ): # type: ignore[no-untyped-def]
61- data : dict [str , t .Union [ str , Header , list [ Header ]] ] = {
59+ def __represent_json_serialization (obj : BaseJSONEncryption ) -> t . Any :
60+ data : dict [str , t .Any ] = {
6261 "protected" : to_str (json_b64encode (obj .protected )),
6362 "iv" : to_str (obj .base64_segments ["iv" ]),
6463 "ciphertext" : to_str (obj .base64_segments ["ciphertext" ]),
0 commit comments