voting_schemes-dummy 0.22.2 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2a6b9c60ee60ff66b24a548bc01d30ce4022b44eeca4fe5c390a08b3d6ca5ea
4
- data.tar.gz: fbbf7d9f3dc387a8566106f0b58cc6dbc361c05fc59e73fc04f00710376c1f0c
3
+ metadata.gz: 8e2407882131098b54d1db56156dbe21810af3342e470b6f88d8325ad16454d6
4
+ data.tar.gz: ff23a6901d83f3700eeaee0aa81399b2275635b4fda853e9852467fc561ed943
5
5
  SHA512:
6
- metadata.gz: 646c326fddd0aa8bb0b51e93bbcbb29f0d3c7abb35fff3f8251dd11b6b44662042ded65de6a410435747b6592eebdb4f34e1f882383d3a2ca8e692c362460057
7
- data.tar.gz: 0f386de4f0d0e505aaae6e63ca327a8eef963aa4e49173fd503ab73fe3694044872ee5e2ff1124df97a751e62af37f24990007448965645ad0a8087e2444012b
6
+ metadata.gz: 3b78a68d15917191522faabe0fe820624fd7148065e1c15776d388e860e3e77522e09eec58f12db8aef0e17926870d625ac51284f712677d02e51f17b26cc6e7
7
+ data.tar.gz: db8a83392fc1cc89208dd96cefbf0106f5a1420c04ab9848c656a6b3ce15141db58fbba070c20190c3e27ff0bd3d85896f5099db2a05547fded98bb2a4079266
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.1.1
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in decidim-bulletin_board-dummy.gemspec
6
6
  gemspec
7
7
 
8
- gem "rubocop", "~> 0.92.0"
8
+ gem "rubocop", "~> 1.28.0"
9
9
  gem "rubocop-faker", "~> 1.1.0"
10
- gem "rubocop-rspec", "~> 1.44.1"
10
+ gem "rubocop-rspec", "~> 2.10"
data/Gemfile.lock CHANGED
@@ -1,135 +1,156 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- voting_schemes-dummy (0.22.2)
4
+ voting_schemes-dummy (0.24.0)
5
5
  rails (>= 5.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (6.1.4.1)
11
- actionpack (= 6.1.4.1)
12
- activesupport (= 6.1.4.1)
10
+ actioncable (7.0.3.1)
11
+ actionpack (= 7.0.3.1)
12
+ activesupport (= 7.0.3.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.4.1)
16
- actionpack (= 6.1.4.1)
17
- activejob (= 6.1.4.1)
18
- activerecord (= 6.1.4.1)
19
- activestorage (= 6.1.4.1)
20
- activesupport (= 6.1.4.1)
15
+ actionmailbox (7.0.3.1)
16
+ actionpack (= 7.0.3.1)
17
+ activejob (= 7.0.3.1)
18
+ activerecord (= 7.0.3.1)
19
+ activestorage (= 7.0.3.1)
20
+ activesupport (= 7.0.3.1)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.1.4.1)
23
- actionpack (= 6.1.4.1)
24
- actionview (= 6.1.4.1)
25
- activejob (= 6.1.4.1)
26
- activesupport (= 6.1.4.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.3.1)
26
+ actionpack (= 7.0.3.1)
27
+ actionview (= 7.0.3.1)
28
+ activejob (= 7.0.3.1)
29
+ activesupport (= 7.0.3.1)
27
30
  mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
28
34
  rails-dom-testing (~> 2.0)
29
- actionpack (6.1.4.1)
30
- actionview (= 6.1.4.1)
31
- activesupport (= 6.1.4.1)
32
- rack (~> 2.0, >= 2.0.9)
35
+ actionpack (7.0.3.1)
36
+ actionview (= 7.0.3.1)
37
+ activesupport (= 7.0.3.1)
38
+ rack (~> 2.0, >= 2.2.0)
33
39
  rack-test (>= 0.6.3)
34
40
  rails-dom-testing (~> 2.0)
35
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.4.1)
37
- actionpack (= 6.1.4.1)
38
- activerecord (= 6.1.4.1)
39
- activestorage (= 6.1.4.1)
40
- activesupport (= 6.1.4.1)
42
+ actiontext (7.0.3.1)
43
+ actionpack (= 7.0.3.1)
44
+ activerecord (= 7.0.3.1)
45
+ activestorage (= 7.0.3.1)
46
+ activesupport (= 7.0.3.1)
47
+ globalid (>= 0.6.0)
41
48
  nokogiri (>= 1.8.5)
