latest.ipv8.attestation.identity.metadata
Module Contents
Classes
A JSON dictionary and a pointer to a Token. |
- class latest.ipv8.attestation.identity.metadata.Metadata(token_pointer: bytes, serialized_json_dict: bytes, private_key: latest.ipv8.types.PrivateKey | None = None, signature: bytes | None = None)
Bases:
latest.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).
- classmethod unserialize(data: bytes, public_key: latest.ipv8.keyvault.keys.PublicKey, offset: int = 0) Metadata
Unserialize metadata from the given bytes.
- classmethod create(token: latest.ipv8.types.Token, json_dict: dict, private_key: latest.ipv8.types.PrivateKey) Metadata
Create new metadata for a token from a JSON dict, signed using our key.
- 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.
- classmethod from_database_tuple(token_pointer: bytes, signature: bytes, serialized_json_dict: bytes) Metadata
Create a Token from a three-byte-string representation (token hash, signature and json dictionary).
- Parameters:
token_pointer – the hash of the Token.
signature – the signature over the plaintext Metadata.
serialized_json_dict – the serialized json dictionary of this Metadata.