Skip to content

Commit

Permalink
Fix Type Annotations and Improve Stub Structure for pyrage-stubs (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchemyst0x authored Oct 1, 2024
1 parent cd023bc commit 125b12b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 22 deletions.
22 changes: 0 additions & 22 deletions pyrage-stubs/pyrage-stubs/__init__.pyi

This file was deleted.

42 changes: 42 additions & 0 deletions pyrage-stubs/pyrage/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from io import BufferedIOBase
from typing import Sequence, Union

from pyrage import passphrase, plugin, ssh, x25519
from pyrage.plugin import IdentityPluginV1, RecipientPluginV1
from pyrage.ssh import Identity as SSHIdentity
from pyrage.ssh import Recipient as SSHRecipient
from pyrage.x25519 import Identity as X25519Identity
from pyrage.x25519 import Recipient as X25519Recipient

_Identity = Union[SSHIdentity, X25519Identity, IdentityPluginV1]
_Recipient = Union[SSHRecipient, X25519Recipient, RecipientPluginV1]

__all__ = (
"ssh",
"x25519",
"passphrase",
"plugin",
"encrypt",
"encrypt_file",
"encrypt_io",
"decrypt",
"decrypt_file",
"decrypt_io",
"RecipientError",
"IdentityError",
)


class RecipientError(Exception):
...

class IdentityError(Exception):
...


def encrypt(plaintext: bytes, recipients: Sequence[_Recipient]) -> bytes: ...
def encrypt_file(infile: str, outfile: str, recipients: Sequence[_Recipient]) -> None: ...
def encrypt_io(in_io: BufferedIOBase, out_io: BufferedIOBase, recipients: Sequence[_Recipient]) -> bytes: ...
def decrypt(ciphertext: bytes, identities: Sequence[_Identity]) -> bytes: ...
def decrypt_file(infile: str, outfile: str, identities: Sequence[_Identity]) -> None: ...
def decrypt_io(in_io: BufferedIOBase, out_io: BufferedIOBase, recipient: Sequence[_Identity]) -> None: ...
File renamed without changes.
File renamed without changes.
Empty file added pyrage-stubs/pyrage/py.typed
Empty file.
File renamed without changes.
File renamed without changes.

0 comments on commit 125b12b

Please sign in to comment.