1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
use super::*;
uuid_id!{ #[doc="Unique verification key identifier."] VerificationKeyId }
pub type LabelledVerificationKey = Labelled<VerificationKeyId, VerificationKey>;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Agent {
pub id: AgentId,
pub verification_key: LabelledVerificationKey,
}
uuid_id!{ #[doc="Unique agent identifier."] AgentId }
identify!(Agent,AgentId);
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Profile {
pub owner: AgentId,
pub name: Option<String>,
pub twitter_id: Option<String>,
pub keybase_id: Option<String>,
pub website: Option<String>,
}
uuid_id!{ #[doc="Unique encryption key identifier."] EncryptionKeyId }
pub type SignedEncryptionKey = Signed<Labelled<EncryptionKeyId, EncryptionKey>>;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Aggregation {
pub id: AggregationId,
pub title: String,
pub vector_dimension: usize,
pub modulus: i64,
pub recipient: AgentId,
pub recipient_key: EncryptionKeyId,
pub masking_scheme: LinearMaskingScheme,
pub committee_sharing_scheme: LinearSecretSharingScheme,
pub recipient_encryption_scheme: AdditiveEncryptionScheme,
pub committee_encryption_scheme: AdditiveEncryptionScheme,
}
uuid_id!{ #[doc="Unique aggregation identifier."] AggregationId }
identify!(Aggregation, AggregationId);
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ClerkCandidate {
pub id: AgentId,
pub keys: Vec<EncryptionKeyId>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Committee {
pub aggregation: AggregationId,
pub clerks_and_keys: Vec<(AgentId, EncryptionKeyId)>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Participation {
pub id: ParticipationId,
pub participant: AgentId,
pub aggregation: AggregationId,
pub recipient_encryption: Option<Encryption>,
pub clerk_encryptions: Vec<(AgentId, Encryption)>,
}
uuid_id!{ #[doc="Unique participation identifier."] ParticipationId }
identify!(Participation, ParticipationId);
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Snapshot {
pub id: SnapshotId,
pub aggregation: AggregationId,
}
uuid_id!{ #[doc="Unique snapshot identifier."] SnapshotId }
identify!(Snapshot, SnapshotId);
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClerkingJob {
pub id: ClerkingJobId,
pub clerk: AgentId,
pub aggregation: AggregationId,
pub snapshot: SnapshotId,
pub encryptions: Vec<Encryption>,
}
uuid_id!{ #[doc="Unique job identifier."] ClerkingJobId }
identify!(ClerkingJob, ClerkingJobId);
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClerkingResult {
pub job: ClerkingJobId,
pub clerk: AgentId,
pub encryption: Encryption,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AggregationStatus {
pub aggregation: AggregationId,
pub number_of_participations: usize,
pub snapshots: Vec<SnapshotStatus>
}
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct SnapshotStatus {
pub id: SnapshotId,
pub number_of_clerking_results: usize,
pub result_ready: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct SnapshotResult {
pub snapshot: SnapshotId,
pub number_of_participations: usize,
pub clerk_encryptions: Vec<ClerkingResult>,
pub recipient_encryptions: Option<Vec<Encryption>>,
}