latest.ipv8.attestation.identity_formats
Module Contents
Classes
An attestation for a public key of a value. |
|
Interface for IPv8-compatible identity/credential algorithms. |
- class latest.ipv8.attestation.identity_formats.Attestation
An attestation for a public key of a value.
!!! Requires implementation of a .id_format field.
- PK: Any
- abstract serialize() bytes
Serialize this Attestation to a string.
- Returns:
the serialized form of this attestation
- Return type:
- abstract serialize_private(PK: Any) bytes
Serialize this Attestation to a string, include shared secrets (not to be published!).
- Parameters:
PK – the public key to encode for
- Returns:
the serialized form of this attestation
- Return type:
- abstract classmethod unserialize(s: bytes, id_format: str) typing_extensions.Self
Given a string, create an Attestation object.
- Parameters:
- Returns:
the attestation object
- Return type:
- class latest.ipv8.attestation.identity_formats.IdentityAlgorithm(id_format: str, formats: dict[str, dict[str, Any]])
Bases:
Generic
[AT
]Interface for IPv8-compatible identity/credential algorithms.
- abstract generate_secret_key() Any
Generate a secret key.
- Returns:
the secret key
- abstract load_secret_key(serialized: bytes) Any
Unserialize a secret key from the key material.
- Parameters:
serialized – the string of the private key
- Returns:
the private key
- abstract load_public_key(serialized: bytes) Any
Unserialize a public key from the key material.
- Parameters:
serialized – the string of the public key
- Returns:
the public key
- abstract get_attestation_class() type[AT]
Return the Attestation (sub)class for serialization.
- Returns:
the Attestation object
- Return type:
- abstract certainty(value: bytes, aggregate: dict) float
The current certainty of the aggregate object representing a certain value.
- abstract create_challenges(PK: Any, attestation: AT) list[bytes]
Create challenges for a certain counterparty.
- Parameters:
PK (BonehPublicKey) – the public key of the party we are challenging
attestation (Attestation) – the attestation information
- Returns:
the challenges to send
- Return type:
[str]
- abstract create_challenge_response(SK: Any, attestation: AT, challenge: bytes) bytes
Create an honest response to a challenge of our value.
- Parameters:
SK – our secret key
attestation (Attestation) – the attestation information
challenge – the challenge to respond to
- Returns:
the response to a challenge
- Return type:
- abstract create_certainty_aggregate(attestation: AT | None) dict
Create an empty aggregate object, for matching to values.
- Parameters:
attestation (Attestation) – the attestation information
- Returns:
the aggregate object
- abstract create_honesty_challenge(PK: Any, value: int) bytes
Use a known value to check for honesty.
- abstract process_honesty_challenge(value: int, response: bytes) bool
Given a response, check if it matches the expected value.
- abstract process_challenge_response(aggregate: dict, challenge: bytes, response: bytes) dict
Given a response, update the current aggregate.
- abstract import_blob(blob: bytes) tuple[bytes, latest.ipv8.attestation.wallet.database.SecretKeyProtocol]
Directly import a raw serialized form.