3.0.ipv8.attestation.identity.community ======================================= .. py:module:: 3.0.ipv8.attestation.identity.community Attributes ---------- .. autoapisummary:: 3.0.ipv8.attestation.identity.community.SAFE_UDP_PACKET_LENGTH Classes ------- .. autoapisummary:: 3.0.ipv8.attestation.identity.community.IdentitySettings 3.0.ipv8.attestation.identity.community.IdentityCommunity Functions --------- .. autoapisummary:: 3.0.ipv8.attestation.identity.community.create_community Module Contents --------------- .. py:data:: SAFE_UDP_PACKET_LENGTH :value: 1296 .. py:class:: IdentitySettings Bases: :py:obj:`3.0.ipv8.community.CommunitySettings` Settings for the Identity community. .. py:attribute:: identity_manager :type: 3.0.ipv8.attestation.identity.manager.IdentityManager | None :value: None .. py:attribute:: working_directory :type: str :value: '.' .. py:class:: IdentityCommunity(settings: IdentitySettings) Bases: :py:obj:`3.0.ipv8.community.Community` Community for business logic surrounding identities. Actual identity information goes through the wallet. .. py:attribute:: community_id .. py:attribute:: settings_class .. py:attribute:: known_attestation_hashes :type: dict[bytes, tuple[str, float, bytes, dict[str, str] | None]] .. py:attribute:: identity_manager .. py:attribute:: pseudonym_manager .. py:attribute:: token_chain :type: list[3.0.ipv8.types.Token] :value: [] .. py:attribute:: metadata_chain :value: [] .. py:attribute:: attestation_chain :value: [] .. py:attribute:: permissions :type: dict[3.0.ipv8.peer.Peer, int] .. py:method:: pad_hash(attribute_hash: bytes) -> bytes Pad an old-style SHA-1 hash into the new 32 byte SHA3-256 space. .. py:method:: 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. .. py:method:: get_attestation_by_hash(attribute_hash: bytes) -> 3.0.ipv8.types.Metadata | None Get the Metadata object for a particular attribute hash, if it exists. .. py:method:: should_sign(pseudonym: 3.0.ipv8.types.PseudonymManager, metadata: 3.0.ipv8.types.Metadata) -> bool Has the user asked us to sign for some metadata and is it still valid? .. py:method:: _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 .. py:method:: _received_disclosure_for_attest(peer: 3.0.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. .. py:method:: request_attestation_advertisement(peer: 3.0.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. :param peer: the attestor of our block :param attribute_hash: the hash of the attestation :param name: the name of the attribute (metadata) :param block_type: the type of block (from identity_foromats.py) :param metadata: custom additional metadata .. py:method:: self_advertise(attribute_hash: bytes, name: str, block_type: str = 'id_metadata', metadata: dict | None = None) -> 3.0.ipv8.types.Credential | None Self-sign an attribute. :param attribute_hash: the hash of the attestation :param name: the name of the attribute (metadata) :param block_type: the type of block (from identity_formats.py) :param metadata: custom additional metadata .. py:method:: on_disclosure(peer: 3.0.ipv8.peer.Peer, disclosure: 3.0.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. .. py:method:: on_attest(peer: 3.0.ipv8.peer.Peer, payload: 3.0.ipv8.attestation.identity.payload.AttestPayload) -> None Someone made an attestation for us, try to insert it into our database. .. py:method:: on_request_missing(peer: 3.0.ipv8.peer.Peer, request: 3.0.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. .. py:method:: on_missing_response(peer: 3.0.ipv8.peer.Peer, response: 3.0.ipv8.attestation.identity.payload.MissingResponsePayload) -> None We received tokens, attempt to insert them into our database and check if we are still missing some. .. py:function:: create_community(private_key: 3.0.ipv8.keyvault.keys.PrivateKey, ipv8: 3.0.ipv8.types.IPv8, identity_manager: 3.0.ipv8.attestation.identity.manager.IdentityManager, endpoint: 3.0.ipv8.types.Endpoint | None = None, working_directory: str | None = None, anonymize: bool = True, rendezvous_token: bytes | None = None) -> IdentityCommunity :async: Create an anonymized runtime overlay to meet other peers for identity business logic.