latest.ipv8.attestation.identity.community

Module Contents

Classes

IdentitySettings

Settings for the Identity community.

IdentityCommunity

Community for business logic surrounding identities.

Functions

create_community(→ IdentityCommunity)

Create an anonymized runtime overlay to meet other peers for identity business logic.

Attributes

SAFE_UDP_PACKET_LENGTH

latest.ipv8.attestation.identity.community.SAFE_UDP_PACKET_LENGTH = 1296
class latest.ipv8.attestation.identity.community.IdentitySettings

Bases: latest.ipv8.community.CommunitySettings

Settings for the Identity community.

identity_manager: latest.ipv8.attestation.identity.manager.IdentityManager | None
working_directory: str = '.'
class latest.ipv8.attestation.identity.community.IdentityCommunity(settings: IdentitySettings)

Bases: latest.ipv8.community.Community

Community for business logic surrounding identities.

Actual identity information goes through the wallet.

community_id
settings_class
pad_hash(attribute_hash: bytes) bytes

Pad an old-style SHA-1 hash into the new 32 byte SHA3-256 space.

add_known_hash(attribute_hash: bytes, name: str, public_key: bytes, metadata: dict[str, str] | None = None) None

We know about this hash+peer combination. Thus we can handle sign requests for it.

get_attestation_by_hash(attribute_hash: bytes) latest.ipv8.types.Metadata | None

Get the Metadata object for a particular attribute hash, if it exists.

should_sign(pseudonym: latest.ipv8.types.PseudonymManager, metadata: latest.ipv8.types.Metadata) bool

Has the user asked us to sign for some metadata and is it still valid?

_fit_disclosure(disclosure: tuple[bytes, bytes, bytes, bytes]) tuple[bytes, bytes, bytes, bytes]

Fit a disclosure (metadata, tokens, attestations and authorities) to a UDP packet.

This comes down to stripping tokens until the serialization fits in a UDP packet, as tokens can be shown to be missing from a disclosure and will be retrieved on demand

_received_disclosure_for_attest(peer: latest.ipv8.peer.Peer, disclosure: tuple[bytes, bytes, bytes, bytes]) None

Attempt to insert a disclosure into our database and request more if we are still missing tokens.

request_attestation_advertisement(peer: latest.ipv8.peer.Peer, attribute_hash: bytes, name: str, block_type: str = 'id_metadata', metadata: dict | None = None) None

Request a peer to sign for our attestation advertisement.

Parameters:
  • peer – the attestor of our block

  • attribute_hash – the hash of the attestation

  • name – the name of the attribute (metadata)

  • block_type – the type of block (from identity_foromats.py)

  • metadata – custom additional metadata

self_advertise(attribute_hash: bytes, name: str, block_type: str = 'id_metadata', metadata: dict | None = None) latest.ipv8.types.Credential | None

Self-sign an attribute.

Parameters:
  • attribute_hash – the hash of the attestation

  • name – the name of the attribute (metadata)

  • block_type – the type of block (from identity_formats.py)

  • metadata – custom additional metadata

on_disclosure(peer: latest.ipv8.peer.Peer, disclosure: latest.ipv8.attestation.identity.payload.DiclosePayload) None

Someone disclosed their attributes to us. Attempt to insert them into our database and check if we are still missing some.

on_attest(peer: latest.ipv8.peer.Peer, payload: latest.ipv8.attestation.identity.payload.AttestPayload) None

Someone made an attestation for us, try to insert it into our database.

on_request_missing(peer: latest.ipv8.peer.Peer, request: latest.ipv8.attestation.identity.payload.RequestMissingPayload) None

Someone requested tokens from us. If they are permitted to see them, send them over.

Note that tokens do not have indices publicly, so instead of sending missing tokens one at a time, we send a range, starting from the lowest index that is missing.

on_missing_response(peer: latest.ipv8.peer.Peer, response: latest.ipv8.attestation.identity.payload.MissingResponsePayload) None

We received tokens, attempt to insert them into our database and check if we are still missing some.

async latest.ipv8.attestation.identity.community.create_community(private_key: latest.ipv8.keyvault.keys.PrivateKey, ipv8: latest.ipv8.types.IPv8, identity_manager: latest.ipv8.attestation.identity.manager.IdentityManager, endpoint: latest.ipv8.types.Endpoint | None = None, working_directory: str | None = None, anonymize: bool = True, rendezvous_token: bytes | None = None) IdentityCommunity

Create an anonymized runtime overlay to meet other peers for identity business logic.