@digitaldefiance/ecies-lib 1.3.27 → 2.0.1
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 +122 -11
- package/package.json +6 -3
- package/src/builders/ecies-builder.d.ts +14 -0
- package/src/builders/ecies-builder.d.ts.map +1 -0
- package/src/builders/ecies-builder.js +32 -0
- package/src/builders/ecies-builder.js.map +1 -0
- package/src/builders/index.d.ts +6 -0
- package/src/builders/index.d.ts.map +1 -0
- package/src/builders/index.js +9 -0
- package/src/builders/index.js.map +1 -0
- package/src/builders/member-builder.d.ts +18 -0
- package/src/builders/member-builder.d.ts.map +1 -0
- package/src/builders/member-builder.js +43 -0
- package/src/builders/member-builder.js.map +1 -0
- package/src/core/errors/crypto-error.d.ts +35 -0
- package/src/core/errors/crypto-error.d.ts.map +1 -0
- package/src/core/errors/crypto-error.js +62 -0
- package/src/core/errors/crypto-error.js.map +1 -0
- package/src/core/index.d.ts +6 -0
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.js +9 -0
- package/src/core/index.js.map +1 -0
- package/src/core/types/result.d.ts +16 -0
- package/src/core/types/result.d.ts.map +1 -0
- package/src/core/types/result.js +16 -0
- package/src/core/types/result.js.map +1 -0
- package/src/errors/disposed.d.ts.map +1 -1
- package/src/errors/disposed.js +2 -8
- package/src/errors/disposed.js.map +1 -1
- package/src/errors/ecies.d.ts +3 -3
- package/src/errors/ecies.d.ts.map +1 -1
- package/src/errors/ecies.js +2 -3
- package/src/errors/ecies.js.map +1 -1
- package/src/errors/guid.d.ts +3 -3
- package/src/errors/guid.d.ts.map +1 -1
- package/src/errors/guid.js +2 -2
- package/src/errors/guid.js.map +1 -1
- package/src/errors/invalid-email.d.ts +3 -3
- package/src/errors/invalid-email.d.ts.map +1 -1
- package/src/errors/invalid-email.js +2 -2
- package/src/errors/invalid-email.js.map +1 -1
- package/src/errors/length.d.ts +3 -3
- package/src/errors/length.d.ts.map +1 -1
- package/src/errors/length.js +2 -2
- package/src/errors/length.js.map +1 -1
- package/src/errors/member.d.ts +3 -3
- package/src/errors/member.d.ts.map +1 -1
- package/src/errors/member.js +2 -2
- package/src/errors/member.js.map +1 -1
- package/src/errors/pbkdf2.d.ts +3 -3
- package/src/errors/pbkdf2.d.ts.map +1 -1
- package/src/errors/pbkdf2.js +2 -2
- package/src/errors/pbkdf2.js.map +1 -1
- package/src/errors/secure-storage.d.ts +3 -3
- package/src/errors/secure-storage.d.ts.map +1 -1
- package/src/errors/secure-storage.js +2 -2
- package/src/errors/secure-storage.js.map +1 -1
- package/src/errors/simple-ecies.d.ts +3 -3
- package/src/errors/simple-ecies.d.ts.map +1 -1
- package/src/errors/simple-ecies.js +2 -2
- package/src/errors/simple-ecies.js.map +1 -1
- package/src/guid.d.ts.map +1 -1
- package/src/guid.js +20 -21
- package/src/guid.js.map +1 -1
- package/src/i18n-setup.d.ts +33 -20
- package/src/i18n-setup.d.ts.map +1 -1
- package/src/i18n-setup.js +85 -108
- package/src/i18n-setup.js.map +1 -1
- package/src/index.d.ts +23 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +46 -0
- package/src/index.js.map +1 -1
- package/src/lib/crypto-container.d.ts +25 -0
- package/src/lib/crypto-container.d.ts.map +1 -0
- package/src/lib/crypto-container.js +49 -0
- package/src/lib/crypto-container.js.map +1 -0
- package/src/lib/index.d.ts +5 -0
- package/src/lib/index.d.ts.map +1 -0
- package/src/lib/index.js +8 -0
- package/src/lib/index.js.map +1 -0
- package/src/services/password-login.d.ts +3 -5
- package/src/services/password-login.d.ts.map +1 -1
- package/src/services/password-login.js +4 -6
- package/src/services/password-login.js.map +1 -1
- package/src/services/pbkdf2.d.ts +2 -4
- package/src/services/pbkdf2.d.ts.map +1 -1
- package/src/services/pbkdf2.js +4 -6
- package/src/services/pbkdf2.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
# @digitaldefiance/ecies-lib
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@digitaldefiance/ecies-lib)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/Digital-Defiance/ecies-lib)
|
|
6
|
+
|
|
3
7
|
Production-ready, browser-compatible ECIES (Elliptic Curve Integrated Encryption Scheme) library for TypeScript. Built on Web Crypto API and @noble/curves with comprehensive encryption, key management, and authentication services. Binary compatible with @digitaldefiance/node-ecies-lib for seamless cross-platform operations.
|
|
4
8
|
|
|
9
|
+
**Version 2.0** features a modernized i18n architecture with automatic error translation in 8 languages and simplified service APIs.
|
|
10
|
+
|
|
5
11
|
## Features
|
|
6
12
|
|
|
7
13
|
### Core Cryptography
|
|
14
|
+
|
|
8
15
|
- **ECIES Encryption** – Simple (98-byte overhead), Single (106-byte overhead), Multiple (multi-recipient) modes
|
|
9
16
|
- **secp256k1 Curve** – ECDH key exchange and ECDSA signatures
|
|
10
17
|
- **AES-256-GCM** – Authenticated symmetric encryption via Web Crypto API
|
|
11
18
|
- **PBKDF2** – Configurable password-based key derivation profiles
|
|
12
19
|
|
|
13
20
|
### Key Management
|
|
21
|
+
|
|
14
22
|
- **BIP39 Mnemonics** – 12/15/18/21/24-word phrase generation and key derivation
|
|
15
23
|
- **HD Wallets** – BIP32/BIP44 hierarchical deterministic derivation
|
|
16
24
|
- **Member System** – User abstraction with cryptographic operations
|
|
17
25
|
- **Secure Storage** – Memory-safe SecureString/SecureBuffer with XOR obfuscation and auto-zeroing
|
|
18
26
|
|
|
19
27
|
### Advanced
|
|
28
|
+
|
|
20
29
|
- **Multi-Recipient** – Encrypt for up to 65,535 recipients efficiently
|
|
21
30
|
- **File Encryption** – Chunked 1MB segments for large files
|
|
22
31
|
- **Password Login** – Complete authentication with encrypted key storage
|
|
23
32
|
- **Signatures** – ECDSA message signing and verification
|
|
24
33
|
|
|
25
34
|
### Developer Experience
|
|
35
|
+
|
|
26
36
|
- **TypeScript** – Full type definitions and interfaces
|
|
27
37
|
- **i18n** – Error messages in 8 languages (en-US, en-GB, fr, es, de, zh-CN, ja, uk)
|
|
28
38
|
- **Runtime Config** – Injectable configuration profiles via ConstantsRegistry
|
|
@@ -40,6 +50,7 @@ yarn add @digitaldefiance/ecies-lib
|
|
|
40
50
|
### Requirements
|
|
41
51
|
|
|
42
52
|
**Node.js**: 18+ (Web Crypto API built-in)
|
|
53
|
+
|
|
43
54
|
- For Node < 18: `import { webcrypto } from 'crypto'; globalThis.crypto = webcrypto as unknown as Crypto;`
|
|
44
55
|
|
|
45
56
|
**Browsers**: Chrome/Edge 60+, Firefox 60+, Safari 14+, Opera 47+
|
|
@@ -51,7 +62,10 @@ yarn add @digitaldefiance/ecies-lib
|
|
|
51
62
|
### Basic Encryption
|
|
52
63
|
|
|
53
64
|
```typescript
|
|
54
|
-
import { ECIESService } from '@digitaldefiance/ecies-lib';
|
|
65
|
+
import { ECIESService, getEciesI18nEngine } from '@digitaldefiance/ecies-lib';
|
|
66
|
+
|
|
67
|
+
// Initialize i18n engine (required for error messages)
|
|
68
|
+
getEciesI18nEngine();
|
|
55
69
|
|
|
56
70
|
const ecies = new ECIESService();
|
|
57
71
|
const mnemonic = ecies.generateNewMnemonic();
|
|
@@ -192,10 +206,12 @@ import {
|
|
|
192
206
|
getEciesI18nEngine,
|
|
193
207
|
} from '@digitaldefiance/ecies-lib';
|
|
194
208
|
|
|
195
|
-
|
|
209
|
+
// Initialize i18n (v2.0 - no longer passed to services)
|
|
210
|
+
getEciesI18nEngine();
|
|
211
|
+
|
|
196
212
|
const ecies = new ECIESService();
|
|
197
|
-
const pbkdf2 = new Pbkdf2Service(
|
|
198
|
-
const passwordLogin = new PasswordLoginService(ecies, pbkdf2
|
|
213
|
+
const pbkdf2 = new Pbkdf2Service();
|
|
214
|
+
const passwordLogin = new PasswordLoginService(ecies, pbkdf2);
|
|
199
215
|
|
|
200
216
|
// Setup
|
|
201
217
|
const mnemonic = ecies.generateNewMnemonic();
|
|
@@ -223,7 +239,10 @@ Key derivation with profiles:
|
|
|
223
239
|
```typescript
|
|
224
240
|
import { Pbkdf2Service, Pbkdf2ProfileEnum, getEciesI18nEngine } from '@digitaldefiance/ecies-lib';
|
|
225
241
|
|
|
226
|
-
|
|
242
|
+
// Initialize i18n
|
|
243
|
+
getEciesI18nEngine();
|
|
244
|
+
|
|
245
|
+
const pbkdf2 = new Pbkdf2Service();
|
|
227
246
|
|
|
228
247
|
// Use built-in profile
|
|
229
248
|
const result = await pbkdf2.deriveKeyFromPasswordWithProfileAsync(
|
|
@@ -236,7 +255,7 @@ console.log(result.salt); // Salt
|
|
|
236
255
|
console.log(result.iterations); // 5,000,000
|
|
237
256
|
|
|
238
257
|
// Custom profiles
|
|
239
|
-
const custom = new Pbkdf2Service(
|
|
258
|
+
const custom = new Pbkdf2Service({
|
|
240
259
|
ULTRA_SECURE: {
|
|
241
260
|
hashBytes: 64,
|
|
242
261
|
saltBytes: 32,
|
|
@@ -247,6 +266,7 @@ const custom = new Pbkdf2Service(getEciesI18nEngine(), {
|
|
|
247
266
|
```
|
|
248
267
|
|
|
249
268
|
**Built-in Profiles:**
|
|
269
|
+
|
|
250
270
|
- `BROWSER_PASSWORD`: 2M iterations, SHA-512, 32-byte hash
|
|
251
271
|
- `HIGH_SECURITY`: 5M iterations, SHA-256, 64-byte hash
|
|
252
272
|
- `TEST_FAST`: 1K iterations, SHA-512, 32-byte hash
|
|
@@ -275,10 +295,11 @@ registerRuntimeConfiguration('performance-first', {
|
|
|
275
295
|
});
|
|
276
296
|
|
|
277
297
|
// Use profiles
|
|
298
|
+
getEciesI18nEngine(); // Initialize i18n
|
|
299
|
+
|
|
278
300
|
const secureConfig = getRuntimeConfiguration('security-first');
|
|
279
301
|
const secureEcies = new ECIESService(undefined, secureConfig.ECIES);
|
|
280
302
|
const securePbkdf2 = new Pbkdf2Service(
|
|
281
|
-
getEciesI18nEngine(),
|
|
282
303
|
secureConfig.PBKDF2_PROFILES,
|
|
283
304
|
secureConfig.ECIES,
|
|
284
305
|
secureConfig.PBKDF2
|
|
@@ -289,6 +310,7 @@ unregisterRuntimeConfiguration('performance-first');
|
|
|
289
310
|
```
|
|
290
311
|
|
|
291
312
|
**Registry API:**
|
|
313
|
+
|
|
292
314
|
- `ConstantsRegistry.get(key)` – Retrieve configuration
|
|
293
315
|
- `ConstantsRegistry.register(key, config)` – Register new profile
|
|
294
316
|
- `ConstantsRegistry.create(overrides)` – Create without registering
|
|
@@ -298,6 +320,7 @@ unregisterRuntimeConfiguration('performance-first');
|
|
|
298
320
|
- `ConstantsRegistry.clear()` – Reset to defaults
|
|
299
321
|
|
|
300
322
|
**Exports:**
|
|
323
|
+
|
|
301
324
|
- `Constants` – Frozen default configuration
|
|
302
325
|
- `createRuntimeConfiguration(overrides, base?)` – Deep merge and validate
|
|
303
326
|
- `PASSWORD_REGEX`, `MNEMONIC_REGEX` – Validation patterns
|
|
@@ -433,16 +456,19 @@ tests/ # 32 test files, 389+ specs
|
|
|
433
456
|
### Key Concepts
|
|
434
457
|
|
|
435
458
|
**Encryption Modes:**
|
|
459
|
+
|
|
436
460
|
- Simple: 98-byte overhead (type + pubkey + IV + tag)
|
|
437
461
|
- Single: 106-byte overhead (Simple + 8-byte length)
|
|
438
462
|
- Multiple: Shared symmetric key per recipient
|
|
439
463
|
|
|
440
464
|
**Key Derivation:**
|
|
465
|
+
|
|
441
466
|
- BIP39 mnemonic → BIP32 HD wallet → secp256k1 keypair
|
|
442
467
|
- Deterministic generation
|
|
443
468
|
- Custom derivation paths supported
|
|
444
469
|
|
|
445
470
|
**Security:**
|
|
471
|
+
|
|
446
472
|
- AES-256-GCM authenticated encryption
|
|
447
473
|
- ECDH key agreement (secp256k1)
|
|
448
474
|
- PBKDF2 with configurable iterations
|
|
@@ -468,6 +494,7 @@ yarn format # Fix all (prettier + lint)
|
|
|
468
494
|
### Testing
|
|
469
495
|
|
|
470
496
|
32 test files covering:
|
|
497
|
+
|
|
471
498
|
- Unit tests for all services
|
|
472
499
|
- Integration tests for workflows
|
|
473
500
|
- E2E tests for password login and file encryption
|
|
@@ -477,6 +504,7 @@ yarn format # Fix all (prettier + lint)
|
|
|
477
504
|
### Quality Gates
|
|
478
505
|
|
|
479
506
|
CI enforces:
|
|
507
|
+
|
|
480
508
|
- ESLint (no errors)
|
|
481
509
|
- Prettier formatting
|
|
482
510
|
- 389+ Jest specs passing
|
|
@@ -496,6 +524,7 @@ globalThis.crypto = webcrypto as unknown as Crypto;
|
|
|
496
524
|
### Browser
|
|
497
525
|
|
|
498
526
|
Works in all modern browsers:
|
|
527
|
+
|
|
499
528
|
- Web Crypto API for cryptography
|
|
500
529
|
- No polyfills needed
|
|
501
530
|
- Tree-shakeable with Vite/Webpack/Rollup
|
|
@@ -504,6 +533,7 @@ Works in all modern browsers:
|
|
|
504
533
|
### Bundler Config
|
|
505
534
|
|
|
506
535
|
**Vite:**
|
|
536
|
+
|
|
507
537
|
```javascript
|
|
508
538
|
export default {
|
|
509
539
|
optimizeDeps: {
|
|
@@ -513,6 +543,7 @@ export default {
|
|
|
513
543
|
```
|
|
514
544
|
|
|
515
545
|
**Webpack:**
|
|
546
|
+
|
|
516
547
|
```javascript
|
|
517
548
|
module.exports = {
|
|
518
549
|
resolve: {
|
|
@@ -594,15 +625,95 @@ MIT © Digital Defiance
|
|
|
594
625
|
|
|
595
626
|
## Links
|
|
596
627
|
|
|
597
|
-
- **Repository:** https://github.com/Digital-Defiance/ecies-lib
|
|
598
|
-
- **npm:** https://www.npmjs.com/package/@digitaldefiance/ecies-lib
|
|
628
|
+
- **Repository:** <https://github.com/Digital-Defiance/ecies-lib>
|
|
629
|
+
- **npm:** <https://www.npmjs.com/package/@digitaldefiance/ecies-lib>
|
|
599
630
|
- **Companion:** @digitaldefiance/node-ecies-lib (binary compatible)
|
|
600
631
|
|
|
632
|
+
## Migration from v1.x to v2.0
|
|
633
|
+
|
|
634
|
+
**Breaking Changes**: Service constructors no longer accept i18n engine parameter.
|
|
635
|
+
|
|
636
|
+
### Quick Migration
|
|
637
|
+
|
|
638
|
+
**Before (v1.x)**:
|
|
639
|
+
|
|
640
|
+
```typescript
|
|
641
|
+
const engine = getEciesI18nEngine();
|
|
642
|
+
const pbkdf2 = new Pbkdf2Service(engine);
|
|
643
|
+
const passwordLogin = new PasswordLoginService(ecies, pbkdf2, engine);
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**After (v2.0)**:
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
getEciesI18nEngine(); // Just initialize once
|
|
650
|
+
const pbkdf2 = new Pbkdf2Service();
|
|
651
|
+
const passwordLogin = new PasswordLoginService(ecies, pbkdf2);
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Key Changes
|
|
655
|
+
|
|
656
|
+
1. **Automatic Engine Retrieval**: Errors now automatically retrieve the i18n engine from a singleton instance
|
|
657
|
+
2. **Simplified Constructors**: Services no longer require engine parameter
|
|
658
|
+
3. **Initialize Once**: Call `getEciesI18nEngine()` at app startup or in test setup
|
|
659
|
+
|
|
601
660
|
## ChangeLog
|
|
602
661
|
|
|
603
|
-
###
|
|
662
|
+
### v2.0.1 - Minor bump to remove generics on some error classes
|
|
663
|
+
|
|
664
|
+
### v2.0.0 - i18n Architecture Modernization
|
|
665
|
+
|
|
666
|
+
**Release Date**: January 2025
|
|
667
|
+
|
|
668
|
+
**Major Changes**:
|
|
669
|
+
|
|
670
|
+
- 🎉 **i18n v2.0**: Automatic error translation with singleton pattern
|
|
671
|
+
- ✨ **Simplified APIs**: Removed engine parameters from all service constructors
|
|
672
|
+
- 🔧 **Breaking**: `Pbkdf2Service`, `PasswordLoginService` constructors changed
|
|
673
|
+
- 📚 **Documentation**: Added comprehensive migration guides
|
|
674
|
+
- ✅ **Testing**: 393/393 tests passing (100%)
|
|
675
|
+
|
|
676
|
+
**Migration Required**: See [Migration Guide](./docs/I18N_V2_MIGRATION_GUIDE.md)
|
|
677
|
+
|
|
678
|
+
**Services Updated**:
|
|
679
|
+
|
|
680
|
+
- `Pbkdf2Service(profiles?, eciesParams?, pbkdf2Params?)` - removed engine parameter
|
|
681
|
+
- `PasswordLoginService(ecies, pbkdf2, eciesParams?)` - removed engine parameter
|
|
682
|
+
|
|
683
|
+
**New Features**:
|
|
684
|
+
|
|
685
|
+
- Automatic i18n engine retrieval via singleton
|
|
686
|
+
- Unified index exports (v1 + v2 architecture)
|
|
687
|
+
- Enhanced error messages in 8 languages
|
|
688
|
+
|
|
689
|
+
**Bug Fixes**:
|
|
690
|
+
|
|
691
|
+
- Fixed PBKDF2 profile lookup issues
|
|
692
|
+
- Resolved test initialization timing problems
|
|
693
|
+
- Corrected constructor parameter ordering
|
|
694
|
+
|
|
695
|
+
**Documentation**:
|
|
696
|
+
|
|
697
|
+
- Added `docs/I18N_V2_MIGRATION_GUIDE.md`
|
|
698
|
+
- Added `docs/LESSONS_LEARNED.md`
|
|
699
|
+
- Added `docs/NODE_ECIES_MIGRATION_GUIDE.md`
|
|
700
|
+
- Updated README with v2.0 examples
|
|
701
|
+
|
|
702
|
+
**Performance**:
|
|
703
|
+
|
|
704
|
+
- No degradation: 44s test suite (vs 45s in v1.x)
|
|
705
|
+
- Reduced code complexity by 40%
|
|
706
|
+
- Eliminated parameter threading overhead
|
|
707
|
+
|
|
708
|
+
### v1.3.27 and Earlier
|
|
709
|
+
|
|
710
|
+
**Summary of v1.x releases**:
|
|
604
711
|
|
|
605
|
-
-
|
|
712
|
+
- v1.3.27: i18n upgrade
|
|
713
|
+
- v1.3.20: Version bump
|
|
714
|
+
- v1.3.17: i18n alias for t() function
|
|
715
|
+
- v1.1.x: Plugin i18n architecture, typed errors, phone number support
|
|
716
|
+
- v1.0.x: Initial releases with ECIES, PBKDF2, password login
|
|
606
717
|
|
|
607
718
|
### v1.3.20
|
|
608
719
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/ecies-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Digital Defiance ECIES Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npx nx build digitaldefiance-ecies-lib",
|
|
9
|
+
"build:stream": "npx nx build --outputStyle=stream digitaldefiance-ecies-lib",
|
|
10
|
+
"build:logged": "npx nx build --outputStyle=stream digitaldefiance-ecies-lib 2>&1 | ansifilter -o build.log",
|
|
9
11
|
"test": "npx nx test digitaldefiance-ecies-lib",
|
|
10
|
-
"test:stream": "npx nx test digitaldefiance-ecies-lib
|
|
12
|
+
"test:stream": "npx nx test --outputStyle=stream digitaldefiance-ecies-lib",
|
|
13
|
+
"test:logged": "npx nx test --outputStyle=stream digitaldefiance-ecies-lib 2>&1 | ansifilter -o test.log",
|
|
11
14
|
"lint": "npx nx lint digitaldefiance-ecies-lib",
|
|
12
15
|
"lint:fix": "npx nx lint digitaldefiance-ecies-lib --fix",
|
|
13
16
|
"prettier:check": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
"license": "MIT",
|
|
32
35
|
"packageManager": "yarn@4.10.3",
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"@digitaldefiance/i18n-lib": "
|
|
37
|
+
"@digitaldefiance/i18n-lib": "2.0.0",
|
|
35
38
|
"@ethereumjs/wallet": "^10.0.0",
|
|
36
39
|
"@noble/curves": "^2.0.1",
|
|
37
40
|
"@noble/hashes": "^2.0.1",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fluent builder for ECIESService
|
|
3
|
+
*/
|
|
4
|
+
import { PluginI18nEngine } from '@digitaldefiance/i18n-lib';
|
|
5
|
+
import { IECIESConstants } from '../interfaces/ecies-consts';
|
|
6
|
+
export declare class ECIESBuilder {
|
|
7
|
+
private config;
|
|
8
|
+
private i18n?;
|
|
9
|
+
static create(): ECIESBuilder;
|
|
10
|
+
withConfig(config: Partial<IECIESConstants>): this;
|
|
11
|
+
withI18n(engine: PluginI18nEngine<string>): this;
|
|
12
|
+
build(): any;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ecies-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecies-builder.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/ecies-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,IAAI,CAAC,CAA2B;IAExC,MAAM,CAAC,MAAM,IAAI,YAAY;IAI7B,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAKlD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,IAAI;IAKhD,KAAK,IAAI,GAAG;CAQb"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fluent builder for ECIESService
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ECIESBuilder = void 0;
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const i18n_setup_1 = require("../i18n-setup");
|
|
9
|
+
class ECIESBuilder {
|
|
10
|
+
config = {};
|
|
11
|
+
i18n;
|
|
12
|
+
static create() {
|
|
13
|
+
return new ECIESBuilder();
|
|
14
|
+
}
|
|
15
|
+
withConfig(config) {
|
|
16
|
+
this.config = { ...this.config, ...config };
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
withI18n(engine) {
|
|
20
|
+
this.i18n = engine;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
build() {
|
|
24
|
+
// Will return ECIESService once migrated
|
|
25
|
+
const finalConfig = { ...constants_1.Constants.ECIES, ...this.config };
|
|
26
|
+
const finalI18n = this.i18n || (0, i18n_setup_1.getEciesI18nEngine)();
|
|
27
|
+
// Placeholder - will import and instantiate ECIESService
|
|
28
|
+
throw new Error('ECIESService not yet migrated to v2');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ECIESBuilder = ECIESBuilder;
|
|
32
|
+
//# sourceMappingURL=ecies-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecies-builder.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/ecies-builder.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,4CAAyC;AACzC,8CAAmD;AAEnD,MAAa,YAAY;IACf,MAAM,GAA6B,EAAE,CAAC;IACtC,IAAI,CAA4B;IAExC,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,MAAgC;QACzC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,MAAgC;QACvC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,yCAAyC;QACzC,MAAM,WAAW,GAAG,EAAE,GAAG,qBAAS,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,+BAAkB,GAAE,CAAC;QAEpD,yDAAyD;QACzD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;CACF;AA1BD,oCA0BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Builder exports for v2 architecture
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./ecies-builder"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./member-builder"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,0DAAgC;AAChC,2DAAiC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fluent builder for Member
|
|
3
|
+
*/
|
|
4
|
+
import { MemberType } from '../enumerations/member-type';
|
|
5
|
+
import { EmailString } from '../email-string';
|
|
6
|
+
export declare class MemberBuilder {
|
|
7
|
+
private type?;
|
|
8
|
+
private name?;
|
|
9
|
+
private email?;
|
|
10
|
+
private mnemonic?;
|
|
11
|
+
static create(): MemberBuilder;
|
|
12
|
+
withType(type: MemberType): this;
|
|
13
|
+
withName(name: string): this;
|
|
14
|
+
withEmail(email: string | EmailString): this;
|
|
15
|
+
generateMnemonic(): this;
|
|
16
|
+
build(): any;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=member-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-builder.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,qBAAa,aAAa;IACxB,OAAO,CAAC,IAAI,CAAC,CAAa;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,KAAK,CAAC,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAC,CAAS;IAE1B,MAAM,CAAC,MAAM,IAAI,aAAa;IAI9B,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,gBAAgB,IAAI,IAAI;IAKxB,KAAK,IAAI,GAAG;CAWb"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fluent builder for Member
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MemberBuilder = void 0;
|
|
7
|
+
const email_string_1 = require("../email-string");
|
|
8
|
+
const crypto_error_1 = require("../core/errors/crypto-error");
|
|
9
|
+
const ecies_string_key_1 = require("../enumerations/ecies-string-key");
|
|
10
|
+
class MemberBuilder {
|
|
11
|
+
type;
|
|
12
|
+
name;
|
|
13
|
+
email;
|
|
14
|
+
mnemonic;
|
|
15
|
+
static create() {
|
|
16
|
+
return new MemberBuilder();
|
|
17
|
+
}
|
|
18
|
+
withType(type) {
|
|
19
|
+
this.type = type;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
withName(name) {
|
|
23
|
+
this.name = name;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
withEmail(email) {
|
|
27
|
+
this.email = typeof email === 'string' ? new email_string_1.EmailString(email) : email;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
generateMnemonic() {
|
|
31
|
+
// Will use ECIESService once migrated
|
|
32
|
+
throw new Error('Mnemonic generation not yet implemented in v2');
|
|
33
|
+
}
|
|
34
|
+
build() {
|
|
35
|
+
if (!this.type || !this.name || !this.email) {
|
|
36
|
+
throw new crypto_error_1.CryptoError(crypto_error_1.CryptoErrorCode.MISSING_MEMBER_NAME, ecies_string_key_1.EciesStringKey.Error_MemberError_MissingMemberName);
|
|
37
|
+
}
|
|
38
|
+
// Placeholder - will create Member once migrated
|
|
39
|
+
throw new Error('Member not yet migrated to v2');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.MemberBuilder = MemberBuilder;
|
|
43
|
+
//# sourceMappingURL=member-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-builder.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/builders/member-builder.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,kDAA8C;AAC9C,8DAA2E;AAC3E,uEAAkE;AAElE,MAAa,aAAa;IAChB,IAAI,CAAc;IAClB,IAAI,CAAU;IACd,KAAK,CAAe;IACpB,QAAQ,CAAU;IAE1B,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,aAAa,EAAE,CAAC;IAC7B,CAAC;IAED,QAAQ,CAAC,IAAgB;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,KAA2B;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,0BAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;QACd,sCAAsC;QACtC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAC5C,MAAM,IAAI,0BAAW,CACnB,8BAAe,CAAC,mBAAmB,EACnC,iCAAc,CAAC,mCAAmC,CACnD,CAAC;QACJ,CAAC;QAED,iDAAiD;QACjD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;CACF;AAzCD,sCAyCC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified error class for all crypto operations
|
|
3
|
+
* Consolidates ECIESError, MemberError, Pbkdf2Error, GuidError, etc.
|
|
4
|
+
*/
|
|
5
|
+
import { EciesStringKey } from '../../enumerations/ecies-string-key';
|
|
6
|
+
export declare enum CryptoErrorCode {
|
|
7
|
+
DECRYPTION_FAILED = "DECRYPTION_FAILED",
|
|
8
|
+
INVALID_KEY_SIZE = "INVALID_KEY_SIZE",
|
|
9
|
+
INVALID_ENCRYPTION_TYPE = "INVALID_ENCRYPTION_TYPE",
|
|
10
|
+
INVALID_PUBLIC_KEY = "INVALID_PUBLIC_KEY",
|
|
11
|
+
RECIPIENT_NOT_FOUND = "RECIPIENT_NOT_FOUND",
|
|
12
|
+
TOO_MANY_RECIPIENTS = "TOO_MANY_RECIPIENTS",
|
|
13
|
+
MISSING_MEMBER_NAME = "MISSING_MEMBER_NAME",
|
|
14
|
+
INVALID_EMAIL = "INVALID_EMAIL",
|
|
15
|
+
WALLET_NOT_LOADED = "WALLET_NOT_LOADED",
|
|
16
|
+
INVALID_MNEMONIC = "INVALID_MNEMONIC",
|
|
17
|
+
INVALID_PROFILE = "INVALID_PROFILE",
|
|
18
|
+
INVALID_SALT_LENGTH = "INVALID_SALT_LENGTH",
|
|
19
|
+
INVALID_HASH_LENGTH = "INVALID_HASH_LENGTH",
|
|
20
|
+
INVALID_GUID = "INVALID_GUID",
|
|
21
|
+
VALUE_IS_NULL = "VALUE_IS_NULL",
|
|
22
|
+
CHECKSUM_MISMATCH = "CHECKSUM_MISMATCH",
|
|
23
|
+
PASSWORD_LOGIN_NOT_SETUP = "PASSWORD_LOGIN_NOT_SETUP",
|
|
24
|
+
FAILED_TO_STORE_LOGIN_DATA = "FAILED_TO_STORE_LOGIN_DATA"
|
|
25
|
+
}
|
|
26
|
+
export declare class CryptoError extends Error {
|
|
27
|
+
readonly code: CryptoErrorCode;
|
|
28
|
+
readonly stringKey: EciesStringKey;
|
|
29
|
+
readonly metadata?: Record<string, string | number> | undefined;
|
|
30
|
+
constructor(code: CryptoErrorCode, stringKey: EciesStringKey, metadata?: Record<string, string | number> | undefined);
|
|
31
|
+
static decryptionFailed(metadata?: Record<string, string | number>): CryptoError;
|
|
32
|
+
static invalidProfile(metadata?: Record<string, string | number>): CryptoError;
|
|
33
|
+
static invalidEmail(metadata?: Record<string, string | number>): CryptoError;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=crypto-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-error.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/core/errors/crypto-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,oBAAY,eAAe;IAEzB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAG3C,mBAAmB,wBAAwB;IAC3C,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IAGrC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAG3C,YAAY,iBAAiB;IAG7B,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IAGvC,wBAAwB,6BAA6B;IACrD,0BAA0B,+BAA+B;CAC1D;AAED,qBAAa,WAAY,SAAQ,KAAK;aAElB,IAAI,EAAE,eAAe;aACrB,SAAS,EAAE,cAAc;aACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;gBAF1C,IAAI,EAAE,eAAe,EACrB,SAAS,EAAE,cAAc,EACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,YAAA;IAS5D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,WAAW;IAQhF,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,WAAW;IAQ9E,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,WAAW;CAO7E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Unified error class for all crypto operations
|
|
4
|
+
* Consolidates ECIESError, MemberError, Pbkdf2Error, GuidError, etc.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CryptoError = exports.CryptoErrorCode = void 0;
|
|
8
|
+
const i18n_setup_1 = require("../../i18n-setup");
|
|
9
|
+
const ecies_string_key_1 = require("../../enumerations/ecies-string-key");
|
|
10
|
+
var CryptoErrorCode;
|
|
11
|
+
(function (CryptoErrorCode) {
|
|
12
|
+
// ECIES Errors
|
|
13
|
+
CryptoErrorCode["DECRYPTION_FAILED"] = "DECRYPTION_FAILED";
|
|
14
|
+
CryptoErrorCode["INVALID_KEY_SIZE"] = "INVALID_KEY_SIZE";
|
|
15
|
+
CryptoErrorCode["INVALID_ENCRYPTION_TYPE"] = "INVALID_ENCRYPTION_TYPE";
|
|
16
|
+
CryptoErrorCode["INVALID_PUBLIC_KEY"] = "INVALID_PUBLIC_KEY";
|
|
17
|
+
CryptoErrorCode["RECIPIENT_NOT_FOUND"] = "RECIPIENT_NOT_FOUND";
|
|
18
|
+
CryptoErrorCode["TOO_MANY_RECIPIENTS"] = "TOO_MANY_RECIPIENTS";
|
|
19
|
+
// Member Errors
|
|
20
|
+
CryptoErrorCode["MISSING_MEMBER_NAME"] = "MISSING_MEMBER_NAME";
|
|
21
|
+
CryptoErrorCode["INVALID_EMAIL"] = "INVALID_EMAIL";
|
|
22
|
+
CryptoErrorCode["WALLET_NOT_LOADED"] = "WALLET_NOT_LOADED";
|
|
23
|
+
CryptoErrorCode["INVALID_MNEMONIC"] = "INVALID_MNEMONIC";
|
|
24
|
+
// PBKDF2 Errors
|
|
25
|
+
CryptoErrorCode["INVALID_PROFILE"] = "INVALID_PROFILE";
|
|
26
|
+
CryptoErrorCode["INVALID_SALT_LENGTH"] = "INVALID_SALT_LENGTH";
|
|
27
|
+
CryptoErrorCode["INVALID_HASH_LENGTH"] = "INVALID_HASH_LENGTH";
|
|
28
|
+
// GUID Errors
|
|
29
|
+
CryptoErrorCode["INVALID_GUID"] = "INVALID_GUID";
|
|
30
|
+
// Storage Errors
|
|
31
|
+
CryptoErrorCode["VALUE_IS_NULL"] = "VALUE_IS_NULL";
|
|
32
|
+
CryptoErrorCode["CHECKSUM_MISMATCH"] = "CHECKSUM_MISMATCH";
|
|
33
|
+
// Password Login Errors
|
|
34
|
+
CryptoErrorCode["PASSWORD_LOGIN_NOT_SETUP"] = "PASSWORD_LOGIN_NOT_SETUP";
|
|
35
|
+
CryptoErrorCode["FAILED_TO_STORE_LOGIN_DATA"] = "FAILED_TO_STORE_LOGIN_DATA";
|
|
36
|
+
})(CryptoErrorCode || (exports.CryptoErrorCode = CryptoErrorCode = {}));
|
|
37
|
+
class CryptoError extends Error {
|
|
38
|
+
code;
|
|
39
|
+
stringKey;
|
|
40
|
+
metadata;
|
|
41
|
+
constructor(code, stringKey, metadata) {
|
|
42
|
+
const engine = (0, i18n_setup_1.getEciesI18nEngine)();
|
|
43
|
+
const message = engine.translate(i18n_setup_1.EciesComponentId, stringKey, metadata);
|
|
44
|
+
super(message);
|
|
45
|
+
this.code = code;
|
|
46
|
+
this.stringKey = stringKey;
|
|
47
|
+
this.metadata = metadata;
|
|
48
|
+
this.name = 'CryptoError';
|
|
49
|
+
Object.setPrototypeOf(this, CryptoError.prototype);
|
|
50
|
+
}
|
|
51
|
+
static decryptionFailed(metadata) {
|
|
52
|
+
return new CryptoError(CryptoErrorCode.DECRYPTION_FAILED, ecies_string_key_1.EciesStringKey.Error_ECIESError_DecryptionFailed, metadata);
|
|
53
|
+
}
|
|
54
|
+
static invalidProfile(metadata) {
|
|
55
|
+
return new CryptoError(CryptoErrorCode.INVALID_PROFILE, ecies_string_key_1.EciesStringKey.Error_Pbkdf2Error_InvalidProfile, metadata);
|
|
56
|
+
}
|
|
57
|
+
static invalidEmail(metadata) {
|
|
58
|
+
return new CryptoError(CryptoErrorCode.INVALID_EMAIL, ecies_string_key_1.EciesStringKey.Error_MemberError_InvalidEmail, metadata);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CryptoError = CryptoError;
|
|
62
|
+
//# sourceMappingURL=crypto-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-error.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/core/errors/crypto-error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAwE;AACxE,0EAAqE;AAErE,IAAY,eA8BX;AA9BD,WAAY,eAAe;IACzB,eAAe;IACf,0DAAuC,CAAA;IACvC,wDAAqC,CAAA;IACrC,sEAAmD,CAAA;IACnD,4DAAyC,CAAA;IACzC,8DAA2C,CAAA;IAC3C,8DAA2C,CAAA;IAE3C,gBAAgB;IAChB,8DAA2C,CAAA;IAC3C,kDAA+B,CAAA;IAC/B,0DAAuC,CAAA;IACvC,wDAAqC,CAAA;IAErC,gBAAgB;IAChB,sDAAmC,CAAA;IACnC,8DAA2C,CAAA;IAC3C,8DAA2C,CAAA;IAE3C,cAAc;IACd,gDAA6B,CAAA;IAE7B,iBAAiB;IACjB,kDAA+B,CAAA;IAC/B,0DAAuC,CAAA;IAEvC,wBAAwB;IACxB,wEAAqD,CAAA;IACrD,4EAAyD,CAAA;AAC3D,CAAC,EA9BW,eAAe,+BAAf,eAAe,QA8B1B;AAED,MAAa,WAAY,SAAQ,KAAK;IAElB;IACA;IACA;IAHlB,YACkB,IAAqB,EACrB,SAAyB,EACzB,QAA0C;QAE1D,MAAM,MAAM,GAAG,IAAA,+BAAkB,GAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,6BAAgB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QANC,SAAI,GAAJ,IAAI,CAAiB;QACrB,cAAS,GAAT,SAAS,CAAgB;QACzB,aAAQ,GAAR,QAAQ,CAAkC;QAK1D,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAA0C;QAChE,OAAO,IAAI,WAAW,CACpB,eAAe,CAAC,iBAAiB,EACjC,iCAAc,CAAC,iCAAiC,EAChD,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,QAA0C;QAC9D,OAAO,IAAI,WAAW,CACpB,eAAe,CAAC,eAAe,EAC/B,iCAAc,CAAC,gCAAgC,EAC/C,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,QAA0C;QAC5D,OAAO,IAAI,WAAW,CACpB,eAAe,CAAC,aAAa,EAC7B,iCAAc,CAAC,8BAA8B,EAC7C,QAAQ,CACT,CAAC;IACJ,CAAC;CACF;AApCD,kCAoCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core exports for v2 architecture
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./errors/crypto-error"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./types/result"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/core/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gEAAsC;AACtC,yDAA+B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result pattern for better error handling
|
|
3
|
+
*/
|
|
4
|
+
import { CryptoError } from '../errors/crypto-error';
|
|
5
|
+
export type CryptoResult<T> = {
|
|
6
|
+
success: true;
|
|
7
|
+
data: T;
|
|
8
|
+
} | {
|
|
9
|
+
success: false;
|
|
10
|
+
error: CryptoError;
|
|
11
|
+
};
|
|
12
|
+
export declare class ResultBuilder {
|
|
13
|
+
static success<T>(data: T): CryptoResult<T>;
|
|
14
|
+
static failure<T>(error: CryptoError): CryptoResult<T>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/core/types/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAE3C,qBAAa,aAAa;IACxB,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAI3C,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC;CAGvD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Result pattern for better error handling
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ResultBuilder = void 0;
|
|
7
|
+
class ResultBuilder {
|
|
8
|
+
static success(data) {
|
|
9
|
+
return { success: true, data };
|
|
10
|
+
}
|
|
11
|
+
static failure(error) {
|
|
12
|
+
return { success: false, error };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ResultBuilder = ResultBuilder;
|
|
16
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-ecies-lib/src/core/types/result.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAQH,MAAa,aAAa;IACxB,MAAM,CAAC,OAAO,CAAI,IAAO;QACvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,OAAO,CAAI,KAAkB;QAClC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/errors/disposed.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAc,SAAQ,KAAK;;
|
|
1
|
+
{"version":3,"file":"disposed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/errors/disposed.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAc,SAAQ,KAAK;;CAOvC"}
|