3.0.ipv8.attestation.identity.metadata ====================================== .. py:module:: 3.0.ipv8.attestation.identity.metadata Classes ------- .. autoapisummary:: 3.0.ipv8.attestation.identity.metadata.Metadata Module Contents --------------- .. py:class:: Metadata(token_pointer: bytes, serialized_json_dict: bytes, private_key: 3.0.ipv8.types.PrivateKey | None = None, signature: bytes | None = None) Bases: :py:obj:`3.0.ipv8.attestation.signed_object.AbstractSignedObject` A JSON dictionary and a pointer to a Token. Metadata does not and should not contain an index. Metadata does not and should not contain a reference to the public key (but is signed by one). .. py:attribute:: token_pointer .. py:attribute:: serialized_json_dict .. py:method:: get_plaintext() -> bytes Serialized Metadata consists of a token pointer and serialized JSON. .. py:method:: unserialize(data: bytes, public_key: 3.0.ipv8.keyvault.keys.PublicKey, offset: int = 0) -> Metadata :classmethod: Unserialize metadata from the given bytes. .. py:method:: create(token: 3.0.ipv8.types.Token, json_dict: dict, private_key: 3.0.ipv8.types.PrivateKey) -> Metadata :classmethod: Create new metadata for a token from a JSON dict, signed using our key. .. py:method:: to_database_tuple() -> tuple[bytes, bytes, bytes] Get a representation of this Metadata as three byte strings (token hash, signature and json dictionary). :returns: the three byte strings for database insertion. .. py:method:: from_database_tuple(token_pointer: bytes, signature: bytes, serialized_json_dict: bytes) -> Metadata :classmethod: Create a Token from a three-byte-string representation (token hash, signature and json dictionary). :param token_pointer: the hash of the Token. :param signature: the signature over the plaintext Metadata. :param serialized_json_dict: the serialized json dictionary of this Metadata. .. py:method:: __str__() -> str Convert this Metadata to human-readable format.