42
- actionview (6.1.4.1)
43
- activesupport (= 6.1.4.1)
49
+ actionview (7.0.3.1)
50
+ activesupport (= 7.0.3.1)
44
51
  builder (~> 3.1)
45
52
  erubi (~> 1.4)
46
53
  rails-dom-testing (~> 2.0)
47
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.4.1)
49
- activesupport (= 6.1.4.1)
55
+ activejob (7.0.3.1)
56
+ activesupport (= 7.0.3.1)
50
57
  globalid (>= 0.3.6)
51
- activemodel (6.1.4.1)
52
- activesupport (= 6.1.4.1)
53
- activerecord (6.1.4.1)
54
- activemodel (= 6.1.4.1)
55
- activesupport (= 6.1.4.1)
56
- activestorage (6.1.4.1)
57
- actionpack (= 6.1.4.1)
58
- activejob (= 6.1.4.1)
59
- activerecord (= 6.1.4.1)
60
- activesupport (= 6.1.4.1)
61
- marcel (~> 1.0.0)
58
+ activemodel (7.0.3.1)
59
+ activesupport (= 7.0.3.1)
60
+ activerecord (7.0.3.1)
61
+ activemodel (= 7.0.3.1)
62
+ activesupport (= 7.0.3.1)
63
+ activestorage (7.0.3.1)
64
+ actionpack (= 7.0.3.1)
65
+ activejob (= 7.0.3.1)
66
+ activerecord (= 7.0.3.1)
67
+ activesupport (= 7.0.3.1)
68
+ marcel (~> 1.0)
62
69
  mini_mime (>= 1.1.0)
63
- activesupport (6.1.4.1)
70
+ activesupport (7.0.3.1)
64
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
72
  i18n (>= 1.6, < 2)
66
73
  minitest (>= 5.1)
67
74
  tzinfo (~> 2.0)
68
- zeitwerk (~> 2.3)
69
75
  ast (2.4.2)
70
76
  builder (3.2.4)
71
- concurrent-ruby (1.1.8)
77
+ concurrent-ruby (1.1.10)
72
78
  crass (1.0.6)
73
79
  diff-lcs (1.4.4)
74
- erubi (1.10.0)
80
+ digest (3.1.0)
81
+ erubi (1.11.0)
75
82
  faker (2.15.1)
76
83
  i18n (>= 1.6, < 2)
77
- globalid (0.5.2)
84
+ globalid (1.0.0)
78
85
  activesupport (>= 5.0)
79
- i18n (1.8.10)
86
+ i18n (1.10.0)
80
87
  concurrent-ruby (~> 1.0)
81
- loofah (2.12.0)
88
+ loofah (2.18.0)
82
89
  crass (~> 1.0.2)
83
90
  nokogiri (>= 1.5.9)
84
91
  mail (2.7.1)
85
92
  mini_mime (>= 0.1.1)
86
- marcel (1.0.1)
93
+ marcel (1.0.2)
87
94
  method_source (1.0.0)
88
- mini_mime (1.1.1)
89
- mini_portile2 (2.6.1)
90
- minitest (5.14.4)
95
+ mini_mime (1.1.2)
96
+ mini_portile2 (2.8.0)
97
+ minitest (5.16.3)
98
+ net-imap (0.2.3)
99
+ digest
100
+ net-protocol
101
+ strscan
102
+ net-pop (0.1.1)
103
+ digest
104
+ net-protocol
105
+ timeout
106
+ net-protocol (0.1.3)
107
+ timeout
108
+ net-smtp (0.3.1)
109
+ digest
110
+ net-protocol
111
+ timeout
91
112
  nio4r (2.5.8)
92
- nokogiri (1.12.4)
93
- mini_portile2 (~> 2.6.1)
113
+ nokogiri (1.13.8)
114
+ mini_portile2 (~> 2.8.0)
94
115
  racc (~> 1.4)
95
- nokogiri (1.12.4-x86_64-linux)
116
+ nokogiri (1.13.8-x86_64-linux)
96
117
  racc (~> 1.4)
