mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
Add algorithm parameter (Django 3.1) (#489)
* add algorithm parameter * add algorithm field * reformat
This commit is contained in:
@@ -6,6 +6,7 @@ from django.contrib.auth.base_user import AbstractBaseUser
|
|||||||
class PasswordResetTokenGenerator:
|
class PasswordResetTokenGenerator:
|
||||||
key_salt: str = ...
|
key_salt: str = ...
|
||||||
secret: Any = ...
|
secret: Any = ...
|
||||||
|
algorithm: str = ...
|
||||||
def make_token(self, user: AbstractBaseUser) -> str: ...
|
def make_token(self, user: AbstractBaseUser) -> str: ...
|
||||||
def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ...
|
def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ...
|
||||||
def _make_token_with_timestamp(self, user: AbstractBaseUser, timestamp: int) -> str: ...
|
def _make_token_with_timestamp(self, user: AbstractBaseUser, timestamp: int) -> str: ...
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class SignatureExpired(BadSignature): ...
|
|||||||
|
|
||||||
def b64_encode(s: bytes) -> bytes: ...
|
def b64_encode(s: bytes) -> bytes: ...
|
||||||
def b64_decode(s: bytes) -> bytes: ...
|
def b64_decode(s: bytes) -> bytes: ...
|
||||||
def base64_hmac(salt: str, value: Union[bytes, str], key: Union[bytes, str]) -> str: ...
|
def base64_hmac(salt: str, value: Union[bytes, str], key: Union[bytes, str], algorithm: str = ...) -> str: ...
|
||||||
def get_cookie_signer(salt: str = ...) -> TimestampSigner: ...
|
def get_cookie_signer(salt: str = ...) -> TimestampSigner: ...
|
||||||
|
|
||||||
class Serializer(Protocol):
|
class Serializer(Protocol):
|
||||||
@@ -32,7 +32,14 @@ class Signer:
|
|||||||
key: str = ...
|
key: str = ...
|
||||||
sep: str = ...
|
sep: str = ...
|
||||||
salt: str = ...
|
salt: str = ...
|
||||||
def __init__(self, key: Optional[Union[bytes, str]] = ..., sep: str = ..., salt: Optional[str] = ...) -> None: ...
|
algorithm: str = ...
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
key: Optional[Union[bytes, str]] = ...,
|
||||||
|
sep: str = ...,
|
||||||
|
salt: Optional[str] = ...,
|
||||||
|
algorithm: Optional[str] = ...,
|
||||||
|
) -> None: ...
|
||||||
def signature(self, value: Union[bytes, str]) -> str: ...
|
def signature(self, value: Union[bytes, str]) -> str: ...
|
||||||
def sign(self, value: str) -> str: ...
|
def sign(self, value: str) -> str: ...
|
||||||
def unsign(self, signed_value: str) -> str: ...
|
def unsign(self, signed_value: str) -> str: ...
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ from typing import Callable, Optional, Union
|
|||||||
|
|
||||||
using_sysrandom: bool
|
using_sysrandom: bool
|
||||||
|
|
||||||
def salted_hmac(key_salt: str, value: Union[bytes, str], secret: Optional[Union[bytes, str]] = ...) -> HMAC: ...
|
def salted_hmac(
|
||||||
|
key_salt: str, value: Union[bytes, str], secret: Optional[Union[bytes, str]] = ..., algorithm: str = ...
|
||||||
|
) -> HMAC: ...
|
||||||
def get_random_string(length: int = ..., allowed_chars: str = ...) -> str: ...
|
def get_random_string(length: int = ..., allowed_chars: str = ...) -> str: ...
|
||||||
def constant_time_compare(val1: Union[bytes, str], val2: Union[bytes, str]) -> bool: ...
|
def constant_time_compare(val1: Union[bytes, str], val2: Union[bytes, str]) -> bool: ...
|
||||||
def pbkdf2(
|
def pbkdf2(
|
||||||
|
|||||||
Reference in New Issue
Block a user