mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
Add signature for Django 3.2 TimestampSigner (#751)
Django 3.2 introduced two new methods: `sign_object` and `unsign_object` which can sign/unsign "complex data structures" such as lists, tuples, dictionaries: https://docs.djangoproject.com/en/3.2/topics/signing/#django.core.signing.TimestampSigner Because the methods take an arbitrary serializer (a JSON serializer by default, but not guaranteed), we cannot be sure of the type of `obj`.
This commit is contained in:
@@ -51,3 +51,15 @@ class Signer:
|
||||
class TimestampSigner(Signer):
|
||||
def timestamp(self) -> str: ...
|
||||
def unsign(self, value: str, max_age: Optional[Union[int, timedelta]] = ...) -> str: ...
|
||||
def sign_object(
|
||||
self,
|
||||
obj: Any,
|
||||
serializer: Type[Serializer] = ...,
|
||||
compress: bool = ...,
|
||||
) -> str: ...
|
||||
def unsign_object(
|
||||
self,
|
||||
signed_obj: str,
|
||||
serializer: Type[Serializer] = ...,
|
||||
max_age: Optional[Union[int, timedelta]] = ...,
|
||||
) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user