[openpgp] Improve type annotations
This commit is contained in:
@@ -2,8 +2,11 @@ from typing import Any
|
||||
|
||||
from collections.abc import Iterator
|
||||
|
||||
from gpg.results import DecryptResult
|
||||
from gpg.results import EncryptResult
|
||||
from gpg.results import Key
|
||||
from gpg.results import SignResult
|
||||
from gpg.results import VerifyResult
|
||||
|
||||
class GpgmeWrapper(object): ...
|
||||
|
||||
@@ -24,7 +27,7 @@ class Context(GpgmeWrapper):
|
||||
def encrypt(
|
||||
self,
|
||||
plaintext: bytes,
|
||||
recipients: list[str] = [],
|
||||
recipients: list[Any] = [],
|
||||
sign: bool = ...,
|
||||
sink: Any | None = ...,
|
||||
passphrase: str | None = ...,
|
||||
@@ -41,7 +44,7 @@ class Context(GpgmeWrapper):
|
||||
passphrase: str | None = ...,
|
||||
verify: bool = ...,
|
||||
filter_signatures: bool = ...,
|
||||
) -> tuple[bytes, str, str]: ...
|
||||
) -> tuple[bytes, DecryptResult, VerifyResult]: ...
|
||||
def key_import(self, data: bytes) -> str: ...
|
||||
def key_export_minimal(self, pattern: Any | None = ...) -> bytes | None: ...
|
||||
def keylist(
|
||||
|
||||
@@ -6,10 +6,19 @@ class InvalidKey(Result): ...
|
||||
class EncryptResult(Result):
|
||||
invalid_recipients: list[Any]
|
||||
|
||||
class Recipient(Result): ...
|
||||
class Recipient(Result):
|
||||
keyid: str
|
||||
pubkey_algo: int
|
||||
status: int
|
||||
|
||||
class DecryptResult(Result):
|
||||
recipients: Recipient
|
||||
file_name: str | None
|
||||
is_de_vs: bool
|
||||
is_mime: int
|
||||
legacy_cipher_nomdc: int
|
||||
recipients: list[Recipient]
|
||||
symkey_algo: str
|
||||
wrong_key_usage: bool
|
||||
|
||||
class NewSignature(Result): ...
|
||||
|
||||
@@ -21,10 +30,25 @@ class Notation(Result): ...
|
||||
|
||||
class Signature(Result):
|
||||
_type = dict(wrong_key_usage=bool, chain_model=bool, is_de_vs=bool)
|
||||
notations: Notation
|
||||
notations: list[Notation]
|
||||
chain_model: bool
|
||||
exp_timestamp: int
|
||||
fpr: str
|
||||
hash_algo: int
|
||||
is_de_vs: bool
|
||||
pka_trust: int
|
||||
pubkey_algo: int
|
||||
status: int
|
||||
summary: int
|
||||
timestamp: int
|
||||
validity: int
|
||||
validity_reason: int
|
||||
wrong_key_usage: bool
|
||||
|
||||
class VerifyResult(Result):
|
||||
signatures: Signature
|
||||
file_name: str | None
|
||||
is_mime: int
|
||||
signatures: list[Signature]
|
||||
|
||||
class ImportStatus(Result): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user