diff --git a/src/netius/auth/address.pyi b/src/netius/auth/address.pyi new file mode 100644 index 00000000..047d7924 --- /dev/null +++ b/src/netius/auth/address.pyi @@ -0,0 +1,8 @@ +from typing import Sequence + +from netius import Auth + +class AddressAuth(Auth): + def __init__(self, allowed: Sequence[str] = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, allowed: Sequence[str] = ..., *args, **kwargs) -> bool: ... diff --git a/src/netius/auth/allow.pyi b/src/netius/auth/allow.pyi new file mode 100644 index 00000000..83f67b0a --- /dev/null +++ b/src/netius/auth/allow.pyi @@ -0,0 +1,4 @@ +from netius import Auth + +class AllowAuth(Auth): + pass diff --git a/src/netius/auth/base.pyi b/src/netius/auth/base.pyi index 450c6131..32dbaf60 100644 --- a/src/netius/auth/base.pyi +++ b/src/netius/auth/base.pyi @@ -1,13 +1,27 @@ -from typing import Literal +from typing import Any, Literal, NoReturn, PathLike -HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"] +HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"] -class Auth(object): +class Auth: + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def auth(cls, *args, **kwargs) -> bool: ... + @classmethod + def meta(cls, *args, **kwargs) -> dict[str, Any]: ... + @classmethod + def auth_assert(cls, *args, **kwargs) -> NoReturn: ... @classmethod def verify(cls, encoded: str, decoded: str) -> bool: ... - @classmethod def generate(cls, password: str, type: HashType = ..., salt: str = ...) -> str: ... - @classmethod - def unpack(cls, password: str) -> tuple[HashType, str, str, str]: ... + def unpack(cls, password) -> tuple[HashType, str | None, str, str | None]: ... + @classmethod + def get_file( + cls, path: PathLike[str], cache: bool = ..., encoding: str | None = ... + ) -> str | bytes: ... + @classmethod + def is_simple(cls) -> bool: ... + def auth_i(self, *args, **kwargs) -> bool: ... + def auth_assert_i(self, *args, **kwargs) -> NoReturn: ... + def is_simple_i(self) -> bool: ... diff --git a/src/netius/auth/deny.pyi b/src/netius/auth/deny.pyi new file mode 100644 index 00000000..5670d4e5 --- /dev/null +++ b/src/netius/auth/deny.pyi @@ -0,0 +1,4 @@ +from netius import Auth + +class DenyAuth(Auth): + pass diff --git a/src/netius/auth/dummy.pyi b/src/netius/auth/dummy.pyi new file mode 100644 index 00000000..3122d000 --- /dev/null +++ b/src/netius/auth/dummy.pyi @@ -0,0 +1,6 @@ +from netius import Auth + +class DummyAuth(Auth): + def __init__(self, value: bool = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, value: bool = ..., *args, **kwargs) -> bool: ... diff --git a/src/netius/auth/memory.pyi b/src/netius/auth/memory.pyi new file mode 100644 index 00000000..29efe893 --- /dev/null +++ b/src/netius/auth/memory.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from netius import Auth + +class MemoryAuth(Auth): + def __init__( + self, registry: dict[str, Any] | None = ..., *args, **kwargs + ) -> None: ... + @classmethod + def auth( + cls, + username: str, + password: str, + registry: dict[str, Any] | None = ..., + *args, + **kwargs + ) -> bool: ... + @classmethod + def meta( + cls, username: str, registry: dict[str, Any] | None = ..., *args, **kwargs + ) -> dict[str, Any]: ... + @classmethod + def get_registry(cls) -> dict[str, Any]: ... + @classmethod + def load_registry(cls) -> dict[str, Any]: ... diff --git a/src/netius/auth/passwd.pyi b/src/netius/auth/passwd.pyi new file mode 100644 index 00000000..d93b898d --- /dev/null +++ b/src/netius/auth/passwd.pyi @@ -0,0 +1,13 @@ +from typing import PathLike + +from netius import Auth + +class PasswdAuth(Auth): + def __init__(self, path: PathLike[str] | None = ..., *args, **kwargs) -> None: ... + @classmethod + def auth( + cls, username: str, password: str, path: str = ..., *args, **kwargs + ) -> bool: ... + @classmethod + def get_passwd(cls, path: PathLike[str], cache: bool = ...) -> dict[str, str]: ... + def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ... diff --git a/src/netius/auth/simple.pyi b/src/netius/auth/simple.pyi new file mode 100644 index 00000000..08e07c08 --- /dev/null +++ b/src/netius/auth/simple.pyi @@ -0,0 +1,18 @@ +from typing import Sequence + +from netius import Auth + +class SimpleAuth(Auth): + def __init__( + self, username: str | None = ..., password: str | None = ..., *args, **kwargs + ) -> None: ... + @classmethod + def auth( + cls, + username: str, + password: str, + target: Sequence[str, str] | None = ..., + *args, + **kwargs + ) -> bool: ... + def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ...