3.0.ipv8.attestation.signed_object ================================== .. py:module:: 3.0.ipv8.attestation.signed_object Attributes ---------- .. autoapisummary:: 3.0.ipv8.attestation.signed_object.T Classes ------- .. autoapisummary:: 3.0.ipv8.attestation.signed_object.AbstractSignedObject Module Contents --------------- .. py:data:: T .. py:class:: AbstractSignedObject(private_key: 3.0.ipv8.types.PrivateKey | None = None, signature: bytes | None = None) To reach immutability different objects will have to be signed to reach non-repudiation. Examples are Tokens, Metadata and Attestation objects. This class handles many of the commonly required interactions for this type of signed data. .. py:attribute:: _hash :value: b'' .. py:attribute:: crypto .. py:method:: get_hash() -> bytes Return the hash of this object itself. .. py:method:: verify(public_key: 3.0.ipv8.types.PublicKey) -> bool Verify if a public key belongs to this object. :returns: whether the given public key has signed for this object. .. py:method:: _sign(private_key: 3.0.ipv8.types.PrivateKey | None = None, signature: bytes | None = None) -> None Add a signature to this data. Supply either your private key for signing or pass an existing signature. :param private_key: the private key to sign with. :param signature: the signature to adapt. .. py:method:: get_plaintext() -> bytes :abstractmethod: Retrieve the content that needs to be signed, in serialized form (bytes). .. py:method:: get_plaintext_signed() -> bytes Concatenate the signature to the plaintext. .. py:method:: unserialize(data: bytes, public_key: 3.0.ipv8.types.PublicKey, offset: int = 0) -> T :classmethod: :abstractmethod: Read this signed object from its serialized form. .. py:method:: __hash__() -> int The hash of this signed object. .. py:method:: __eq__(other: object) -> bool Signed objects are equal if their signed plaintext is equal. .. py:method:: __ne__(other: object) -> bool Signed objects are not equal if their signed plaintext is not equal.