97
- parallel (1.20.1)
98
- parser (3.0.0.0)
118
+ parallel (1.22.1)
119
+ parser (3.1.2.1)
99
120
  ast (~> 2.4.1)
100
- racc (1.5.2)
101
- rack (2.2.3)
102
- rack-test (1.1.0)
103
- rack (>= 1.0, < 3)
104
- rails (6.1.4.1)
105
- actioncable (= 6.1.4.1)
106
- actionmailbox (= 6.1.4.1)
107
- actionmailer (= 6.1.4.1)
108
- actionpack (= 6.1.4.1)
109
- actiontext (= 6.1.4.1)
110
- actionview (= 6.1.4.1)
111
- activejob (= 6.1.4.1)
112
- activemodel (= 6.1.4.1)
113
- activerecord (= 6.1.4.1)
114
- activestorage (= 6.1.4.1)
115
- activesupport (= 6.1.4.1)
121
+ racc (1.6.0)
122
+ rack (2.2.4)
123
+ rack-test (2.0.2)
124
+ rack (>= 1.3)
125
+ rails (7.0.3.1)
126
+ actioncable (= 7.0.3.1)
127
+ actionmailbox (= 7.0.3.1)
128
+ actionmailer (= 7.0.3.1)
129
+ actionpack (= 7.0.3.1)
130
+ actiontext (= 7.0.3.1)
131
+ actionview (= 7.0.3.1)
132
+ activejob (= 7.0.3.1)
133
+ activemodel (= 7.0.3.1)
134
+ activerecord (= 7.0.3.1)
135
+ activestorage (= 7.0.3.1)
136
+ activesupport (= 7.0.3.1)
116
137
  bundler (>= 1.15.0)
117
- railties (= 6.1.4.1)
118
- sprockets-rails (>= 2.0.0)
138
+ railties (= 7.0.3.1)
119
139
  rails-dom-testing (2.0.3)
120
140
  activesupport (>= 4.2.0)
121
141
  nokogiri (>= 1.6)
122
- rails-html-sanitizer (1.4.2)
142
+ rails-html-sanitizer (1.4.3)
123
143
  loofah (~> 2.3)
124
- railties (6.1.4.1)
125
- actionpack (= 6.1.4.1)
126
- activesupport (= 6.1.4.1)
144
+ railties (7.0.3.1)
145
+ actionpack (= 7.0.3.1)
146
+ activesupport (= 7.0.3.1)
127
147
  method_source
128
- rake (>= 0.13)
148
+ rake (>= 12.2)
129
149
  thor (~> 1.0)
130
- rainbow (3.0.0)
131
- rake (13.0.3)
132
- regexp_parser (2.1.1)
150
+ zeitwerk (~> 2.5)
151
+ rainbow (3.1.1)
152
+ rake (13.0.6)
153
+ regexp_parser (2.5.0)
133
154
  rexml (3.2.5)
134
155
  rspec (3.10.0)
135
156
  rspec-core (~> 3.10.0)
@@ -144,39 +165,33 @@ GEM
144
165
  diff-lcs (>= 1.2.0, < 2.0)
145
166
  rspec-support (~> 3.10.0)
146
167
  rspec-support (3.10.2)
147
- rubocop (0.92.0)
168
+ rubocop (1.28.2)
148
169
  parallel (~> 1.10)
149
- parser (>= 2.7.1.5)
170
+ parser (>= 3.1.0.0)
150
171
  rainbow (>= 2.2.2, < 4.0)
151
- regexp_parser (>= 1.7)
172
+ regexp_parser (>= 1.8, < 3.0)
152
173
  rexml
153
- rubocop-ast (>= 0.5.0)
174
+ rubocop-ast (>= 1.17.0, < 2.0)
154
175
  ruby-progressbar (~> 1.7)
155
- unicode-display_width (>= 1.4.0, < 2.0)
156
- rubocop-ast (1.4.1)
157
- parser (>= 2.7.1.5)
176
+ unicode-display_width (>= 1.4.0, < 3.0)
177
+ rubocop-ast (1.21.0)
178
+ parser (>= 3.1.1.0)
158
179
  rubocop-faker (1.1.0)
159
180
  faker (>= 2.12.0)
160
181
  rubocop (>= 0.82.0)
