@digitaldefiance/node-ecies-lib 4.16.20 → 4.16.27
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 +64 -2
- package/package.json +4 -4
- package/src/builders/member-builder.d.ts.map +1 -1
- package/src/builders/member-builder.js +3 -3
- package/src/builders/member-builder.js.map +1 -1
- package/src/constants.d.ts.map +1 -1
- package/src/constants.js +1 -1
- package/src/constants.js.map +1 -1
- package/src/errors/voting.js +2 -2
- package/src/errors/voting.js.map +1 -1
- package/src/i18n/ecies-i18n-factory.d.ts +24 -15
- package/src/i18n/ecies-i18n-factory.d.ts.map +1 -1
- package/src/i18n/ecies-i18n-factory.js +43 -67
- package/src/i18n/ecies-i18n-factory.js.map +1 -1
- package/src/i18n/node-ecies-i18n-setup.d.ts +38 -7
- package/src/i18n/node-ecies-i18n-setup.d.ts.map +1 -1
- package/src/i18n/node-ecies-i18n-setup.js +121 -33
- package/src/i18n/node-ecies-i18n-setup.js.map +1 -1
- package/src/lib/guid.d.ts +307 -18
- package/src/lib/guid.d.ts.map +1 -1
- package/src/lib/guid.js +520 -55
- package/src/lib/guid.js.map +1 -1
- package/src/lib/id-providers/guidv4-provider.js +4 -4
- package/src/lib/id-providers/guidv4-provider.js.map +1 -1
- package/src/services/aes-gcm.d.ts.map +1 -1
- package/src/services/aes-gcm.js +9 -9
- package/src/services/aes-gcm.js.map +1 -1
- package/src/services/ecies/crypto-core.d.ts.map +1 -1
- package/src/services/ecies/crypto-core.js +5 -4
- package/src/services/ecies/crypto-core.js.map +1 -1
- package/src/services/ecies/service.d.ts.map +1 -1
- package/src/services/ecies/service.js +9 -8
- package/src/services/ecies/service.js.map +1 -1
- package/src/services/ecies/single-recipient.d.ts.map +1 -1
- package/src/services/ecies/single-recipient.js +9 -8
- package/src/services/ecies/single-recipient.js.map +1 -1
- package/src/services/encryption-stream.d.ts.map +1 -1
- package/src/services/encryption-stream.js +20 -20
- package/src/services/encryption-stream.js.map +1 -1
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +6 -5
- package/src/utils.js.map +1 -1
- package/src/i18n-setup.d.ts +0 -26
- package/src/i18n-setup.d.ts.map +0 -1
- package/src/i18n-setup.js +0 -111
- package/src/i18n-setup.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,19 @@ A Node.js-specific implementation of the Digital Defiance ECIES (Elliptic Curve
|
|
|
8
8
|
|
|
9
9
|
Part of [Express Suite](https://github.com/Digital-Defiance/express-suite)
|
|
10
10
|
|
|
11
|
-
> Current Version: v4.16.
|
|
11
|
+
> Current Version: v4.16.25
|
|
12
|
+
|
|
13
|
+
## What's New in v4.16.x
|
|
14
|
+
|
|
15
|
+
✨ **Voting Key Derivation Security Improvements** - Enhanced voting key derivation to use both X and Y coordinates of the shared secret for improved security and cross-platform consistency with the browser implementation.
|
|
16
|
+
|
|
17
|
+
**Key Changes:**
|
|
18
|
+
- **HKDF Salt Handling**: Per RFC 5869, when salt is not provided or empty, it now uses a string of HashLen zeros instead of an empty buffer, ensuring consistency with Web Crypto API implementation
|
|
19
|
+
- **Private Key Normalization**: `deriveVotingKeysFromECDH` now handles 31-byte private keys (which can occur ~0.4% of the time when Node.js createECDH returns keys with leading zeros) by padding to 32 bytes
|
|
20
|
+
- **Uncompressed Public Keys**: Voting key derivation now uses uncompressed format (65 bytes with 0x04 prefix) for maximum entropy in ECDH shared secret computation
|
|
21
|
+
- **Simplified Prime Generation**: Removed constant-time padding in `generateDeterministicPrime` for cleaner implementation
|
|
22
|
+
- **i18n Improvements**: Uses `I18nBuilder` pattern with `withStringKeyEnums()` for registering branded enums
|
|
23
|
+
- **String Key Enum Registration**: Added `registerStringKeyEnum()` for direct translation via `translateStringKey()`
|
|
12
24
|
|
|
13
25
|
This library implements a modern, enterprise-grade ECIES protocol (v4.0) featuring HKDF key derivation, AAD binding, and optimized multi-recipient encryption. It includes a pluggable ID provider system, memory-efficient streaming encryption, and comprehensive internationalization.
|
|
14
26
|
|
|
@@ -264,6 +276,47 @@ const decryptedJson = await aesGcm.decryptJson<typeof userData>(encryptedJson, k
|
|
|
264
276
|
console.log(decryptedJson); // { name: 'Alice', email: 'alice@example.com', age: 30 }
|
|
265
277
|
```
|
|
266
278
|
|
|
279
|
+
### Internationalization (i18n)
|
|
280
|
+
|
|
281
|
+
The library provides automatic error translation in 8 languages with helper functions for direct translation:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import {
|
|
285
|
+
getNodeEciesI18nEngine,
|
|
286
|
+
getNodeEciesTranslation,
|
|
287
|
+
safeGetNodeEciesTranslation,
|
|
288
|
+
NodeEciesStringKey
|
|
289
|
+
} from '@digitaldefiance/node-ecies-lib';
|
|
290
|
+
|
|
291
|
+
// Initialize the i18n engine (required once at startup)
|
|
292
|
+
const engine = getNodeEciesI18nEngine();
|
|
293
|
+
|
|
294
|
+
// Direct translation using branded string keys (v4.16.0+)
|
|
295
|
+
// Component ID is automatically resolved from the branded enum
|
|
296
|
+
const errorMessage = getNodeEciesTranslation(NodeEciesStringKey.Error_InvalidKey);
|
|
297
|
+
|
|
298
|
+
// With variables
|
|
299
|
+
const message = getNodeEciesTranslation(
|
|
300
|
+
NodeEciesStringKey.Error_InvalidKeyLength,
|
|
301
|
+
{ expected: 32, actual: 16 }
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
// With specific language
|
|
305
|
+
const frenchMessage = getNodeEciesTranslation(
|
|
306
|
+
NodeEciesStringKey.Error_InvalidKey,
|
|
307
|
+
{},
|
|
308
|
+
'fr'
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// Safe translation (returns placeholder on failure instead of throwing)
|
|
312
|
+
const safeMessage = safeGetNodeEciesTranslation(NodeEciesStringKey.Error_InvalidKey);
|
|
313
|
+
|
|
314
|
+
// Or use the engine directly with translateStringKey
|
|
315
|
+
const directTranslation = engine.translateStringKey(NodeEciesStringKey.Error_InvalidKey);
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Supported Languages:** en-US, en-GB, fr, es, de, zh-CN, ja, uk
|
|
319
|
+
|
|
267
320
|
### 3. Using Custom ID Providers (e.g., GUID)
|
|
268
321
|
|
|
269
322
|
```typescript
|
|
@@ -671,7 +724,16 @@ describe('Integration with suite-core-lib', () => {
|
|
|
671
724
|
|
|
672
725
|
## ChangeLog
|
|
673
726
|
|
|
674
|
-
### v4.16.0 -
|
|
727
|
+
### v4.16.x (v4.16.0 - v4.16.20)
|
|
728
|
+
|
|
729
|
+
**Voting Key Derivation Security Improvements**
|
|
730
|
+
|
|
731
|
+
- **HKDF RFC 5869 Compliance**: When salt is not provided or empty, now uses HashLen zeros instead of empty buffer for consistency with Web Crypto API
|
|
732
|
+
- **Private Key Normalization**: `deriveVotingKeysFromECDH` handles 31-byte private keys by padding to 32 bytes (occurs ~0.4% of the time with Node.js createECDH)
|
|
733
|
+
- **Uncompressed Public Keys**: Voting key derivation uses uncompressed format (65 bytes) for maximum entropy
|
|
734
|
+
- **Simplified Prime Generation**: Cleaner `generateDeterministicPrime` implementation
|
|
735
|
+
- **i18n Builder Pattern**: Uses `I18nBuilder.withStringKeyEnums()` for registering branded enums
|
|
736
|
+
- **String Key Enum Registration**: Added `registerStringKeyEnum()` for direct translation via `translateStringKey()`
|
|
675
737
|
|
|
676
738
|
### v4.13.0 - API Naming Improvements & Configuration Enhancements
|
|
677
739
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-ecies-lib",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.27",
|
|
4
4
|
"description": "Digital Defiance Node ECIES Library",
|
|
5
5
|
"homepage": "https://github.com/Digital-Defiance/node-ecies-lib",
|
|
6
6
|
"repository": {
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"license": "MIT",
|
|
60
60
|
"packageManager": "yarn@4.10.3",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@digitaldefiance/ecies-lib": "4.16.
|
|
63
|
-
"@digitaldefiance/express-suite-test-utils": "1.0
|
|
64
|
-
"@digitaldefiance/i18n-lib": "4.
|
|
62
|
+
"@digitaldefiance/ecies-lib": "4.16.26",
|
|
63
|
+
"@digitaldefiance/express-suite-test-utils": "1.1.0",
|
|
64
|
+
"@digitaldefiance/i18n-lib": "4.3.0",
|
|
65
65
|
"@ethereumjs/wallet": "^2.0.4",
|
|
66
66
|
"@noble/curves": "^1.4.2",
|
|
67
67
|
"@noble/hashes": "^1.4.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-builder.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACb,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"member-builder.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACb,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAC,CAAe;IACpC,OAAO,CAAC,IAAI,CAAC,CAAa;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,KAAK,CAAC,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B,MAAM,CAAC,MAAM,IAAI,aAAa;IAI9B,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAK7C,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAKhC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK5B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAK5C,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAK1C,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKtC,gBAAgB,IAAI,IAAI;IAaxB,KAAK,IAAI,0BAA0B;IA2BnC;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,EAC9C,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,MAAM,EAC3B,aAAa,CAAC,EAAE,YAAY,EAC5B,SAAS,CAAC,EAAE,GAAG,GACd,0BAA0B,CAAC,GAAG,CAAC;IAclC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC;IAK3E;;;;;;;OAOG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,EACjD,QAAQ,EAAE,YAAY,EACtB,UAAU,aAAkB,EAC5B,IAAI,SAAc,EAClB,KAAK,GAAE,WAAW,GAAG,MAA2B,GAC/C,MAAM,CAAC,GAAG,CAAC;CAYf"}
|
|
@@ -61,7 +61,7 @@ class MemberBuilder {
|
|
|
61
61
|
generateMnemonic() {
|
|
62
62
|
if (!this.eciesService) {
|
|
63
63
|
const engine = (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
64
|
-
throw new Error(engine.
|
|
64
|
+
throw new Error(engine.translateStringKey(ecies_i18n_factory_1.NodeEciesStringKey.Error_Builder_ECIESServiceMustBeSetBeforeGeneratingMnemonic));
|
|
65
65
|
}
|
|
66
66
|
this.mnemonic = this.eciesService.generateNewMnemonic();
|
|
67
67
|
return this;
|
|
@@ -69,10 +69,10 @@ class MemberBuilder {
|
|
|
69
69
|
build() {
|
|
70
70
|
const engine = (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
71
71
|
if (!this.eciesService) {
|
|
72
|
-
throw new Error(engine.
|
|
72
|
+
throw new Error(engine.translateStringKey(ecies_i18n_factory_1.NodeEciesStringKey.Error_Builder_ECIESServiceIsRequired));
|
|
73
73
|
}
|
|
74
74
|
if (!this.type || !this.name || !this.email) {
|
|
75
|
-
throw new Error(engine.
|
|
75
|
+
throw new Error(engine.translateStringKey(ecies_i18n_factory_1.NodeEciesStringKey.Error_Builder_TypeNameAndEmailAreRequired));
|
|
76
76
|
}
|
|
77
77
|
return member_1.Member.newMember(this.eciesService, this.type, this.name, this.email, this.mnemonic, this.createdBy);
|
|
78
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-builder.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,0DAIoC;AAEpC,4CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"member-builder.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,0DAIoC;AAEpC,4CAA2D;AAC3D,mEAAgE;AAChE,yEAAuE;AAGvE,sCAAmC;AACnC,6CAAiD;AACjD,MAAM,SAAS,GAAG,IAAA,uCAA2B,GAAE,CAAC;AAEhD,MAAa,aAAa;IAChB,YAAY,CAAgB;IAC5B,IAAI,CAAc;IAClB,IAAI,CAAU;IACd,KAAK,CAAe;IACpB,QAAQ,CAAgB;IACxB,SAAS,CAAU;IAE3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,kBAAkB;QAEhD,MAAM,OAAO,GAAG,IAAI,oBAAY,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,uBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE5E,OAAO,eAAM,CAAC,YAAY,CACxB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,IAAI,EACJ,QAAQ,CACM,CAAC;IACnB,CAAC;CACF;AAlJD,sCAkJC"}
|
package/src/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-ecies-lib/src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAEL,4BAA4B,EAE7B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-ecies-lib/src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAEL,4BAA4B,EAE7B,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAA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,7 @@ exports.Constants = Object.freeze({
|
|
|
158
158
|
function safeTranslate(key, fallback) {
|
|
159
159
|
try {
|
|
160
160
|
const engine = (0, i18n_1.getNodeEciesI18nEngine)();
|
|
161
|
-
return engine.
|
|
161
|
+
return engine.translateStringKey(key);
|
|
162
162
|
}
|
|
163
163
|
catch {
|
|
164
164
|
return fallback;
|
package/src/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-ecies-lib/src/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-ecies-lib/src/constants.ts"],"names":[],"mappings":";;;AAkOA,wEAQC;AAeD,4EAoCC;AAQD,wEAOC;AAED,kEAGC;AAGQ,0DAAuB;AAAE,oDAAoB;AA3StD,0DAIoC;AACpC,6CAA4C;AAC5C,+CAAiD;AAEjD,kEAA2F;AAC3F,iCAAoE;AAOpE,8DAAoD;AAGpD;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAkB;IACjD,0DAA0D;IAC1D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAc,EAAE,EAAE,CAChD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,IAAA,kBAAU,EAAC,IAAA,aAAM,EAAC,IAAI,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB;IAC3B,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,K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8,7 +8,7 @@ exports.VotingError = void 0;
|
|
|
8
8
|
*/
|
|
9
9
|
const i18n_lib_1 = require("@digitaldefiance/i18n-lib");
|
|
10
10
|
const voting_error_type_1 = require("../enumerations/voting-error-type");
|
|
11
|
-
const
|
|
11
|
+
const i18n_1 = require("../i18n");
|
|
12
12
|
/**
|
|
13
13
|
* Error class for voting-related operations.
|
|
14
14
|
* Provides detailed error information for debugging and user feedback.
|
|
@@ -24,7 +24,7 @@ class VotingError extends i18n_lib_1.TypedHandleableError {
|
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
25
|
_replacements) {
|
|
26
26
|
const source = options?.cause instanceof Error ? options.cause : new Error();
|
|
27
|
-
super(
|
|
27
|
+
super(i18n_1.NodeEciesComponentId, type, (0, i18n_lib_1.buildReasonMap)(voting_error_type_1.VotingErrorType, ['Error', 'VotingError']), source, options, undefined);
|
|
28
28
|
this.name = 'VotingError';
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/errors/voting.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voting.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/errors/voting.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,wDAImC;AAEnC,yEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"voting.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/errors/voting.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,wDAImC;AAEnC,yEAAoE;AACpE,kCAA+C;AAE/C;;;GAGG;AACH,MAAa,WAAY,SAAQ,+BAGhC;IACC;;;;;OAKG;IACH,YACE,IAAqB,EACrB,OAAgC;IAChC,6DAA6D;IAC7D,aAA+C;QAE/C,MAAM,MAAM,GACV,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;QAChE,KAAK,CACH,2BAAoB,EACpB,IAAI,EACJ,IAAA,yBAAc,EAAC,mCAAe,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,EACzD,MAAM,EACN,OAAO,EACP,SAAS,CACV,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AA5BD,kCA4BC"}
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import { ComponentDefinition, ComponentRegistration, CoreLanguageCode, EngineConfig, I18nEngine, PluginI18nEngine, RegistryConfig } from '@digitaldefiance/i18n-lib';
|
|
2
|
-
import { NodeEciesComponentId, NodeEciesStringKey, NodeEciesStringKeyValue } from './node-keys';
|
|
3
|
-
export { NodeEciesComponentId, NodeEciesStringKey };
|
|
4
|
-
export type { NodeEciesStringKeyValue };
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
2
|
+
* I18n factory for Node.js ECIES library.
|
|
3
|
+
*
|
|
4
|
+
* This file provides backward-compatible exports and convenience functions.
|
|
5
|
+
* The main i18n setup is in node-ecies-i18n-setup.ts.
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { EciesStringKey } from '@digitaldefiance/ecies-lib';
|
|
8
|
+
import { CoreLanguageCode, I18nEngine } from '@digitaldefiance/i18n-lib';
|
|
9
|
+
import { NodeEciesStringKey, NodeEciesStringKeyValue } from './node-keys';
|
|
10
|
+
export { NodeEciesStringKey, EciesStringKey };
|
|
11
|
+
export type { NodeEciesStringKeyValue };
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
12
|
-
* This
|
|
13
|
+
* Get the Node ECIES I18n engine with all components registered.
|
|
14
|
+
* This engine supports both EciesStringKey and NodeEciesStringKey
|
|
15
|
+
* for translateStringKey calls.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Use getNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
13
18
|
*/
|
|
14
|
-
export declare function getEciesPluginI18nEngine(
|
|
19
|
+
export declare function getEciesPluginI18nEngine(): I18nEngine;
|
|
15
20
|
/**
|
|
16
21
|
* Reset the engine instance (useful for testing)
|
|
22
|
+
*
|
|
23
|
+
* @deprecated Use resetNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
17
24
|
*/
|
|
18
25
|
export declare function resetEciesPluginI18nEngine(): void;
|
|
19
26
|
/**
|
|
20
|
-
* Get a translation
|
|
27
|
+
* Get a translation using translateStringKey.
|
|
28
|
+
* Supports both NodeEciesStringKey and EciesStringKey values.
|
|
29
|
+
* Falls back to component-based translation if string key enum is not registered.
|
|
21
30
|
*/
|
|
22
31
|
export declare function getLazyNodeEciesTranslation(key: NodeEciesStringKeyValue, variables?: Record<string, string | number>, language?: CoreLanguageCode): string;
|
|
23
32
|
/**
|
|
24
|
-
* Get the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
33
|
+
* Get the I18nEngine for use in node-ecies services.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated Use getNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
27
36
|
*/
|
|
28
|
-
export declare function createEciesTranslationEngine(
|
|
37
|
+
export declare function createEciesTranslationEngine(): I18nEngine;
|
|
29
38
|
//# sourceMappingURL=ecies-i18n-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecies-i18n-factory.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/ecies-i18n-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecies-i18n-factory.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/ecies-i18n-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAMzE,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC;AAC9C,YAAY,EAAE,uBAAuB,EAAE,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,UAAU,CAErD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,uBAAuB,EAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,MAAM,CAoBR;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,UAAU,CAEzD"}
|
|
@@ -1,95 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.createNodeEciesComponentDefinition = createNodeEciesComponentDefinition;
|
|
5
|
-
exports.createNodeEciesComponentRegistration = createNodeEciesComponentRegistration;
|
|
3
|
+
exports.EciesStringKey = exports.NodeEciesStringKey = void 0;
|
|
6
4
|
exports.getEciesPluginI18nEngine = getEciesPluginI18nEngine;
|
|
7
5
|
exports.resetEciesPluginI18nEngine = resetEciesPluginI18nEngine;
|
|
8
6
|
exports.getLazyNodeEciesTranslation = getLazyNodeEciesTranslation;
|
|
9
7
|
exports.createEciesTranslationEngine = createEciesTranslationEngine;
|
|
10
8
|
/**
|
|
11
9
|
* I18n factory for Node.js ECIES library.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* This file provides backward-compatible exports and convenience functions.
|
|
12
|
+
* The main i18n setup is in node-ecies-i18n-setup.ts.
|
|
14
13
|
*/
|
|
15
14
|
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
16
|
-
|
|
15
|
+
Object.defineProperty(exports, "EciesStringKey", { enumerable: true, get: function () { return ecies_lib_1.EciesStringKey; } });
|
|
16
|
+
const node_ecies_i18n_setup_1 = require("./node-ecies-i18n-setup");
|
|
17
17
|
const node_keys_1 = require("./node-keys");
|
|
18
|
-
Object.defineProperty(exports, "NodeEciesComponentId", { enumerable: true, get: function () { return node_keys_1.NodeEciesComponentId; } });
|
|
19
18
|
Object.defineProperty(exports, "NodeEciesStringKey", { enumerable: true, get: function () { return node_keys_1.NodeEciesStringKey; } });
|
|
20
|
-
const translations_1 = require("./translations");
|
|
21
|
-
const en_GB_1 = require("./translations/en-GB");
|
|
22
|
-
const en_US_1 = require("./translations/en-US");
|
|
23
19
|
/**
|
|
24
|
-
*
|
|
20
|
+
* Get the Node ECIES I18n engine with all components registered.
|
|
21
|
+
* This engine supports both EciesStringKey and NodeEciesStringKey
|
|
22
|
+
* for translateStringKey calls.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Use getNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
25
25
|
*/
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
id: node_keys_1.NodeEciesComponentId,
|
|
29
|
-
name: 'Node ECIES Library Strings',
|
|
30
|
-
stringKeys: node_keys_1.NodeEciesStringKey,
|
|
31
|
-
};
|
|
32
|
-
return NodeEciesComponent;
|
|
33
|
-
}
|
|
34
|
-
function createNodeEciesComponentRegistration() {
|
|
35
|
-
const component = createNodeEciesComponentDefinition();
|
|
36
|
-
return {
|
|
37
|
-
component,
|
|
38
|
-
strings: {
|
|
39
|
-
[i18n_lib_1.LanguageCodes.EN_US]: en_US_1.englishTranslations,
|
|
40
|
-
[i18n_lib_1.LanguageCodes.EN_GB]: en_GB_1.britishEnglishTranslations,
|
|
41
|
-
[i18n_lib_1.LanguageCodes.FR]: translations_1.frenchTranslations,
|
|
42
|
-
[i18n_lib_1.LanguageCodes.ES]: translations_1.spanishTranslations,
|
|
43
|
-
[i18n_lib_1.LanguageCodes.DE]: translations_1.germanTranslations,
|
|
44
|
-
[i18n_lib_1.LanguageCodes.ZH_CN]: translations_1.mandarinTranslations,
|
|
45
|
-
[i18n_lib_1.LanguageCodes.JA]: translations_1.japaneseTranslations,
|
|
46
|
-
[i18n_lib_1.LanguageCodes.UK]: translations_1.ukrainianTranslations,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Singleton instance of the ECIES I18n engine
|
|
52
|
-
*/
|
|
53
|
-
let eciesI18nEngineInstance = null;
|
|
54
|
-
/**
|
|
55
|
-
* Create or get the ECIES I18n engine with proper component registration
|
|
56
|
-
* This replaces the legacy getEciesI18nEngine() function
|
|
57
|
-
*/
|
|
58
|
-
function getEciesPluginI18nEngine(config) {
|
|
59
|
-
if (!eciesI18nEngineInstance) {
|
|
60
|
-
// Create core engine with system strings
|
|
61
|
-
eciesI18nEngineInstance = (0, i18n_lib_1.createCoreI18nEngine)(node_keys_1.NodeEciesComponentId, config);
|
|
62
|
-
const result = eciesI18nEngineInstance.registerComponent(createNodeEciesComponentRegistration());
|
|
63
|
-
if (!result.isValid) {
|
|
64
|
-
console.warn('Node ECIES component registration incomplete:', result.missingKeys);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return eciesI18nEngineInstance;
|
|
26
|
+
function getEciesPluginI18nEngine() {
|
|
27
|
+
return (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
68
28
|
}
|
|
69
29
|
/**
|
|
70
30
|
* Reset the engine instance (useful for testing)
|
|
31
|
+
*
|
|
32
|
+
* @deprecated Use resetNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
71
33
|
*/
|
|
72
34
|
function resetEciesPluginI18nEngine() {
|
|
73
|
-
|
|
35
|
+
(0, node_ecies_i18n_setup_1.resetNodeEciesI18nEngine)();
|
|
74
36
|
}
|
|
75
37
|
/**
|
|
76
|
-
* Get a translation
|
|
38
|
+
* Get a translation using translateStringKey.
|
|
39
|
+
* Supports both NodeEciesStringKey and EciesStringKey values.
|
|
40
|
+
* Falls back to component-based translation if string key enum is not registered.
|
|
77
41
|
*/
|
|
78
42
|
function getLazyNodeEciesTranslation(key, variables, language) {
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
43
|
+
const engine = (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
44
|
+
// Try translateStringKey first, fall back to component-based translation
|
|
45
|
+
try {
|
|
46
|
+
return engine.translateStringKey(key, variables, language);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Fall back to direct component translation
|
|
50
|
+
// The key format is 'componentId:stringKey', extract the string key part
|
|
51
|
+
const keyStr = String(key);
|
|
52
|
+
const colonIndex = keyStr.indexOf(':');
|
|
53
|
+
const stringKey = colonIndex >= 0 ? keyStr.slice(colonIndex + 1) : keyStr;
|
|
54
|
+
// Try NodeEcies component first, then Ecies component
|
|
55
|
+
try {
|
|
56
|
+
return engine.translate('node-ecies', stringKey, variables, language);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return engine.translate('ecies', stringKey, variables, language);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
86
62
|
}
|
|
87
63
|
/**
|
|
88
|
-
* Get the
|
|
89
|
-
*
|
|
90
|
-
*
|
|
64
|
+
* Get the I18nEngine for use in node-ecies services.
|
|
65
|
+
*
|
|
66
|
+
* @deprecated Use getNodeEciesI18nEngine() from node-ecies-i18n-setup instead
|
|
91
67
|
*/
|
|
92
|
-
function createEciesTranslationEngine(
|
|
93
|
-
return (0,
|
|
68
|
+
function createEciesTranslationEngine() {
|
|
69
|
+
return (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
94
70
|
}
|
|
95
71
|
//# sourceMappingURL=ecies-i18n-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecies-i18n-factory.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/ecies-i18n-factory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ecies-i18n-factory.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/ecies-i18n-factory.ts"],"names":[],"mappings":";;;AA0BA,4DAEC;AAOD,gEAEC;AAOD,kEAwBC;AAOD,oEAEC;AA7ED;;;;;GAKG;AACH,0DAA4D;AAU/B,+FAVpB,0BAAc,OAUoB;AAP3C,mEAGiC;AACjC,2CAA0E;AAGjE,mGAHA,8BAAkB,OAGA;AAG3B;;;;;;GAMG;AACH,SAAgB,wBAAwB;IACtC,OAAO,IAAA,8CAAsB,GAAE,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B;IACxC,IAAA,gDAAwB,GAAE,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,GAA4B,EAC5B,SAA2C,EAC3C,QAA2B;IAE3B,MAAM,MAAM,GAAG,IAAA,8CAAsB,GAAE,CAAC;IAExC,yEAAyE;IACzE,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,4CAA4C;QAC5C,yEAAyE;QACzE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAE1E,sDAAsD;QACtD,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B;IAC1C,OAAO,IAAA,8CAAsB,GAAE,CAAC;AAClC,CAAC"}
|
|
@@ -1,16 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Node.js ECIES i18n setup and configuration.
|
|
3
|
+
*
|
|
4
|
+
* This is the single source of truth for i18n in node-ecies-lib.
|
|
5
|
+
* Uses I18nBuilder pattern for proper engine initialization and registers:
|
|
6
|
+
* - Core component (for error messages)
|
|
7
|
+
* - ECIES component (imported from ecies-lib - translations defined there)
|
|
8
|
+
* - Node ECIES component (translations defined here)
|
|
9
|
+
*
|
|
10
|
+
* All components support translateStringKey for direct branded enum translation.
|
|
11
|
+
*/
|
|
12
|
+
import { EciesComponentId } from '@digitaldefiance/ecies-lib';
|
|
13
|
+
import { ComponentConfig, I18nEngine, type BrandedMasterStringsCollection, type CoreLanguageCode } from '@digitaldefiance/i18n-lib';
|
|
14
|
+
import { NodeEciesComponentId, NodeEciesStringKey } from './node-keys';
|
|
3
15
|
import type { NodeEciesStringKeyValue } from './node-keys';
|
|
4
|
-
export
|
|
5
|
-
export declare function resetNodeEciesI18nEngine(): void;
|
|
6
|
-
export declare function createNodeEciesComponentConfig(): ComponentConfig;
|
|
16
|
+
export { NodeEciesComponentId, EciesComponentId };
|
|
7
17
|
/**
|
|
8
18
|
* Master strings collection for the Node ECIES component.
|
|
9
|
-
*
|
|
19
|
+
* These are the translations specific to node-ecies-lib.
|
|
20
|
+
* ECIES translations come from ecies-lib via createEciesComponentConfig().
|
|
10
21
|
*/
|
|
11
22
|
export declare const NodeEciesComponentStrings: BrandedMasterStringsCollection<typeof NodeEciesStringKey, CoreLanguageCode>;
|
|
12
23
|
/**
|
|
13
|
-
*
|
|
24
|
+
* Create Node ECIES component configuration
|
|
25
|
+
*/
|
|
26
|
+
export declare function createNodeEciesComponentConfig(): ComponentConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Get or create the Node ECIES i18n engine.
|
|
29
|
+
*
|
|
30
|
+
* This engine has Core, ECIES, and NodeECIES components registered,
|
|
31
|
+
* allowing translateStringKey to work with both EciesStringKey and NodeEciesStringKey.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getNodeEciesI18nEngine(): I18nEngine;
|
|
34
|
+
/**
|
|
35
|
+
* Reset the engine instance (useful for testing)
|
|
36
|
+
*/
|
|
37
|
+
export declare function resetNodeEciesI18nEngine(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Helper to translate Node ECIES strings.
|
|
40
|
+
* Uses translateStringKey for automatic component ID resolution from the branded enum.
|
|
14
41
|
*/
|
|
15
42
|
export declare function getNodeEciesTranslation(stringKey: NodeEciesStringKeyValue, variables?: Record<string, string | number>, language?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Safe translation helper that returns a placeholder on failure.
|
|
45
|
+
*/
|
|
46
|
+
export declare function safeGetNodeEciesTranslation(stringKey: NodeEciesStringKeyValue, variables?: Record<string, string | number>, language?: string): string;
|
|
16
47
|
//# sourceMappingURL=node-ecies-i18n-setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-ecies-i18n-setup.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/node-ecies-i18n-setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-ecies-i18n-setup.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/node-ecies-i18n-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EAIf,UAAU,EAEV,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAY3D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,8BAA8B,CACpE,OAAO,kBAAkB,EACzB,gBAAgB,CAUjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,eAAe,CAMhE;AAoDD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,UAAU,CAkCnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,uBAAuB,EAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,uBAAuB,EAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAMR"}
|