Skip to content

Commit ed65441

Browse files
committed
tring out require()s again
1 parent 200f4b5 commit ed65441

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,26 @@ const aggregatedEncryptedVoteOption2 = encryptedVotesOption2.reduce(
178178
const decryptionSharesOption1 = [
179179
createDecryptionShare(
180180
aggregatedEncryptedVoteOption1,
181-
participant1Keys.privateKey,
181+
// The order of the shares does not matter during decryption.
182+
participant3Keys.privateKey,
182183
),
183184
createDecryptionShare(
184185
aggregatedEncryptedVoteOption1,
185-
participant2Keys.privateKey,
186+
participant1Keys.privateKey,
186187
),
187188
createDecryptionShare(
188189
aggregatedEncryptedVoteOption1,
189-
participant3Keys.privateKey,
190+
participant2Keys.privateKey,
190191
),
191192
];
192193
const decryptionSharesOption2 = [
193194
createDecryptionShare(
194195
aggregatedEncryptedVoteOption2,
195-
participant1Keys.privateKey,
196+
participant2Keys.privateKey,
196197
),
197198
createDecryptionShare(
198199
aggregatedEncryptedVoteOption2,
199-
participant2Keys.privateKey,
200+
participant1Keys.privateKey,
200201
),
201202
createDecryptionShare(
202203
aggregatedEncryptedVoteOption2,

docs/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,26 @@ const aggregatedEncryptedVoteOption2 = encryptedVotesOption2.reduce(
180180
const decryptionSharesOption1 = [
181181
createDecryptionShare(
182182
aggregatedEncryptedVoteOption1,
183-
participant1Keys.privateKey,
183+
// The order of the shares does not matter during decryption.
184+
participant3Keys.privateKey,
184185
),
185186
createDecryptionShare(
186187
aggregatedEncryptedVoteOption1,
187-
participant2Keys.privateKey,
188+
participant1Keys.privateKey,
188189
),
189190
createDecryptionShare(
190191
aggregatedEncryptedVoteOption1,
191-
participant3Keys.privateKey,
192+
participant2Keys.privateKey,
192193
),
193194
];
194195
const decryptionSharesOption2 = [
195196
createDecryptionShare(
196197
aggregatedEncryptedVoteOption2,
197-
participant1Keys.privateKey,
198+
participant2Keys.privateKey,
198199
),
199200
createDecryptionShare(
200201
aggregatedEncryptedVoteOption2,
201-
participant2Keys.privateKey,
202+
participant1Keys.privateKey,
202203
),
203204
createDecryptionShare(
204205
aggregatedEncryptedVoteOption2,

docs/modules.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#### Defined in
4141

42-
[types.ts:1](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/types.ts#L1)
42+
[types.ts:1](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/types.ts#L1)
4343

4444
___
4545

@@ -58,7 +58,7 @@ ___
5858

5959
#### Defined in
6060

61-
[types.ts:6](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/types.ts#L6)
61+
[types.ts:6](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/types.ts#L6)
6262

6363
## Functions
6464

@@ -83,7 +83,7 @@ The combined decryption factor.
8383

8484
#### Defined in
8585

86-
[thresholdElgamal.ts:111](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L111)
86+
[thresholdElgamal.ts:111](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L111)
8787

8888
___
8989

@@ -108,7 +108,7 @@ The combined public key.
108108

109109
#### Defined in
110110

111-
[thresholdElgamal.ts:81](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L81)
111+
[thresholdElgamal.ts:81](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L81)
112112

113113
___
114114

@@ -134,7 +134,7 @@ The result of the partial decryption.
134134

135135
#### Defined in
136136

137-
[thresholdElgamal.ts:98](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L98)
137+
[thresholdElgamal.ts:98](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L98)
138138

139139
___
140140

@@ -160,7 +160,7 @@ The decrypted secret as an integer.
160160

161161
#### Defined in
162162

163-
[elgamal.ts:58](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/elgamal.ts#L58)
163+
[elgamal.ts:58](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/elgamal.ts#L58)
164164

165165
___
166166

@@ -187,7 +187,7 @@ The encrypted secret, consisting of two BigIntegers (c1 and c2).
187187

188188
#### Defined in
189189

190-
[elgamal.ts:32](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/elgamal.ts#L32)
190+
[elgamal.ts:32](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/elgamal.ts#L32)
191191

192192
___
193193

@@ -213,7 +213,7 @@ An array of key shares, each containing a private and public key share.
213213

214214
#### Defined in
215215

216-
[thresholdElgamal.ts:61](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L61)
216+
[thresholdElgamal.ts:61](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L61)
217217

218218
___
219219

@@ -244,7 +244,7 @@ The key share containing a private and public key share for the participant.
244244

245245
#### Defined in
246246

247-
[thresholdElgamal.ts:34](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L34)
247+
[thresholdElgamal.ts:34](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L34)
248248

249249
___
250250

@@ -269,7 +269,7 @@ The generated parameters including the prime, generator, publicKey, and privateK
269269

270270
#### Defined in
271271

272-
[elgamal.ts:13](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/elgamal.ts#L13)
272+
[elgamal.ts:13](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/elgamal.ts#L13)
273273

274274
___
275275

@@ -298,7 +298,7 @@ The group parameters including prime and generator.
298298

299299
#### Defined in
300300

301-
[utils/utils.ts:47](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/utils/utils.ts#L47)
301+
[utils/utils.ts:47](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/utils/utils.ts#L47)
302302

303303
___
304304

@@ -323,7 +323,7 @@ A random bigint within the specified range.
323323

324324
#### Defined in
325325

326-
[utils/utils.ts:68](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/utils/utils.ts#L68)
326+
[utils/utils.ts:68](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/utils/utils.ts#L68)
327327

328328
___
329329

@@ -349,7 +349,7 @@ The result of the multiplication, as a new encrypted message.
349349

350350
#### Defined in
351351

352-
[utils/utils.ts:90](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/utils/utils.ts#L90)
352+
[utils/utils.ts:90](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/utils/utils.ts#L90)
353353

354354
___
355355

@@ -377,4 +377,4 @@ The decrypted secret, assuming it was small enough to be directly encrypted.
377377

378378
#### Defined in
379379

380-
[thresholdElgamal.ts:130](https://github.com/Tenemo/threshold-elgamal/blob/cec5de1333fce35b9cdf8de74bc17da64050e141/src/thresholdElgamal.ts#L130)
380+
[thresholdElgamal.ts:130](https://github.com/Tenemo/threshold-elgamal/blob/200f4b5f9f8a52456b80a9b0ed87c33590168052/src/thresholdElgamal.ts#L130)

src/thresholdElgamal.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,26 @@ describe('Threshold ElGamal', () => {
179179
const decryptionSharesOption1 = [
180180
createDecryptionShare(
181181
aggregatedEncryptedVoteOption1,
182-
participant1Keys.privateKey,
182+
// The order of the shares does not matter during decryption.
183+
participant3Keys.privateKey,
183184
),
184185
createDecryptionShare(
185186
aggregatedEncryptedVoteOption1,
186-
participant2Keys.privateKey,
187+
participant1Keys.privateKey,
187188
),
188189
createDecryptionShare(
189190
aggregatedEncryptedVoteOption1,
190-
participant3Keys.privateKey,
191+
participant2Keys.privateKey,
191192
),
192193
];
193194
const decryptionSharesOption2 = [
194195
createDecryptionShare(
195196
aggregatedEncryptedVoteOption2,
196-
participant1Keys.privateKey,
197+
participant2Keys.privateKey,
197198
),
198199
createDecryptionShare(
199200
aggregatedEncryptedVoteOption2,
200-
participant2Keys.privateKey,
201+
participant1Keys.privateKey,
201202
),
202203
createDecryptionShare(
203204
aggregatedEncryptedVoteOption2,

tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"outDir": "./dist/",
55
"target": "ES2020",
6-
"module": "esnext",
6+
"module": "commonjs",
7+
"moduleResolution": "node",
78
"noEmit": false,
89
"declaration": true,
910
"sourceMap": false,

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"baseUrl": "./src/",
44
"target": "ES2020",
55
"module": "ESNext",
6-
"moduleResolution": "Bundler",
6+
"moduleResolution": "node",
77
"removeComments": true,
88
"declaration": false,
99
"allowSyntheticDefaultImports": true,

0 commit comments

Comments
 (0)