latest.ipv8.attestation.identity.database

Module Contents

Classes

Credential

Cache for Metadata <- [Attestation] mappings.

IdentityDatabase

Database to store identity layer data.

Functions

to_list(→ list)

If no results are found in the database, the cursor will return None.

class latest.ipv8.attestation.identity.database.Credential(metadata: latest.ipv8.attestation.identity.metadata.Metadata, attestations: Set[latest.ipv8.attestation.identity.attestation.Attestation])

Cache for Metadata <- [Attestation] mappings.

latest.ipv8.attestation.identity.database.to_list(obj: Any | None) list

If no results are found in the database, the cursor will return None. This function always returns a list.

class latest.ipv8.attestation.identity.database.IdentityDatabase(file_path: str)

Bases: latest.ipv8.database.Database

Database to store identity layer data.

This database stores: meta information of different pseudonyms, both ours and those of others. This database does not store: commitments and schemes for proving knowledge of data.

LATEST_DB_VERSION = 1
insert_token(public_key: latest.ipv8.types.PublicKey, token: latest.ipv8.attestation.tokentree.token.Token) None

Inject a Token belonging to a certain public key into this database.

insert_metadata(public_key: latest.ipv8.types.PublicKey, metadata: latest.ipv8.attestation.identity.metadata.Metadata) None

Inject Metadata belonging to a certain public key into this database.

insert_attestation(public_key: latest.ipv8.types.PublicKey, authority_key: latest.ipv8.types.PublicKey, attestation: latest.ipv8.attestation.identity.attestation.Attestation) None

Inject an Attestation made by some authority for a certain public key into this database.

get_tokens_for(public_key: latest.ipv8.types.PublicKey) Set[latest.ipv8.attestation.tokentree.token.Token]

Get all tokens in the tree of a certain public key.

get_metadata_for(public_key: latest.ipv8.types.PublicKey) Set[latest.ipv8.attestation.identity.metadata.Metadata]

Get all known metadata for a certain public key.

get_attestations_for(public_key: latest.ipv8.types.PublicKey) Set[latest.ipv8.attestation.identity.attestation.Attestation]

Get all known attestations (made by others) for a certain public key.

get_attestations_by(public_key: latest.ipv8.types.PublicKey) Set[latest.ipv8.attestation.identity.attestation.Attestation]

Get all attestations made by a certain public key (for others).

This is the signing authority.

get_attestations_over(metadata: latest.ipv8.attestation.identity.metadata.Metadata) Set[latest.ipv8.attestation.identity.attestation.Attestation]

Get all known attestations for given metadata.

get_authority(attestation: latest.ipv8.attestation.identity.attestation.Attestation) bytes

Retrieve the authority that created a certain attestation.

get_credential_over(metadata: latest.ipv8.attestation.identity.metadata.Metadata) Credential

Collect all attestations for the given metadata, forming a credential.

get_credentials_for(public_key: latest.ipv8.types.PublicKey) list[Credential]

Get all credentials for a given public key.

get_known_identities() list[bytes]

List the public keys of all known identity owners.

get_schema(version: int) str

Return the schema for the database.

check_database(database_version: bytes) int

Check if we need to upgrade.