Skip to content

Commit

Permalink
Add __bytes__, from_bytes() and __hash__() to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Apr 13, 2021
1 parent 21f91b7 commit 75e6a76
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions umbral-pre-python/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ API reference
Generates a new :py:class:`SecretKey` using ``label`` as a seed.

.. py:method:: __bytes__() -> bytes
Serializes the object into a bytestring.

.. py:staticmethod:: from_bytes(data: bytes) -> SecretKey
Restores the object from a bytestring.

.. py:class:: PublicKey
An ``umbral-pre`` public key object.
Expand All @@ -46,10 +54,34 @@ API reference
Creates a public key corresponding to the given secret key.

.. py:method:: __bytes__() -> bytes
Serializes the object into a bytestring.

.. py:staticmethod:: from_bytes(data: bytes) -> PublicKey
Restores the object from a bytestring.

.. py:method:: __hash__() -> int
Returns a hash of self.

.. py:class:: Capsule
An encapsulated symmetric key.

.. py:method:: __bytes__() -> bytes
Serializes the object into a bytestring.

.. py:staticmethod:: from_bytes(data: bytes) -> Capsule
Restores the object from a bytestring.

.. py:method:: __hash__() -> int
Returns a hash of self.

.. 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 Expand Up @@ -81,6 +113,18 @@ API reference
Verifies the integrity of the fragment using the signing key and, optionally, the delegating and the receiving keys (if they were included in the signature in :py:func:`generate_kfrags`).

.. py:method:: __bytes__() -> bytes
Serializes the object into a bytestring.

.. py:staticmethod:: from_bytes(data: bytes) -> KeyFrag
Restores the object from a bytestring.

.. py:method:: __hash__() -> int
Returns a hash of self.

.. py:class:: CapsuleFrag
A reencrypted fragment of an encapsulated symmetric key.
Expand All @@ -89,6 +133,18 @@ API reference
Verifies the integrity of the fragment.

.. py:method:: __bytes__() -> bytes
Serializes the object into a bytestring.

.. py:staticmethod:: from_bytes(data: bytes) -> CapsuleFrag
Restores the object from a bytestring.

.. py:method:: __hash__() -> int
Returns a hash of self.


Indices and tables
==================
Expand Down

0 comments on commit 75e6a76

Please sign in to comment.