M1-PCA-Project/source/models/Elector.py

27 lines
796 B
Python

from dataclasses import dataclass
@dataclass
class Elector:
# [
# {
# "name": "Bob",
# "votant": (pub_key_bob, Hash(empreinte_bob)),
# "mandataire": None,
# },
# {
# "name": "Alice",
# "votant": (pub_key_alice, Hash(empreinte_alice)),
# "mandataire": (pub_key_Eve, Hash(empreinte_eve)), # Eve peut voter pour Alice.
# }
# ]
name: str
public_key_elector: bytes
hashed_fingerprint_elector: bytes
public_key_mandataire: bytes = b""
hashed_fingerprint_mandataire: bytes = b""
def set_mandataire(self, public_key: bytes, hashed_fingerprint: bytes):
self.public_key_mandataire = public_key
self.hashed_fingerprint_mandataire = hashed_fingerprint