From 3830188cff1a15e741cbe02cd6ca4c4a8ec167ef Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Sun, 28 Mar 2021 11:29:54 -0700 Subject: [PATCH] py-bindings: add SecretKeyFactory to docs and .pyi --- umbral-pre-python/docs/index.rst | 13 ++++++++++++- umbral-pre-python/umbral_pre/__init__.pyi | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/umbral-pre-python/docs/index.rst b/umbral-pre-python/docs/index.rst index c0ba1d6c..acb94f43 100644 --- a/umbral-pre-python/docs/index.rst +++ b/umbral-pre-python/docs/index.rst @@ -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. @@ -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. diff --git a/umbral-pre-python/umbral_pre/__init__.pyi b/umbral-pre-python/umbral_pre/__init__.pyi index 62a2d5ce..927c02bd 100644 --- a/umbral-pre-python/umbral_pre/__init__.pyi +++ b/umbral-pre-python/umbral_pre/__init__.pyi @@ -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: