@digitaldefiance/node-ecies-lib 4.17.10 → 4.18.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.
Files changed (50) hide show
  1. package/README.md +6 -1
  2. package/package.json +3 -3
  3. package/src/lib/voting/index.d.ts +1 -0
  4. package/src/lib/voting/index.d.ts.map +1 -1
  5. package/src/lib/voting/index.js +2 -0
  6. package/src/lib/voting/index.js.map +1 -1
  7. package/src/lib/voting/threshold/ceremony-coordinator.d.ts +25 -0
  8. package/src/lib/voting/threshold/ceremony-coordinator.d.ts.map +1 -0
  9. package/src/lib/voting/threshold/ceremony-coordinator.js +64 -0
  10. package/src/lib/voting/threshold/ceremony-coordinator.js.map +1 -0
  11. package/src/lib/voting/threshold/index.d.ts +16 -0
  12. package/src/lib/voting/threshold/index.d.ts.map +1 -1
  13. package/src/lib/voting/threshold/index.js +60 -1
  14. package/src/lib/voting/threshold/index.js.map +1 -1
  15. package/src/lib/voting/threshold/partial-decryption-service.d.ts +51 -0
  16. package/src/lib/voting/threshold/partial-decryption-service.d.ts.map +1 -0
  17. package/src/lib/voting/threshold/partial-decryption-service.js +65 -0
  18. package/src/lib/voting/threshold/partial-decryption-service.js.map +1 -0
  19. package/src/lib/voting/threshold/threshold-aggregators.d.ts +43 -0
  20. package/src/lib/voting/threshold/threshold-aggregators.d.ts.map +1 -0
  21. package/src/lib/voting/threshold/threshold-aggregators.js +53 -0
  22. package/src/lib/voting/threshold/threshold-aggregators.js.map +1 -0
  23. package/src/lib/voting/threshold/threshold-audit-log.d.ts +31 -0
  24. package/src/lib/voting/threshold/threshold-audit-log.d.ts.map +1 -0
  25. package/src/lib/voting/threshold/threshold-audit-log.js +101 -0
  26. package/src/lib/voting/threshold/threshold-audit-log.js.map +1 -0
  27. package/src/lib/voting/threshold/threshold-key-generator.d.ts +45 -0
  28. package/src/lib/voting/threshold/threshold-key-generator.d.ts.map +1 -0
  29. package/src/lib/voting/threshold/threshold-key-generator.js +60 -0
  30. package/src/lib/voting/threshold/threshold-key-generator.js.map +1 -0
  31. package/src/lib/voting/threshold/threshold-poll-factory.d.ts +16 -0
  32. package/src/lib/voting/threshold/threshold-poll-factory.d.ts.map +1 -0
  33. package/src/lib/voting/threshold/threshold-poll-factory.js +19 -0
  34. package/src/lib/voting/threshold/threshold-poll-factory.js.map +1 -0
  35. package/src/lib/voting/threshold/threshold-poll.d.ts +21 -0
  36. package/src/lib/voting/threshold/threshold-poll.d.ts.map +1 -0
  37. package/src/lib/voting/threshold/threshold-poll.js +22 -0
  38. package/src/lib/voting/threshold/threshold-poll.js.map +1 -0
  39. package/src/lib/voting/threshold-corporate-vote-example.d.ts +33 -0
  40. package/src/lib/voting/threshold-corporate-vote-example.d.ts.map +1 -0
  41. package/src/lib/voting/threshold-corporate-vote-example.js +206 -0
  42. package/src/lib/voting/threshold-corporate-vote-example.js.map +1 -0
  43. package/src/lib/voting/threshold-small-org-example.d.ts +38 -0
  44. package/src/lib/voting/threshold-small-org-example.d.ts.map +1 -0
  45. package/src/lib/voting/threshold-small-org-example.js +186 -0
  46. package/src/lib/voting/threshold-small-org-example.js.map +1 -0
  47. package/src/lib/voting/threshold-us-election-example.d.ts +33 -0
  48. package/src/lib/voting/threshold-us-election-example.d.ts.map +1 -0
  49. package/src/lib/voting/threshold-us-election-example.js +213 -0
  50. package/src/lib/voting/threshold-us-election-example.js.map +1 -0
package/README.md CHANGED
@@ -63,10 +63,12 @@ A comprehensive voting system built on homomorphic encryption with 17 voting met
63
63
 
64
64
  **When NOT to use:**
65
65
  - Simple polls where privacy is not a concern (use a basic database instead)
66
- - Real-time result displays during voting (results are encrypted until poll closure)
67
66
  - Systems where the computational overhead of homomorphic encryption is prohibitive
68
67
 