161
- rubocop-rspec (1.44.1)
162
- rubocop (~> 0.87)
163
- rubocop-ast (>= 0.7.1)
182
+ rubocop-rspec (2.11.1)
183
+ rubocop (~> 1.19)
164
184
  ruby-progressbar (1.11.0)
165
- sprockets (4.0.2)
185
+ strscan (3.0.4)
186
+ thor (1.2.1)
187
+ timeout (0.3.0)
188
+ tzinfo (2.0.5)
166
189
  concurrent-ruby (~> 1.0)
167
- rack (> 1, < 3)
168
- sprockets-rails (3.2.2)
169
- actionpack (>= 4.0)
170
- activesupport (>= 4.0)
171
- sprockets (>= 3.0.0)
172
- thor (1.1.0)
173
- tzinfo (2.0.4)
174
- concurrent-ruby (~> 1.0)
175
- unicode-display_width (1.7.0)
190
+ unicode-display_width (2.2.0)
176
191
  websocket-driver (0.7.5)
177
192
  websocket-extensions (>= 0.1.0)
178
193
  websocket-extensions (0.1.5)
179
- zeitwerk (2.4.2)
194
+ zeitwerk (2.6.0)
180
195
 
181
196
  PLATFORMS
182
197
  ruby
@@ -185,10 +200,10 @@ PLATFORMS
185
200
  DEPENDENCIES
186
201
  rake (~> 13.0)
187
202
  rspec (~> 3.7)
188
- rubocop (~> 0.92.0)
203
+ rubocop (~> 1.28.0)
189
204
  rubocop-faker (~> 1.1.0)
190
- rubocop-rspec (~> 1.44.1)
205
+ rubocop-rspec (~> 2.10)
191
206
  voting_schemes-dummy!
192
207
 
193
208
  BUNDLED WITH
