from collections.abc import Sequence
from datetime import datetime, timedelta
from os import PathLike
from pysequoia.packet import HashAlgorithm, Packet, PublicKeyAlgorithm, SignatureType
from typing import Any, Final, final

@final
class ArmorKind:
    Message: Final[ArmorKind]
    PublicKey: Final[ArmorKind]
    SecretKey: Final[ArmorKind]
    Signature: Final[ArmorKind]
    def __eq__(self, /, other: ArmorKind) -> bool: ...
    def __int__(self, /) -> int: ...
    def __ne__(self, /, other: ArmorKind) -> bool: ...
    def __repr__(self, /) -> str: ...

@final
class Cert:
    def __bytes__(self, /) -> bytes: ...
    def __repr__(self, /) -> str: ...
    def __str__(self, /) -> str: ...
    def add_user_id(self, /, value: str, certifier: PySigner) -> Cert: ...
    @property
    def expiration(self, /) -> datetime |None: ...
    @property
    def fingerprint(self, /) -> str: ...
    @staticmethod
    def from_bytes(bytes: bytes) -> Cert: ...
    @staticmethod
    def from_file(path: str) -> Cert: ...
    @staticmethod
    def from_packets(packets: Sequence[Packet]) -> Cert: ...
    @staticmethod
    def generate(user_id: str |None = None, user_ids: Sequence[str] |None = None, profile: Profile |None = None, validity_seconds: int |None = ...) -> Cert: ...
    @property
    def has_secret_keys(self, /) -> bool: ...
    @property
    def is_revoked(self, /) -> bool: ...
    def merge(self, /, new_cert: Cert) -> Cert: ...
    def revoke(self, /, certifier: PySigner) -> Sig: ...
    def revoke_user_id(self, /, user_id: UserId, certifier: PySigner) -> Sig: ...
    @property
    def secrets(self, /) -> Tsk |None: ...
    def set_expiration(self, /, expiration: datetime, certifier: PySigner) -> Cert: ...
    def set_notations(self, /, certifier: PySigner, notations: Sequence[Notation]) -> Cert: ...
    @staticmethod
    def split_bytes(bytes: bytes) -> list[Cert]: ...
    @staticmethod
    def split_file(path: str) -> list[Cert]: ...
    @property
    def user_ids(self, /) -> list[UserId]: ...

@final
class Decrypted:
    @property
    def bytes(self, /) -> bytes |None: ...
    @property
    def valid_sigs(self, /) -> list[Any]: ...

@final
class Notation:
    def __new__(cls, /, key: str, value: str) -> Notation: ...
    def __repr__(self, /) -> str: ...
    def __str__(self, /) -> str: ...
    @property
    def key(self, /) -> str: ...
    @property
    def value(self, /) -> str: ...

@final
class Profile:
    RFC4880: Final[Profile]
    RFC9580: Final[Profile]
    def __eq__(self, /, other: Profile) -> bool: ...
    def __int__(self, /) -> int: ...
    def __ne__(self, /, other: Profile) -> bool: ...
    def __repr__(self, /) -> str: ...

@final
class PyDecryptor: ...

@final
class PySigner: ...

@final
class Sig:
    def __bytes__(self, /) -> bytes: ...
    def __repr__(self, /) -> str: ...
    def __str__(self, /) -> str: ...
    @property
    def created(self, /) -> datetime |None: ...
    @property
    def expiration(self, /) -> datetime |None: ...
    @staticmethod
    def from_bytes(bytes: bytes) -> Sig: ...
    @staticmethod
    def from_file(path: str) -> Sig: ...
    @property
    def hash_algorithm(self, /) -> HashAlgorithm: ...
    @property
    def issuer_fingerprint(self, /) -> str |None: ...
    @property
    def issuer_fpr(self, /) -> str |None: ...
    @property
    def issuer_key_id(self, /) -> str |None: ...
    @property
    def key_algorithm(self, /) -> PublicKeyAlgorithm: ...
    @property
    def key_validity_period(self, /) -> timedelta |None: ...
    @property
    def signature_type(self, /) -> SignatureType: ...
    @property
    def signers_user_id(self, /) -> str |None: ...
    @property
    def version(self, /) -> int: ...

@final
class SignatureMode:
    CLEAR: Final[SignatureMode]
    DETACHED: Final[SignatureMode]
    INLINE: Final[SignatureMode]
    def __eq__(self, /, other: SignatureMode |int) -> bool: ...
    def __int__(self, /) -> int: ...
    def __ne__(self, /, other: SignatureMode |int) -> bool: ...
    def __repr__(self, /) -> str: ...

@final
class Tsk:
    def __bytes__(self, /) -> bytes: ...
    def __repr__(self, /) -> str: ...
    def __str__(self, /) -> str: ...
    def certifier(self, /, password: str |None = None) -> PySigner: ...
    def decryptor(self, /, password: str |None = None) -> PyDecryptor: ...
    def signer(self, /, password: str |None = None) -> PySigner: ...

@final
class UserId:
    def __repr__(self, /) -> str: ...
    def __str__(self, /) -> str: ...
    @property
    def notations(self, /) -> list[Notation]: ...

def armor(data: bytes, kind: ArmorKind) -> str: ...
def decrypt(bytes: bytes, decryptor: PyDecryptor |None = None, store: Any |None = None, passwords: Sequence[str] = ...) -> Decrypted: ...
def decrypt_file(input: str |PathLike, output: str |PathLike, decryptor: PyDecryptor |None = None, store: Any |None = None, passwords: Sequence[str] = ...) -> Decrypted: ...
def encrypt(bytes: bytes, recipients: Sequence[Cert] = ..., signer: PySigner |None = None, passwords: Sequence[str] = ..., *, armor: bool = True) -> bytes: ...
def encrypt_file(input: str |PathLike, output: str |PathLike, recipients: Sequence[Cert] = ..., signer: PySigner |None = None, passwords: Sequence[str] = ..., *, armor: bool = True) -> None: ...
def sign(signer: PySigner, bytes: bytes, *, mode: SignatureMode = ..., armor: bool = True) -> bytes: ...
def sign_file(signer: PySigner, input: str |PathLike, output: str |PathLike, *, mode: SignatureMode = ..., armor: bool = True) -> None: ...
def verify(bytes: bytes |None = None, store: Any |None = None, file: str |PathLike |None = None, signature: Sig |None = None) -> Decrypted: ...
