Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
coordinator.contributor_list.ContributorList Class Reference

Public Member Functions

def __init__ (self, List[Contributor] contributors)
 
None ensure_validity (self)
 
Optional[int] get_contributor_index (self, VerificationKey verification_key)
 
Contributor __getitem__ (self, int key)
 
int __len__ (self)
 
str to_json (self)
 

Static Public Member Functions

ContributorList from_json (str json_str)
 

Public Attributes

 contributors
 

Detailed Description

Model for contributors list file

Definition at line 44 of file contributor_list.py.

Constructor & Destructor Documentation

◆ __init__()

def coordinator.contributor_list.ContributorList.__init__ (   self,
List[Contributor contributors 
)

Definition at line 48 of file contributor_list.py.

48  def __init__(self, contributors: List[Contributor]):
49  self.contributors = contributors
50 

Member Function Documentation

◆ __getitem__()

Contributor coordinator.contributor_list.ContributorList.__getitem__ (   self,
int  key 
)

Definition at line 77 of file contributor_list.py.

77  def __getitem__(self, key: int) -> Contributor:
78  return self.contributors[key]
79 

◆ __len__()

int coordinator.contributor_list.ContributorList.__len__ (   self)

Definition at line 80 of file contributor_list.py.

80  def __len__(self) -> int:
81  return len(self.contributors)
82 

◆ ensure_validity()

None coordinator.contributor_list.ContributorList.ensure_validity (   self)
Checks the server configuration. If there are any problems, throw an
exception with a message.

Definition at line 51 of file contributor_list.py.

51  def ensure_validity(self) -> None:
52  """
53  Checks the server configuration. If there are any problems, throw an
54  exception with a message.
55  """
56 
57  # Evidence is expected to be the signature of
58  # KEY_VALIDATION_CHECK_STRING. Check this for all the contributors
59  # keys
60  for contr in self.contributors:
61  if not check_key_evidence(contr.verification_key, contr.key_evidence):
62  raise Exception(f"Key for {contr.email} has invalid evidence")
63 
Here is the call graph for this function:

◆ from_json()

ContributorList coordinator.contributor_list.ContributorList.from_json ( str  json_str)
static

Definition at line 87 of file contributor_list.py.

87  def from_json(json_str: str) -> ContributorList:
88  return ContributorList._from_json_dict(json.loads(json_str))
89 

◆ get_contributor_index()

Optional[int] coordinator.contributor_list.ContributorList.get_contributor_index (   self,
VerificationKey  verification_key 
)
Return the index of the contributor, if present.

Definition at line 64 of file contributor_list.py.

64  def get_contributor_index(
65  self,
66  verification_key: VerificationKey) -> Optional[int]:
67  """
68  Return the index of the contributor, if present.
69  """
70  key = export_verification_key(verification_key)
71  try:
72  return [export_verification_key(c.verification_key)
73  for c in self.contributors].index(key)
74  except ValueError:
75  return None
76 
Here is the call graph for this function:

◆ to_json()

str coordinator.contributor_list.ContributorList.to_json (   self)

Definition at line 83 of file contributor_list.py.

83  def to_json(self) -> str:
84  return json.dumps(self._to_json_dict(), indent=4)
85 
Here is the call graph for this function:

Member Data Documentation

◆ contributors

coordinator.contributor_list.ContributorList.contributors

Definition at line 49 of file contributor_list.py.


The documentation for this class was generated from the following file:
coordinator.crypto.export_verification_key
str export_verification_key(ecdsa.VerifyingKey vk)
Definition: crypto.py:66
coordinator.crypto.check_key_evidence
bool check_key_evidence(ecdsa.VerificationKey verification_key, Signature key_evidence)
Definition: crypto.py:107