Skip to content

Commit

Permalink
py-bindings: add SecretKeyFactory to docs and .pyi
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Mar 28, 2021
1 parent ee40050 commit 3830188
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 12 additions & 1 deletion umbral-pre-python/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ API reference
Generates a new secret key.

.. py:class:: SecretKeyFactory
A deterministic generator of :py:class:`SecretKey` objects.

.. py:staticmethod:: random() -> SecretKeyFactory
Generates a new random factory.

.. py:method:: secret_key_by_label(label: bytes) -> SecretKey
Generates a new :py:class:`SecretKey` using ``label`` as a seed.

.. py:class:: PublicKey
An ``umbral-pre`` public key object.
Expand All @@ -38,7 +50,6 @@ API reference
An encapsulated symmetric key.


.. py:function:: encrypt(pk: PublicKey, plaintext: bytes) -> Tuple[Capsule, bytes]
Creates a symmetric key, encrypts ``plaintext`` with it, and returns the encapsulated symmetric key along with the ciphertext. ``pk`` is the public key of the recipient.
Expand Down
11 changes: 11 additions & 0 deletions umbral-pre-python/umbral_pre/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ class SecretKey:
def random() -> SecretKey:
...


class SecretKeyFactory:

@staticmethod
def random() -> SecretKeyFactory:
...

def secret_key_by_label(self, label: bytes) -> SecretKey:
...


class PublicKey:
@staticmethod
def from_secret_key(sk: SecretKey) -> PublicKey:
Expand Down

0 comments on commit 3830188

Please sign in to comment.