68
+ > **Note**: Real-time result displays during voting are now supported via the [Threshold Voting](src/lib/voting/README.md#threshold-voting-nodejs-extensions) module, which enables configurable interval decryption.
69
+
69
70
  - **All 17 Methods Fully Implemented**: Plurality, Approval, Weighted, Borda Count, Score, Yes/No, Yes/No/Abstain, Supermajority, Ranked Choice (IRV), Two-Round, STAR, STV, Quadratic, Consensus, Consent-Based
71
+ - **Threshold Decryption**: Distributed trust with k-of-n Guardians, real-time interval tallies, and zero-knowledge proofs ([details](src/lib/voting/README.md#threshold-voting-nodejs-extensions))
70
72
  - **Node.js Optimized**: Uses Buffer instead of Uint8Array for better Node.js performance
71
73
  - **Extended PlatformID**: Supports Buffer and mongoose ObjectId in addition to base types
72
74
  - **Core Security Features**:
@@ -546,6 +548,7 @@ All transforms extend Node.js `Transform` class for use with Node.js streams.
546
548
  - **`EncryptedVote<TID extends PlatformID>`**: Encrypted vote structure with generic ID support (defaults to Buffer).
547
549
  - **`PollResults<TID extends PlatformID>`**: Tally results with winner(s) and generic ID support (defaults to Buffer).
548
550
  - **`VoteReceipt`**: Cryptographic vote receipt with signature verification.
551
+ - **Threshold Voting**: `ThresholdKeyGenerator`, `GuardianRegistry`, `CeremonyCoordinator`, `DecryptionCombiner`, `IntervalScheduler`, `PublicTallyFeed`, `TallyVerifier`, `ThresholdPoll`, `ThresholdPollFactory`, `ThresholdAuditLog` — see [Threshold Voting docs](src/lib/voting/README.md#threshold-voting-nodejs-extensions)
549
552
 
550
553
  ## API Reference
551
554
 
@@ -762,6 +765,8 @@ describe('Integration with suite-core-lib', () => {
762
765
 
763
766
  ## ChangeLog
764
767
 
768
+ ### v4.18.0 Threshold voting
769
+
765
770
  ### v4.16.x (v4.16.0 - v4.16.20)
766
771
 
767
772
  **Voting Key Derivation Security Improvements**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/node-ecies-lib",
3
- "version": "4.17.10",
3
+ "version": "4.18.0",
4
4
  "description": "Digital Defiance Node ECIES Library",
5
5
  "homepage": "https://github.com/Digital-Defiance/node-ecies-lib",
6
6
  "repository": {
@@ -59,8 +59,8 @@
59
59
  "license": "MIT",
60
60
  "packageManager": "yarn@4.10.3",
61
61
  "dependencies": {
62
- "@digitaldefiance/ecies-lib": "4.17.10",
63
- "@digitaldefiance/i18n-lib": "4.4.0",
62
+ "@digitaldefiance/ecies-lib": "4.18.0",
63
+ "@digitaldefiance/i18n-lib": "4.5.0",
64
64
  "@ethereumjs/wallet": "^2.0.4",
65
65
  "@noble/curves": "^1.4.2",
66
66
  "@noble/hashes": "^1.4.0",
@@ -47,4 +47,5 @@ export * from './enumerations';
47
47
  export type * from './interfaces';
48
48
  export { NodeVoteLogger, NodeCheckpointManager } from './persistent-state';
49
49
  export { VotingPoll, type ECKeyPairBuffer } from './poll';
50
+ export * from './threshold';
50
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,cAAc,gBAAgB,CAAC;AAG/B,mBAAmB,cAAc,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,cAAc,gBAAgB,CAAC;AAG/B,mBAAmB,cAAc,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG1D,cAAc,aAAa,CAAC"}
@@ -71,4 +71,6 @@ Object.defineProperty(exports, "NodeCheckpointManager", { enumerable: true, get:
71
71
  // Export legacy Node.js-specific wrapper (for backward compatibility)
72
72
  var poll_1 = require("./poll");
73
73
  Object.defineProperty(exports, "VotingPoll", { enumerable: true, get: function () { return poll_1.VotingPoll; } });
74
+ // Re-export threshold voting module
75
+ tslib_1.__exportStar(require("./threshold"), exports);
74
76
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;AAEH,+DAA+D;AAC/D,yCAAmC;AAA1B,iGAAA,IAAI,OAAA;AACb,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,uCAAsE;AAA7D,mHAAA,uBAAuB,OAAA;AAAE,2GAAA,eAAe,OAAA;AACjD,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAC1B,mDAAuD;AAA9C,qHAAA,mBAAmB,OAAA;AAC5B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AACxB,qEAKmC;AAJjC,6HAAA,kBAAkB,OAAA;AAClB,2HAAA,gBAAgB,OAAA;AAChB,0HAAA,eAAe,OAAA;AACf,6HAAA,kBAAkB,OAAA;AAEpB,uDAAwD;AAA/C,sHAAA,kBAAkB,OAAA;AAE3B,wEAAwE;AACxE,yDAA+B;AAK/B,0CAA0C;AAC1C,uDAA2E;AAAlE,kHAAA,cAAc,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAE9C,sEAAsE;AACtE,+BAA0D;AAAjD,kGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;AAEH,+DAA+D;AAC/D,yCAAmC;AAA1B,iGAAA,IAAI,OAAA;AACb,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,uCAAsE;AAA7D,mHAAA,uBAAuB,OAAA;AAAE,2GAAA,eAAe,OAAA;AACjD,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAC1B,mDAAuD;AAA9C,qHAAA,mBAAmB,OAAA;AAC5B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AACxB,qEAKmC;AAJjC,6HAAA,kBAAkB,OAAA;AAClB,2HAAA,gBAAgB,OAAA;AAChB,0HAAA,eAAe,OAAA;AACf,6HAAA,kBAAkB,OAAA;AAEpB,uDAAwD;AAA/C,sHAAA,kBAAkB,OAAA;AAE3B,wEAAwE;AACxE,yDAA+B;AAK/B,0CAA0C;AAC1C,uDAA2E;AAAlE,kHAAA,cAAc,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAE9C,sEAAsE;AACtE,+BAA0D;AAAjD,kGAAA,UAAU,OAAA;AAEnB,oCAAoC;AACpC,sDAA4B"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Ceremony Coordinator - Node.js Optimized
3
+ *
4
+ * Extends ecies-lib CeremonyCoordinator with Buffer conversions
5
+ * for Uint8Array fields in Ceremony objects (nonce, result inputHash).
6
+ *
7
+ * @module voting/threshold
8
+ */
9
+ import { CeremonyCoordinator as BaseCeremonyCoordinator } from '@digitaldefiance/ecies-lib';
10
+ import type { Ceremony, ThresholdKeyConfig } from '@digitaldefiance/ecies-lib';
11
+ import type { PublicKey } from 'paillier-bigint';
12
+ import type { PlatformID } from '../../../interfaces';
13
+ /**
14
+ * Node.js CeremonyCoordinator that extends ecies-lib CeremonyCoordinator.
15
+ *
16
+ * Converts Uint8Array fields (nonce, inputHash) to Buffer in returned
17
+ * Ceremony objects for consistency with the node-ecies-lib Buffer convention.
18
+ */
19
+ export declare class CeremonyCoordinator<TID extends PlatformID = Buffer> extends BaseCeremonyCoordinator<TID> {
20
+ constructor(publicKey: PublicKey, verificationKeys: readonly Uint8Array[], theta: bigint, config: ThresholdKeyConfig, ceremonyTimeoutMs?: number);
21
+ startCeremony(pollId: TID, intervalNumber: number, encryptedTally: bigint[]): Ceremony<TID>;
22
+ getCeremony(ceremonyId: string): Ceremony<TID> | undefined;
23
+ getCeremoniesForPoll(pollId: TID): readonly Ceremony<TID>[];
24
+ }
25
+ //# sourceMappingURL=ceremony-coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ceremony-coordinator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/ceremony-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkCtD;;;;;GAKG;AACH,qBAAa,mBAAmB,CAC9B,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,uBAAuB,CAAC,GAAG,CAAC;gBAElC,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,SAAS,UAAU,EAAE,EACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,SAAI;IAKvB,aAAa,CACX,MAAM,EAAE,GAAG,EACX,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EAAE,GACvB,QAAQ,CAAC,GAAG,CAAC;IAShB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS;IAK1D,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,QAAQ,CAAC,GAAG,CAAC,EAAE;CAK5D"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * Ceremony Coordinator - Node.js Optimized
4
+ *
5
+ * Extends ecies-lib CeremonyCoordinator with Buffer conversions
6
+ * for Uint8Array fields in Ceremony objects (nonce, result inputHash).
7
+ *
8
+ * @module voting/threshold
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.CeremonyCoordinator = void 0;
12
+ const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
13
+ /**
14
+ * Convert Uint8Array fields in a Ceremony to Buffer.
15
+ */
16
+ function convertCeremonyToBuffer(ceremony) {
17
+ const converted = {
18
+ ...ceremony,
19
+ nonce: Buffer.isBuffer(ceremony.nonce)
20
+ ? ceremony.nonce
21
+ : Buffer.from(ceremony.nonce),
22
+ };
23
+ // Convert inputHash in result's combinedProof if present
24
+ if (converted.result) {
25
+ const proof = converted.result.combinedProof;
26
+ const inputHash = Buffer.isBuffer(proof.inputHash)
27
+ ? proof.inputHash
28
+ : Buffer.from(proof.inputHash);
29
+ converted.result = {
30
+ ...converted.result,
31
+ combinedProof: {
32
+ ...proof,
33
+ inputHash,
34
+ },
35
+ };
36
+ }
37
+ return converted;
38
+ }
39
+ /**
40
+ * Node.js CeremonyCoordinator that extends ecies-lib CeremonyCoordinator.
41
+ *
42
+ * Converts Uint8Array fields (nonce, inputHash) to Buffer in returned
43
+ * Ceremony objects for consistency with the node-ecies-lib Buffer convention.
44
+ */
45
+ class CeremonyCoordinator extends ecies_lib_1.CeremonyCoordinator {
46
+ constructor(publicKey, verificationKeys, theta, config, ceremonyTimeoutMs = 0) {
47
+ super(publicKey, verificationKeys, theta, config, ceremonyTimeoutMs);
48
+ }
49
+ startCeremony(pollId, intervalNumber, encryptedTally) {
50
+ const ceremony = super.startCeremony(pollId, intervalNumber, encryptedTally);
51
+ return convertCeremonyToBuffer(ceremony);
52
+ }
53
+ getCeremony(ceremonyId) {
54
+ const ceremony = super.getCeremony(ceremonyId);
55
+ return ceremony ? convertCeremonyToBuffer(ceremony) : undefined;
56
+ }
57
+ getCeremoniesForPoll(pollId) {
58
+ return super
59
+ .getCeremoniesForPoll(pollId)
60
+ .map((c) => convertCeremonyToBuffer(c));
61
+ }
62
+ }
63
+ exports.CeremonyCoordinator = CeremonyCoordinator;
64
+ //# sourceMappingURL=ceremony-coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ceremony-coordinator.js","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/ceremony-coordinator.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,0DAA4F;AAM5F;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAAuB;IAEvB,MAAM,SAAS,GAAkB;QAC/B,GAAG,QAAQ;QACX,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACpC,CAAC,CAAC,QAAQ,CAAC,KAAK;YAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;KAChC,CAAC;IAEF,yDAAyD;IACzD,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,CAAC,CAAC,KAAK,CAAC,SAAS;YACjB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjC,SAAS,CAAC,MAAM,GAAG;YACjB,GAAG,SAAS,CAAC,MAAM;YACnB,aAAa,EAAE;gBACb,GAAG,KAAK;gBACR,SAAS;aACV;SACF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAa,mBAEX,SAAQ,+BAA4B;IACpC,YACE,SAAoB,EACpB,gBAAuC,EACvC,KAAa,EACb,MAA0B,EAC1B,iBAAiB,GAAG,CAAC;QAErB,KAAK,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACvE,CAAC;IAED,aAAa,CACX,MAAW,EACX,cAAsB,EACtB,cAAwB;QAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAClC,MAAM,EACN,cAAc,EACd,cAAc,CACf,CAAC;QACF,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,UAAkB;QAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;IAED,oBAAoB,CAAC,MAAW;QAC9B,OAAO,KAAK;aACT,oBAAoB,CAAC,MAAM,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF;AApCD,kDAoCC"}
@@ -42,4 +42,20 @@
42
42
  */
43
43
  export * from './enumerations';
44
44
  export type * from './interfaces';
45
+ export { ThresholdKeyGenerator, type BufferKeyShare, type BufferThresholdKeyPair, } from './threshold-key-generator';
46
+ export { PartialDecryptionService, type BufferPartialDecryption, } from './partial-decryption-service';
47
+ export { ThresholdPrecinctAggregator, ThresholdCountyAggregator, ThresholdStateAggregator, ThresholdNationalAggregator, } from './threshold-aggregators';
48
+ export { ThresholdPoll } from './threshold-poll';
49
+ export { ThresholdPollFactory } from './threshold-poll-factory';
50
+ export { ThresholdAuditLog } from './threshold-audit-log';
51
+ export { DecryptionCombiner, InsufficientPartialsError, InvalidPartialInCombineError, CombineFailedError, } from '@digitaldefiance/ecies-lib';
52
+ export { GuardianRegistry, GuardianAlreadyRegisteredError, GuardianNotFoundError, InvalidShareIndexError, RegistryFullError, } from '@digitaldefiance/ecies-lib';
53
+ export { IntervalScheduler, PollNotConfiguredError, InvalidIntervalConfigError, PollSchedulingStateError, } from '@digitaldefiance/ecies-lib';
54
+ export { CeremonyCoordinator } from './ceremony-coordinator';
55
+ export { CeremonyNotFoundError, CeremonyAlreadyCompleteError, DuplicatePartialSubmissionError, InvalidCeremonyPartialProofError, } from '@digitaldefiance/ecies-lib';
56
+ export { PublicTallyFeed } from '@digitaldefiance/ecies-lib';
57
+ export { TallyVerifier } from '@digitaldefiance/ecies-lib';
58
+ export { InvalidThresholdConfigError, KeyGenerationFailedError, } from '@digitaldefiance/ecies-lib';
59
+ export { InvalidPartialProofError, DeserializationError, } from '@digitaldefiance/ecies-lib';
60
+ export { InsufficientGuardiansError, InvalidThresholdPollConfigError, } from '@digitaldefiance/ecies-lib';
45
61
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,cAAc,gBAAgB,CAAC;AAG/B,mBAAmB,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,cAAc,gBAAgB,CAAC;AAG/B,mBAAmB,cAAc,CAAC;AAGlC,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC5B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,wBAAwB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,4BAA4B,CAAC"}
@@ -42,8 +42,67 @@
42
42
  * ```
43
43
  */
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.InvalidThresholdPollConfigError = exports.InsufficientGuardiansError = exports.DeserializationError = exports.InvalidPartialProofError = exports.KeyGenerationFailedError = exports.InvalidThresholdConfigError = exports.TallyVerifier = exports.PublicTallyFeed = exports.InvalidCeremonyPartialProofError = exports.DuplicatePartialSubmissionError = exports.CeremonyAlreadyCompleteError = exports.CeremonyNotFoundError = exports.CeremonyCoordinator = exports.PollSchedulingStateError = exports.InvalidIntervalConfigError = exports.PollNotConfiguredError = exports.IntervalScheduler = exports.RegistryFullError = exports.InvalidShareIndexError = exports.GuardianNotFoundError = exports.GuardianAlreadyRegisteredError = exports.GuardianRegistry = exports.CombineFailedError = exports.InvalidPartialInCombineError = exports.InsufficientPartialsError = exports.DecryptionCombiner = exports.ThresholdAuditLog = exports.ThresholdPollFactory = exports.ThresholdPoll = exports.ThresholdNationalAggregator = exports.ThresholdStateAggregator = exports.ThresholdCountyAggregator = exports.ThresholdPrecinctAggregator = exports.PartialDecryptionService = exports.ThresholdKeyGenerator = void 0;
45
46
  const tslib_1 = require("tslib");
46
47
  // Re-export enumerations from ecies-lib
47
48
  tslib_1.__exportStar(require("./enumerations"), exports);
48
- // Node.js-specific extensions will be added in Task 17
49
+ // Node.js Buffer-based extensions
50
+ var threshold_key_generator_1 = require("./threshold-key-generator");
51
+ Object.defineProperty(exports, "ThresholdKeyGenerator", { enumerable: true, get: function () { return threshold_key_generator_1.ThresholdKeyGenerator; } });
52
+ var partial_decryption_service_1 = require("./partial-decryption-service");
53
+ Object.defineProperty(exports, "PartialDecryptionService", { enumerable: true, get: function () { return partial_decryption_service_1.PartialDecryptionService; } });
54
+ var threshold_aggregators_1 = require("./threshold-aggregators");
55
+ Object.defineProperty(exports, "ThresholdPrecinctAggregator", { enumerable: true, get: function () { return threshold_aggregators_1.ThresholdPrecinctAggregator; } });
56
+ Object.defineProperty(exports, "ThresholdCountyAggregator", { enumerable: true, get: function () { return threshold_aggregators_1.ThresholdCountyAggregator; } });
57
+ Object.defineProperty(exports, "ThresholdStateAggregator", { enumerable: true, get: function () { return threshold_aggregators_1.ThresholdStateAggregator; } });
58
+ Object.defineProperty(exports, "ThresholdNationalAggregator", { enumerable: true, get: function () { return threshold_aggregators_1.ThresholdNationalAggregator; } });
59
+ var threshold_poll_1 = require("./threshold-poll");
60
+ Object.defineProperty(exports, "ThresholdPoll", { enumerable: true, get: function () { return threshold_poll_1.ThresholdPoll; } });
61
+ var threshold_poll_factory_1 = require("./threshold-poll-factory");
62
+ Object.defineProperty(exports, "ThresholdPollFactory", { enumerable: true, get: function () { return threshold_poll_factory_1.ThresholdPollFactory; } });
63
+ var threshold_audit_log_1 = require("./threshold-audit-log");
64
+ Object.defineProperty(exports, "ThresholdAuditLog", { enumerable: true, get: function () { return threshold_audit_log_1.ThresholdAuditLog; } });
65
+ // Re-export classes from ecies-lib that don't need Buffer extensions
66
+ // (they use generics and work with any PlatformID)
67
+ var ecies_lib_1 = require("@digitaldefiance/ecies-lib");
68
+ Object.defineProperty(exports, "DecryptionCombiner", { enumerable: true, get: function () { return ecies_lib_1.DecryptionCombiner; } });
69
+ Object.defineProperty(exports, "InsufficientPartialsError", { enumerable: true, get: function () { return ecies_lib_1.InsufficientPartialsError; } });
70
+ Object.defineProperty(exports, "InvalidPartialInCombineError", { enumerable: true, get: function () { return ecies_lib_1.InvalidPartialInCombineError; } });
71
+ Object.defineProperty(exports, "CombineFailedError", { enumerable: true, get: function () { return ecies_lib_1.CombineFailedError; } });
72
+ var ecies_lib_2 = require("@digitaldefiance/ecies-lib");
73
+ Object.defineProperty(exports, "GuardianRegistry", { enumerable: true, get: function () { return ecies_lib_2.GuardianRegistry; } });
74
+ Object.defineProperty(exports, "GuardianAlreadyRegisteredError", { enumerable: true, get: function () { return ecies_lib_2.GuardianAlreadyRegisteredError; } });
75
+ Object.defineProperty(exports, "GuardianNotFoundError", { enumerable: true, get: function () { return ecies_lib_2.GuardianNotFoundError; } });
76
+ Object.defineProperty(exports, "InvalidShareIndexError", { enumerable: true, get: function () { return ecies_lib_2.InvalidShareIndexError; } });
77
+ Object.defineProperty(exports, "RegistryFullError", { enumerable: true, get: function () { return ecies_lib_2.RegistryFullError; } });
78
+ var ecies_lib_3 = require("@digitaldefiance/ecies-lib");
79
+ Object.defineProperty(exports, "IntervalScheduler", { enumerable: true, get: function () { return ecies_lib_3.IntervalScheduler; } });
80
+ Object.defineProperty(exports, "PollNotConfiguredError", { enumerable: true, get: function () { return ecies_lib_3.PollNotConfiguredError; } });
81
+ Object.defineProperty(exports, "InvalidIntervalConfigError", { enumerable: true, get: function () { return ecies_lib_3.InvalidIntervalConfigError; } });
82
+ Object.defineProperty(exports, "PollSchedulingStateError", { enumerable: true, get: function () { return ecies_lib_3.PollSchedulingStateError; } });
83
+ // Node.js Buffer-based CeremonyCoordinator extension
84
+ var ceremony_coordinator_1 = require("./ceremony-coordinator");
85
+ Object.defineProperty(exports, "CeremonyCoordinator", { enumerable: true, get: function () { return ceremony_coordinator_1.CeremonyCoordinator; } });
86
+ // Re-export error classes from ecies-lib ceremony coordinator
87
+ var ecies_lib_4 = require("@digitaldefiance/ecies-lib");
88
+ Object.defineProperty(exports, "CeremonyNotFoundError", { enumerable: true, get: function () { return ecies_lib_4.CeremonyNotFoundError; } });
89
+ Object.defineProperty(exports, "CeremonyAlreadyCompleteError", { enumerable: true, get: function () { return ecies_lib_4.CeremonyAlreadyCompleteError; } });
90
+ Object.defineProperty(exports, "DuplicatePartialSubmissionError", { enumerable: true, get: function () { return ecies_lib_4.DuplicatePartialSubmissionError; } });
91
+ Object.defineProperty(exports, "InvalidCeremonyPartialProofError", { enumerable: true, get: function () { return ecies_lib_4.InvalidCeremonyPartialProofError; } });
92
+ var ecies_lib_5 = require("@digitaldefiance/ecies-lib");
93
+ Object.defineProperty(exports, "PublicTallyFeed", { enumerable: true, get: function () { return ecies_lib_5.PublicTallyFeed; } });
94
+ var ecies_lib_6 = require("@digitaldefiance/ecies-lib");
95
+ Object.defineProperty(exports, "TallyVerifier", { enumerable: true, get: function () { return ecies_lib_6.TallyVerifier; } });
96
+ // Re-export error classes from ecies-lib threshold key generator
97
+ var ecies_lib_7 = require("@digitaldefiance/ecies-lib");
98
+ Object.defineProperty(exports, "InvalidThresholdConfigError", { enumerable: true, get: function () { return ecies_lib_7.InvalidThresholdConfigError; } });
99
+ Object.defineProperty(exports, "KeyGenerationFailedError", { enumerable: true, get: function () { return ecies_lib_7.KeyGenerationFailedError; } });
100
+ // Re-export error classes from ecies-lib partial decryption service
101
+ var ecies_lib_8 = require("@digitaldefiance/ecies-lib");
102
+ Object.defineProperty(exports, "InvalidPartialProofError", { enumerable: true, get: function () { return ecies_lib_8.InvalidPartialProofError; } });
103
+ Object.defineProperty(exports, "DeserializationError", { enumerable: true, get: function () { return ecies_lib_8.DeserializationError; } });
104
+ // Re-export error classes from ecies-lib threshold poll factory
105
+ var ecies_lib_9 = require("@digitaldefiance/ecies-lib");
106
+ Object.defineProperty(exports, "InsufficientGuardiansError", { enumerable: true, get: function () { return ecies_lib_9.InsufficientGuardiansError; } });
107
+ Object.defineProperty(exports, "InvalidThresholdPollConfigError", { enumerable: true, get: function () { return ecies_lib_9.InvalidThresholdPollConfigError; } });
49
108
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;AAEH,wCAAwC;AACxC,yDAA+B;AAK/B,uDAAuD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;;AAEH,wCAAwC;AACxC,yDAA+B;AAK/B,kCAAkC;AAClC,qEAImC;AAHjC,gIAAA,qBAAqB,OAAA;AAKvB,2EAGsC;AAFpC,sIAAA,wBAAwB,OAAA;AAI1B,iEAKiC;AAJ/B,oIAAA,2BAA2B,OAAA;AAC3B,kIAAA,yBAAyB,OAAA;AACzB,iIAAA,wBAAwB,OAAA;AACxB,oIAAA,2BAA2B,OAAA;AAG7B,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAEtB,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAE7B,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAE1B,qEAAqE;AACrE,mDAAmD;AACnD,wDAKoC;AAJlC,+GAAA,kBAAkB,OAAA;AAClB,sHAAA,yBAAyB,OAAA;AACzB,yHAAA,4BAA4B,OAAA;AAC5B,+GAAA,kBAAkB,OAAA;AAGpB,wDAMoC;AALlC,6GAAA,gBAAgB,OAAA;AAChB,2HAAA,8BAA8B,OAAA;AAC9B,kHAAA,qBAAqB,OAAA;AACrB,mHAAA,sBAAsB,OAAA;AACtB,8GAAA,iBAAiB,OAAA;AAGnB,wDAKoC;AAJlC,8GAAA,iBAAiB,OAAA;AACjB,mHAAA,sBAAsB,OAAA;AACtB,uHAAA,0BAA0B,OAAA;AAC1B,qHAAA,wBAAwB,OAAA;AAG1B,qDAAqD;AACrD,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAE5B,8DAA8D;AAC9D,wDAKoC;AAJlC,kHAAA,qBAAqB,OAAA;AACrB,yHAAA,4BAA4B,OAAA;AAC5B,4HAAA,+BAA+B,OAAA;AAC/B,6HAAA,gCAAgC,OAAA;AAGlC,wDAA6D;AAApD,4GAAA,eAAe,OAAA;AAExB,wDAA2D;AAAlD,0GAAA,aAAa,OAAA;AAEtB,iEAAiE;AACjE,wDAGoC;AAFlC,wHAAA,2BAA2B,OAAA;AAC3B,qHAAA,wBAAwB,OAAA;AAG1B,oEAAoE;AACpE,wDAGoC;AAFlC,qHAAA,wBAAwB,OAAA;AACxB,iHAAA,oBAAoB,OAAA;AAGtB,gEAAgE;AAChE,wDAGoC;AAFlC,uHAAA,0BAA0B,OAAA;AAC1B,4HAAA,+BAA+B,OAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Partial Decryption Service - Node.js Optimized
3
+ *
4
+ * Extends ecies-lib PartialDecryptionService with Buffer support
5
+ * for serialization/deserialization.
6
+ *
7
+ * @module voting/threshold
8
+ */
9
+ import { PartialDecryptionService as BasePartialDecryptionService } from '@digitaldefiance/ecies-lib';
10
+ import type { PartialDecryption } from '@digitaldefiance/ecies-lib';
11
+ /**
12
+ * Buffer-based partial decryption with ceremonyNonce as Buffer.
13
+ */
14
+ export interface BufferPartialDecryption extends Omit<PartialDecryption, 'ceremonyNonce'> {
15
+ readonly ceremonyNonce: Buffer;
16
+ }
17
+ /**
18
+ * Node.js PartialDecryptionService that extends ecies-lib PartialDecryptionService.
19
+ *
20
+ * Overrides serialization methods to use Buffer instead of Uint8Array,
21
+ * and converts partial decryption outputs to use Buffer for ceremonyNonce.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const service = new PartialDecryptionService(publicKey);
26
+ * const partial = service.computePartial([ciphertext], keyShare, nonce);
27
+ * // partial.ceremonyNonce is a Buffer
28
+ *
29
+ * const serialized = service.serialize(partial); // returns Buffer
30
+ * const deserialized = service.deserialize(serialized); // ceremonyNonce is Buffer
31
+ * ```
32
+ */
33
+ export declare class PartialDecryptionService extends BasePartialDecryptionService {
34
+ /**
35
+ * Compute partial decryption with Buffer-based output.
36
+ */
37
+ computePartial(encryptedTally: bigint[], keyShare: {
38
+ readonly index: number;
39
+ readonly share: bigint;
40
+ readonly verificationKey: Uint8Array;
41
+ }, ceremonyNonce: Uint8Array): BufferPartialDecryption;
42
+ /**
43
+ * Serialize partial decryption to Buffer.
44
+ */
45
+ serialize(partial: PartialDecryption): Buffer;
46
+ /**
47
+ * Deserialize Buffer to Buffer-based partial decryption.
48
+ */
49
+ deserialize(data: Uint8Array): BufferPartialDecryption;
50
+ }
51
+ //# sourceMappingURL=partial-decryption-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-decryption-service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/partial-decryption-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,wBAAwB,IAAI,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,iBAAiB,EACjB,eAAe,CAChB;IACC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAiBD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE;;OAEG;IACH,cAAc,CACZ,cAAc,EAAE,MAAM,EAAE,EACxB,QAAQ,EAAE;QACR,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;KACtC,EACD,aAAa,EAAE,UAAU,GACxB,uBAAuB;IAS1B;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAK7C;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,uBAAuB;CAIvD"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /**
3
+ * Partial Decryption Service - Node.js Optimized
4
+ *
5
+ * Extends ecies-lib PartialDecryptionService with Buffer support
6
+ * for serialization/deserialization.
7
+ *
8
+ * @module voting/threshold
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.PartialDecryptionService = void 0;
12
+ const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
13
+ /**
14
+ * Convert a Uint8Array-based PartialDecryption to a Buffer-based one.
15
+ */
16
+ function convertPartialToBuffer(partial) {
17
+ return {
18
+ guardianIndex: partial.guardianIndex,
19
+ values: partial.values,
20
+ proof: partial.proof,
21
+ ceremonyNonce: Buffer.from(partial.ceremonyNonce),
22
+ timestamp: partial.timestamp,
23
+ };
24
+ }
25
+ /**
26
+ * Node.js PartialDecryptionService that extends ecies-lib PartialDecryptionService.
27
+ *
28
+ * Overrides serialization methods to use Buffer instead of Uint8Array,
29
+ * and converts partial decryption outputs to use Buffer for ceremonyNonce.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const service = new PartialDecryptionService(publicKey);
34
+ * const partial = service.computePartial([ciphertext], keyShare, nonce);
35
+ * // partial.ceremonyNonce is a Buffer
36
+ *
37
+ * const serialized = service.serialize(partial); // returns Buffer
38
+ * const deserialized = service.deserialize(serialized); // ceremonyNonce is Buffer
39
+ * ```
40
+ */
41
+ class PartialDecryptionService extends ecies_lib_1.PartialDecryptionService {
42
+ /**
43
+ * Compute partial decryption with Buffer-based output.
44
+ */
45
+ computePartial(encryptedTally, keyShare, ceremonyNonce) {
46
+ const basePartial = super.computePartial(encryptedTally, keyShare, ceremonyNonce);
47
+ return convertPartialToBuffer(basePartial);
48
+ }
49
+ /**
50
+ * Serialize partial decryption to Buffer.
51
+ */
52
+ serialize(partial) {
53
+ const baseResult = super.serialize(partial);
54
+ return Buffer.from(baseResult);
55
+ }
56
+ /**
57
+ * Deserialize Buffer to Buffer-based partial decryption.
58
+ */
59
+ deserialize(data) {
60
+ const baseResult = super.deserialize(data);
61
+ return convertPartialToBuffer(baseResult);
62
+ }
63
+ }
64
+ exports.PartialDecryptionService = PartialDecryptionService;
65
+ //# sourceMappingURL=partial-decryption-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-decryption-service.js","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/partial-decryption-service.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,0DAAsG;AAatG;;GAEG;AACH,SAAS,sBAAsB,CAC7B,OAA0B;IAE1B,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QACjD,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAa,wBAAyB,SAAQ,oCAA4B;IACxE;;OAEG;IACH,cAAc,CACZ,cAAwB,EACxB,QAIC,EACD,aAAyB;QAEzB,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CACtC,cAAc,EACd,QAAQ,EACR,aAAa,CACd,CAAC;QACF,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,OAA0B;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,IAAgB;QAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;CACF;AApCD,4DAoCC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Threshold Hierarchical Aggregators - Node.js Optimized
3
+ *
4
+ * Extends ecies-lib threshold aggregators with Buffer as the default
5
+ * TID type for Node.js compatibility.
6
+ *
7
+ * @module voting/threshold
8
+ */
9
+ import { ThresholdPrecinctAggregator as BaseThresholdPrecinctAggregator, ThresholdCountyAggregator as BaseThresholdCountyAggregator, ThresholdStateAggregator as BaseThresholdStateAggregator, ThresholdNationalAggregator as BaseThresholdNationalAggregator } from '@digitaldefiance/ecies-lib';
10
+ import type { ThresholdKeyConfig, IPublicTallyFeed } from '@digitaldefiance/ecies-lib';
11
+ import type { PublicKey } from 'paillier-bigint';
12
+ import type { PlatformID } from '../../../interfaces';
13
+ import type { JurisdictionConfig, IVoteLogger, ICheckpointManager } from '../interfaces';
14
+ import { Poll } from '../poll-core';
15
+ /**
16
+ * Node.js Threshold Precinct Aggregator
17
+ * Extends ecies-lib ThresholdPrecinctAggregator with Buffer default
18
+ */
19
+ export declare class ThresholdPrecinctAggregator<TID extends PlatformID = Buffer> extends BaseThresholdPrecinctAggregator<TID> {
20
+ constructor(poll: Poll<TID>, config: JurisdictionConfig<TID>, publicKey: PublicKey, thresholdConfig: ThresholdKeyConfig, tallyFeed?: IPublicTallyFeed<TID>, logger?: IVoteLogger<TID>, checkpointMgr?: ICheckpointManager<TID>);
21
+ }
22
+ /**
23
+ * Node.js Threshold County Aggregator
24
+ * Extends ecies-lib ThresholdCountyAggregator with Buffer default
25
+ */
26
+ export declare class ThresholdCountyAggregator<TID extends PlatformID = Buffer> extends BaseThresholdCountyAggregator<TID> {
27
+ constructor(config: JurisdictionConfig<TID>, publicKey: PublicKey, thresholdConfig: ThresholdKeyConfig, choices: readonly string[], pollId: TID, tallyFeed?: IPublicTallyFeed<TID>);
28
+ }
29
+ /**
30
+ * Node.js Threshold State Aggregator
31
+ * Extends ecies-lib ThresholdStateAggregator with Buffer default
32
+ */
33
+ export declare class ThresholdStateAggregator<TID extends PlatformID = Buffer> extends BaseThresholdStateAggregator<TID> {
34
+ constructor(config: JurisdictionConfig<TID>, publicKey: PublicKey, thresholdConfig: ThresholdKeyConfig, choices: readonly string[], pollId: TID, tallyFeed?: IPublicTallyFeed<TID>);
35
+ }
36
+ /**
37
+ * Node.js Threshold National Aggregator
38
+ * Extends ecies-lib ThresholdNationalAggregator with Buffer default
39
+ */
40
+ export declare class ThresholdNationalAggregator<TID extends PlatformID = Buffer> extends BaseThresholdNationalAggregator<TID> {
41
+ constructor(config: JurisdictionConfig<TID>, publicKey: PublicKey, thresholdConfig: ThresholdKeyConfig, choices: readonly string[], pollId: TID, tallyFeed?: IPublicTallyFeed<TID>);
42
+ }
43
+ //# sourceMappingURL=threshold-aggregators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threshold-aggregators.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/threshold-aggregators.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,2BAA2B,IAAI,+BAA+B,EAC9D,yBAAyB,IAAI,6BAA6B,EAC1D,wBAAwB,IAAI,4BAA4B,EACxD,2BAA2B,IAAI,+BAA+B,EAC/D,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;;GAGG;AACH,qBAAa,2BAA2B,CACtC,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,+BAA+B,CAAC,GAAG,CAAC;gBAE1C,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,EACf,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,EACnC,SAAS,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACjC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,EACzB,aAAa,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC;CAY1C;AAED;;;GAGG;AACH,qBAAa,yBAAyB,CACpC,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,6BAA6B,CAAC,GAAG,CAAC;gBAExC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,EACnC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,GAAG,EACX,SAAS,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC;CAIpC;AAED;;;GAGG;AACH,qBAAa,wBAAwB,CACnC,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,4BAA4B,CAAC,GAAG,CAAC;gBAEvC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,EACnC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,GAAG,EACX,SAAS,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC;CAIpC;AAED;;;GAGG;AACH,qBAAa,2BAA2B,CACtC,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,+BAA+B,CAAC,GAAG,CAAC;gBAE1C,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,kBAAkB,EACnC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,GAAG,EACX,SAAS,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC;CAIpC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * Threshold Hierarchical Aggregators - Node.js Optimized
4
+ *
5
+ * Extends ecies-lib threshold aggregators with Buffer as the default
6
+ * TID type for Node.js compatibility.
7
+ *
8
+ * @module voting/threshold
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ThresholdNationalAggregator = exports.ThresholdStateAggregator = exports.ThresholdCountyAggregator = exports.ThresholdPrecinctAggregator = void 0;
12
+ const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
13
+ /**
14
+ * Node.js Threshold Precinct Aggregator
15
+ * Extends ecies-lib ThresholdPrecinctAggregator with Buffer default
16
+ */
17
+ class ThresholdPrecinctAggregator extends ecies_lib_1.ThresholdPrecinctAggregator {
18
+ constructor(poll, config, publicKey, thresholdConfig, tallyFeed, logger, checkpointMgr) {
19
+ super(poll, config, publicKey, thresholdConfig, tallyFeed, logger, checkpointMgr);
20
+ }
21
+ }
22
+ exports.ThresholdPrecinctAggregator = ThresholdPrecinctAggregator;
23
+ /**
24
+ * Node.js Threshold County Aggregator
25
+ * Extends ecies-lib ThresholdCountyAggregator with Buffer default
26
+ */
27
+ class ThresholdCountyAggregator extends ecies_lib_1.ThresholdCountyAggregator {
28
+ constructor(config, publicKey, thresholdConfig, choices, pollId, tallyFeed) {
29
+ super(config, publicKey, thresholdConfig, choices, pollId, tallyFeed);
30
+ }
31
+ }
32
+ exports.ThresholdCountyAggregator = ThresholdCountyAggregator;
33
+ /**
34
+ * Node.js Threshold State Aggregator
35
+ * Extends ecies-lib ThresholdStateAggregator with Buffer default
36
+ */
37
+ class ThresholdStateAggregator extends ecies_lib_1.ThresholdStateAggregator {
38
+ constructor(config, publicKey, thresholdConfig, choices, pollId, tallyFeed) {
39
+ super(config, publicKey, thresholdConfig, choices, pollId, tallyFeed);
40
+ }
41
+ }
42
+ exports.ThresholdStateAggregator = ThresholdStateAggregator;
43
+ /**
44
+ * Node.js Threshold National Aggregator
45
+ * Extends ecies-lib ThresholdNationalAggregator with Buffer default
46
+ */
47
+ class ThresholdNationalAggregator extends ecies_lib_1.ThresholdNationalAggregator {
48
+ constructor(config, publicKey, thresholdConfig, choices, pollId, tallyFeed) {
49
+ super(config, publicKey, thresholdConfig, choices, pollId, tallyFeed);
50
+ }
51
+ }
52
+ exports.ThresholdNationalAggregator = ThresholdNationalAggregator;
53
+ //# sourceMappingURL=threshold-aggregators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threshold-aggregators.js","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/threshold-aggregators.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,0DAKoC;AAepC;;;GAGG;AACH,MAAa,2BAEX,SAAQ,uCAAoC;IAC5C,YACE,IAAe,EACf,MAA+B,EAC/B,SAAoB,EACpB,eAAmC,EACnC,SAAiC,EACjC,MAAyB,EACzB,aAAuC;QAEvC,KAAK,CACH,IAAI,EACJ,MAAM,EACN,SAAS,EACT,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,CACd,CAAC;IACJ,CAAC;CACF;AAtBD,kEAsBC;AAED;;;GAGG;AACH,MAAa,yBAEX,SAAQ,qCAAkC;IAC1C,YACE,MAA+B,EAC/B,SAAoB,EACpB,eAAmC,EACnC,OAA0B,EAC1B,MAAW,EACX,SAAiC;QAEjC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAbD,8DAaC;AAED;;;GAGG;AACH,MAAa,wBAEX,SAAQ,oCAAiC;IACzC,YACE,MAA+B,EAC/B,SAAoB,EACpB,eAAmC,EACnC,OAA0B,EAC1B,MAAW,EACX,SAAiC;QAEjC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAbD,4DAaC;AAED;;;GAGG;AACH,MAAa,2BAEX,SAAQ,uCAAoC;IAC5C,YACE,MAA+B,EAC/B,SAAoB,EACpB,eAAmC,EACnC,OAA0B,EAC1B,MAAW,EACX,SAAiC;QAEjC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAbD,kEAaC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Threshold Audit Log - Node.js Optimized
3
+ *
4
+ * Extends ecies-lib ThresholdAuditLog with Buffer support,
5
+ * converting Uint8Array fields (previousHash, entryHash, signature)
6
+ * to Buffer in returned entries.
7
+ *
8
+ * @module voting/threshold
9
+ */
10
+ import { ThresholdAuditLog as BaseThresholdAuditLog, ThresholdAuditEntry } from '@digitaldefiance/ecies-lib';
11
+ import type { PlatformID } from '../../../interfaces';
12
+ import type { IMember } from '../../../interfaces/member';
13
+ /**
14
+ * Node.js ThresholdAuditLog that extends ecies-lib ThresholdAuditLog.
15
+ *
16
+ * Overrides methods to convert Uint8Array fields to Buffer in returned entries,
17
+ * following the same pattern as the node-ecies-lib ImmutableAuditLog.
18
+ */
19
+ export declare class ThresholdAuditLog<TID extends PlatformID = Buffer> extends BaseThresholdAuditLog<TID> {
20
+ constructor(authority: IMember<TID>);
21
+ recordKeyGeneration(pollId: TID, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
22
+ recordKeyShareDistribution(pollId: TID, guardianId: TID, guardianIndex: number, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
23
+ recordCeremonyStarted(pollId: TID, ceremonyId: string, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
24
+ recordPartialSubmitted(pollId: TID, ceremonyId: string, guardianId: TID, guardianIndex: number, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
25
+ recordCeremonyCompleted(pollId: TID, ceremonyId: string, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
26
+ recordTallyPublished(pollId: TID, metadata: Record<string, string | number | boolean>): ThresholdAuditEntry<TID>;
27
+ getEntries(): readonly ThresholdAuditEntry<TID>[];
28
+ getEntriesForPoll(pollId: TID): readonly ThresholdAuditEntry<TID>[];
29
+ getEntriesForCeremony(ceremonyId: string): readonly ThresholdAuditEntry<TID>[];
30
+ }
31
+ //# sourceMappingURL=threshold-audit-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threshold-audit-log.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/voting/threshold/threshold-audit-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,iBAAiB,IAAI,qBAAqB,EAE1C,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AA0B1D;;;;;GAKG;AACH,qBAAa,iBAAiB,CAC5B,GAAG,SAAS,UAAU,GAAG,MAAM,CAC/B,SAAQ,qBAAqB,CAAC,GAAG,CAAC;gBACtB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC;IA8CnC,mBAAmB,CACjB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAI3B,0BAA0B,CACxB,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,GAAG,EACf,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAW3B,qBAAqB,CACnB,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAM3B,sBAAsB,CACpB,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,GAAG,EACf,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAY3B,uBAAuB,CACrB,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAM3B,oBAAoB,CAClB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAClD,mBAAmB,CAAC,GAAG,CAAC;IAI3B,UAAU,IAAI,SAAS,mBAAmB,CAAC,GAAG,CAAC,EAAE;IAIjD,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,mBAAmB,CAAC,GAAG,CAAC,EAAE;IAMnE,qBAAqB,CACnB,UAAU,EAAE,MAAM,GACjB,SAAS,mBAAmB,CAAC,GAAG,CAAC,EAAE;CAKvC"}