diff --git a/django-stubs/contrib/auth/tokens.pyi b/django-stubs/contrib/auth/tokens.pyi index b97d91da8..f9138d557 100644 --- a/django-stubs/contrib/auth/tokens.pyi +++ b/django-stubs/contrib/auth/tokens.pyi @@ -5,6 +5,7 @@ from django.contrib.auth.base_user import AbstractBaseUser class PasswordResetTokenGenerator: key_salt: str = ... secret: Any = ... + algorithm: str = ... def make_token(self, user: AbstractBaseUser) -> str: ... def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ... diff --git a/django-stubs/core/signing.pyi b/django-stubs/core/signing.pyi index 16d64c045..36a38a71d 100644 --- a/django-stubs/core/signing.pyi +++ b/django-stubs/core/signing.pyi @@ -6,7 +6,7 @@ class SignatureExpired(BadSignature): ... def b64_encode(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: ... class Serializer(Protocol): @@ -32,7 +32,14 @@ class Signer: key: str = ... sep: 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 sign(self, value: str) -> str: ... def unsign(self, signed_value: str) -> str: ... diff --git a/django-stubs/utils/crypto.pyi b/django-stubs/utils/crypto.pyi index 9b41ab78b..a6537e468 100644 --- a/django-stubs/utils/crypto.pyi +++ b/django-stubs/utils/crypto.pyi @@ -3,7 +3,9 @@ from typing import Callable, Optional, Union 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 constant_time_compare(val1: Union[bytes, str], val2: Union[bytes, str]) -> bool: ... def pbkdf2(