@digitaldefiance/ecies-lib 4.17.1 → 4.17.3
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 +36 -1
- package/package.json +1 -1
- package/src/i18n-setup.d.ts +7 -1
- package/src/i18n-setup.d.ts.map +1 -1
- package/src/i18n-setup.js +12 -0
- package/src/i18n-setup.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/lib/voting/index.d.ts +1 -0
- package/src/lib/voting/index.d.ts.map +1 -1
- package/src/lib/voting/index.js +2 -0
- package/src/lib/voting/index.js.map +1 -1
- package/src/lib/voting/threshold/decryption-combiner.d.ts +141 -0
- package/src/lib/voting/threshold/decryption-combiner.d.ts.map +1 -0
- package/src/lib/voting/threshold/decryption-combiner.js +343 -0
- package/src/lib/voting/threshold/decryption-combiner.js.map +1 -0
- package/src/lib/voting/threshold/enumerations/ceremony-status.d.ts +19 -0
- package/src/lib/voting/threshold/enumerations/ceremony-status.d.ts.map +1 -0
- package/src/lib/voting/threshold/enumerations/ceremony-status.js +23 -0
- package/src/lib/voting/threshold/enumerations/ceremony-status.js.map +1 -0
- package/src/lib/voting/threshold/enumerations/guardian-status.d.ts +18 -0
- package/src/lib/voting/threshold/enumerations/guardian-status.d.ts.map +1 -0
- package/src/lib/voting/threshold/enumerations/guardian-status.js +22 -0
- package/src/lib/voting/threshold/enumerations/guardian-status.js.map +1 -0
- package/src/lib/voting/threshold/enumerations/index.d.ts +8 -0
- package/src/lib/voting/threshold/enumerations/index.d.ts.map +1 -0
- package/src/lib/voting/threshold/enumerations/index.js +11 -0
- package/src/lib/voting/threshold/enumerations/index.js.map +1 -0
- package/src/lib/voting/threshold/enumerations/interval-trigger-type.d.ts +15 -0
- package/src/lib/voting/threshold/enumerations/interval-trigger-type.d.ts.map +1 -0
- package/src/lib/voting/threshold/enumerations/interval-trigger-type.js +19 -0
- package/src/lib/voting/threshold/enumerations/interval-trigger-type.js.map +1 -0
- package/src/lib/voting/threshold/enumerations/threshold-audit-event-type.d.ts +29 -0
- package/src/lib/voting/threshold/enumerations/threshold-audit-event-type.d.ts.map +1 -0
- package/src/lib/voting/threshold/enumerations/threshold-audit-event-type.js +33 -0
- package/src/lib/voting/threshold/enumerations/threshold-audit-event-type.js.map +1 -0
- package/src/lib/voting/threshold/guardian-registry.d.ts +120 -0
- package/src/lib/voting/threshold/guardian-registry.d.ts.map +1 -0
- package/src/lib/voting/threshold/guardian-registry.js +227 -0
- package/src/lib/voting/threshold/guardian-registry.js.map +1 -0
- package/src/lib/voting/threshold/index.d.ts +49 -0
- package/src/lib/voting/threshold/index.d.ts.map +1 -0
- package/src/lib/voting/threshold/index.js +69 -0
- package/src/lib/voting/threshold/index.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/ceremony-coordinator.d.ts +19 -0
- package/src/lib/voting/threshold/interfaces/ceremony-coordinator.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/ceremony-coordinator.js +3 -0
- package/src/lib/voting/threshold/interfaces/ceremony-coordinator.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/ceremony.d.ts +33 -0
- package/src/lib/voting/threshold/interfaces/ceremony.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/ceremony.js +3 -0
- package/src/lib/voting/threshold/interfaces/ceremony.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/combined-decryption.d.ts +20 -0
- package/src/lib/voting/threshold/interfaces/combined-decryption.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/combined-decryption.js +3 -0
- package/src/lib/voting/threshold/interfaces/combined-decryption.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/combined-zk-proof.d.ts +16 -0
- package/src/lib/voting/threshold/interfaces/combined-zk-proof.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/combined-zk-proof.js +3 -0
- package/src/lib/voting/threshold/interfaces/combined-zk-proof.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/decryption-combiner.d.ts +14 -0
- package/src/lib/voting/threshold/interfaces/decryption-combiner.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/decryption-combiner.js +3 -0
- package/src/lib/voting/threshold/interfaces/decryption-combiner.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian-registry.d.ts +28 -0
- package/src/lib/voting/threshold/interfaces/guardian-registry.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian-registry.js +3 -0
- package/src/lib/voting/threshold/interfaces/guardian-registry.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian-status-change-event.d.ts +16 -0
- package/src/lib/voting/threshold/interfaces/guardian-status-change-event.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian-status-change-event.js +3 -0
- package/src/lib/voting/threshold/interfaces/guardian-status-change-event.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian.d.ts +25 -0
- package/src/lib/voting/threshold/interfaces/guardian.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/guardian.js +3 -0
- package/src/lib/voting/threshold/interfaces/guardian.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/index.d.ts +32 -0
- package/src/lib/voting/threshold/interfaces/index.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/index.js +6 -0
- package/src/lib/voting/threshold/interfaces/index.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-config.d.ts +17 -0
- package/src/lib/voting/threshold/interfaces/interval-config.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-config.js +3 -0
- package/src/lib/voting/threshold/interfaces/interval-config.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-scheduler.d.ts +23 -0
- package/src/lib/voting/threshold/interfaces/interval-scheduler.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-scheduler.js +3 -0
- package/src/lib/voting/threshold/interfaces/interval-scheduler.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-tally.d.ts +30 -0
- package/src/lib/voting/threshold/interfaces/interval-tally.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-tally.js +3 -0
- package/src/lib/voting/threshold/interfaces/interval-tally.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-trigger-event.d.ts +20 -0
- package/src/lib/voting/threshold/interfaces/interval-trigger-event.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/interval-trigger-event.js +3 -0
- package/src/lib/voting/threshold/interfaces/interval-trigger-event.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/key-share.d.ts +15 -0
- package/src/lib/voting/threshold/interfaces/key-share.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/key-share.js +3 -0
- package/src/lib/voting/threshold/interfaces/key-share.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption-service.d.ts +17 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption-service.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption-service.js +3 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption-service.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption.d.ts +20 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption.js +3 -0
- package/src/lib/voting/threshold/interfaces/partial-decryption.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/public-tally-feed.d.ts +19 -0
- package/src/lib/voting/threshold/interfaces/public-tally-feed.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/public-tally-feed.js +3 -0
- package/src/lib/voting/threshold/interfaces/public-tally-feed.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/tally-subscription.d.ts +16 -0
- package/src/lib/voting/threshold/interfaces/tally-subscription.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/tally-subscription.js +3 -0
- package/src/lib/voting/threshold/interfaces/tally-subscription.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/tally-verifier.d.ts +12 -0
- package/src/lib/voting/threshold/interfaces/tally-verifier.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/tally-verifier.js +3 -0
- package/src/lib/voting/threshold/interfaces/tally-verifier.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-aggregator.d.ts +15 -0
- package/src/lib/voting/threshold/interfaces/threshold-aggregator.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-aggregator.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-aggregator.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-audit-entry.d.ts +28 -0
- package/src/lib/voting/threshold/interfaces/threshold-audit-entry.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-audit-entry.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-audit-entry.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-config.d.ts +12 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-config.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-config.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-config.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-generator.d.ts +12 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-generator.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-generator.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-generator.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-pair.d.ts +30 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-pair.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-pair.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-key-pair.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-config.d.ts +19 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-config.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-config.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-config.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-factory.d.ts +16 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-factory.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-factory.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll-factory.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll.d.ts +25 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll.js +3 -0
- package/src/lib/voting/threshold/interfaces/threshold-poll.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/verification-result.d.ts +17 -0
- package/src/lib/voting/threshold/interfaces/verification-result.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/verification-result.js +3 -0
- package/src/lib/voting/threshold/interfaces/verification-result.js.map +1 -0
- package/src/lib/voting/threshold/interfaces/zk-proof.d.ts +15 -0
- package/src/lib/voting/threshold/interfaces/zk-proof.d.ts.map +1 -0
- package/src/lib/voting/threshold/interfaces/zk-proof.js +3 -0
- package/src/lib/voting/threshold/interfaces/zk-proof.js.map +1 -0
- package/src/lib/voting/threshold/partial-decryption-service.d.ts +130 -0
- package/src/lib/voting/threshold/partial-decryption-service.d.ts.map +1 -0
- package/src/lib/voting/threshold/partial-decryption-service.js +288 -0
- package/src/lib/voting/threshold/partial-decryption-service.js.map +1 -0
- package/src/lib/voting/threshold/threshold-key-generator.d.ts +114 -0
- package/src/lib/voting/threshold/threshold-key-generator.d.ts.map +1 -0
- package/src/lib/voting/threshold/threshold-key-generator.js +275 -0
- package/src/lib/voting/threshold/threshold-key-generator.js.map +1 -0
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ This library implements a modern, enterprise-grade ECIES protocol (v4.0) featuri
|
|
|
23
23
|
- **Curve**: `secp256k1` for ECDH key exchange and ECDSA signatures.
|
|
24
24
|
- **Symmetric**: `AES-256-GCM` for authenticated symmetric encryption.
|
|
25
25
|
- **Hashing**: `SHA-256` and `SHA-512`.
|
|
26
|
+
- **Key Derivation**: `PBKDF2` with configurable profiles (Fast, Standard, Secure, Maximum).
|
|
27
|
+
- **Checksums**: `CRC8`, `CRC16-CCITT`, `CRC32` for data integrity.
|
|
26
28
|
- **Modes**:
|
|
27
29
|
- **Basic**: Minimal overhead (no length prefix) - Use for fixed-size data or when size is known
|
|
28
30
|
- **WithLength**: Includes data length prefix - Use for variable-size data or streaming
|
|
@@ -53,7 +55,8 @@ This library implements a modern, enterprise-grade ECIES protocol (v4.0) featuri
|
|
|
53
55
|
|
|
54
56
|
### 🚀 Advanced Capabilities
|
|
55
57
|
|
|
56
|
-
- **Streaming Encryption**: Memory-efficient processing for large files (<10MB RAM usage for any file size)
|
|
58
|
+
- **Streaming Encryption**: Memory-efficient processing for large files (<10MB RAM usage for any file size) with Web Streams API transforms
|
|
59
|
+
- **Fluent Builders**: Type-safe configuration with `ECIESBuilder` and `MemberBuilder` for clean, chainable APIs
|
|
57
60
|
- **Internationalization (i18n)**: Automatic error translation in 8 languages (en-US, en-GB, fr, es, de, zh-CN, ja, uk)
|
|
58
61
|
- **Runtime Configuration**: Injectable configuration profiles via `ConstantsRegistry` for dependency injection and testing
|
|
59
62
|
- **Cross-Platform**: Fully compatible with Node.js 18+ and modern browsers (Chrome, Edge, Firefox, Safari)
|
|
@@ -1046,6 +1049,19 @@ class MemberService {
|
|
|
1046
1049
|
- **`EciesMultiRecipient`**: Specialized service for handling multi-recipient messages.
|
|
1047
1050
|
- **`EciesFileService`**: Helper for chunked file encryption.
|
|
1048
1051
|
- **`PasswordLoginService`**: Secure authentication using PBKDF2 and encrypted key bundles.
|
|
1052
|
+
- **`AESGCMService`**: Instance-based AES-256-GCM encryption with JSON support.
|
|
1053
|
+
- **Methods**: `encrypt()`, `decrypt()`, `encryptJson()`, `decryptJson()`, `combineEncryptedDataAndTag()`
|
|
1054
|
+
- Supports authenticated encryption with optional AAD
|
|
1055
|
+
- **`Pbkdf2Service`**: Password-based key derivation (PBKDF2).
|
|
1056
|
+
- **Methods**: `deriveKeyFromPasswordAsync()`, `deriveKeyFromPasswordWithProfileAsync()`, `getProfileConfig()`
|
|
1057
|
+
- **Profiles**: Fast, Standard, Secure, Maximum
|
|
1058
|
+
- **`CrcService`**: CRC checksum computation and verification.
|
|
1059
|
+
- **Algorithms**: CRC8, CRC16-CCITT, CRC32
|
|
1060
|
+
- **Methods**: `crc8()`, `crc16()`, `crc32()`, `verifyCrc8()`, `verifyCrc16()`, `verifyCrc32()`
|
|
1061
|
+
- Supports async stream processing with `crc8Async()`, `crc16Async()`, `crc32Async()`
|
|
1062
|
+
- **`XorService`**: Simple XOR cipher for memory obfuscation.
|
|
1063
|
+
- **Static Methods**: `xor()`, `generateKey()`, `stringToBytes()`, `bytesToString()`
|
|
1064
|
+
- Used internally by `SecureString` and `SecureBuffer`
|
|
1049
1065
|
|
|
1050
1066
|
### Voting System Services
|
|
1051
1067
|
|
|
@@ -1095,6 +1111,25 @@ class MemberService {
|
|
|
1095
1111
|
- `fromJson(json, eciesService)`: Deserialize from JSON (uses ID provider)
|
|
1096
1112
|
- `newMember(...)`: Static factory method
|
|
1097
1113
|
- `fromMnemonic(...)`: Create from BIP39 mnemonic
|
|
1114
|
+
- **`MemberBuilder`**: Fluent builder for creating Member instances
|
|
1115
|
+
- **Methods**: `withId()`, `withName()`, `withEmail()`, `withPhone()`, `withType()`, `withKeys()`, `build()`
|
|
1116
|
+
- Provides type-safe member construction with validation
|
|
1117
|
+
|
|
1118
|
+
### Builders
|
|
1119
|
+
|
|
1120
|
+
- **`ECIESBuilder`**: Fluent builder for ECIESService configuration
|
|
1121
|
+
- **Methods**: `create()`, `withServiceConfig()`, `withConstants()`, `withI18n()`, `build()`
|
|
1122
|
+
- Simplifies service initialization with method chaining
|
|
1123
|
+
|
|
1124
|
+
### Stream Transforms
|
|
1125
|
+
|
|
1126
|
+
- **`EciesEncryptTransform`**: Web Streams API transform for ECIES encryption
|
|
1127
|
+
- **`EciesDecryptTransform`**: Web Streams API transform for ECIES decryption
|
|
1128
|
+
- **`ChecksumTransform`**: Stream transform for CRC checksum computation
|
|
1129
|
+
- **`XorTransform`**: Stream transform for XOR cipher operations
|
|
1130
|
+
- **`XorMultipleTransform`**: Stream transform for multiple XOR operations
|
|
1131
|
+
|
|
1132
|
+
All transforms implement the standard `Transformer<I, O>` interface for use with `TransformStream`.
|
|
1098
1133
|
|
|
1099
1134
|
### Voting System Types & Enumerations
|
|
1100
1135
|
|
package/package.json
CHANGED
package/src/i18n-setup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ECIES i18n Setup - v2.0 Architecture
|
|
3
3
|
* Uses i18n-lib 2.0 patterns with runtime validation
|
|
4
4
|
*/
|
|
5
|
-
import type { BrandedPluralMasterStringsCollection, ComponentConfig, CoreLanguageCode, EngineConfig } from '@digitaldefiance/i18n-lib';
|
|
5
|
+
import type { BrandedPluralMasterStringsCollection, ComponentConfig, CoreLanguageCode, EngineConfig, I18nComponentPackage } from '@digitaldefiance/i18n-lib';
|
|
6
6
|
import { I18nEngine } from '@digitaldefiance/i18n-lib';
|
|
7
7
|
import { EciesComponentId, EciesStringKey, type EciesStringKeyValue } from './enumerations/ecies-string-key';
|
|
8
8
|
export declare const EciesI18nEngineKey: "DigitalDefiance.Ecies.I18nEngine";
|
|
@@ -18,6 +18,12 @@ export declare const EciesComponentStrings: BrandedPluralMasterStringsCollection
|
|
|
18
18
|
* Note: Includes all 8 supported languages
|
|
19
19
|
*/
|
|
20
20
|
export declare function createEciesComponentConfig(): ComponentConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an I18nComponentPackage bundling the ECIES ComponentConfig
|
|
23
|
+
* with its branded string key enum. Use this with createI18nSetup's
|
|
24
|
+
* libraryComponents array.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createEciesComponentPackage(): I18nComponentPackage;
|
|
21
27
|
export declare function getEciesI18nEngine(config?: EngineConfig): I18nEngine;
|
|
22
28
|
/**
|
|
23
29
|
* Proxy for backward compatibility
|
package/src/i18n-setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-setup.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/i18n-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,oCAAoC,EACpC,eAAe,EACf,gBAAgB,EAChB,YAAY,
|
|
1
|
+
{"version":3,"file":"i18n-setup.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/i18n-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,oCAAoC,EACpC,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,UAAU,EAIX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AASzC,eAAO,MAAM,kBAAkB,EAAG,kCAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,oCAAoC,CACtE,OAAO,cAAc,EACrB,gBAAgB,CAUjB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,eAAe,CAK5D;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,oBAAoB,CAKlE;AA+CD,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAKpE;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,YAI1B,CAAC;AAEH;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,mBAAmB,EAC9B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,mBAAmB,EAC9B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR"}
|
package/src/i18n-setup.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.eciesI18nEngine = exports.EciesComponentStrings = exports.EciesComponentId = exports.EciesI18nEngineKey = void 0;
|
|
8
8
|
exports.createEciesComponentConfig = createEciesComponentConfig;
|
|
9
|
+
exports.createEciesComponentPackage = createEciesComponentPackage;
|
|
9
10
|
exports.getEciesI18nEngine = getEciesI18nEngine;
|
|
10
11
|
exports.resetEciesI18nEngine = resetEciesI18nEngine;
|
|
11
12
|
exports.getEciesTranslation = getEciesTranslation;
|
|
@@ -46,6 +47,17 @@ function createEciesComponentConfig() {
|
|
|
46
47
|
strings: exports.EciesComponentStrings,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates an I18nComponentPackage bundling the ECIES ComponentConfig
|
|
52
|
+
* with its branded string key enum. Use this with createI18nSetup's
|
|
53
|
+
* libraryComponents array.
|
|
54
|
+
*/
|
|
55
|
+
function createEciesComponentPackage() {
|
|
56
|
+
return {
|
|
57
|
+
config: createEciesComponentConfig(),
|
|
58
|
+
stringKeyEnum: ecies_string_key_1.EciesStringKey,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
49
61
|
/**
|
|
50
62
|
* Create ECIES i18n engine instance
|
|
51
63
|
* Uses i18n 2.0 pattern with runtime validation
|
package/src/i18n-setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-setup.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/i18n-setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"i18n-setup.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/i18n-setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsDH,gEAKC;AAOD,kEAKC;AA+CD,gDAKC;AAcD,oDAEC;AAKD,kDAUC;AAKD,oDAUC;AAhKD,wDAKmC;AACnC,sEAIyC;AAUhC,iGAbP,mCAAgB,OAaO;AATzB,0CAAuD;AACvD,gDAA2D;AAC3D,0CAAwD;AACxD,0CAAuD;AACvD,0CAAyD;AACzD,0CAA0D;AAC1D,gDAAmE;AAEtD,QAAA,kBAAkB,GAAG,kCAA2C,CAAC;AAG9E;;;;GAIG;AACU,QAAA,qBAAqB,GAG9B;IACF,CAAC,wBAAa,CAAC,KAAK,CAAC,EAAE,2BAAmB;IAC1C,CAAC,wBAAa,CAAC,KAAK,CAAC,EAAE,2BAAmB;IAC1C,CAAC,wBAAa,CAAC,EAAE,CAAC,EAAE,uBAAkB;IACtC,CAAC,wBAAa,CAAC,EAAE,CAAC,EAAE,wBAAmB;IACvC,CAAC,wBAAa,CAAC,EAAE,CAAC,EAAE,uBAAkB;IACtC,CAAC,wBAAa,CAAC,KAAK,CAAC,EAAE,mCAA2B;IAClD,CAAC,wBAAa,CAAC,EAAE,CAAC,EAAE,yBAAoB;IACxC,CAAC,wBAAa,CAAC,EAAE,CAAC,EAAE,0BAAqB;CAC1C,CAAC;AAEF;;;GAGG;AACH,SAAgB,0BAA0B;IACxC,OAAO;QACL,EAAE,EAAE,mCAAgB;QACpB,OAAO,EAAE,6BAAqB;KAC/B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B;IACzC,OAAO;QACL,MAAM,EAAE,0BAA0B,EAAE;QACpC,aAAa,EAAE,iCAAc;KAC9B,CAAC;AACJ,CAAC;AAED;;;;G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GAAG,CAAC,QAAQ,EAAE,IAAI;QAChB,OAAO,kBAAkB,EAAE,CAAC,IAAwB,CAAC,CAAC;IACxD,CAAC;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,SAAgB,oBAAoB;IAClC,YAAY,GAAG,SAAS,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,SAA8B,EAC9B,SAA2C,EAC3C,QAAiB;IAEjB,OAAO,kBAAkB,EAAE,CAAC,kBAAkB,CAC5C,SAAS,EACT,SAAS,EACT,QAAQ,CACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,SAA8B,EAC9B,SAA2C,EAC3C,QAAiB;IAEjB,OAAO,kBAAkB,EAAE,CAAC,sBAAsB,CAChD,SAAS,EACT,SAAS,EACT,QAAQ,CACT,CAAC;AACJ,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import './lib/crypto-polyfill';
|
|
|
12
12
|
export * from './builders/index';
|
|
13
13
|
export * from './core/index';
|
|
14
14
|
export * from './lib/index';
|
|
15
|
-
export { createEciesComponentConfig, EciesComponentStrings, EciesI18nEngineKey, getEciesI18nEngine, getEciesTranslation, resetEciesI18nEngine, safeEciesTranslation, } from './i18n-setup';
|
|
15
|
+
export { createEciesComponentConfig, createEciesComponentPackage, EciesComponentStrings, EciesI18nEngineKey, getEciesI18nEngine, getEciesTranslation, resetEciesI18nEngine, safeEciesTranslation, } from './i18n-setup';
|
|
16
16
|
export { encryptionTypeEnumToType, encryptionTypeToString, ensureEciesEncryptionTypeEnum, validateEciesEncryptionTypeEnum, } from './utils/encryption-type-utils';
|
|
17
17
|
export * from './constants';
|
|
18
18
|
export * from './typed-configuration';
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;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i18n 2.0 integration
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ENCRYPTION_STATE_VERSION = exports.validateEciesEncryptionTypeEnum = exports.ensureEciesEncryptionTypeEnum = exports.encryptionTypeToString = exports.encryptionTypeEnumToType = exports.safeEciesTranslation = exports.resetEciesI18nEngine = exports.getEciesTranslation = exports.getEciesI18nEngine = exports.EciesI18nEngineKey = exports.EciesComponentStrings = exports.createEciesComponentConfig = void 0;
|
|
13
|
+
exports.ENCRYPTION_STATE_VERSION = exports.validateEciesEncryptionTypeEnum = exports.ensureEciesEncryptionTypeEnum = exports.encryptionTypeToString = exports.encryptionTypeEnumToType = exports.safeEciesTranslation = exports.resetEciesI18nEngine = exports.getEciesTranslation = exports.getEciesI18nEngine = exports.EciesI18nEngineKey = exports.EciesComponentStrings = exports.createEciesComponentPackage = exports.createEciesComponentConfig = void 0;
|
|
14
14
|
const tslib_1 = require("tslib");
|
|
15
15
|
// CRITICAL: Apply crypto polyfill BEFORE any @noble/curves imports
|
|
16
16
|
// This ensures crypto.getRandomValues returns pure Uint8Array instances
|
|
@@ -22,6 +22,7 @@ tslib_1.__exportStar(require("./lib/index"), exports);
|
|
|
22
22
|
// i18n v2
|
|
23
23
|
var i18n_setup_1 = require("./i18n-setup");
|
|
24
24
|
Object.defineProperty(exports, "createEciesComponentConfig", { enumerable: true, get: function () { return i18n_setup_1.createEciesComponentConfig; } });
|
|
25
|
+
Object.defineProperty(exports, "createEciesComponentPackage", { enumerable: true, get: function () { return i18n_setup_1.createEciesComponentPackage; } });
|
|
25
26
|
Object.defineProperty(exports, "EciesComponentStrings", { enumerable: true, get: function () { return i18n_setup_1.EciesComponentStrings; } });
|
|
26
27
|
Object.defineProperty(exports, "EciesI18nEngineKey", { enumerable: true, get: function () { return i18n_setup_1.EciesI18nEngineKey; } });
|
|
27
28
|
Object.defineProperty(exports, "getEciesI18nEngine", { enumerable: true, get: function () { return i18n_setup_1.getEciesI18nEngine; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;AAEH,mEAAmE;AACnE,wEAAwE;AACxE,iCAA+B;AAE/B,kBAAkB;AAClB,2DAAiC;AACjC,uDAA6B;AAC7B,sDAA4B;AAE5B,UAAU;AACV,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;AAEH,mEAAmE;AACnE,wEAAwE;AACxE,iCAA+B;AAE/B,kBAAkB;AAClB,2DAAiC;AACjC,uDAA6B;AAC7B,sDAA4B;AAE5B,UAAU;AACV,2CASsB;AARpB,wHAAA,0BAA0B,OAAA;AAC1B,yHAAA,2BAA2B,OAAA;AAC3B,mHAAA,qBAAqB,OAAA;AACrB,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,iHAAA,mBAAmB,OAAA;AACnB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AAGtB,mFAAmF;AACnF,mEAAmE;AACnE,uEAKuC;AAJrC,iIAAA,wBAAwB,OAAA;AACxB,+HAAA,sBAAsB,OAAA;AACtB,sIAAA,6BAA6B,OAAA;AAC7B,wIAAA,+BAA+B,OAAA;AAGjC,2DAA2D;AAC3D,oEAAoE;AACpE,8DAA8D;AAE9D,kEAAkE;AAClE,gEAAgE;AAEhE,sDAA4B;AAC5B,gEAAsC;AACtC,yDAA+B;AAC/B,yDAA+B;AAC/B,mDAAyB;AACzB,uDAA6B;AAC7B,uEAA6C;AAC7C,kEAAyE;AAAhE,4HAAA,wBAAwB,OAAA;AAEjC,qEAA2C;AAC3C,qEAA2C;AAC3C,uEAA6C;AAC7C,6DAAmC;AACnC,4DAAkC;AAClC,mDAAyB;AACzB,4DAAkC;AAClC,yDAA+B;AAC/B,0DAAgC;AAChC,0DAAgC;AAChC,qDAA2B;AAC3B,uDAA6B;AAC7B,wDAA8B;AAC9B,kDAAwB;AACxB,kDAAwB;AAExB,qEAAqE;AACrE,uDAA6B"}
|
|
@@ -44,4 +44,5 @@ export { PrecinctAggregator, CountyAggregator, StateAggregator, NationalAggregat
|
|
|
44
44
|
export { BatchVoteProcessor } from './persistent-state';
|
|
45
45
|
export * from './enumerations';
|
|
46
46
|
export type * from './interfaces';
|
|
47
|
+
export * from './threshold';
|
|
47
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,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,cAAc,aAAa,CAAC"}
|
package/src/lib/voting/index.js
CHANGED
|
@@ -62,4 +62,6 @@ var persistent_state_1 = require("./persistent-state");
|
|
|
62
62
|
Object.defineProperty(exports, "BatchVoteProcessor", { enumerable: true, get: function () { return persistent_state_1.BatchVoteProcessor; } });
|
|
63
63
|
// Re-export enumerations
|
|
64
64
|
tslib_1.__exportStar(require("./enumerations"), exports);
|
|
65
|
+
// Re-export threshold voting module
|
|
66
|
+
tslib_1.__exportStar(require("./threshold"), exports);
|
|
65
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;;AAEH,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,yBAAyB;AACzB,yDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/lib/voting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;;AAEH,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,yBAAyB;AACzB,yDAA+B;AAK/B,oCAAoC;AACpC,sDAA4B"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decryption Combiner
|
|
3
|
+
*
|
|
4
|
+
* Combines k partial decryptions using Lagrange interpolation to produce
|
|
5
|
+
* the final plaintext tally. Based on Damgård et al.'s threshold Paillier scheme.
|
|
6
|
+
*
|
|
7
|
+
* The combining process:
|
|
8
|
+
* 1. Verify each partial decryption's ZK proof
|
|
9
|
+
* 2. Compute Lagrange coefficients for the participating share indices
|
|
10
|
+
* 3. Combine partials: product of partial_i^(2·λ_i) mod n²
|
|
11
|
+
* 4. Apply the Paillier L-function: L(x) = (x - 1) / n
|
|
12
|
+
* 5. Multiply by the modular inverse of 4·Δ² to recover plaintext
|
|
13
|
+
*
|
|
14
|
+
* Where Δ = n! (factorial of total shares count).
|
|
15
|
+
*/
|
|
16
|
+
import type { PublicKey } from 'paillier-bigint';
|
|
17
|
+
import type { CombinedDecryption, IDecryptionCombiner, PartialDecryption, ThresholdKeyConfig } from './interfaces';
|
|
18
|
+
/**
|
|
19
|
+
* Error thrown when there are insufficient partial decryptions.
|
|
20
|
+
*/
|
|
21
|
+
export declare class InsufficientPartialsError extends Error {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when a partial decryption's ZK proof is invalid during combining.
|
|
26
|
+
*/
|
|
27
|
+
export declare class InvalidPartialInCombineError extends Error {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Error thrown when decryption combining fails.
|
|
32
|
+
*/
|
|
33
|
+
export declare class CombineFailedError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Combines k partial decryptions into the final plaintext using
|
|
38
|
+
* Lagrange interpolation over the Paillier ciphertext space.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const combiner = new DecryptionCombiner(publicKey, verificationKeys);
|
|
43
|
+
*
|
|
44
|
+
* const result = combiner.combine(
|
|
45
|
+
* partials,
|
|
46
|
+
* encryptedTally,
|
|
47
|
+
* publicKey,
|
|
48
|
+
* { totalShares: 9, threshold: 5 }
|
|
49
|
+
* );
|
|
50
|
+
*
|
|
51
|
+
* console.log(result.tallies); // decrypted vote counts
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare class DecryptionCombiner implements IDecryptionCombiner {
|
|
55
|
+
private readonly verificationKeys;
|
|
56
|
+
private readonly partialService;
|
|
57
|
+
private readonly theta;
|
|
58
|
+
constructor(publicKey: PublicKey, verificationKeys: readonly Uint8Array[], theta: bigint);
|
|
59
|
+
/**
|
|
60
|
+
* Combine k partial decryptions into the final plaintext.
|
|
61
|
+
*
|
|
62
|
+
* @param partials - The partial decryptions from k Guardians
|
|
63
|
+
* @param encryptedTally - The encrypted tally ciphertexts
|
|
64
|
+
* @param publicKey - The Paillier public key
|
|
65
|
+
* @param config - The threshold configuration
|
|
66
|
+
* @returns The combined decryption with plaintext tallies and proof
|
|
67
|
+
* @throws InsufficientPartialsError if fewer than k partials provided
|
|
68
|
+
* @throws InvalidPartialInCombineError if any partial's ZK proof is invalid
|
|
69
|
+
* @throws CombineFailedError if the combining operation fails
|
|
70
|
+
*/
|
|
71
|
+
combine(partials: readonly PartialDecryption[], encryptedTally: bigint[], publicKey: PublicKey, config: ThresholdKeyConfig): CombinedDecryption;
|
|
72
|
+
/**
|
|
73
|
+
* Verify a combined decryption result.
|
|
74
|
+
*
|
|
75
|
+
* Checks that:
|
|
76
|
+
* 1. All individual partial proofs are valid
|
|
77
|
+
* 2. The participating Guardians are authorized (have valid verification keys)
|
|
78
|
+
* 3. The aggregated commitment is consistent
|
|
79
|
+
*/
|
|
80
|
+
verifyCombined(combined: CombinedDecryption, encryptedTally: bigint[], verificationKeys: readonly Uint8Array[], publicKey: PublicKey): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Combine partial decryptions for a single ciphertext.
|
|
83
|
+
*
|
|
84
|
+
* Each partial_i = c^(2·s_i) mod n² (computed by PartialDecryptionService).
|
|
85
|
+
*
|
|
86
|
+
* Using integer Lagrange coefficients λ_i' = Δ · Π_{j≠i} j/(j-i):
|
|
87
|
+
* combined = Π partial_i^(2·λ_i') mod n²
|
|
88
|
+
* = c^(4·Δ·λ) mod n²
|
|
89
|
+
*
|
|
90
|
+
* where λ is the original Paillier secret key.
|
|
91
|
+
*
|
|
92
|
+
* By the Paillier L-function property: L(c^(4·Δ·λ)) = 4·Δ·λ·m mod n
|
|
93
|
+
* So: plaintext = L(combined) · (4·Δ)^(-1) mod n
|
|
94
|
+
*/
|
|
95
|
+
private combineSingleCiphertext;
|
|
96
|
+
/**
|
|
97
|
+
* Compute integer Lagrange coefficient scaled by delta.
|
|
98
|
+
*
|
|
99
|
+
* λ_i = Δ · Π_{j≠i} (j / (j - i))
|
|
100
|
+
*
|
|
101
|
+
* Since we scale by Δ = n!, the result is always an integer.
|
|
102
|
+
*/
|
|
103
|
+
private lagrangeCoefficientInteger;
|
|
104
|
+
/**
|
|
105
|
+
* Build the combined ZK proof from individual partial proofs.
|
|
106
|
+
*/
|
|
107
|
+
private buildCombinedProof;
|
|
108
|
+
/**
|
|
109
|
+
* Compute a hash of the encrypted tally inputs.
|
|
110
|
+
*/
|
|
111
|
+
private computeInputHash;
|
|
112
|
+
/**
|
|
113
|
+
* Generate a ceremony ID from the partials' nonces.
|
|
114
|
+
*/
|
|
115
|
+
private generateCeremonyId;
|
|
116
|
+
/**
|
|
117
|
+
* Compute n! (factorial).
|
|
118
|
+
*/
|
|
119
|
+
private factorial;
|
|
120
|
+
/**
|
|
121
|
+
* Compute a mod m, handling negative numbers correctly.
|
|
122
|
+
*/
|
|
123
|
+
private mod;
|
|
124
|
+
/**
|
|
125
|
+
* Compute base^exp mod m using square-and-multiply.
|
|
126
|
+
*/
|
|
127
|
+
private modPow;
|
|
128
|
+
/**
|
|
129
|
+
* Compute modular inverse using extended Euclidean algorithm.
|
|
130
|
+
*/
|
|
131
|
+
private modInverse;
|
|
132
|
+
/**
|
|
133
|
+
* Convert a bigint to Uint8Array.
|
|
134
|
+
*/
|
|
135
|
+
private bigintToUint8Array;
|
|
136
|
+
/**
|
|
137
|
+
* Compare two Uint8Arrays for equality.
|
|
138
|
+
*/
|
|
139
|
+
private uint8ArrayEquals;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=decryption-combiner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decryption-combiner.d.ts","sourceRoot":"","sources":["../../../../../../../packages/digitaldefiance-ecies-lib/src/lib/voting/threshold/decryption-combiner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,kBAAkB,EAElB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAGtB;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,kBAAmB,YAAW,mBAAmB;IAC5D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAG7B,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,SAAS,UAAU,EAAE,EACvC,KAAK,EAAE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