Add passlib stubs (#7024)

This commit is contained in:
Sebastian Rittau
2022-03-07 01:25:00 +01:00
committed by GitHub
parent 7e5d2a58aa
commit addce5c067
64 changed files with 2020 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
"stubs/prettytable",
"stubs/protobuf",
"stubs/google-cloud-ndb",
"stubs/passlib",
"stubs/pep8-naming",
"stubs/psutil",
"stubs/psycopg2",

View File

@@ -0,0 +1,28 @@
# proxy module that uses some import magic incompatible with stubtest
passlib.hash
# django unsupported in stubs
passlib.ext.django.models
# uses @memoized_property at runtime, but @property in the stubs
passlib.crypto.digest.HashInfo.supported
passlib.crypto.digest.HashInfo.supported_by_fastpbkdf2
passlib.crypto.digest.HashInfo.supported_by_hashlib_pbkdf2
passlib.pwd.PhraseGenerator.symbol_count
passlib.pwd.SequenceGenerator.entropy
passlib.pwd.SequenceGenerator.entropy_per_symbol
passlib.pwd.SequenceGenerator.symbol_count
passlib.pwd.WordGenerator.symbol_count
passlib.totp.TotpMatch.cache_seconds
passlib.totp.TotpMatch.cache_time
passlib.totp.TotpMatch.expected_counter
passlib.totp.TotpMatch.expire_time
passlib.totp.TotpMatch.skipped
passlib.totp.TotpToken.expire_time
passlib.totp.TotpToken.start_time
# "hybrid" method that can be called on an instance or class
passlib.totp.TOTP.normalize_token
# import problem
passlib.utils.compat._ordered_dict

View File

@@ -0,0 +1 @@
version = "1.7.*"

View File

View File

@@ -0,0 +1,58 @@
from typing import Any
class _CommonFile:
encoding: Any
return_unicode: Any
autosave: bool
@classmethod
def from_string(cls, data, **kwds): ...
@classmethod
def from_path(cls, path, **kwds): ...
def __init__(
self,
path: Any | None = ...,
new: bool = ...,
autoload: bool = ...,
autosave: bool = ...,
encoding: str = ...,
return_unicode=...,
) -> None: ...
@property
def path(self): ...
@path.setter
def path(self, value) -> None: ...
@property
def mtime(self): ...
def load_if_changed(self): ...
def load(self, path: Any | None = ..., force: bool = ...): ...
def load_string(self, data) -> None: ...
def save(self, path: Any | None = ...) -> None: ...
def to_string(self): ...
class HtpasswdFile(_CommonFile):
context: Any
def __init__(self, path: Any | None = ..., default_scheme: Any | None = ..., context=..., **kwds) -> None: ...
def users(self): ...
def set_password(self, user, password): ...
def update(self, user, password): ...
def get_hash(self, user): ...
def set_hash(self, user, hash): ...
def find(self, user): ...
def delete(self, user): ...
def check_password(self, user, password): ...
def verify(self, user, password): ...
class HtdigestFile(_CommonFile):
default_realm: Any
def __init__(self, path: Any | None = ..., default_realm: Any | None = ..., **kwds) -> None: ...
def realms(self): ...
def users(self, realm: Any | None = ...): ...
def set_password(self, user, realm: Any | None = ..., password=...): ...
def update(self, user, realm, password): ...
def get_hash(self, user, realm: Any | None = ...): ...
def set_hash(self, user, realm: Any | None = ..., hash=...): ...
def find(self, user, realm): ...
def delete(self, user, realm: Any | None = ...): ...
def delete_realm(self, realm): ...
def check_password(self, user, realm: Any | None = ..., password=...): ...
def verify(self, user, realm, password): ...

View File

@@ -0,0 +1,35 @@
from .context import CryptContext
__all__ = [
"custom_app_context",
"django_context",
"ldap_context",
"ldap_nocrypt_context",
"mysql_context",
"mysql4_context",
"mysql3_context",
"phpass_context",
"phpbb3_context",
"postgres_context",
]
master_context: CryptContext
custom_app_context: CryptContext
django10_context: CryptContext
django14_context: CryptContext
django16_context: CryptContext
django110_context: CryptContext
django21_context: CryptContext
django_context = django21_context # noqa: F821
std_ldap_schemes: list[str]
ldap_nocrypt_context: CryptContext
ldap_context: CryptContext
mysql3_context: CryptContext
mysql4_context: CryptContext
mysql_context = mysql4_context # noqa: F821
postgres_context: CryptContext
phpass_context: CryptContext
phpbb3_context: CryptContext
roundup10_context: CryptContext
roundup15_context: CryptContext
roundup_context = roundup15_context # noqa: F821

View File

@@ -0,0 +1,69 @@
from typing import Any
class CryptPolicy:
@classmethod
def from_path(cls, path, section: str = ..., encoding: str = ...): ...
@classmethod
def from_string(cls, source, section: str = ..., encoding: str = ...): ...
@classmethod
def from_source(cls, source, _warn: bool = ...): ...
@classmethod
def from_sources(cls, sources, _warn: bool = ...): ...
def replace(self, *args, **kwds): ...
def __init__(self, *args, **kwds) -> None: ...
def has_schemes(self): ...
def iter_handlers(self): ...
def schemes(self, resolve: bool = ...): ...
def get_handler(self, name: Any | None = ..., category: Any | None = ..., required: bool = ...): ...
def get_min_verify_time(self, category: Any | None = ...): ...
def get_options(self, name, category: Any | None = ...): ...
def handler_is_deprecated(self, name, category: Any | None = ...): ...
def iter_config(self, ini: bool = ..., resolve: bool = ...): ...
def to_dict(self, resolve: bool = ...): ...
def to_file(self, stream, section: str = ...) -> None: ...
def to_string(self, section: str = ..., encoding: Any | None = ...): ...
class CryptContext:
@classmethod
def from_string(cls, source, section: str = ..., encoding: str = ...): ...
@classmethod
def from_path(cls, path, section: str = ..., encoding: str = ...): ...
def copy(self, **kwds): ...
def using(self, **kwds): ...
def replace(self, **kwds): ...
def __init__(self, schemes: Any | None = ..., policy=..., _autoload: bool = ..., **kwds) -> None: ...
policy: Any
def load_path(self, path, update: bool = ..., section: str = ..., encoding: str = ...): ...
def load(self, source, update: bool = ..., section: str = ..., encoding: str = ...) -> None: ...
def update(self, *args, **kwds) -> None: ...
def schemes(self, resolve: bool = ..., category: Any | None = ..., unconfigured: bool = ...): ...
def default_scheme(self, category: Any | None = ..., resolve: bool = ..., unconfigured: bool = ...): ...
def handler(self, scheme: Any | None = ..., category: Any | None = ..., unconfigured: bool = ...): ...
@property
def context_kwds(self): ...
def to_dict(self, resolve: bool = ...): ...
def to_string(self, section: str = ...): ...
mvt_estimate_max_samples: int
mvt_estimate_min_samples: int
mvt_estimate_max_time: int
mvt_estimate_resolution: float
harden_verify: Any
min_verify_time: int
def reset_min_verify_time(self) -> None: ...
def needs_update(self, hash, scheme: Any | None = ..., category: Any | None = ..., secret: Any | None = ...): ...
def hash_needs_update(self, hash, scheme: Any | None = ..., category: Any | None = ...): ...
def genconfig(self, scheme: Any | None = ..., category: Any | None = ..., **settings): ...
def genhash(self, secret, config, scheme: Any | None = ..., category: Any | None = ..., **kwds): ...
def identify(self, hash, category: Any | None = ..., resolve: bool = ..., required: bool = ..., unconfigured: bool = ...): ...
def hash(self, secret, scheme: Any | None = ..., category: Any | None = ..., **kwds): ...
def encrypt(self, *args, **kwds): ...
def verify(self, secret, hash, scheme: Any | None = ..., category: Any | None = ..., **kwds): ...
def verify_and_update(self, secret, hash, scheme: Any | None = ..., category: Any | None = ..., **kwds): ...
def dummy_verify(self, elapsed: int = ...): ...
def is_enabled(self, hash): ...
def disable(self, hash: Any | None = ...): ...
def enable(self, hash): ...
class LazyCryptContext(CryptContext):
def __init__(self, schemes: Any | None = ..., **kwds) -> None: ...
def __getattribute__(self, attr): ...

View File

@@ -0,0 +1,3 @@
from passlib.crypto._blowfish.unrolled import BlowfishEngine as BlowfishEngine
def raw_bcrypt(password, ident, salt, log_rounds): ...

View File

@@ -0,0 +1,11 @@
from typing import Any
def varlist(name, count): ...
def indent_block(block, padding): ...
BFSTR: Any
def render_encipher(write, indent: int = ...) -> None: ...
def write_encipher_function(write, indent: int = ...) -> None: ...
def write_expand_function(write, indent: int = ...) -> None: ...
def main() -> None: ...

View File

@@ -0,0 +1,13 @@
from typing import Any
class BlowfishEngine:
P: Any
S: Any
def __init__(self) -> None: ...
@staticmethod
def key_to_words(data, size: int = ...): ...
def encipher(self, l, r): ...
def expand(self, key_words) -> None: ...
def eks_salted_expand(self, key_words, salt_words) -> None: ...
def eks_repeated_expand(self, key_words, salt_words, rounds) -> None: ...
def repeat_encipher(self, l, r, count): ...

View File

@@ -0,0 +1,5 @@
from passlib.crypto._blowfish.base import BlowfishEngine as _BlowfishEngine
class BlowfishEngine(_BlowfishEngine):
def encipher(self, l, r): ...
def expand(self, key_words) -> None: ...

View File

@@ -0,0 +1,12 @@
from typing import Any
class md4:
name: str
digest_size: int
digestsize: int
block_size: int
def __init__(self, content: Any | None = ...) -> None: ...
def update(self, content) -> None: ...
def copy(self): ...
def digest(self): ...
def hexdigest(self): ...

View File

@@ -0,0 +1,5 @@
__all__ = ["expand_des_key", "des_encrypt_block"]
def expand_des_key(key): ...
def des_encrypt_block(key, input, salt: int = ..., rounds: int = ...): ...
def des_encrypt_int_block(key, input, salt: int = ..., rounds: int = ...): ...

View File

@@ -0,0 +1,27 @@
from typing import Any
from passlib.utils import SequenceMixin
def lookup_hash(digest, return_unknown: bool = ..., required: bool = ...): ...
def norm_hash_name(name, format: str = ...): ...
class HashInfo(SequenceMixin):
name: Any
iana_name: Any
aliases: Any
const: Any
digest_size: Any
block_size: Any
error_text: Any
unknown: bool
def __init__(self, const, names, required: bool = ...) -> None: ...
@property
def supported(self): ...
@property
def supported_by_fastpbkdf2(self): ...
@property
def supported_by_hashlib_pbkdf2(self): ...
def compile_hmac(digest, key, multipart: bool = ...): ...
def pbkdf1(digest, secret, salt, rounds, keylen: Any | None = ...): ...
def pbkdf2_hmac(digest, secret, salt, rounds, keylen: Any | None = ...): ...

View File

@@ -0,0 +1,2 @@
def validate(n, r, p): ...
def scrypt(secret, salt, n, r, p: int = ..., keylen: int = ...): ...

View File

@@ -0,0 +1,19 @@
from collections.abc import Generator
from typing import Any
class ScryptEngine:
n: int
r: int
p: int
smix_bytes: int
iv_bytes: int
bmix_len: int
bmix_half_len: int
bmix_struct: Any
integerify: Any
@classmethod
def execute(cls, secret, salt, n, r, p, keylen): ...
def __init__(self, n, r, p): ...
def run(self, secret, salt, keylen): ...
def smix(self, input) -> Generator[None, None, Any]: ...
def bmix(self, source, target) -> None: ...

View File

@@ -0,0 +1 @@
def main() -> None: ...

View File

@@ -0,0 +1 @@
def salsa20(input): ...

View File

@@ -0,0 +1,55 @@
from typing import Any
class UnknownBackendError(ValueError):
hasher: Any
backend: Any
def __init__(self, hasher, backend) -> None: ...
class MissingBackendError(RuntimeError): ...
class InternalBackendError(RuntimeError): ...
class PasswordValueError(ValueError): ...
class PasswordSizeError(PasswordValueError):
max_size: Any
def __init__(self, max_size, msg: Any | None = ...) -> None: ...
class PasswordTruncateError(PasswordSizeError):
def __init__(self, cls, msg: Any | None = ...) -> None: ...
class PasslibSecurityError(RuntimeError): ...
class TokenError(ValueError):
def __init__(self, msg: Any | None = ..., *args, **kwds) -> None: ...
class MalformedTokenError(TokenError): ...
class InvalidTokenError(TokenError): ...
class UsedTokenError(TokenError):
expire_time: Any
def __init__(self, *args, **kwds) -> None: ...
class UnknownHashError(ValueError):
value: Any
message: Any
def __init__(self, message: Any | None = ..., value: Any | None = ...) -> None: ...
class PasslibWarning(UserWarning): ...
class PasslibConfigWarning(PasslibWarning): ...
class PasslibHashWarning(PasslibWarning): ...
class PasslibRuntimeWarning(PasslibWarning): ...
class PasslibSecurityWarning(PasslibWarning): ...
def type_name(value): ...
def ExpectedTypeError(value, expected, param): ...
def ExpectedStringError(value, param): ...
def MissingDigestError(handler: Any | None = ...): ...
def NullPasswordError(handler: Any | None = ...): ...
def InvalidHashError(handler: Any | None = ...): ...
def MalformedHashError(handler: Any | None = ..., reason: Any | None = ...): ...
def ZeroPaddedRoundsError(handler: Any | None = ...): ...
def ChecksumSizeError(handler, raw: bool = ...): ...
ENABLE_DEBUG_ONLY_REPR: bool
def debug_only_repr(value, param: str = ...): ...
def CryptBackendError(handler, config, hash, source: str = ...) -> None: ...

View File

View File

@@ -0,0 +1,3 @@
from typing import Any
password_context: Any

View File

@@ -0,0 +1,55 @@
from typing import Any
__all__ = ["DJANGO_VERSION", "MIN_DJANGO_VERSION", "get_preset_config", "quirks"]
DJANGO_VERSION: tuple[Any, ...]
MIN_DJANGO_VERSION: tuple[int, int]
class quirks:
none_causes_check_password_error: Any
empty_is_usable_password: Any
invalid_is_usable_password: Any
def get_preset_config(name): ...
class DjangoTranslator:
context: Any
def __init__(self, context: Any | None = ..., **kwds) -> None: ...
def reset_hashers(self) -> None: ...
def passlib_to_django_name(self, passlib_name): ...
def passlib_to_django(self, passlib_hasher, cached: bool = ...): ...
def django_to_passlib_name(self, django_name): ...
def django_to_passlib(self, django_name, cached: bool = ...): ...
def resolve_django_hasher(self, django_name, cached: bool = ...): ...
class DjangoContextAdapter(DjangoTranslator):
context: Any
is_password_usable: Any
enabled: bool
patched: bool
log: Any
def __init__(self, context: Any | None = ..., get_user_category: Any | None = ..., **kwds) -> None: ...
def reset_hashers(self) -> None: ...
def get_hashers(self): ...
def get_hasher(self, algorithm: str = ...): ...
def identify_hasher(self, encoded): ...
def make_password(self, password, salt: Any | None = ..., hasher: str = ...): ...
def check_password(self, password, encoded, setter: Any | None = ..., preferred: str = ...): ...
def user_check_password(self, user, password): ...
def user_set_password(self, user, password) -> None: ...
def get_user_category(self, user): ...
HASHERS_PATH: str
MODELS_PATH: str
USER_CLASS_PATH: Any
FORMS_PATH: str
patch_locations: Any
def install_patch(self): ...
def remove_patch(self): ...
def load_model(self) -> None: ...
class ProxyProperty:
attr: Any
def __init__(self, attr) -> None: ...
def __get__(self, obj, cls): ...
def __set__(self, obj, value) -> None: ...
def __delete__(self, obj) -> None: ...

View File

@@ -0,0 +1,86 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
class _DummyCffiHasher:
time_cost: int
memory_cost: int
parallelism: int
salt_len: int
hash_len: int
class _Argon2Common( # type: ignore
uh.SubclassBackendMixin, uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler
):
name: str
setting_kwds: Any
checksum_size: Any
default_salt_size: ClassVar[int]
min_salt_size: int
max_salt_size: Any
default_rounds: Any
min_rounds: int
max_rounds: Any
rounds_cost: str
max_parallelism: Any
max_version: Any
min_desired_version: Any
min_memory_cost: int
max_threads: int
pure_use_threads: bool
def type_values(cls): ... # type: ignore
type: Any
parallelism: Any
version: Any
memory_cost: Any
@property
def type_d(self): ...
data: Any
@classmethod
def using( # type: ignore[override]
cls,
type: Any | None = ...,
memory_cost: Any | None = ...,
salt_len: Any | None = ...,
time_cost: Any | None = ...,
digest_size: Any | None = ...,
checksum_size: Any | None = ...,
hash_len: Any | None = ...,
max_threads: Any | None = ...,
**kwds,
): ...
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
def __init__(
self,
type: Any | None = ...,
type_d: bool = ...,
version: Any | None = ...,
memory_cost: Any | None = ...,
data: Any | None = ...,
**kwds,
) -> None: ...
class _NoBackend(_Argon2Common):
@classmethod
def hash(cls, secret): ...
@classmethod
def verify(cls, secret, hash): ...
@classmethod
def genhash(cls, secret, config): ...
class _CffiBackend(_Argon2Common):
@classmethod
def hash(cls, secret): ...
@classmethod
def verify(cls, secret, hash): ...
@classmethod
def genhash(cls, secret, config): ...
class _PureBackend(_Argon2Common): ...
class argon2(_NoBackend, _Argon2Common): # type: ignore
backends: Any

View File

@@ -0,0 +1,58 @@
from typing import Any
import passlib.utils.handlers as uh
class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
checksum_chars: Any
default_ident: Any
ident_values: Any
ident_aliases: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
final_salt_chars: str
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
truncate_size: int
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
@classmethod
def needs_update(cls, hash, **kwds): ...
@classmethod
def normhash(cls, hash): ...
class _NoBackend(_BcryptCommon): ...
class _BcryptBackend(_BcryptCommon): ...
class _BcryptorBackend(_BcryptCommon): ...
class _PyBcryptBackend(_BcryptCommon): ...
class _OsCryptBackend(_BcryptCommon): ...
class _BuiltinBackend(_BcryptCommon): ...
class bcrypt(_NoBackend, _BcryptCommon): # type: ignore
backends: Any
class _wrapped_bcrypt(bcrypt):
setting_kwds: Any
truncate_size: Any
class bcrypt_sha256(_wrapped_bcrypt):
name: str
ident_values: Any
ident_aliases: Any
default_ident: Any
version: int
@classmethod
def using(cls, version: Any | None = ..., **kwds): ... # type: ignore[override]
prefix: Any
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
def __init__(self, version: Any | None = ..., **kwds) -> None: ...

View File

@@ -0,0 +1,31 @@
from typing import Any
import passlib.utils.handlers as uh
class cisco_pix(uh.HasUserContext, uh.StaticHandler): # type: ignore
name: str
truncate_size: int
truncate_error: bool
truncate_verify_reject: bool
checksum_size: int
checksum_chars: Any
class cisco_asa(cisco_pix):
name: str
truncate_size: int
class cisco_type7(uh.GenericHandler):
name: str
setting_kwds: Any
checksum_chars: Any
min_salt_value: int
max_salt_value: int
@classmethod
def using(cls, salt: Any | None = ..., **kwds): ... # type: ignore[override]
@classmethod
def from_string(cls, hash): ...
salt: Any
def __init__(self, salt: Any | None = ..., **kwds) -> None: ...
def to_string(self): ...
@classmethod
def decode(cls, hash, encoding: str = ...): ...

View File

@@ -0,0 +1,60 @@
from typing import Any
import passlib.utils.handlers as uh
class des_crypt(uh.TruncateMixin, uh.HasManyBackends, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
checksum_size: int
min_salt_size: int
max_salt_size: int
salt_chars: Any
truncate_size: int
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
backends: Any
class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
checksum_chars: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
@classmethod
def using(cls, **kwds): ...
backends: Any
class bigcrypt(uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class crypt16(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
checksum_chars: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
truncate_size: int
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...

View File

@@ -0,0 +1,32 @@
from typing import Any
import passlib.utils.handlers as uh
class HexDigestHash(uh.StaticHandler):
checksum_size: Any
checksum_chars: Any
supported: bool
def create_hex_hash(digest, module=..., django_name: Any | None = ..., required: bool = ...): ...
hex_md4: Any
hex_md5: Any
hex_sha1: Any
hex_sha256: Any
hex_sha512: Any
class htdigest(uh.MinimalHandler):
name: str
setting_kwds: Any
context_kwds: Any
default_encoding: str
@classmethod
def hash(cls, secret, user, realm, encoding: Any | None = ...): ... # type: ignore[override]
@classmethod
def verify(cls, secret, hash, user, realm, encoding: str = ...): ... # type: ignore[override]
@classmethod
def identify(cls, hash): ...
@classmethod
def genconfig(cls): ...
@classmethod
def genhash(cls, secret, config, user, realm, encoding: Any | None = ...): ... # type: ignore[override]

View File

@@ -0,0 +1,89 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
from passlib.handlers.bcrypt import _wrapped_bcrypt
from passlib.ifc import DisabledHash
class DjangoSaltedHash(uh.HasSalt, uh.GenericHandler): # type: ignore
setting_kwds: Any
default_salt_size: ClassVar[int]
max_salt_size: Any
salt_chars: Any
checksum_chars: Any
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class DjangoVariableHash(uh.HasRounds, DjangoSaltedHash): # type: ignore
setting_kwds: Any
min_rounds: int
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class django_salted_sha1(DjangoSaltedHash):
name: str
django_name: str
ident: Any
checksum_size: int
class django_salted_md5(DjangoSaltedHash):
name: str
django_name: str
ident: Any
checksum_size: int
django_bcrypt: Any
class django_bcrypt_sha256(_wrapped_bcrypt):
name: str
django_name: str
django_prefix: Any
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class django_pbkdf2_sha256(DjangoVariableHash):
name: str
django_name: str
ident: Any
min_salt_size: int
max_rounds: int
checksum_chars: Any
checksum_size: int
default_rounds: Any
class django_pbkdf2_sha1(django_pbkdf2_sha256):
name: str
django_name: str
ident: Any
checksum_size: int
default_rounds: Any
django_argon2: Any
class django_des_crypt(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
django_name: str
setting_kwds: Any
ident: Any
checksum_chars: Any
salt_chars: Any
checksum_size: int
min_salt_size: int
default_salt_size: ClassVar[int]
truncate_size: int
use_duplicate_salt: bool
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class django_disabled(DisabledHash, uh.StaticHandler): # type: ignore
name: str
suffix_length: int
@classmethod
def identify(cls, hash): ...
@classmethod
def verify(cls, secret, hash): ...

View File

@@ -0,0 +1,28 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
ident: Any
default_salt_size: ClassVar[int]
max_salt_size: Any
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
default_variant: int
@classmethod
def using(cls, variant: Any | None = ..., **kwds): ... # type: ignore[override]
variant: Any
use_defaults: Any
def __init__(self, variant: Any | None = ..., **kwds) -> None: ...
@property
def checksum_alg(self): ...
@property
def checksum_size(self): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...

View File

@@ -0,0 +1,83 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
from passlib.handlers.misc import plaintext
from passlib.utils.handlers import PrefixWrapper
__all__ = [
"ldap_plaintext",
"ldap_md5",
"ldap_sha1",
"ldap_salted_md5",
"ldap_salted_sha1",
"ldap_salted_sha256",
"ldap_salted_sha512",
"ldap_des_crypt",
"ldap_bsdi_crypt",
"ldap_md5_crypt",
"ldap_sha1_crypt",
"ldap_bcrypt",
"ldap_sha256_crypt",
"ldap_sha512_crypt",
]
class _Base64DigestHelper(uh.StaticHandler):
ident: Any
checksum_chars: Any
class _SaltedBase64DigestHelper(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
setting_kwds: Any
checksum_chars: Any
ident: Any
min_salt_size: int
max_salt_size: int
default_salt_size: ClassVar[int]
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class ldap_md5(_Base64DigestHelper):
name: str
ident: Any
class ldap_sha1(_Base64DigestHelper):
name: str
ident: Any
class ldap_salted_md5(_SaltedBase64DigestHelper):
name: str
ident: Any
checksum_size: int
class ldap_salted_sha1(_SaltedBase64DigestHelper):
name: str
ident: Any
checksum_size: int
class ldap_salted_sha256(_SaltedBase64DigestHelper):
name: str
ident: Any
checksum_size: int
default_salt_size: ClassVar[int]
class ldap_salted_sha512(_SaltedBase64DigestHelper):
name: str
ident: Any
checksum_size: int
default_salt_size: ClassVar[int]
class ldap_plaintext(plaintext):
name: str
@classmethod
def genconfig(cls): ...
@classmethod
def identify(cls, hash): ...
# Dynamically created
ldap_sha512_crypt: PrefixWrapper
ldap_sha256_crypt: PrefixWrapper
ldap_sha1_crypt: PrefixWrapper
ldap_bcrypt: PrefixWrapper
ldap_md5_crypt: PrefixWrapper
ldap_bsdi_crypt: PrefixWrapper
ldap_des_crypt: PrefixWrapper

View File

@@ -0,0 +1,22 @@
from typing import Any
import passlib.utils.handlers as uh
class _MD5_Common(uh.HasSalt, uh.GenericHandler): # type: ignore
setting_kwds: Any
checksum_size: int
checksum_chars: Any
max_salt_size: int
salt_chars: Any
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class md5_crypt(uh.HasManyBackends, _MD5_Common): # type: ignore
name: str
ident: Any
backends: Any
class apr_md5_crypt(_MD5_Common):
name: str
ident: Any

View File

@@ -0,0 +1,50 @@
from typing import Any
import passlib.utils.handlers as uh
from passlib.ifc import DisabledHash
class unix_fallback(DisabledHash, uh.StaticHandler): # type: ignore
name: str
context_kwds: Any
@classmethod
def identify(cls, hash): ...
enable_wildcard: Any
def __init__(self, enable_wildcard: bool = ..., **kwds) -> None: ...
@classmethod
def verify(cls, secret, hash, enable_wildcard: bool = ...): ... # type: ignore[override]
class unix_disabled(DisabledHash, uh.MinimalHandler): # type: ignore
name: str
setting_kwds: Any
context_kwds: Any
default_marker: Any
@classmethod
def using(cls, marker: Any | None = ..., **kwds): ... # type: ignore[override]
@classmethod
def identify(cls, hash): ...
@classmethod
def verify(cls, secret, hash): ...
@classmethod
def hash(cls, secret, **kwds): ...
@classmethod
def genhash(cls, secret, config, marker: Any | None = ...): ... # type: ignore[override]
@classmethod
def disable(cls, hash: Any | None = ...): ...
@classmethod
def enable(cls, hash): ...
class plaintext(uh.MinimalHandler):
name: str
setting_kwds: Any
context_kwds: Any
default_encoding: str
@classmethod
def identify(cls, hash): ...
@classmethod
def hash(cls, secret, encoding: Any | None = ...): ... # type: ignore[override]
@classmethod
def verify(cls, secret, hash, encoding: Any | None = ...): ... # type: ignore[override]
@classmethod
def genconfig(cls): ...
@classmethod
def genhash(cls, secret, config, encoding: Any | None = ...): ... # type: ignore[override]

View File

@@ -0,0 +1,29 @@
from typing import Any
import passlib.utils.handlers as uh
class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
min_salt_size: int
max_salt_size: int
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
@classmethod
def verify(cls, secret, hash): ...
class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
min_salt_size: int
max_salt_size: int
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...

View File

@@ -0,0 +1,16 @@
from typing import Any
import passlib.utils.handlers as uh
class mysql323(uh.StaticHandler):
name: str
checksum_size: int
checksum_chars: Any
class mysql41(uh.StaticHandler):
name: str
checksum_chars: Any
checksum_size: int
# Names in __all__ with no definition:
# mysq41

View File

@@ -0,0 +1,24 @@
from typing import Any
import passlib.utils.handlers as uh
class oracle10(uh.HasUserContext, uh.StaticHandler): # type: ignore
name: str
checksum_chars: Any
checksum_size: int
class oracle11(uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_size: int
checksum_chars: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
# Names in __all__ with no definition:
# oracle10g
# oracle11g

View File

@@ -0,0 +1,81 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
from passlib.utils.handlers import PrefixWrapper
class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
setting_kwds: Any
checksum_chars: Any
default_salt_size: ClassVar[int]
max_salt_size: int
default_rounds: Any
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
pbkdf2_sha1: Any
pbkdf2_sha256: Any
pbkdf2_sha512: Any
ldap_pbkdf2_sha1: PrefixWrapper
ldap_pbkdf2_sha256: PrefixWrapper
ldap_pbkdf2_sha512: PrefixWrapper
class cta_pbkdf2_sha1(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
checksum_size: int
default_salt_size: ClassVar[int]
max_salt_size: int
default_rounds: Any
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class dlitz_pbkdf2_sha1(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
default_salt_size: ClassVar[int]
max_salt_size: int
salt_chars: Any
default_rounds: Any
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class atlassian_pbkdf2_sha1(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
checksum_size: int
min_salt_size: int
max_salt_size: int
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
class grub_pbkdf2_sha512(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
checksum_size: int
default_salt_size: ClassVar[int]
max_salt_size: int
default_rounds: Any
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...

View File

@@ -0,0 +1,21 @@
from typing import Any
import passlib.utils.handlers as uh
class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
min_salt_size: int
max_salt_size: int
salt_chars: Any
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
default_ident: Any
ident_values: Any
ident_aliases: Any
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...

View File

@@ -0,0 +1,8 @@
from typing import Any
import passlib.utils.handlers as uh
class postgres_md5(uh.HasUserContext, uh.StaticHandler): # type: ignore
name: str
checksum_chars: Any
checksum_size: int

View File

@@ -0,0 +1,5 @@
from typing import Any
roundup_plaintext: Any
ldap_hex_md5: Any
ldap_hex_sha1: Any

View File

@@ -0,0 +1,30 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
default_salt_size: ClassVar[int]
max_salt_size: int
default_rounds: int
min_rounds: int
max_rounds: Any
rounds_cost: str
default_algs: Any
algs: Any
@classmethod
def extract_digest_info(cls, hash, alg): ...
@classmethod
def extract_digest_algs(cls, hash, format: str = ...): ...
@classmethod
def derive_digest(cls, password, salt, rounds, alg): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
@classmethod
def using(cls, default_algs: Any | None = ..., algs: Any | None = ..., **kwds): ... # type: ignore[override]
def __init__(self, algs: Any | None = ..., **kwds) -> None: ...
@classmethod
def verify(cls, secret, hash, full: bool = ...): ... # type: ignore[override]

View File

@@ -0,0 +1,33 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
class scrypt(uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.HasManyIdents, uh.GenericHandler): # type: ignore
backends: ClassVar[tuple[str, ...]]
name: str
setting_kwds: Any
checksum_size: int
default_ident: Any
ident_values: Any
default_salt_size: ClassVar[int]
max_salt_size: int
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
parallelism: int
block_size: int
@classmethod
def using(cls, block_size: Any | None = ..., **kwds): ... # type: ignore[override]
@classmethod
def from_string(cls, hash): ...
@classmethod
def parse(cls, hash): ...
def to_string(self): ...
def __init__(self, block_size: Any | None = ..., **kwds) -> None: ...
@classmethod
def get_backend(cls): ...
@classmethod
def has_backend(cls, name: str = ...): ...
@classmethod
def set_backend(cls, name: str = ..., dryrun: bool = ...) -> None: ...

View File

@@ -0,0 +1,23 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
log: Any
class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
ident: Any
checksum_size: int
checksum_chars: Any
default_salt_size: ClassVar[int]
max_salt_size: int
salt_chars: Any
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
@classmethod
def from_string(cls, hash): ...
def to_string(self, config: bool = ...): ...
backends: Any

View File

@@ -0,0 +1,30 @@
from typing import Any
import passlib.utils.handlers as uh
class _SHA2_Common(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
setting_kwds: Any
checksum_chars: Any
max_salt_size: int
salt_chars: Any
min_rounds: int
max_rounds: int
rounds_cost: str
implicit_rounds: bool
def __init__(self, implicit_rounds: Any | None = ..., **kwds) -> None: ...
@classmethod
def from_string(cls, hash): ...
def to_string(self): ...
backends: Any
class sha256_crypt(_SHA2_Common):
name: str
ident: Any
checksum_size: int
default_rounds: int
class sha512_crypt(_SHA2_Common):
name: str
ident: Any
checksum_size: int
default_rounds: int

View File

@@ -0,0 +1,24 @@
from typing import Any, ClassVar
import passlib.utils.handlers as uh
class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
checksum_size: int
default_salt_size: ClassVar[int]
max_salt_size: Any
salt_chars: Any
default_rounds: int
min_rounds: int
max_rounds: int
rounds_cost: str
ident_values: Any
bare_salt: bool
def __init__(self, bare_salt: bool = ..., **kwds) -> None: ...
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash): ...
def to_string(self, _withchk: bool = ...): ...

View File

@@ -0,0 +1,38 @@
from typing import Any
import passlib.utils.handlers as uh
class lmhash(uh.TruncateMixin, uh.HasEncodingContext, uh.StaticHandler): # type: ignore
name: str
setting_kwds: Any
checksum_chars: Any
checksum_size: int
truncate_size: int
default_encoding: str
@classmethod
def raw(cls, secret, encoding: Any | None = ...): ...
class nthash(uh.StaticHandler):
name: str
checksum_chars: Any
checksum_size: int
@classmethod
def raw(cls, secret): ...
@classmethod
def raw_nthash(cls, secret, hex: bool = ...): ...
bsd_nthash: Any
class msdcc(uh.HasUserContext, uh.StaticHandler): # type: ignore
name: str
checksum_chars: Any
checksum_size: int
@classmethod
def raw(cls, secret, user): ...
class msdcc2(uh.HasUserContext, uh.StaticHandler): # type: ignore
name: str
checksum_chars: Any
checksum_size: int
@classmethod
def raw(cls, secret, user): ...

View File

@@ -0,0 +1,75 @@
from passlib.handlers.argon2 import argon2 as argon2
from passlib.handlers.bcrypt import bcrypt as bcrypt, bcrypt_sha256 as bcrypt_sha256
from passlib.handlers.cisco import cisco_asa as cisco_asa, cisco_pix as cisco_pix, cisco_type7 as cisco_type7
from passlib.handlers.des_crypt import bigcrypt as bigcrypt, bsdi_crypt as bsdi_crypt, crypt16 as crypt16, des_crypt as des_crypt
from passlib.handlers.digests import (
hex_md4 as hex_md4,
hex_md5 as hex_md5,
hex_sha1 as hex_sha1,
hex_sha256 as hex_sha256,
hex_sha512 as hex_sha512,
htdigest as htdigest,
)
from passlib.handlers.django import (
django_bcrypt as django_bcrypt,
django_bcrypt_sha256 as django_bcrypt_sha256,
django_des_crypt as django_des_crypt,
django_disabled as django_disabled,
django_pbkdf2_sha1 as django_pbkdf2_sha1,
django_pbkdf2_sha256 as django_pbkdf2_sha256,
django_salted_md5 as django_salted_md5,
django_salted_sha1 as django_salted_sha1,
)
from passlib.handlers.fshp import fshp as fshp
from passlib.handlers.ldap_digests import (
ldap_bcrypt as ldap_bcrypt,
ldap_bsdi_crypt as ldap_bsdi_crypt,
ldap_des_crypt as ldap_des_crypt,
ldap_md5 as ldap_md5,
ldap_md5_crypt as ldap_md5_crypt,
ldap_plaintext as ldap_plaintext,
ldap_salted_md5 as ldap_salted_md5,
ldap_salted_sha1 as ldap_salted_sha1,
ldap_salted_sha256 as ldap_salted_sha256,
ldap_salted_sha512 as ldap_salted_sha512,
ldap_sha1 as ldap_sha1,
ldap_sha1_crypt as ldap_sha1_crypt,
ldap_sha256_crypt as ldap_sha256_crypt,
ldap_sha512_crypt as ldap_sha512_crypt,
)
from passlib.handlers.md5_crypt import apr_md5_crypt as apr_md5_crypt, md5_crypt as md5_crypt
from passlib.handlers.misc import plaintext as plaintext, unix_disabled as unix_disabled, unix_fallback as unix_fallback
from passlib.handlers.mssql import mssql2000 as mssql2000, mssql2005 as mssql2005
from passlib.handlers.mysql import mysql41 as mysql41, mysql323 as mysql323
from passlib.handlers.oracle import oracle10 as oracle10, oracle11 as oracle11
from passlib.handlers.pbkdf2 import (
atlassian_pbkdf2_sha1 as atlassian_pbkdf2_sha1,
cta_pbkdf2_sha1 as cta_pbkdf2_sha1,
dlitz_pbkdf2_sha1 as dlitz_pbkdf2_sha1,
grub_pbkdf2_sha512 as grub_pbkdf2_sha512,
ldap_pbkdf2_sha1 as ldap_pbkdf2_sha1,
ldap_pbkdf2_sha256 as ldap_pbkdf2_sha256,
ldap_pbkdf2_sha512 as ldap_pbkdf2_sha512,
pbkdf2_sha1 as pbkdf2_sha1,
pbkdf2_sha256 as pbkdf2_sha256,
pbkdf2_sha512 as pbkdf2_sha512,
)
from passlib.handlers.phpass import phpass as phpass
from passlib.handlers.postgres import postgres_md5 as postgres_md5
from passlib.handlers.roundup import (
ldap_hex_md5 as ldap_hex_md5,
ldap_hex_sha1 as ldap_hex_sha1,
roundup_plaintext as roundup_plaintext,
)
from passlib.handlers.scram import scram as scram
from passlib.handlers.scrypt import scrypt as scrypt
from passlib.handlers.sha1_crypt import sha1_crypt as sha1_crypt
from passlib.handlers.sha2_crypt import sha256_crypt as sha256_crypt, sha512_crypt as sha512_crypt
from passlib.handlers.sun_md5_crypt import sun_md5_crypt as sun_md5_crypt
from passlib.handlers.windows import (
bsd_nthash as bsd_nthash,
lmhash as lmhash,
msdcc as msdcc,
msdcc2 as msdcc2,
nthash as nthash,
)

View File

@@ -0,0 +1,8 @@
from typing import Any
linux_context: Any
linux2_context: Any
freebsd_context: Any
openbsd_context: Any
netbsd_context: Any
host_context: Any

View File

@@ -0,0 +1,37 @@
import abc
from abc import abstractmethod
from typing import Any
class PasswordHash(metaclass=abc.ABCMeta):
is_disabled: bool
truncate_size: Any
truncate_error: bool
truncate_verify_reject: bool
@classmethod
@abstractmethod
def hash(cls, secret, **setting_and_context_kwds): ...
@classmethod
def encrypt(cls, *args, **kwds): ...
@classmethod
@abstractmethod
def verify(cls, secret, hash, **context_kwds): ...
@classmethod
@abstractmethod
def using(cls, relaxed: bool = ..., **kwds): ...
@classmethod
def needs_update(cls, hash, secret: Any | None = ...): ...
@classmethod
@abstractmethod
def identify(cls, hash): ...
@classmethod
def genconfig(cls, **setting_kwds): ...
@classmethod
def genhash(cls, secret, config, **context) -> None: ...
deprecated: bool
class DisabledHash(PasswordHash, metaclass=abc.ABCMeta):
is_disabled: bool
@classmethod
def disable(cls, hash: Any | None = ...): ...
@classmethod
def enable(cls, hash) -> None: ...

View File

@@ -0,0 +1,55 @@
from abc import abstractmethod
from collections import MutableMapping
from typing import Any
class SequenceGenerator:
length: Any
requested_entropy: str
rng: Any
@property
@abstractmethod
def symbol_count(self) -> int: ...
def __init__(self, entropy: Any | None = ..., length: Any | None = ..., rng: Any | None = ..., **kwds) -> None: ...
@property
def entropy_per_symbol(self) -> float: ...
@property
def entropy(self) -> float: ...
def __next__(self) -> None: ...
def __call__(self, returns: Any | None = ...): ...
def __iter__(self): ...
default_charsets: Any
class WordGenerator(SequenceGenerator):
charset: str
chars: Any
def __init__(self, chars: Any | None = ..., charset: Any | None = ..., **kwds) -> None: ...
@property
def symbol_count(self): ...
def __next__(self): ...
def genword(entropy: Any | None = ..., length: Any | None = ..., returns: Any | None = ..., **kwds): ...
class WordsetDict(MutableMapping[Any, Any]):
paths: Any
def __init__(self, *args, **kwds) -> None: ...
def __getitem__(self, key): ...
def set_path(self, key, path) -> None: ...
def __setitem__(self, key, value) -> None: ...
def __delitem__(self, key) -> None: ...
def __iter__(self): ...
def __len__(self): ...
def __contains__(self, key): ...
default_wordsets: Any
class PhraseGenerator(SequenceGenerator):
wordset: str
words: Any
sep: str
def __init__(self, wordset: Any | None = ..., words: Any | None = ..., sep: Any | None = ..., **kwds) -> None: ...
@property
def symbol_count(self): ...
def __next__(self): ...
def genphrase(entropy: Any | None = ..., length: Any | None = ..., returns: Any | None = ..., **kwds): ...

View File

@@ -0,0 +1,13 @@
from typing import Any
class _PasslibRegistryProxy:
__name__: str
__package__: Any
def __getattr__(self, attr): ...
def __setattr__(self, attr, value) -> None: ...
def __dir__(self): ...
def register_crypt_handler_path(name, path) -> None: ...
def register_crypt_handler(handler, force: bool = ..., _attr: Any | None = ...) -> None: ...
def get_crypt_handler(name, default=...): ...
def list_crypt_handlers(loaded_only: bool = ...): ...

View File

@@ -0,0 +1,127 @@
from typing import Any
from passlib.exc import (
InvalidTokenError as InvalidTokenError,
MalformedTokenError as MalformedTokenError,
TokenError as TokenError,
UsedTokenError as UsedTokenError,
)
from passlib.utils import SequenceMixin
class AppWallet:
salt_size: int
encrypt_cost: int
default_tag: Any
def __init__(
self,
secrets: Any | None = ...,
default_tag: Any | None = ...,
encrypt_cost: Any | None = ...,
secrets_path: Any | None = ...,
) -> None: ...
@property
def has_secrets(self): ...
def get_secret(self, tag): ...
def encrypt_key(self, key): ...
def decrypt_key(self, enckey): ...
class TOTP:
min_json_version: int
json_version: int
wallet: Any
now: Any
digits: int
alg: str
label: Any
issuer: Any
period: int
changed: bool
@classmethod
def using(
cls,
digits: Any | None = ...,
alg: Any | None = ...,
period: Any | None = ...,
issuer: Any | None = ...,
wallet: Any | None = ...,
now: Any | None = ...,
**kwds,
): ...
@classmethod
def new(cls, **kwds): ...
def __init__(
self,
key: Any | None = ...,
format: str = ...,
new: bool = ...,
digits: Any | None = ...,
alg: Any | None = ...,
size: Any | None = ...,
period: Any | None = ...,
label: Any | None = ...,
issuer: Any | None = ...,
changed: bool = ...,
**kwds,
) -> None: ...
@property
def key(self): ...
@key.setter
def key(self, value) -> None: ...
@property
def encrypted_key(self): ...
@encrypted_key.setter
def encrypted_key(self, value) -> None: ...
@property
def hex_key(self): ...
@property
def base32_key(self): ...
def pretty_key(self, format: str = ..., sep: str = ...): ...
@classmethod
def normalize_time(cls, time): ...
def normalize_token(self_or_cls, token): ... # type: ignore
def generate(self, time: Any | None = ...): ...
@classmethod
def verify(cls, token, source, **kwds): ...
def match(self, token, time: Any | None = ..., window: int = ..., skew: int = ..., last_counter: Any | None = ...): ...
@classmethod
def from_source(cls, source): ...
@classmethod
def from_uri(cls, uri): ...
def to_uri(self, label: Any | None = ..., issuer: Any | None = ...): ...
@classmethod
def from_json(cls, source): ...
def to_json(self, encrypt: Any | None = ...): ...
@classmethod
def from_dict(cls, source): ...
def to_dict(self, encrypt: Any | None = ...): ...
class TotpToken(SequenceMixin):
totp: Any
token: Any
counter: Any
def __init__(self, totp, token, counter) -> None: ...
@property
def start_time(self): ...
@property
def expire_time(self): ...
@property
def remaining(self): ...
@property
def valid(self): ...
class TotpMatch(SequenceMixin):
totp: Any
counter: int
time: int
window: int
def __init__(self, totp, counter, time, window: int = ...) -> None: ...
@property
def expected_counter(self): ...
@property
def skipped(self): ...
@property
def expire_time(self): ...
@property
def cache_seconds(self): ...
@property
def cache_time(self): ...

View File

@@ -0,0 +1,74 @@
import timeit
from collections.abc import Generator
from hmac import compare_digest
from typing import Any
from passlib.utils.compat import JYTHON as JYTHON
__all__ = [
"JYTHON",
"sys_bits",
"unix_crypt_schemes",
"rounds_cost_values",
"consteq",
"saslprep",
"xor_bytes",
"render_bytes",
"is_same_codec",
"is_ascii_safe",
"to_bytes",
"to_unicode",
"to_native_str",
"has_crypt",
"test_crypt",
"safe_crypt",
"tick",
"rng",
"getrandbytes",
"getrandstr",
"generate_password",
"is_crypt_handler",
"is_crypt_context",
"has_rounds_info",
"has_salt_info",
]
sys_bits: Any
unix_crypt_schemes: list[str]
rounds_cost_values: Any
class SequenceMixin:
def __getitem__(self, idx): ...
def __iter__(self): ...
def __len__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
consteq = compare_digest
def str_consteq(left, right): ...
def saslprep(source, param: str = ...): ...
def render_bytes(source, *args): ...
def xor_bytes(left, right): ...
def is_same_codec(left, right): ...
def is_ascii_safe(source): ...
def to_bytes(source, encoding: str = ..., param: str = ..., source_encoding: Any | None = ...): ...
def to_unicode(source, encoding: str = ..., param: str = ...): ...
def to_native_str(source, encoding: str = ..., param: str = ...): ...
has_crypt: bool
def safe_crypt(secret, hash) -> None: ...
def test_crypt(secret, hash): ...
timer = timeit.default_timer
tick = timer
rng: Any
def getrandbytes(rng, count) -> Generator[None, None, Any]: ...
def getrandstr(rng, charset, count) -> Generator[None, None, Any]: ...
def generate_password(size: int = ..., charset=...): ...
def is_crypt_handler(obj): ...
def is_crypt_context(obj): ...
def has_rounds_info(handler): ...
def has_salt_info(handler): ...

View File

@@ -0,0 +1,50 @@
from typing import Any
BASE64_CHARS: Any
AB64_CHARS: Any
HASH64_CHARS: Any
BCRYPT_CHARS: Any
PADDED_BASE64_CHARS: Any
HEX_CHARS: Any
UPPER_HEX_CHARS: Any
LOWER_HEX_CHARS: Any
ALL_BYTE_VALUES: Any
def compile_byte_translation(mapping, source: Any | None = ...): ...
def b64s_encode(data): ...
def b64s_decode(data): ...
def ab64_encode(data): ...
def ab64_decode(data): ...
def b32encode(source): ...
def b32decode(source): ...
class Base64Engine:
bytemap: Any
big: Any
def __init__(self, charmap, big: bool = ...) -> None: ...
@property
def charmap(self): ...
def encode_bytes(self, source): ...
def decode_bytes(self, source): ...
def check_repair_unused(self, source): ...
def repair_unused(self, source): ...
def encode_transposed_bytes(self, source, offsets): ...
def decode_transposed_bytes(self, source, offsets): ...
def decode_int6(self, source): ...
def decode_int12(self, source): ...
def decode_int24(self, source): ...
def decode_int30(self, source): ...
def decode_int64(self, source): ...
def encode_int6(self, value): ...
def encode_int12(self, value): ...
def encode_int24(self, value): ...
def encode_int30(self, value): ...
def encode_int64(self, value): ...
class LazyBase64Engine(Base64Engine):
def __init__(self, *args, **kwds) -> None: ...
def __getattribute__(self, attr): ...
h64: Any
h64big: Any
bcrypt64: Any

View File

@@ -0,0 +1,8 @@
from typing_extensions import Literal
PY2: Literal[False]
PY3: Literal[True]
PY26: Literal[False]
JYTHON: bool
PYPY: bool
PYSTON: bool

View File

@@ -0,0 +1,26 @@
from collections.abc import Generator
from typing import Any
class OrderedDict(dict[Any, Any]):
def __init__(self, *args, **kwds) -> None: ...
def __setitem__(self, key, value, dict_setitem=...) -> None: ...
def __delitem__(self, key, dict_delitem=...) -> None: ...
def __iter__(self): ...
def __reversed__(self) -> Generator[Any, None, None]: ...
def clear(self) -> None: ...
def popitem(self, last: bool = ...): ...
def keys(self): ...
def values(self): ...
def items(self): ...
def iterkeys(self): ...
def itervalues(self) -> Generator[Any, None, None]: ...
def iteritems(self) -> Generator[Any, None, None]: ...
def update(*args, **kwds) -> None: ... # type: ignore[override]
def pop(self, key, default=...): ...
def setdefault(self, key, default: Any | None = ...): ...
def __reduce__(self): ...
def copy(self): ...
@classmethod
def fromkeys(cls, iterable, value: Any | None = ...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...

View File

@@ -0,0 +1,41 @@
from typing import Any
class classproperty:
im_func: Any
def __init__(self, func) -> None: ...
def __get__(self, obj, cls): ...
@property
def __func__(self): ...
class hybrid_method:
func: Any
def __init__(self, func) -> None: ...
def __get__(self, obj, cls): ...
def memoize_single_value(func): ...
class memoized_property:
__func__: Any
__name__: Any
__doc__: Any
def __init__(self, func) -> None: ...
def __get__(self, obj, cls): ...
def clear_cache(self, obj) -> None: ...
def peek_cache(self, obj, default: Any | None = ...): ...
def deprecated_function(
msg: Any | None = ...,
deprecated: Any | None = ...,
removed: Any | None = ...,
updoc: bool = ...,
replacement: Any | None = ...,
_is_method: bool = ...,
func_module: Any | None = ...,
): ...
def deprecated_method(
msg: Any | None = ...,
deprecated: Any | None = ...,
removed: Any | None = ...,
updoc: bool = ...,
replacement: Any | None = ...,
): ...

View File

@@ -0,0 +1,8 @@
from passlib.crypto.des import (
des_encrypt_block as des_encrypt_block,
des_encrypt_int_block as des_encrypt_int_block,
expand_des_key as expand_des_key,
)
from passlib.utils.decor import deprecated_function as deprecated_function
def mdes_encrypt_int_block(key, input, salt: int = ..., rounds: int = ...): ...

View File

@@ -0,0 +1,176 @@
import abc
from typing import Any, ClassVar
from passlib.ifc import PasswordHash
from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS
H64_CHARS = HASH64_CHARS
B64_CHARS = BASE64_CHARS
PADDED_B64_CHARS = PADDED_BASE64_CHARS
UC_HEX_CHARS = UPPER_HEX_CHARS
LC_HEX_CHARS = LOWER_HEX_CHARS
def parse_mc2(hash, prefix, sep=..., handler: Any | None = ...): ...
def parse_mc3(hash, prefix, sep=..., rounds_base: int = ..., default_rounds: Any | None = ..., handler: Any | None = ...): ...
def render_mc2(ident, salt, checksum, sep=...): ...
def render_mc3(ident, rounds, salt, checksum, sep=..., rounds_base: int = ...): ...
class MinimalHandler(PasswordHash, metaclass=abc.ABCMeta):
@classmethod
def using(cls, relaxed: bool = ...): ... # type: ignore[override]
class TruncateMixin(MinimalHandler, metaclass=abc.ABCMeta):
truncate_error: bool
truncate_verify_reject: bool
@classmethod
def using(cls, truncate_error: Any | None = ..., **kwds): ... # type: ignore[override]
class GenericHandler(MinimalHandler):
setting_kwds: Any
context_kwds: Any
ident: Any
checksum_size: Any
checksum_chars: Any
checksum: Any
use_defaults: Any
def __init__(self, checksum: Any | None = ..., use_defaults: bool = ..., **kwds) -> None: ...
@classmethod
def identify(cls, hash): ...
@classmethod
def from_string(cls, hash, **context) -> None: ...
def to_string(self) -> None: ...
@classmethod
def hash(cls, secret, **kwds): ...
@classmethod
def verify(cls, secret, hash, **context): ...
@classmethod
def genconfig(cls, **kwds): ...
@classmethod
def genhash(cls, secret, config, **context): ...
@classmethod
def needs_update(cls, hash, secret: Any | None = ..., **kwds): ...
@classmethod
def parsehash(cls, hash, checksum: bool = ..., sanitize: bool = ...): ...
@classmethod
def bitsize(cls, **kwds): ...
class StaticHandler(GenericHandler):
setting_kwds: Any
@classmethod
def from_string(cls, hash, **context): ...
def to_string(self): ...
class HasEncodingContext(GenericHandler):
context_kwds: Any
default_encoding: str
encoding: Any
def __init__(self, encoding: Any | None = ..., **kwds) -> None: ...
class HasUserContext(GenericHandler):
context_kwds: Any
user: Any
def __init__(self, user: Any | None = ..., **kwds) -> None: ...
@classmethod
def hash(cls, secret, user: Any | None = ..., **context): ...
@classmethod
def verify(cls, secret, hash, user: Any | None = ..., **context): ...
@classmethod
def genhash(cls, secret, config, user: Any | None = ..., **context): ...
class HasRawChecksum(GenericHandler): ...
class HasManyIdents(GenericHandler):
default_ident: Any
ident_values: Any
ident_aliases: Any
ident: Any
@classmethod
def using(cls, default_ident: Any | None = ..., ident: Any | None = ..., **kwds): ... # type: ignore[override]
def __init__(self, ident: Any | None = ..., **kwds) -> None: ...
@classmethod
def identify(cls, hash): ...
class HasSalt(GenericHandler):
min_salt_size: int
max_salt_size: Any
salt_chars: Any
default_salt_size: ClassVar[int | None]
default_salt_chars: ClassVar[int | None]
salt: Any
@classmethod
def using(cls, default_salt_size: Any | None = ..., salt_size: Any | None = ..., salt: Any | None = ..., **kwds): ... # type: ignore[override]
def __init__(self, salt: Any | None = ..., **kwds) -> None: ...
@classmethod
def bitsize(cls, salt_size: Any | None = ..., **kwds): ...
class HasRawSalt(HasSalt):
salt_chars: Any
class HasRounds(GenericHandler):
min_rounds: int
max_rounds: Any
rounds_cost: str
using_rounds_kwds: Any
min_desired_rounds: Any
max_desired_rounds: Any
default_rounds: Any
vary_rounds: Any
rounds: Any
@classmethod
def using( # type: ignore[override]
cls,
min_desired_rounds: Any | None = ...,
max_desired_rounds: Any | None = ...,
default_rounds: Any | None = ...,
vary_rounds: Any | None = ...,
min_rounds: Any | None = ...,
max_rounds: Any | None = ...,
rounds: Any | None = ...,
**kwds,
): ...
def __init__(self, rounds: Any | None = ..., **kwds) -> None: ...
@classmethod
def bitsize(cls, rounds: Any | None = ..., vary_rounds: float = ..., **kwds): ...
class ParallelismMixin(GenericHandler):
parallelism: int
@classmethod
def using(cls, parallelism: Any | None = ..., **kwds): ... # type: ignore[override]
def __init__(self, parallelism: Any | None = ..., **kwds) -> None: ...
class BackendMixin(PasswordHash, metaclass=abc.ABCMeta):
backends: Any
@classmethod
def get_backend(cls): ...
@classmethod
def has_backend(cls, name: str = ...): ...
@classmethod
def set_backend(cls, name: str = ..., dryrun: bool = ...): ...
class SubclassBackendMixin(BackendMixin, metaclass=abc.ABCMeta): ...
class HasManyBackends(BackendMixin, GenericHandler): ... # type: ignore
class PrefixWrapper:
name: Any
prefix: Any
orig_prefix: Any
__doc__: Any
def __init__(
self, name, wrapped, prefix=..., orig_prefix=..., lazy: bool = ..., doc: Any | None = ..., ident: Any | None = ...
) -> None: ...
wrapped: Any
@property
def ident(self): ...
@property
def ident_values(self): ...
def __dir__(self): ...
def __getattr__(self, attr): ...
def __setattr__(self, attr, value): ...
def using(self, **kwds): ...
def needs_update(self, hash, **kwds): ...
def identify(self, hash): ...
def genconfig(self, **kwds): ...
def genhash(self, secret, config, **kwds): ...
def encrypt(self, secret, **kwds): ...
def hash(self, secret, **kwds): ...
def verify(self, secret, hash, **kwds): ...

View File

@@ -0,0 +1,3 @@
from typing import Any
md4: Any

View File

@@ -0,0 +1,7 @@
from typing import Any
from passlib.crypto.digest import norm_hash_name as norm_hash_name
def get_prf(name): ...
def pbkdf1(secret, salt, rounds, keylen: Any | None = ..., hash: str = ...): ...
def pbkdf2(secret, salt, rounds, keylen: Any | None = ..., prf: str = ...): ...

View File

@@ -0,0 +1,7 @@
from typing import Any
from passlib.hash import nthash as nthash
raw_nthash: Any
def raw_lmhash(secret, encoding: str = ..., hex: bool = ...): ...