194
- 2.2.27
209
+ 2.3.10
@@ -1 +1 @@
1
- (()=>{"use strict";var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{TrusteeWrapperAdapter:()=>n,VoterWrapperAdapter:()=>a});const s="key_ceremony.step_1",r="tally.share";class i{constructor({trusteeId:e}){this.trusteeId=e,this.status=0,this.electionPublicKey=0,this.jointElectionKey=0,this.tallyCastMessage=null,this.quorum=0,this.trusteesKeys={},this.trusteesShares={}}processMessage(e,t){switch(this.status){case 0:"create_election"===e&&(this.quorum=t.scheme.quorum,this.status=1);case 1:if("start_key_ceremony"===e)return this.status=2,this.electionPublicKey=2*Math.floor(50+200*Math.random())+1,{messageType:s,content:JSON.stringify({election_public_key:this.electionPublicKey,owner_id:this.trusteeId})};break;case 2:if(e===s){const e=JSON.parse(t.content);this.trusteesKeys[e.owner_id]=e.election_public_key}else if("end_key_ceremony"===e){const e=JSON.parse(t.content);this.jointElectionKey=e.joint_election_key,this.status=3}break;case 3:"start_tally"===e&&(this.status=4);break;case 4:if("tally.cast"===e){this.tallyCastMessage=t.content;const e=JSON.parse(this.tallyCastMessage);for(const[t,s]of Object.entries(e))for(const[r,i]of Object.entries(s))e[t][r]=i%this.electionPublicKey*this.electionPublicKey;return{messageType:r,content:JSON.stringify({owner_id:this.trusteeId,contests:e})}}if(e===r){const e=JSON.parse(t.content);return this.trusteesShares[e.owner_id]=!0,this._compensate()}if("tally.missing_trustee"===e){if(!(t.truestee_id in this.trusteesShares))return this.trusteesShares[t.truestee_id]=!1,this._compensate()}else"end_tally"===e&&(this.status=5)}}isFresh(){return 0===this.status}backup(){return JSON.stringify(this)}restore(e){if(!this.isFresh())return console.warn("Restore not needed"),!1;const t=JSON.parse(e);if(t.trusteeId!==this.trusteeId)return console.warn("Invalid trustee id"),!1;if(1===t.status)return console.warn("Invalid restored status"),!1;try{Object.assign(this,t)}catch(e){return console.error(e),!1}return!0}isKeyCeremonyDone(){return this.status>=3}isTallyDone(){return this.status>=5}_compensate(){const e=Object.keys(this.trusteesKeys).length,t=Object.values(this.trusteesShares).filter((e=>!e)).length;if(t>0&&Object.keys(this.trusteesShares).length===e){const s=JSON.parse(this.tallyCastMessage);for(const[r,i]of Object.entries(s))for(const[n,o]of Object.entries(i))s[r][n]=Math.pow(o%this.electionPublicKey,t)/Math.pow(this.electionPublicKey,e-t);return{messageType:"tally.compensation",content:JSON.stringify({owner_id:this.trusteeId,contests:s})}}}}class n{constructor({trusteeId:e}){this.trusteeId=e,this.wrapper=new i({trusteeId:e})}setup(){}processMessage(e,t){return this.wrapper.processMessage(e,t)}isFresh(){return this.wrapper.isFresh()}backup(){return this.wrapper.backup()}restore(e){return this.wrapper.restore(e)}isKeyCeremonyDone(){return this.wrapper.isKeyCeremonyDone()}isTallyDone(){return this.wrapper.isTallyDone()}}class o{constructor({voterId:e,waitTime:t}){this.voterId=e,this.jointElectionKey=null,this.contests={},this.waitTime=t??500}processMessage(e,t){switch(e){case"create_election":this.contests=t.description.contests;break;case"end_key_ceremony":{const e=JSON.parse(t.content);this.jointElectionKey=e.joint_election_key;break}}}async encrypt(e,t){return new Promise((e=>setTimeout(e,500))).then((()=>{if(!this.jointElectionKey)return void console.warn("Invalid election status.");const t=this.createAuditableBallot(e);return{auditableData:t,encryptedData:JSON.stringify(this.createEncryptedData(JSON.parse(JSON.stringify(t))))}}))}createAuditableBallot(e){return{ballot_style:"ballot-style",contests:this.contests.map((({object_id:t,ballot_selections:s})=>({object_id:t,ballot_selections:s.map((s=>{const r=Math.random(),i=e[t]&&e[t].includes(s.object_id)?1:0;return{object_id:s.object_id,ciphertext:i+Math.floor(500*r)*this.jointElectionKey,random:r,plaintext:i}}))})))}}createEncryptedData(e){return this.removeAuditInformation(e)}removeAuditInformation(e){return e.contests.map((e=>e.ballot_selections.map((e=>(delete e.random,delete e.plaintext,e))))),e}}class a{constructor({voterId:e,waitTime:t}){this.voterId=e,this.wrapper=new o({voterId:e,waitTime:t})}setup(){}processMessage(e,t){return this.wrapper.processMessage(e,t)}encrypt(e,t){return this.wrapper.encrypt(e,t)}}window.dummyVotingScheme=t})();
1
+ (()=>{"use strict";var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{TrusteeWrapperAdapter:()=>n,VoterWrapperAdapter:()=>a});const s="key_ceremony.step_1",r="tally.share";class i{constructor({trusteeId:e}){this.trusteeId=e,this.status=0,this.electionPublicKey=0,this.jointElectionKey=0,this.tallyCastMessage=null,this.quorum=0,this.trusteesKeys={},this.trusteesShares={}}processMessage(e,t){switch(this.status){case 0:"create_election"===e&&(this.quorum=t.scheme.quorum,this.status=1);break;case 1:if("start_key_ceremony"===e)return this.status=2,this.electionPublicKey=2*Math.floor(50+200*Math.random())+1,{messageType:s,content:JSON.stringify({election_public_key:this.electionPublicKey,owner_id:this.trusteeId})};break;case 2:if(e===s){const e=JSON.parse(t.content);this.trusteesKeys[e.owner_id]=e.election_public_key}else if("end_key_ceremony"===e){const e=JSON.parse(t.content);this.jointElectionKey=e.joint_election_key,this.status=3}break;case 3:"start_tally"===e&&(this.status=4);break;case 4:if("tally.cast"===e){this.tallyCastMessage=t.content;const e=JSON.parse(this.tallyCastMessage);for(const[t,s]of Object.entries(e))for(const[r,i]of Object.entries(s))e[t][r]=i%this.electionPublicKey*this.electionPublicKey;return{messageType:r,content:JSON.stringify({owner_id:this.trusteeId,contests:e})}}if(e===r){const e=JSON.parse(t.content);return this.trusteesShares[e.owner_id]=!0,this._compensate()}if("tally.missing_trustee"===e){if(!(t.trustee_id in this.trusteesShares))return this.trusteesShares[t.trustee_id]=!1,this._compensate()}else"end_tally"===e&&(this.status=5)}}isFresh(){return 0===this.status}backup(){return JSON.stringify(this)}restore(e){if(!this.isFresh())return console.warn("Restore not needed"),!1;const t=JSON.parse(e);if(t.trusteeId!==this.trusteeId)return console.warn("Invalid trustee id"),!1;if(1===t.status)return console.warn("Invalid restored status"),!1;try{Object.assign(this,t)}catch(e){return console.error(e),!1}return!0}isKeyCeremonyDone(){return this.status>=3}isTallyDone(){return this.status>=5}_compensate(){const e=Object.keys(this.trusteesKeys).length,t=Object.values(this.trusteesShares).filter((e=>!e)).length;if(t>0&&t<=e-this.quorum&&Object.keys(this.trusteesShares).length===e){const s=JSON.parse(this.tallyCastMessage);for(const[r,i]of Object.entries(s))for(const[n,o]of Object.entries(i))s[r][n]=Math.pow(o%this.electionPublicKey,t)/Math.pow(this.electionPublicKey,e-t);return{messageType:"tally.compensation",content:JSON.stringify({owner_id:this.trusteeId,contests:s})}}}}class n{constructor({trusteeId:e}){this.trusteeId=e,this.wrapper=new i({trusteeId:e})}setup(){}processMessage(e,t){return this.wrapper.processMessage(e,t)}isFresh(){return this.wrapper.isFresh()}backup(){return this.wrapper.backup()}restore(e){return this.wrapper.restore(e)}isKeyCeremonyDone(){return this.wrapper.isKeyCeremonyDone()}isTallyDone(){return this.wrapper.isTallyDone()}}class o{constructor({voterId:e,waitTime:t}){this.voterId=e,this.jointElectionKey=null,this.contests={},this.waitTime=t??500}processMessage(e,t){switch(e){case"create_election":this.contests=t.description.contests;break;case"end_key_ceremony":{const e=JSON.parse(t.content);this.jointElectionKey=e.joint_election_key;break}}}async encrypt(e,t){return new Promise((e=>setTimeout(e,500))).then((()=>{if(!this.jointElectionKey)return void console.warn("Invalid election status.");const t=this.createAuditableBallot(e);return{auditableData:t,encryptedData:JSON.stringify(this.createEncryptedData(JSON.parse(JSON.stringify(t))))}}))}createAuditableBallot(e){return{ballot_style:"ballot-style",contests:this.contests.map((({object_id:t,ballot_selections:s})=>({object_id:t,ballot_selections:s.map((s=>{const r=Math.random(),i=e[t]&&e[t].includes(s.object_id)?1:0;return{object_id:s.object_id,ciphertext:i+Math.floor(500*r+1)*this.jointElectionKey,random:r,plaintext:i}}))})))}}createEncryptedData(e){return this.removeAuditInformation(e)}removeAuditInformation(e){return e.contests.map((e=>e.ballot_selections.map((e=>(delete e.random,delete e.plaintext,e))))),e}}class a{constructor({voterId:e,waitTime:t}){this.voterId=e,this.wrapper=new o({voterId:e,waitTime:t})}setup(){}processMessage(e,t){return this.wrapper.processMessage(e,t)}encrypt(e,t){return this.wrapper.encrypt(e,t)}}window.dummyVotingScheme=t})();
@@ -2,6 +2,6 @@
2
2
 
3
3
  module VotingSchemes
4
4
  module Dummy
5
- VERSION = "0.22.2"
5
+ VERSION = "0.24.0"
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = ""
13
13
  s.homepage = "https://github.com/decidim/decidim-bulletin-board"
14
14
  s.license = "AGPL-3.0"
15
- s.required_ruby_version = Gem::Requirement.new(">= 2.6.6")
15
+ s.required_ruby_version = Gem::Requirement.new(">= 3.1.1")
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voting_schemes-dummy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Morcillo
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-09-07 00:00:00.000000000 Z
14
+ date: 2022-08-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -94,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 2.6.6
97
+ version: 3.1.1
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.0.3
104
+ rubygems_version: 3.3.7
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: ''