latest.ipv8.attestation.identity.manager

Module Contents

Classes

PseudonymManager

Object to manage interactions with our own pseudonym or one belonging to someone else.

IdentityManager

Manager of our own pseudonyms and those of others.

class latest.ipv8.attestation.identity.manager.PseudonymManager(database: latest.ipv8.attestation.identity.database.IdentityDatabase, public_key: latest.ipv8.types.PublicKey | None = None, private_key: latest.ipv8.keyvault.keys.PrivateKey | None = None)

Object to manage interactions with our own pseudonym or one belonging to someone else.

Never create one yourself, use IdentityManager.get_pseudonym() instead!

property public_key: latest.ipv8.types.PublicKey

Get our associated public key.

add_credential(token: latest.ipv8.types.Token, metadata: latest.ipv8.attestation.identity.metadata.Metadata, attestations: Set[tuple[latest.ipv8.types.PublicKey, latest.ipv8.attestation.identity.attestation.Attestation]] | None = None) latest.ipv8.attestation.identity.database.Credential | None

Add a credential to this pseudonym.

Returns:

the added credential on success, otherwise None

add_attestation(public_key: latest.ipv8.types.PublicKey, attestation: latest.ipv8.attestation.identity.attestation.Attestation) bool

Add an attestation to this pseudonym.

Returns:

True on success, otherwise False

add_metadata(metadata: latest.ipv8.attestation.identity.metadata.Metadata) bool

Add a metadata entry to this pseudonym.

Returns:

True on success, otherwise False

create_attestation(metadata: latest.ipv8.attestation.identity.metadata.Metadata, private_key: latest.ipv8.keyvault.keys.PrivateKey) latest.ipv8.attestation.identity.attestation.Attestation

Create an attestation for a a metadata entry of this pseudonym.

Attesting to your own attributes is allowed (but probably not of any added value).

create_credential(attestation_hash: bytes, metadata_json: dict, after: latest.ipv8.attestation.identity.metadata.Metadata | None = None) latest.ipv8.attestation.identity.database.Credential | None

Create a credential and add it to this pseudonym.

get_credential(metadata: latest.ipv8.attestation.identity.metadata.Metadata) latest.ipv8.attestation.identity.database.Credential

Return the credential belonging to given metadata.

get_credentials() list[latest.ipv8.attestation.identity.database.Credential]

Get all credentials belonging to this pseudonym.

disclose_credentials(credentials: Iterable[latest.ipv8.attestation.identity.database.Credential], attestation_selector: Set[bytes]) tuple[bytes, bytes, bytes, bytes]

Create a public disclosure for the given credentials and only include attestations from the given serialized public keys.

This method automatically minimizes the amount of shared tokens and metadata.

Another instance would receive and load these in using the IdentityManager’s substantiate() method.

Returns:

the serialized metadata, tokens, attestations and authorities.

create_disclosure(metadata: Set[latest.ipv8.attestation.identity.metadata.Metadata], attestation_selector: Set[bytes]) tuple[bytes, bytes, bytes, bytes]

Create a public disclosure for the given set of metadata and only include attestations from the given serialized public keys.

This method automatically minimizes the amount of shared tokens and metadata.

Another instance would receive and load these in using the IdentityManager’s substantiate() method.

Returns:

the serialized metadata, tokens, attestations and authorities.

class latest.ipv8.attestation.identity.manager.IdentityManager(database_path: str = ':memory:')

Manager of our own pseudonyms and those of others.

get_pseudonym(key: latest.ipv8.types.PublicKey | latest.ipv8.keyvault.keys.PrivateKey) PseudonymManager

Get the pseudonym belonging to a given public or private key.

substantiate(public_key: latest.ipv8.types.PublicKey, serialized_metadata: bytes, serialized_tokens: bytes, serialized_attestations: bytes, serialized_authorities: bytes) tuple[bool, PseudonymManager]

Load the serialized form of a pseudonym for a given public key.

Returns:

whether this pseudonym is valid, the newly loaded pseudonym itself