latest.ipv8.attestation.wallet.bonehexact.algorithm

Module Contents

Classes

BonehAttestation

An attestation for a public key of a value consisting of multiple bitpairs.

BonehExactAlgorithm

IPv8 wrapper around ZKP using Boneh partially-homom. crypto scheme.

class latest.ipv8.attestation.wallet.bonehexact.algorithm.BonehAttestation(PK: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, bitpairs: list[BitPairAttestation], id_format: str | None = None)

Bases: latest.ipv8.attestation.identity_formats.Attestation

An attestation for a public key of a value consisting of multiple bitpairs.

serialize() bytes

Serialize this attestation to bytes.

serialize_private(PK: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey) bytes

Serialize the private part of this attestation.

classmethod unserialize(s: bytes, id_format: str | None = None) typing_extensions.Self

Unserialize the public format of this attestation.

classmethod unserialize_private(sk: latest.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey, s: bytes, id_format: str | None = None) typing_extensions.Self

Unserialize the private format of this attestation.

class latest.ipv8.attestation.wallet.bonehexact.algorithm.BonehExactAlgorithm(id_format: str, formats: dict[str, dict[str, Any]])

Bases: latest.ipv8.attestation.identity_formats.IdentityAlgorithm

IPv8 wrapper around ZKP using Boneh partially-homom. crypto scheme.

generate_secret_key() latest.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey

Generate a secret key.

Returns:

the secret key

load_secret_key(serialized: bytes) latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey | None

Unserialize a secret key from the key material.

Parameters:

serialized – the string of the private key

Returns:

the private key

load_public_key(serialized: bytes) latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey | None

Unserialize a public key from the key material.

Parameters:

serialized – the string of the public key

Returns:

the public key

get_attestation_class() type[latest.ipv8.attestation.wallet.bonehexact.structs.BonehAttestation]

Return the Attestation (sub)class for serialization.

Returns:

the Attestation object

Return type:

BonehAttestation

attest(PK: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, value: bytes) bytes

Attest to a value for a certain public key.

Parameters:
  • PK (BonehPublicKey) – the public key of the party we are attesting for

  • value (str) – the value we are attesting to

Returns:

the attestation string

Return type:

str

certainty(value: bytes, aggregate: dict) float

The current certainty of the aggregate object representing a certain value.

Parameters:
  • value (str) – the value to match to

  • aggregate (dict) – the aggregate object

Returns:

the matching factor [0.0-1.0]

Return type:

float

create_challenges(PK: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, attestation: latest.ipv8.attestation.wallet.bonehexact.structs.BonehAttestation) list[bytes]

Create challenges for a certain counterparty.

Parameters:
Returns:

the challenges to send

Return type:

[str]

create_challenge_response(SK: latest.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey, attestation: latest.ipv8.attestation.wallet.bonehexact.structs.BonehAttestation, challenge: bytes) bytes

Create an honest response to a challenge of our value.

Parameters:
  • SK (BonehPrivateKey) – our secret key

  • attestation (Attestation) – the attestation information

  • challenge – the challenge to respond to

Returns:

the response to a challenge

Return type:

str

create_certainty_aggregate(attestation: latest.ipv8.attestation.wallet.bonehexact.structs.BonehAttestation | None) dict

Create an empty aggregate object, for matching to values.

Parameters:

attestation (Attestation) – the attestation information

Returns:

the aggregate object

Return type:

dict

create_honesty_challenge(PK: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, value: int) bytes

Use a known value to check for honesty.

Parameters:
  • PK (BonehPublicKey) – the public key of the party we are challenging

  • value (str) – the value to use

Returns:

the challenge to send

Return type:

str

process_honesty_challenge(value: int, response: bytes) bool

Given a response, check if it matches the expected value.

Parameters:
  • value (int) – the expected value

  • response (str) – the returned response

Returns:

if the value matches the response

Return type:

bool

process_challenge_response(aggregate: dict, challenge: bytes, response: bytes) dict

Given a response, update the current aggregate.

Parameters:
  • aggregate (dict) – the aggregate object

  • challenge (str) – the sent challenge

  • response (str) – the response to introduce

Returns:

the new aggregate

Return type:

dict

abstract import_blob(blob: bytes) tuple[bytes, latest.ipv8.attestation.wallet.database.SecretKeyProtocol]

Not supported.