Files
gajim-plugins/typings/gnupg/__init__.pyi
2026-01-02 21:44:08 +01:00

305 lines
9.7 KiB
Python

from typing import Any
from typing import TypedDict
import logging
import re
from typing_extensions import NotRequired
__version__: str = ...
__author__: str = ...
__date__: str = ...
from typing import Protocol
string_types: type[str] = ...
text_type: type[str] = ...
path_types: tuple[type[str]] = ...
log_everything: bool = ...
logger: logging.Logger = ...
fsencoding: str = ...
UNSAFE: re.Pattern[Any] = ...
def shell_quote(s: str) -> str: ...
def no_quote(s: str) -> str: ...
class _ReadableFile(Protocol):
def read(self, size: int) -> bytes: ...
class StatusHandler:
on_data_failure: Exception | None = ...
def __init__(self, gpg: GPG) -> None: ...
def handle_status(self, key: str, value: str) -> None: ...
class Verify(StatusHandler):
TRUST_EXPIRED: int = ...
TRUST_UNDEFINED: int = ...
TRUST_NEVER: int = ...
TRUST_MARGINAL: int = ...
TRUST_FULLY: int = ...
TRUST_ULTIMATE: int = ...
TRUST_LEVELS: dict[str, int] = ...
GPG_SYSTEM_ERROR_CODES: dict[int, str] = ...
GPG_ERROR_CODES: dict[int, str] = ...
returncode: int | None = ...
valid: bool
fingerprint: str | None
creation_date: str | None
timestamp: str | None
signature_id: str | None
username: str | None
key_id: str | None
key_status: str | None
status: str | None
pubkey_fingerprint: str | None
expire_timestamp: str | None
sig_timestamp: str | None
trust_text: str | None
trust_level: int | None
sig_info: dict[str, dict[str, str]]
problems: list[dict[str, str]]
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def handle_status(self, key: str, value: str) -> None: ...
class ImportResultDict(TypedDict):
fingerprint: str | None
problem: NotRequired[str]
ok: NotRequired[str]
text: str
class ImportResult(StatusHandler):
counts: list[str] = ...
returncode: int | None = ...
results: list[ImportResultDict]
fingerprints: list[str]
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
ok_reason: dict[str, str] = ...
problem_reason: dict[str, str] = ...
def handle_status(self, key: str, value: str) -> None: ...
def summary(self) -> str: ...
ESCAPE_PATTERN: re.Pattern[Any] = ...
BASIC_ESCAPES: dict[str, str] = ...
class SendResult(StatusHandler):
returncode: int | None = ...
def handle_status(self, key: str, value: str) -> None: ...
class SearchKeys(StatusHandler, list[dict[Any, Any]]):
UID_INDEX: int = ...
FIELDS: list[str] = ...
returncode: int | None = ...
def __init__(self, gpg: GPG) -> None: ...
def get_fields(self, args: Any) -> dict[str, Any]: ...
def pub(self, args: Any) -> None: ...
def uid(self, args: Any) -> None: ...
def handle_status(self, key: str, value: str) -> None: ...
class ListKeys(SearchKeys):
UID_INDEX: int = ...
FIELDS: list[str] = ...
fingerprints: list[str] = ...
def __init__(self, gpg: GPG) -> None: ...
def key(self, args: Any) -> None: ...
sec: Any = ...
def fpr(self, args: Any) -> None: ...
def grp(self, args: Any) -> None: ...
def sub(self, args: Any) -> None: ...
def ssb(self, args: Any) -> None: ...
def sig(self, args: Any) -> None: ...
class ScanKeys(ListKeys):
def sub(self, args: Any) -> None: ...
class TextHandler: ...
class Crypt(Verify, TextHandler):
data: bytes
ok: bool
status_detail: str
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def handle_status(self, key: str, value: str) -> None: ...
class GenKey(StatusHandler):
returncode: int | None = ...
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def handle_status(self, key: str, value: str) -> None: ...
class AddSubkey(StatusHandler):
returncode: int | None = ...
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def handle_status(self, key: str, value: str) -> None: ...
class ExportResult(GenKey):
def handle_status(self, key: str, value: str) -> None: ...
class DeleteResult(StatusHandler):
returncode: int | None = ...
def __init__(self, gpg: GPG) -> None: ...
problem_reason: dict[str, str] = ...
def handle_status(self, key: str, value: str) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
class TrustResult(DeleteResult): ...
class Sign(StatusHandler, TextHandler):
returncode: int | None = ...
status: str = ...
def __init__(self, gpg: GPG) -> None: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
def handle_status(self, key: str, value: str) -> None: ...
class AutoLocateKey(StatusHandler):
def __init__(self, gpg: GPG) -> None: ...
def handle_status(self, key: str, value: str) -> None: ...
def pub(self, args: Any) -> None: ...
def uid(self, args: Any) -> None: ...
def sub(self, args: Any) -> None: ...
def fpr(self, args: Any) -> None: ...
VERSION_RE: re.Pattern[Any] = ...
HEX_DIGITS_RE: re.Pattern[Any] = ...
PUBLIC_KEY_RE: re.Pattern[Any] = ...
class GPG:
error_map: None = ...
decode_errors: str = ...
buffer_size: int = ...
result_map: dict[str, Any] = ...
def __init__(
self,
gpgbinary: str = ...,
gnupghome: str | None = ...,
verbose: bool = ...,
use_agent: bool = ...,
keyring: str | list[str] | None = ...,
options: list[str] | None = ...,
secret_keyring: str | list[str] | None = ...,
env: dict[str, str] | None = ...,
) -> None: ...
def make_args(self, args: list[str], passphrase: str) -> list[str]: ...
def is_valid_file(self, fileobj: Any) -> bool: ...
def sign(self, message: str | bytes, **kwargs: Any) -> Sign: ...
def set_output_without_confirmation(self, args: list[str], output: str) -> None: ...
def is_valid_passphrase(self, passphrase: str) -> bool: ...
def sign_file(
self,
fileobj_or_path: str | _ReadableFile,
keyid: str | None = ...,
passphrase: str | None = ...,
clearsign: bool = ...,
detach: bool = ...,
binary: bool = ...,
output: str | None = ...,
extra_args: list[str] | None = ...,
) -> Sign: ...
def verify(self, data: str | bytes, **kwargs: Any) -> Verify: ...
def verify_file(
self,
fileobj_or_path: str | _ReadableFile,
data_filename: str | None = ...,
close_file: bool = ...,
extra_args: list[str] | None = ...,
) -> Verify: ...
def verify_data(
self, sig_filename: str, data: str | bytes, extra_args: list[str] | None = ...
) -> Verify: ...
def import_keys(
self,
key_data: str | bytes,
extra_args: list[str] | None = ...,
passphrase: str | None = ...,
) -> ImportResult: ...
def import_keys_file(self, key_path: str, **kwargs: Any) -> ImportResult: ...
def recv_keys(
self, keyserver: str, *keyids: str, **kwargs: Any
) -> ImportResult: ...
def send_keys(self, keyserver: str, *keyids: str, **kwargs: Any) -> SendResult: ...
def delete_keys(
self,
fingerprints: str | list[str],
secret: bool = ...,
passphrase: str | None = ...,
expect_passphrase: bool = ...,
exclamation_mode: bool = ...,
) -> DeleteResult: ...
def export_keys(
self,
keyids: str | list[str],
secret: bool = ...,
armor: bool = ...,
minimal: bool = ...,
passphrase: str | None = ...,
expect_passphrase: bool = ...,
output: str | None = ...,
) -> str | bytes | None: ...
def list_keys(
self, secret: bool = ..., keys: str | list[str] | None = ..., sigs: bool = ...
) -> ListKeys: ...
def scan_keys(self, filename: str) -> ScanKeys: ...
def scan_keys_mem(self, key_data: str | bytes) -> ScanKeys: ...
def search_keys(
self, query: str, keyserver: str = ..., extra_args: list[str] | None = ...
) -> SearchKeys: ...
def auto_locate_key(
self, email: str, mechanisms: list[str] | None = ..., **kwargs: Any
) -> AutoLocateKey: ...
def gen_key(self, input: str) -> GenKey: ...
def gen_key_input(self, **kwargs: Any) -> str: ...
def add_subkey(
self,
master_key: str,
master_passphrase: str | None = ...,
algorithm: str = ...,
usage: str = ...,
expire: str = ...,
) -> AddSubkey: ...
def encrypt_file(
self,
fileobj_or_path: str | _ReadableFile,
recipients: str | list[str],
sign: str | None = ...,
always_trust: bool = ...,
passphrase: str | None = ...,
armor: bool = ...,
output: str | None = ...,
symmetric: bool = ...,
extra_args: list[str] | None = ...,
) -> Crypt: ...
def encrypt(
self, data: str | bytes, recipients: str | list[str], **kwargs: Any
) -> Crypt: ...
def decrypt(self, message: str | bytes, **kwargs: Any) -> Crypt: ...
def decrypt_file(
self,
fileobj_or_path: str | _ReadableFile,
always_trust: bool = ...,
passphrase: str | None = ...,
output: str | None = ...,
extra_args: list[str] | None = ...,
) -> Crypt: ...
def get_recipients(self, message: str | bytes, **kwargs: Any) -> list[str]: ...
def get_recipients_file(
self, fileobj_or_path: str | _ReadableFile, extra_args: list[str] | None = ...
) -> list[str]: ...
def trust_keys(
self, fingerprints: str | list[str], trustlevel: str
) -> TrustResult: ...