widen type of make_password and get_hasher parameters (#670)

* widen type of make_password's hasher

make_password will accept a subclass of BasePasswordHasher as a hasher

* widen get_hasher's algorithm type

get_hasher will accept (and immediately return) a BasePasswordHasher
This commit is contained in:
Tim Nyborg
2021-07-18 13:01:36 +01:00
committed by GitHub
parent cc5d363cfa
commit 2a9410f3b1

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional
from typing import Any, Callable, Dict, List, Optional, Union
UNUSABLE_PASSWORD_PREFIX: str
UNUSABLE_PASSWORD_SUFFIX_LENGTH: int
@@ -7,11 +7,13 @@ def is_password_usable(encoded: Optional[str]) -> bool: ...
def check_password(
password: Optional[str], encoded: str, setter: Optional[Callable] = ..., preferred: str = ...
) -> bool: ...
def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ...
def make_password(
password: Optional[str], salt: Optional[str] = ..., hasher: Union[str, BasePasswordHasher] = ...
) -> str: ...
def get_hashers() -> List[BasePasswordHasher]: ...
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
def reset_hashers(**kwargs: Any) -> None: ...
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
def get_hasher(algorithm: Union[str, BasePasswordHasher] = ...) -> BasePasswordHasher: ...
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...