threshold-elgamal 0.1.5 → 0.1.7
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.
- package/README.md +15 -1
- package/docs/{README.md → index.md} +15 -1
- package/docs/modules.md +16 -16
- package/eslint.config.js +2 -22
- package/package.json +2 -2
- package/docs/.nojekyll +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Threshold ElGamal
|
|
2
2
|
|
|
3
|
-
This project is a collection of functions implementing the ElGamal encryption algorithm in TypeScript. Its core includes ElGamal functions for key generation, encryption, and decryption. It is extended with support for threshold encryption.
|
|
3
|
+
This project is a collection of functions implementing the ElGamal encryption algorithm in TypeScript on top of native JavaScript BigInteger. Its core includes ElGamal functions for key generation, encryption, and decryption. It is extended with support for threshold encryption.
|
|
4
4
|
|
|
5
5
|
**WIP: Early version. Thresholds when set below the number of scheme participants don't behave as expected.**
|
|
6
6
|
However, it works correctly with `threshold == participantsCount`, which is its main use case for myself for now.
|
|
@@ -13,6 +13,20 @@ It was written as clearly as possible, modularized, and with long, explicit vari
|
|
|
13
13
|
|
|
14
14
|
The JavaScript/TypeScript ecosystem seems to be lacking in modern, functional ElGamal libraries that work out of the box with reasonable default (this library isn't at that point yet). All PRs are welcome.
|
|
15
15
|
|
|
16
|
+
## Libraries/tools used
|
|
17
|
+
|
|
18
|
+
- TypeScript
|
|
19
|
+
- Vitest
|
|
20
|
+
- ESLint + Prettier
|
|
21
|
+
- Typedoc
|
|
22
|
+
|
|
23
|
+
## Production dependencies
|
|
24
|
+
|
|
25
|
+
- [bigint-mod-arith](https://www.npmjs.com/package/bigint-mod-arith)
|
|
26
|
+
- [random-bigint](https://www.npmjs.com/package/random-bigint)
|
|
27
|
+
|
|
28
|
+
It has no other production dependencies apart from these two. They could be inlined easily, if needed.
|
|
29
|
+
|
|
16
30
|
## TODO
|
|
17
31
|
|
|
18
32
|
- Hashing messages
|
|
@@ -2,7 +2,7 @@ threshold-elgamal / [Exports](modules.md)
|
|
|
2
2
|
|
|
3
3
|
# Threshold ElGamal
|
|
4
4
|
|
|
5
|
-
This project is a collection of functions implementing the ElGamal encryption algorithm in TypeScript. Its core includes ElGamal functions for key generation, encryption, and decryption. It is extended with support for threshold encryption.
|
|
5
|
+
This project is a collection of functions implementing the ElGamal encryption algorithm in TypeScript on top of native JavaScript BigInteger. Its core includes ElGamal functions for key generation, encryption, and decryption. It is extended with support for threshold encryption.
|
|
6
6
|
|
|
7
7
|
**WIP: Early version. Thresholds when set below the number of scheme participants don't behave as expected.**
|
|
8
8
|
However, it works correctly with `threshold == participantsCount`, which is its main use case for myself for now.
|
|
@@ -15,6 +15,20 @@ It was written as clearly as possible, modularized, and with long, explicit vari
|
|
|
15
15
|
|
|
16
16
|
The JavaScript/TypeScript ecosystem seems to be lacking in modern, functional ElGamal libraries that work out of the box with reasonable default (this library isn't at that point yet). All PRs are welcome.
|
|
17
17
|
|
|
18
|
+
## Libraries/tools used
|
|
19
|
+
|
|
20
|
+
- TypeScript
|
|
21
|
+
- Vitest
|
|
22
|
+
- ESLint + Prettier
|
|
23
|
+
- Typedoc
|
|
24
|
+
|
|
25
|
+
## Production dependencies
|
|
26
|
+
|
|
27
|
+
- [bigint-mod-arith](https://www.npmjs.com/package/bigint-mod-arith)
|
|
28
|
+
- [random-bigint](https://www.npmjs.com/package/random-bigint)
|
|
29
|
+
|
|
30
|
+
It has no other production dependencies apart from these two. They could be inlined easily, if needed.
|
|
31
|
+
|
|
18
32
|
## TODO
|
|
19
33
|
|
|
20
34
|
- Hashing messages
|
package/docs/modules.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[threshold-elgamal](
|
|
1
|
+
[threshold-elgamal](index.md) / Exports
|
|
2
2
|
|
|
3
3
|
# threshold-elgamal
|
|
4
4
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
#### Defined in
|
|
42
42
|
|
|
43
|
-
[types.ts:1](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
43
|
+
[types.ts:1](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/types.ts#L1)
|
|
44
44
|
|
|
45
45
|
___
|
|
46
46
|
|
|
@@ -57,7 +57,7 @@ ___
|
|
|
57
57
|
|
|
58
58
|
#### Defined in
|
|
59
59
|
|
|
60
|
-
[types.ts:13](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
60
|
+
[types.ts:13](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/types.ts#L13)
|
|
61
61
|
|
|
62
62
|
___
|
|
63
63
|
|
|
@@ -76,7 +76,7 @@ ___
|
|
|
76
76
|
|
|
77
77
|
#### Defined in
|
|
78
78
|
|
|
79
|
-
[types.ts:6](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
79
|
+
[types.ts:6](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/types.ts#L6)
|
|
80
80
|
|
|
81
81
|
___
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ ___
|
|
|
93
93
|
|
|
94
94
|
#### Defined in
|
|
95
95
|
|
|
96
|
-
[types.ts:18](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
96
|
+
[types.ts:18](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/types.ts#L18)
|
|
97
97
|
|
|
98
98
|
## Functions
|
|
99
99
|
|
|
@@ -118,7 +118,7 @@ The combined decryption factor.
|
|
|
118
118
|
|
|
119
119
|
#### Defined in
|
|
120
120
|
|
|
121
|
-
[thresholdElgamal.ts:129](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
121
|
+
[thresholdElgamal.ts:129](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L129)
|
|
122
122
|
|
|
123
123
|
___
|
|
124
124
|
|
|
@@ -143,7 +143,7 @@ The combined public key.
|
|
|
143
143
|
|
|
144
144
|
#### Defined in
|
|
145
145
|
|
|
146
|
-
[thresholdElgamal.ts:103](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
146
|
+
[thresholdElgamal.ts:103](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L103)
|
|
147
147
|
|
|
148
148
|
___
|
|
149
149
|
|
|
@@ -169,7 +169,7 @@ The result of the partial decryption.
|
|
|
169
169
|
|
|
170
170
|
#### Defined in
|
|
171
171
|
|
|
172
|
-
[thresholdElgamal.ts:116](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
172
|
+
[thresholdElgamal.ts:116](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L116)
|
|
173
173
|
|
|
174
174
|
___
|
|
175
175
|
|
|
@@ -195,7 +195,7 @@ The decrypted secret as an integer.
|
|
|
195
195
|
|
|
196
196
|
#### Defined in
|
|
197
197
|
|
|
198
|
-
[elgamal.ts:77](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
198
|
+
[elgamal.ts:77](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/elgamal.ts#L77)
|
|
199
199
|
|
|
200
200
|
___
|
|
201
201
|
|
|
@@ -222,7 +222,7 @@ The encrypted secret, consisting of two BigIntegers (c1 and c2).
|
|
|
222
222
|
|
|
223
223
|
#### Defined in
|
|
224
224
|
|
|
225
|
-
[elgamal.ts:51](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
225
|
+
[elgamal.ts:51](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/elgamal.ts#L51)
|
|
226
226
|
|
|
227
227
|
___
|
|
228
228
|
|
|
@@ -248,7 +248,7 @@ An array of key shares, each containing a private and public key share.
|
|
|
248
248
|
|
|
249
249
|
#### Defined in
|
|
250
250
|
|
|
251
|
-
[thresholdElgamal.ts:83](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
251
|
+
[thresholdElgamal.ts:83](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L83)
|
|
252
252
|
|
|
253
253
|
___
|
|
254
254
|
|
|
@@ -273,7 +273,7 @@ The generated parameters including the prime, generator, publicKey, and privateK
|
|
|
273
273
|
|
|
274
274
|
#### Defined in
|
|
275
275
|
|
|
276
|
-
[elgamal.ts:14](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
276
|
+
[elgamal.ts:14](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/elgamal.ts#L14)
|
|
277
277
|
|
|
278
278
|
___
|
|
279
279
|
|
|
@@ -299,7 +299,7 @@ The key share containing a private and public key share for the participant.
|
|
|
299
299
|
|
|
300
300
|
#### Defined in
|
|
301
301
|
|
|
302
|
-
[thresholdElgamal.ts:56](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
302
|
+
[thresholdElgamal.ts:56](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L56)
|
|
303
303
|
|
|
304
304
|
___
|
|
305
305
|
|
|
@@ -324,7 +324,7 @@ A random bigint within the specified range.
|
|
|
324
324
|
|
|
325
325
|
#### Defined in
|
|
326
326
|
|
|
327
|
-
[utils.ts:11](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
327
|
+
[utils.ts:11](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/utils.ts#L11)
|
|
328
328
|
|
|
329
329
|
___
|
|
330
330
|
|
|
@@ -350,7 +350,7 @@ The result of the multiplication, as a new encrypted message.
|
|
|
350
350
|
|
|
351
351
|
#### Defined in
|
|
352
352
|
|
|
353
|
-
[utils.ts:33](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
353
|
+
[utils.ts:33](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/utils.ts#L33)
|
|
354
354
|
|
|
355
355
|
___
|
|
356
356
|
|
|
@@ -378,4 +378,4 @@ The decrypted secret, assuming it was small enough to be directly encrypted.
|
|
|
378
378
|
|
|
379
379
|
#### Defined in
|
|
380
380
|
|
|
381
|
-
[thresholdElgamal.ts:148](https://github.com/Tenemo/threshold-elgamal/blob/
|
|
381
|
+
[thresholdElgamal.ts:148](https://github.com/Tenemo/threshold-elgamal/blob/10f1361a99b0f5ef342dc456d82e69dcabbdeb55/src/thresholdElgamal.ts#L148)
|
package/eslint.config.js
CHANGED
|
@@ -126,7 +126,7 @@ export default [
|
|
|
126
126
|
],
|
|
127
127
|
overrides: [
|
|
128
128
|
{
|
|
129
|
-
files: ['**/*.mjs', '**/*.js'
|
|
129
|
+
files: ['**/*.mjs', '**/*.js'],
|
|
130
130
|
rules: {
|
|
131
131
|
'@typescript-eslint/no-unsafe-assignment': OFF,
|
|
132
132
|
'@typescript-eslint/no-unsafe-member-access': OFF,
|
|
@@ -136,26 +136,6 @@ export default [
|
|
|
136
136
|
],
|
|
137
137
|
}),
|
|
138
138
|
{
|
|
139
|
-
|
|
140
|
-
rules: {
|
|
141
|
-
'prettier/prettier': OFF,
|
|
142
|
-
'@typescript-eslint/consistent-type-definitions': OFF,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
files: ['**/*.spec.tsx'],
|
|
147
|
-
rules: {
|
|
148
|
-
'@typescript-eslint/ban-ts-comment': OFF,
|
|
149
|
-
'@typescript-eslint/no-unsafe-return': OFF,
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
ignores: [
|
|
154
|
-
'node_modules/*',
|
|
155
|
-
'.tmp/*',
|
|
156
|
-
'coverage/*',
|
|
157
|
-
'dist/*',
|
|
158
|
-
'**/*.html',
|
|
159
|
-
],
|
|
139
|
+
ignores: ['node_modules/*', 'docs/*', 'dist/*'],
|
|
160
140
|
},
|
|
161
141
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "threshold-elgamal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"author": "Piotr Piech <piotr@piech.dev>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "threshold-elgamal",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "vitest --watch=false --reporter=verbose",
|
|
26
26
|
"test:watch": "vitest --watch=true --reporter=verbose",
|
|
27
27
|
"pretypedoc": "rimraf docs",
|
|
28
|
-
"typedoc": "typedoc --plugin typedoc-plugin-markdown src --out docs",
|
|
28
|
+
"typedoc": "typedoc --plugin typedoc-plugin-markdown src --out docs --darkHighlightTheme dark-plus --githubPages false --entryDocument index.md",
|
|
29
29
|
"prepublish:public": "npm run prebuild",
|
|
30
30
|
"publish:public": "npm publish --access public"
|
|
31
31
|
},
|
package/docs/.nojekyll
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|