3.0.ipv8.attestation.identity_formats ===================================== .. py:module:: 3.0.ipv8.attestation.identity_formats Classes ------- .. autoapisummary:: 3.0.ipv8.attestation.identity_formats.Attestation 3.0.ipv8.attestation.identity_formats.IdentityAlgorithm Module Contents --------------- .. py:class:: Attestation An attestation for a public key of a value. !!! Requires implementation of a `.id_format` field. .. py:attribute:: id_format :type: str | None .. py:attribute:: PK :type: Any .. py:method:: serialize() -> bytes :abstractmethod: Serialize this Attestation to a string. :return: the serialized form of this attestation :rtype: str .. py:method:: serialize_private(PK: Any) -> bytes :abstractmethod: Serialize this Attestation to a string, include shared secrets (not to be published!). :param PK: the public key to encode for :return: the serialized form of this attestation :rtype: str .. py:method:: unserialize(s: bytes, id_format: str) -> typing_extensions.Self :classmethod: :abstractmethod: Given a string, create an Attestation object. :param s: the string to unserialize :type s: str :param id_format: the identity format :type id_format: str :return: the attestation object :rtype: Attestation .. py:method:: unserialize_private(SK: Any, s: bytes, id_format: str) -> typing_extensions.Self :classmethod: :abstractmethod: Given a string, create an Attestation object. The input contains shared secrets not to be published. :param SK: the secret key to decode with :param s: the string to unserialize :type s: str :param id_format: the identity format :type id_format: str :return: the attestation object :rtype: Attestation .. py:method:: get_hash() -> bytes The hash over the public part of this Attestation. .. py:class:: IdentityAlgorithm(id_format: str, formats: dict[str, dict[str, Any]]) Bases: :py:obj:`Generic`\ [\ :py:obj:`AT`\ ] Interface for IPv8-compatible identity/credential algorithms. .. py:attribute:: id_format .. py:attribute:: honesty_check :value: False .. py:method:: generate_secret_key() -> Any :abstractmethod: Generate a secret key. :return: the secret key .. py:method:: load_secret_key(serialized: bytes) -> Any :abstractmethod: Unserialize a secret key from the key material. :param serialized: the string of the private key :return: the private key .. py:method:: load_public_key(serialized: bytes) -> Any :abstractmethod: Unserialize a public key from the key material. :param serialized: the string of the public key :return: the public key .. py:method:: get_attestation_class() -> type[AT] :abstractmethod: Return the Attestation (sub)class for serialization. :return: the Attestation object :rtype: Attestation .. py:method:: attest(PK: Any, value: bytes) -> bytes :abstractmethod: Attest to a value for a certain public key. :param PK: the public key of the party we are attesting for :param value: the value we are attesting to :type value: str :return: the attestation string :rtype: str .. py:method:: certainty(value: bytes, aggregate: dict) -> float :abstractmethod: The current certainty of the aggregate object representing a certain value. :param value: the value to match to :type value: str :param aggregate: the aggregate object :return: the matching factor [0.0-1.0] :rtype: float .. py:method:: create_challenges(PK: Any, attestation: AT) -> list[bytes] :abstractmethod: Create challenges for a certain counterparty. :param PK: the public key of the party we are challenging :type PK: BonehPublicKey :param attestation: the attestation information :type attestation: Attestation :return: the challenges to send :rtype: [str] .. py:method:: create_challenge_response(SK: Any, attestation: AT, challenge: bytes) -> bytes :abstractmethod: Create an honest response to a challenge of our value. :param SK: our secret key :param attestation: the attestation information :type attestation: Attestation :param challenge: the challenge to respond to :return: the response to a challenge :rtype: str .. py:method:: create_certainty_aggregate(attestation: AT | None) -> dict :abstractmethod: Create an empty aggregate object, for matching to values. :param attestation: the attestation information :type attestation: Attestation :return: the aggregate object .. py:method:: create_honesty_challenge(PK: Any, value: int) -> bytes :abstractmethod: Use a known value to check for honesty. :param PK: the public key of the party we are challenging :param value: the value to use :type value: str :return: the challenge to send :rtype: str .. py:method:: process_honesty_challenge(value: int, response: bytes) -> bool :abstractmethod: Given a response, check if it matches the expected value. :param value: the expected value :param response: the returned response :type response: str :return: if the value matches the response :rtype: bool .. py:method:: process_challenge_response(aggregate: dict, challenge: bytes, response: bytes) -> dict :abstractmethod: Given a response, update the current aggregate. :param aggregate: the aggregate object :param challenge: the sent challenge :type challenge: str :param response: the response to introduce :type response: str :return: the new aggregate .. py:method:: import_blob(blob: bytes) -> tuple[bytes, 3.0.ipv8.attestation.wallet.database.SecretKeyProtocol] :abstractmethod: Directly import a raw serialized form.