@digitaldefiance/ecies-lib 4.2.6 → 4.2.8
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 +254 -0
- package/package.json +8 -2
- package/src/enumerations/ecies-encryption-type.d.ts +0 -4
- package/src/enumerations/ecies-encryption-type.d.ts.map +1 -1
- package/src/enumerations/ecies-encryption-type.js +6 -42
- package/src/enumerations/ecies-encryption-type.js.map +1 -1
- package/src/index.d.ts +5 -4
- package/src/index.d.ts.map +1 -1
- package/src/index.js +6 -4
- package/src/index.js.map +1 -1
- package/src/interfaces/configuration-provenance.d.ts +2 -2
- package/src/interfaces/configuration-provenance.d.ts.map +1 -1
- package/src/interfaces/configuration-provenance.js +1 -1
- package/src/interfaces/configuration-provenance.js.map +1 -1
- package/src/interfaces/constants.d.ts +5 -5
- package/src/interfaces/constants.d.ts.map +1 -1
- package/src/interfaces/encryption-state.d.ts +1 -1
- package/src/interfaces/encryption-state.d.ts.map +1 -1
- package/src/interfaces/frontend-member-operational.d.ts +9 -9
- package/src/interfaces/frontend-member-operational.d.ts.map +1 -1
- package/src/interfaces/invariant.d.ts +1 -1
- package/src/interfaces/invariant.d.ts.map +1 -1
- package/src/interfaces/member-storage.d.ts +1 -1
- package/src/interfaces/member-storage.d.ts.map +1 -1
- package/src/interfaces/member-with-mnemonic.d.ts +2 -2
- package/src/interfaces/member-with-mnemonic.d.ts.map +1 -1
- package/src/interfaces/stream-header.d.ts +1 -1
- package/src/interfaces/stream-header.d.ts.map +1 -1
- package/src/utils/encryption-type-utils.d.ts +29 -0
- package/src/utils/encryption-type-utils.d.ts.map +1 -0
- package/src/utils/encryption-type-utils.js +61 -0
- package/src/utils/encryption-type-utils.js.map +1 -0
package/README.md
CHANGED
|
@@ -63,6 +63,74 @@ yarn add @digitaldefiance/ecies-lib
|
|
|
63
63
|
|
|
64
64
|
## Architecture & Protocol
|
|
65
65
|
|
|
66
|
+
### Module Dependency Architecture
|
|
67
|
+
|
|
68
|
+
The library follows a strict hierarchical module dependency structure to prevent circular dependencies and ensure reliable initialization:
|
|
69
|
+
|
|
70
|
+
```mermaid
|
|
71
|
+
graph TD
|
|
72
|
+
A[Level 1: Enumerations] --> B[Level 2: Translations]
|
|
73
|
+
B --> C[Level 3: i18n Setup]
|
|
74
|
+
C --> D[Level 4: Errors & Utils]
|
|
75
|
+
D --> E[Level 5: Constants & Services]
|
|
76
|
+
|
|
77
|
+
A1[ecies-string-key.ts] -.-> A
|
|
78
|
+
A2[ecies-error-type.ts] -.-> A
|
|
79
|
+
A3[ecies-encryption-type.ts] -.-> A
|
|
80
|
+
|
|
81
|
+
B1[en-US.ts] -.-> B
|
|
82
|
+
B2[fr.ts] -.-> B
|
|
83
|
+
B3[es.ts] -.-> B
|
|
84
|
+
|
|
85
|
+
C1[i18n-setup.ts] -.-> C
|
|
86
|
+
|
|
87
|
+
D1[errors/ecies.ts] -.-> D
|
|
88
|
+
D2[utils/encryption-type-utils.ts] -.-> D
|
|
89
|
+
|
|
90
|
+
E1[constants.ts] -.-> E
|
|
91
|
+
E2[services/ecies/service.ts] -.-> E
|
|
92
|
+
|
|
93
|
+
style A fill:#e1f5e1
|
|
94
|
+
style B fill:#e3f2fd
|
|
95
|
+
style C fill:#fff3e0
|
|
96
|
+
style D fill:#fce4ec
|
|
97
|
+
style E fill:#f3e5f5
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Dependency Levels:**
|
|
101
|
+
|
|
102
|
+
1. **Level 1 - Enumerations** (Pure, no dependencies)
|
|
103
|
+
- Contains only TypeScript enums and type definitions
|
|
104
|
+
- No imports from other project modules
|
|
105
|
+
- Examples: `EciesStringKey`, `EciesErrorType`, `EciesEncryptionType`
|
|
106
|
+
|
|
107
|
+
2. **Level 2 - Translations** (Depends only on Level 1)
|
|
108
|
+
- Translation objects mapping enum keys to localized strings
|
|
109
|
+
- Only imports enumerations
|
|
110
|
+
- Examples: `en-US.ts`, `fr.ts`, `es.ts`
|
|
111
|
+
|
|
112
|
+
3. **Level 3 - i18n Setup** (Depends on Levels 1-2)
|
|
113
|
+
- Initializes the internationalization engine
|
|
114
|
+
- Imports enumerations and translations
|
|
115
|
+
- Example: `i18n-setup.ts`
|
|
116
|
+
|
|
117
|
+
4. **Level 4 - Errors & Utilities** (Depends on Levels 1-3)
|
|
118
|
+
- Error classes with lazy i18n initialization
|
|
119
|
+
- Utility functions that may throw errors
|
|
120
|
+
- Examples: `errors/ecies.ts`, `utils/encryption-type-utils.ts`
|
|
121
|
+
|
|
122
|
+
5. **Level 5 - Constants & Services** (Depends on Levels 1-4)
|
|
123
|
+
- Configuration constants and validation
|
|
124
|
+
- Business logic and cryptographic services
|
|
125
|
+
- Examples: `constants.ts`, `services/ecies/service.ts`
|
|
126
|
+
|
|
127
|
+
**Key Principles:**
|
|
128
|
+
|
|
129
|
+
- **Enumerations are pure**: No imports except TypeScript types
|
|
130
|
+
- **Translations are data-only**: Only import enumerations
|
|
131
|
+
- **Errors use lazy i18n**: Translation lookup deferred until message access
|
|
132
|
+
- **Constants validate safely**: Early errors use basic Error class with fallback messages
|
|
133
|
+
|
|
66
134
|
### ECIES v4.0 Protocol Flow
|
|
67
135
|
|
|
68
136
|
The library implements a robust ECIES variant designed for security and efficiency.
|
|
@@ -228,8 +296,186 @@ const encrypted = await member.encryptData('My Secrets');
|
|
|
228
296
|
- `dispose()` method to explicitly zero out memory.
|
|
229
297
|
- Prevents accidental leakage via `console.log` or serialization.
|
|
230
298
|
|
|
299
|
+
## Documentation
|
|
300
|
+
|
|
301
|
+
### Architecture & Design
|
|
302
|
+
|
|
303
|
+
- **[ECIES V4 Architecture](docs/ECIES_V4_ARCHITECTURE.md)** - Protocol specification and cryptographic design
|
|
304
|
+
- **[Streaming Encryption Architecture](docs/STREAMING_ENCRYPTION_ARCHITECTURE.md)** - Memory-efficient streaming design
|
|
305
|
+
- **[Circular Dependency Prevention](docs/CIRCULAR_DEPENDENCY_PREVENTION.md)** - Module dependency architecture
|
|
306
|
+
|
|
307
|
+
### Developer Guides
|
|
308
|
+
|
|
309
|
+
- **[Contributing Guide](docs/CONTRIBUTING.md)** - How to contribute to the project
|
|
310
|
+
- **[Module Import Rules](docs/MODULE_IMPORT_RULES.md)** - Quick reference for import rules
|
|
311
|
+
- **[Migration Guide v3.7](docs/MIGRATION_GUIDE_v3.7.md)** - Upgrading from v3.x to v4.x
|
|
312
|
+
|
|
313
|
+
### Quick References
|
|
314
|
+
|
|
315
|
+
- **[Streaming API Quickstart](docs/STREAMING_API_QUICKSTART.md)** - Get started with streaming encryption
|
|
316
|
+
- **[V2 Quickstart](docs/V2_QUICKSTART.md)** - Quick start guide for v2.x architecture
|
|
317
|
+
|
|
231
318
|
## Development
|
|
232
319
|
|
|
320
|
+
### Avoiding Circular Dependencies
|
|
321
|
+
|
|
322
|
+
This library maintains a strict module hierarchy to prevent circular dependencies. When contributing, follow these rules:
|
|
323
|
+
|
|
324
|
+
#### Import Rules by Module Type
|
|
325
|
+
|
|
326
|
+
**Enumerations** (`src/enumerations/*.ts`):
|
|
327
|
+
- ✅ **CAN** import: TypeScript types only
|
|
328
|
+
- ❌ **CANNOT** import: Translations, i18n, errors, constants, services, utilities
|
|
329
|
+
|
|
330
|
+
**Translations** (`src/translations/*.ts`):
|
|
331
|
+
- ✅ **CAN** import: Enumerations, external libraries
|
|
332
|
+
- ❌ **CANNOT** import: i18n setup, errors, constants, services
|
|
333
|
+
|
|
334
|
+
**i18n Setup** (`src/i18n-setup.ts`):
|
|
335
|
+
- ✅ **CAN** import: Enumerations, translations, external libraries
|
|
336
|
+
- ❌ **CANNOT** import: Errors, constants, services
|
|
337
|
+
|
|
338
|
+
**Errors** (`src/errors/*.ts`):
|
|
339
|
+
- ✅ **CAN** import: Enumerations, i18n setup, external libraries
|
|
340
|
+
- ❌ **CANNOT** import: Constants, services (except as lazy imports)
|
|
341
|
+
- ⚠️ **MUST** use lazy i18n initialization (translation lookup on message access, not in constructor)
|
|
342
|
+
|
|
343
|
+
**Utilities** (`src/utils/*.ts`):
|
|
344
|
+
- ✅ **CAN** import: Enumerations, i18n setup, errors, external libraries
|
|
345
|
+
- ❌ **CANNOT** import: Constants, services (except as lazy imports)
|
|
346
|
+
|
|
347
|
+
**Constants** (`src/constants.ts`):
|
|
348
|
+
- ✅ **CAN** import: Enumerations, errors, utilities, external libraries
|
|
349
|
+
- ❌ **CANNOT** import: Services
|
|
350
|
+
- ⚠️ **MUST** handle early initialization errors gracefully (use fallback messages)
|
|
351
|
+
|
|
352
|
+
**Services** (`src/services/**/*.ts`):
|
|
353
|
+
- ✅ **CAN** import: All of the above
|
|
354
|
+
- ⚠️ **SHOULD** avoid circular dependencies with other services
|
|
355
|
+
|
|
356
|
+
#### Detecting Circular Dependencies
|
|
357
|
+
|
|
358
|
+
The project uses `madge` to detect circular dependencies. Run these commands to check:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Check for circular dependencies in the entire project
|
|
362
|
+
npx madge --circular --extensions ts src/index.ts
|
|
363
|
+
|
|
364
|
+
# Check a specific module
|
|
365
|
+
npx madge --circular --extensions ts src/enumerations/index.ts
|
|
366
|
+
|
|
367
|
+
# Generate a visual dependency graph
|
|
368
|
+
npx madge --image graph.svg --extensions ts src/index.ts
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Common Patterns to Avoid
|
|
372
|
+
|
|
373
|
+
**❌ Bad: Enumeration importing error class**
|
|
374
|
+
```typescript
|
|
375
|
+
// src/enumerations/ecies-encryption-type.ts
|
|
376
|
+
import { ECIESError } from '../errors/ecies'; // Creates circular dependency!
|
|
377
|
+
|
|
378
|
+
export function validateType(type: EciesEncryptionTypeEnum): void {
|
|
379
|
+
if (!isValid(type)) {
|
|
380
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**✅ Good: Move validation to utility module**
|
|
386
|
+
```typescript
|
|
387
|
+
// src/enumerations/ecies-encryption-type.ts
|
|
388
|
+
export enum EciesEncryptionTypeEnum {
|
|
389
|
+
Simple = 33,
|
|
390
|
+
Single = 66,
|
|
391
|
+
Multiple = 99,
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/utils/encryption-type-utils.ts
|
|
395
|
+
import { ECIESError } from '../errors/ecies';
|
|
396
|
+
import { EciesEncryptionTypeEnum } from '../enumerations/ecies-encryption-type';
|
|
397
|
+
|
|
398
|
+
export function validateType(type: EciesEncryptionTypeEnum): void {
|
|
399
|
+
if (!isValid(type)) {
|
|
400
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**❌ Bad: Error class with eager i18n initialization**
|
|
406
|
+
```typescript
|
|
407
|
+
// src/errors/ecies.ts
|
|
408
|
+
export class ECIESError extends Error {
|
|
409
|
+
constructor(type: ECIESErrorTypeEnum) {
|
|
410
|
+
const engine = getEciesI18nEngine(); // May not be initialized yet!
|
|
411
|
+
super(engine.translate(EciesComponentId, getKeyForType(type)));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**✅ Good: Error class with lazy i18n initialization**
|
|
417
|
+
```typescript
|
|
418
|
+
// src/errors/ecies.ts
|
|
419
|
+
export class ECIESError extends TypedHandleableError {
|
|
420
|
+
constructor(type: ECIESErrorTypeEnum) {
|
|
421
|
+
super(type); // Don't access i18n in constructor
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Message is accessed lazily via getter when needed
|
|
425
|
+
get message(): string {
|
|
426
|
+
const engine = getEciesI18nEngine();
|
|
427
|
+
return engine.translate(EciesComponentId, getKeyForType(this.type));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**❌ Bad: Constants validation with hard i18n dependency**
|
|
433
|
+
```typescript
|
|
434
|
+
// src/constants.ts
|
|
435
|
+
function validateConstants(config: IConstants): void {
|
|
436
|
+
const engine = getEciesI18nEngine(); // May fail during module init!
|
|
437
|
+
if (config.CHECKSUM.SHA3_BUFFER_LENGTH !== 32) {
|
|
438
|
+
throw new Error(engine.translate(EciesComponentId, EciesStringKey.Error_InvalidChecksum));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**✅ Good: Constants validation with fallback**
|
|
444
|
+
```typescript
|
|
445
|
+
// src/constants.ts
|
|
446
|
+
function safeTranslate(key: EciesStringKey, fallback: string): string {
|
|
447
|
+
try {
|
|
448
|
+
const engine = getEciesI18nEngine();
|
|
449
|
+
return engine.translate(EciesComponentId, key);
|
|
450
|
+
} catch {
|
|
451
|
+
return fallback; // Use fallback during early initialization
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function validateConstants(config: IConstants): void {
|
|
456
|
+
if (config.CHECKSUM.SHA3_BUFFER_LENGTH !== 32) {
|
|
457
|
+
throw new Error(safeTranslate(
|
|
458
|
+
EciesStringKey.Error_InvalidChecksum,
|
|
459
|
+
'Invalid checksum constants'
|
|
460
|
+
));
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### Pre-commit Checks
|
|
466
|
+
|
|
467
|
+
Consider adding a pre-commit hook to catch circular dependencies early:
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# .husky/pre-commit
|
|
471
|
+
#!/bin/sh
|
|
472
|
+
npx madge --circular --extensions ts src/index.ts
|
|
473
|
+
if [ $? -ne 0 ]; then
|
|
474
|
+
echo "❌ Circular dependencies detected! Please fix before committing."
|
|
475
|
+
exit 1
|
|
476
|
+
fi
|
|
477
|
+
```
|
|
478
|
+
|
|
233
479
|
### Commands
|
|
234
480
|
|
|
235
481
|
```bash
|
|
@@ -251,6 +497,10 @@ The library maintains **100% test coverage** with over 1,200 tests, including:
|
|
|
251
497
|
|
|
252
498
|
## ChangeLog
|
|
253
499
|
|
|
500
|
+
### v4.2.8
|
|
501
|
+
|
|
502
|
+
- Improve type safety/circular dependency protection
|
|
503
|
+
|
|
254
504
|
### v4.2.5
|
|
255
505
|
|
|
256
506
|
#### Changed
|
|
@@ -305,6 +555,10 @@ This release focuses on eliminating type safety escape hatches while maintaining
|
|
|
305
555
|
|
|
306
556
|
**Migration Guide:** No migration needed - this is a drop-in replacement for 4.2.x versions
|
|
307
557
|
|
|
558
|
+
### v4.2.7
|
|
559
|
+
|
|
560
|
+
- Minor bump. Fix tests
|
|
561
|
+
|
|
308
562
|
### v4.2.6
|
|
309
563
|
|
|
310
564
|
- Minor bump. Fix exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/ecies-lib",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "Digital Defiance ECIES Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"test:stream": "npx nx test --outputStyle=stream digitaldefiance-ecies-lib",
|
|
24
24
|
"test:logged": "npx nx test --outputStyle=stream digitaldefiance-ecies-lib 2>&1 | ansifilter -o test.log",
|
|
25
25
|
"test:coverage": "npx jest --coverage --testPathPattern=digitaldefiance-ecies-lib --coverageReporters=text",
|
|
26
|
+
"check:circular": "madge --circular --extensions ts src/index.ts",
|
|
27
|
+
"check:circular:json": "madge --circular --extensions ts --json src/index.ts",
|
|
28
|
+
"check:circular:enums": "madge --circular --extensions ts src/enumerations/index.ts",
|
|
26
29
|
"lint": "npx nx lint digitaldefiance-ecies-lib",
|
|
27
30
|
"lint:fix": "npx nx lint digitaldefiance-ecies-lib --fix",
|
|
28
31
|
"prettier:check": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
@@ -56,7 +59,10 @@
|
|
|
56
59
|
},
|
|
57
60
|
"devDependencies": {
|
|
58
61
|
"@digitaldefiance/express-suite-test-utils": "1.0.10",
|
|
59
|
-
"
|
|
62
|
+
"@swc/core": "^1.15.3",
|
|
63
|
+
"@swc/jest": "^0.2.39",
|
|
64
|
+
"fast-check": "^4.3.0",
|
|
65
|
+
"madge": "^8.0.0"
|
|
60
66
|
},
|
|
61
67
|
"module": "./../../dist/packages/digitaldefiance-ecies-lib/packages/digitaldefiance-ecies-lib/src/index.js",
|
|
62
68
|
"type": "module"
|
|
@@ -8,8 +8,4 @@ export declare const EciesEncryptionTypeMap: Record<EciesEncryptionType, EciesEn
|
|
|
8
8
|
export declare const EciesEncryptionTypeStringMap: Record<EciesEncryptionType, string>;
|
|
9
9
|
export declare const EciesEncryptionTypeEnumTypeMap: Record<EciesEncryptionTypeEnum, EciesEncryptionType>;
|
|
10
10
|
export declare const EciesEncryptionTypeEnumStringMap: Record<EciesEncryptionTypeEnum, string>;
|
|
11
|
-
export declare function encryptionTypeToString(type: EciesEncryptionType | EciesEncryptionTypeEnum): string;
|
|
12
|
-
export declare function encryptionTypeEnumToType(type: EciesEncryptionTypeEnum): EciesEncryptionType;
|
|
13
|
-
export declare function validateEciesEncryptionTypeEnum(type: EciesEncryptionTypeEnum): boolean;
|
|
14
|
-
export declare function ensureEciesEncryptionTypeEnum(type: EciesEncryptionTypeEnum): EciesEncryptionTypeEnum;
|
|
15
11
|
//# sourceMappingURL=ecies-encryption-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecies-encryption-type.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/enumerations/ecies-encryption-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecies-encryption-type.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/enumerations/ecies-encryption-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnE,oBAAY,uBAAuB;IACjC,MAAM,KAAK;IACX,MAAM,KAAK;IACX,QAAQ,KAAK;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,mBAAmB,EACnB,uBAAuB,CAKxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAK1E,CAAC;AAEJ,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,uBAAuB,EACvB,mBAAmB,CAKpB,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CACnD,uBAAuB,EACvB,MAAM,CAKP,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ECIESError } from '../errors/ecies';
|
|
2
|
-
import { ECIESErrorTypeEnum } from './ecies-error-type';
|
|
3
1
|
export var EciesEncryptionTypeEnum;
|
|
4
2
|
(function (EciesEncryptionTypeEnum) {
|
|
5
3
|
EciesEncryptionTypeEnum[EciesEncryptionTypeEnum["Simple"] = 33] = "Simple";
|
|
@@ -17,47 +15,13 @@ export const EciesEncryptionTypeStringMap = {
|
|
|
17
15
|
multiple: 'multiple',
|
|
18
16
|
};
|
|
19
17
|
export const EciesEncryptionTypeEnumTypeMap = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
33: 'simple',
|
|
19
|
+
66: 'single',
|
|
20
|
+
99: 'multiple',
|
|
23
21
|
};
|
|
24
22
|
export const EciesEncryptionTypeEnumStringMap = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
33: 'simple',
|
|
24
|
+
66: 'single',
|
|
25
|
+
99: 'multiple',
|
|
28
26
|
};
|
|
29
|
-
export function encryptionTypeToString(type) {
|
|
30
|
-
// if enum
|
|
31
|
-
let resultType;
|
|
32
|
-
if (typeof type === 'number') {
|
|
33
|
-
resultType = EciesEncryptionTypeEnumTypeMap[type];
|
|
34
|
-
if (resultType === undefined) {
|
|
35
|
-
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
resultType = type;
|
|
40
|
-
}
|
|
41
|
-
const result = EciesEncryptionTypeStringMap[resultType];
|
|
42
|
-
if (result === undefined) {
|
|
43
|
-
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
export function encryptionTypeEnumToType(type) {
|
|
48
|
-
const result = EciesEncryptionTypeEnumTypeMap[type];
|
|
49
|
-
if (result === undefined) {
|
|
50
|
-
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
export function validateEciesEncryptionTypeEnum(type) {
|
|
55
|
-
return Object.values(EciesEncryptionTypeEnum).includes(type);
|
|
56
|
-
}
|
|
57
|
-
export function ensureEciesEncryptionTypeEnum(type) {
|
|
58
|
-
if (!validateEciesEncryptionTypeEnum(type)) {
|
|
59
|
-
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
60
|
-
}
|
|
61
|
-
return type;
|
|
62
|
-
}
|
|
63
27
|
//# sourceMappingURL=ecies-encryption-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecies-encryption-type.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/enumerations/ecies-encryption-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecies-encryption-type.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/enumerations/ecies-encryption-type.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,0EAAW,CAAA;IACX,0EAAW,CAAA;IACX,8EAAa,CAAA;AACf,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAG/B;IACF,MAAM,EAAE,uBAAuB,CAAC,MAAM;IACtC,MAAM,EAAE,uBAAuB,CAAC,MAAM;IACtC,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GACvC;IACE,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEJ,MAAM,CAAC,MAAM,8BAA8B,GAGvC;IACF,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,UAAU;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAGzC;IACF,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,UAAU;CACf,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* - Result pattern
|
|
9
9
|
* - i18n 2.0 integration
|
|
10
10
|
*/
|
|
11
|
-
export * from './builders
|
|
12
|
-
export * from './core
|
|
13
|
-
export * from './lib
|
|
11
|
+
export * from './builders';
|
|
12
|
+
export * from './core';
|
|
13
|
+
export * from './lib';
|
|
14
14
|
export { EciesComponentId, EciesI18nEngineKey, getEciesI18nEngine, getEciesTranslation, resetEciesI18nEngine, safeEciesTranslation, } from './i18n-setup';
|
|
15
15
|
export { EciesStringKey } from './enumerations/ecies-string-key';
|
|
16
16
|
export { MemberType } from './enumerations/member-type';
|
|
@@ -22,7 +22,7 @@ export { Constants, ConstantsRegistry } from './constants';
|
|
|
22
22
|
export type { IConstants } from './interfaces';
|
|
23
23
|
export { ECIES, OBJECT_ID_LENGTH, UINT32_MAX, UINT64_SIZE } from './constants';
|
|
24
24
|
export { EciesCipherSuiteEnum } from './enumerations/ecies-cipher-suite';
|
|
25
|
-
export { EciesEncryptionTypeEnum, EciesEncryptionTypeMap,
|
|
25
|
+
export { EciesEncryptionTypeEnum, EciesEncryptionTypeMap, type EciesEncryptionType, } from './enumerations/ecies-encryption-type';
|
|
26
26
|
export { ECIESErrorTypeEnum } from './enumerations/ecies-error-type';
|
|
27
27
|
export { EciesVersionEnum } from './enumerations/ecies-version';
|
|
28
28
|
export { InvalidEmailErrorType } from './enumerations/invalid-email-type';
|
|
@@ -33,6 +33,7 @@ export { ECIESError } from './errors/ecies';
|
|
|
33
33
|
export type { IECIESConfig, IECIESConstants, IMemberStorageData, IPBkdf2Consts, IPbkdf2Config, } from './interfaces';
|
|
34
34
|
export type { HexString } from './types';
|
|
35
35
|
export { getLengthEncodingTypeForLength, getLengthEncodingTypeFromValue, getLengthForLengthType, } from './utils';
|
|
36
|
+
export { encryptionTypeEnumToType, encryptionTypeToString, ensureEciesEncryptionTypeEnum, validateEciesEncryptionTypeEnum, } from './utils/encryption-type-utils';
|
|
36
37
|
export { BaseIdProvider } from './interfaces/id-provider';
|
|
37
38
|
export type { IIdProvider } from './interfaces/id-provider';
|
|
38
39
|
export * from './lib/id-providers';
|
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;;;;;;;;;GASG;AAGH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AAGtB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,UAAU,EAA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E,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EACV,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* - i18n 2.0 integration
|
|
10
10
|
*/
|
|
11
11
|
// Core v2 exports
|
|
12
|
-
export * from './builders
|
|
13
|
-
export * from './core
|
|
14
|
-
export * from './lib
|
|
12
|
+
export * from './builders';
|
|
13
|
+
export * from './core';
|
|
14
|
+
export * from './lib';
|
|
15
15
|
// i18n v2
|
|
16
16
|
export { EciesComponentId, EciesI18nEngineKey, getEciesI18nEngine, getEciesTranslation, resetEciesI18nEngine, safeEciesTranslation, } from './i18n-setup';
|
|
17
17
|
// Re-export existing types and enums (unchanged)
|
|
@@ -27,7 +27,8 @@ export { Constants, ConstantsRegistry } from './constants';
|
|
|
27
27
|
// Also export specific interfaces, types, and enums that are needed
|
|
28
28
|
export { ECIES, OBJECT_ID_LENGTH, UINT32_MAX, UINT64_SIZE } from './constants';
|
|
29
29
|
export { EciesCipherSuiteEnum } from './enumerations/ecies-cipher-suite';
|
|
30
|
-
export { EciesEncryptionTypeEnum, EciesEncryptionTypeMap,
|
|
30
|
+
export { EciesEncryptionTypeEnum, EciesEncryptionTypeMap, } from './enumerations/ecies-encryption-type';
|
|
31
|
+
// Export utility functions from utils module (moved from enumerations for circular dependency fix)
|
|
31
32
|
export { ECIESErrorTypeEnum } from './enumerations/ecies-error-type';
|
|
32
33
|
export { EciesVersionEnum } from './enumerations/ecies-version';
|
|
33
34
|
export { InvalidEmailErrorType } from './enumerations/invalid-email-type';
|
|
@@ -36,6 +37,7 @@ export { MemberErrorType } from './enumerations/member-error-type';
|
|
|
36
37
|
export { Pbkdf2ErrorType } from './enumerations/pbkdf2-error-type';
|
|
37
38
|
export { ECIESError } from './errors/ecies';
|
|
38
39
|
export { getLengthEncodingTypeForLength, getLengthEncodingTypeFromValue, getLengthForLengthType, } from './utils';
|
|
40
|
+
export { encryptionTypeEnumToType, encryptionTypeToString, ensureEciesEncryptionTypeEnum, validateEciesEncryptionTypeEnum, } from './utils/encryption-type-utils';
|
|
39
41
|
// ID Provider system
|
|
40
42
|
export { BaseIdProvider } from './interfaces/id-provider';
|
|
41
43
|
export * from './lib/id-providers';
|
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,kBAAkB;AAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-ecies-lib/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AAEtB,UAAU;AACV,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEt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oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { DeepPartial } from '../types/deep-partial';
|
|
2
|
+
import type { IConstants } from './constants';
|
|
3
3
|
/**
|
|
4
4
|
* Provenance information for a configuration.
|
|
5
5
|
* Tracks who created it, when, and what modifications were made.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-provenance.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/configuration-provenance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration-provenance.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/configuration-provenance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAElD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAMlE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAO7C"}
|
|
@@ -5,7 +5,7 @@ import { createHash } from 'crypto';
|
|
|
5
5
|
*/
|
|
6
6
|
export function calculateConfigChecksum(config) {
|
|
7
7
|
// Create a stable JSON representation with BigInt support
|
|
8
|
-
const replacer = (key, value) =>
|
|
8
|
+
const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value;
|
|
9
9
|
const stable = JSON.stringify(config, replacer);
|
|
10
10
|
return createHash('sha256').update(stable).digest('hex');
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-provenance.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/configuration-provenance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration-provenance.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/configuration-provenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAkDpC;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAkB;IACxD,0DAA0D;IAC1D,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE,CAC3C,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,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,OAAO,mBAAmB,CAAC;IAEvC,+DAA+D;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Pbkdf2Profiles } from '../pbkdf2-profiles';
|
|
2
|
-
import { IChecksumConsts } from './checksum-consts';
|
|
3
|
-
import { IECIESConstants } from './ecies-consts';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { Pbkdf2Profiles } from '../pbkdf2-profiles';
|
|
2
|
+
import type { IChecksumConsts } from './checksum-consts';
|
|
3
|
+
import type { IECIESConstants } from './ecies-consts';
|
|
4
|
+
import type { IIdProvider } from './id-provider';
|
|
5
|
+
import type { IPBkdf2Consts } from './pbkdf2-consts';
|
|
6
6
|
export interface IConstants {
|
|
7
7
|
UINT8_SIZE: number;
|
|
8
8
|
UINT16_SIZE: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,EAAE,WAAW,CAAC;IAExB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-state.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/encryption-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"encryption-state.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/encryption-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,uBAAuB,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,wBAAwB,IAAI,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Wallet } from '@ethereumjs/wallet';
|
|
2
|
-
import { EmailString } from '../email-string';
|
|
3
|
-
import MemberType from '../enumerations/member-type';
|
|
4
|
-
import { SecureBuffer } from '../secure-buffer';
|
|
5
|
-
import { SecureString } from '../secure-string';
|
|
6
|
-
import { SignatureUint8Array } from '../types';
|
|
7
|
-
import { IECIESConstants } from './ecies-consts';
|
|
8
|
-
import { IEncryptedChunk } from './encrypted-chunk';
|
|
9
|
-
import { ProgressCallback } from './stream-progress';
|
|
1
|
+
import type { Wallet } from '@ethereumjs/wallet';
|
|
2
|
+
import type { EmailString } from '../email-string';
|
|
3
|
+
import type MemberType from '../enumerations/member-type';
|
|
4
|
+
import type { SecureBuffer } from '../secure-buffer';
|
|
5
|
+
import type { SecureString } from '../secure-string';
|
|
6
|
+
import type { SignatureUint8Array } from '../types';
|
|
7
|
+
import type { IECIESConstants } from './ecies-consts';
|
|
8
|
+
import type { IEncryptedChunk } from './encrypted-chunk';
|
|
9
|
+
import type { ProgressCallback } from './stream-progress';
|
|
10
10
|
/**
|
|
11
11
|
* Operational interface for member - defines getters and methods
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-member-operational.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/frontend-member-operational.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"frontend-member-operational.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/frontend-member-operational.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,0BAA0B,CACzC,GAAG,GAAG,UAAU,EAChB,KAAK,GAAG,UAAU,EAClB,UAAU,GAAG,mBAAmB;IAGhC,IAAI,EAAE,IAAI,GAAG,CAAC;IACd,IAAI,IAAI,IAAI,UAAU,CAAC;IACvB,IAAI,IAAI,IAAI,MAAM,CAAC;IACnB,IAAI,KAAK,IAAI,WAAW,CAAC;IACzB,IAAI,SAAS,IAAI,UAAU,CAAC;IAC5B,IAAI,SAAS,IAAI,GAAG,CAAC;IACrB,IAAI,WAAW,IAAI,IAAI,CAAC;IACxB,IAAI,WAAW,IAAI,IAAI,CAAC;I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I,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,0BAA0B;IACxE,IAAI,QAAQ,IAAI,YAAY,GAAG,SAAS,CAAC;CAC1C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConstants } from './constants';
|
|
1
|
+
import type { IConstants } from './constants';
|
|
2
2
|
/**
|
|
3
3
|
* An invariant is a relationship between configuration values that must always hold true.
|
|
4
4
|
* Unlike simple property validation, invariants check consistency across multiple related values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/invariant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/invariant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAEnC;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;CAC1C;AAED;;GAEG;AACH,8BAAsB,aAAc,YAAW,UAAU;aAErC,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;gBADnB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM;IAGrC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAC3C,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAEjD;;OAEG;IACH,SAAS,CAAC,WAAW,CACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,MAAM;CAGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-storage.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/member-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"member-storage.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/member-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Member } from '../member';
|
|
2
|
-
import { SecureString } from '../secure-string';
|
|
1
|
+
import type { Member } from '../member';
|
|
2
|
+
import type { SecureString } from '../secure-string';
|
|
3
3
|
export interface IMemberWithMnemonic {
|
|
4
4
|
member: Member;
|
|
5
5
|
mnemonic: SecureString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-with-mnemonic.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/member-with-mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"member-with-mnemonic.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/member-with-mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/stream-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"stream-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/interfaces/stream-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,cAAc,EAAE,uBAAuB,CAAC;IACxC,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EciesEncryptionType, EciesEncryptionTypeEnum } from '../enumerations/ecies-encryption-type';
|
|
2
|
+
/**
|
|
3
|
+
* Converts an encryption type (string or enum) to its string representation
|
|
4
|
+
* @param type The encryption type to convert
|
|
5
|
+
* @returns The string representation of the encryption type
|
|
6
|
+
* @throws ECIESError if the type is invalid
|
|
7
|
+
*/
|
|
8
|
+
export declare function encryptionTypeToString(type: EciesEncryptionType | EciesEncryptionTypeEnum): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts an encryption type enum to its type representation
|
|
11
|
+
* @param type The encryption type enum to convert
|
|
12
|
+
* @returns The type representation of the encryption type
|
|
13
|
+
* @throws ECIESError if the type is invalid
|
|
14
|
+
*/
|
|
15
|
+
export declare function encryptionTypeEnumToType(type: EciesEncryptionTypeEnum): EciesEncryptionType;
|
|
16
|
+
/**
|
|
17
|
+
* Validates that a value is a valid EciesEncryptionTypeEnum
|
|
18
|
+
* @param type The value to validate
|
|
19
|
+
* @returns true if the value is a valid EciesEncryptionTypeEnum, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateEciesEncryptionTypeEnum(type: EciesEncryptionTypeEnum): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Ensures that a value is a valid EciesEncryptionTypeEnum
|
|
24
|
+
* @param type The value to validate
|
|
25
|
+
* @returns The validated EciesEncryptionTypeEnum
|
|
26
|
+
* @throws ECIESError if the type is invalid
|
|
27
|
+
*/
|
|
28
|
+
export declare function ensureEciesEncryptionTypeEnum(type: EciesEncryptionTypeEnum): EciesEncryptionTypeEnum;
|
|
29
|
+
//# sourceMappingURL=encryption-type-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption-type-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/utils/encryption-type-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,uCAAuC,CAAC;AAI/C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAClD,MAAM,CAgBR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,uBAAuB,GAC5B,mBAAmB,CAMrB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,uBAAuB,GAC5B,uBAAuB,CAKzB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EciesEncryptionTypeEnum, EciesEncryptionTypeEnumTypeMap, EciesEncryptionTypeStringMap, } from '../enumerations/ecies-encryption-type';
|
|
2
|
+
import { ECIESErrorTypeEnum } from '../enumerations/ecies-error-type';
|
|
3
|
+
import { ECIESError } from '../errors/ecies';
|
|
4
|
+
/**
|
|
5
|
+
* Converts an encryption type (string or enum) to its string representation
|
|
6
|
+
* @param type The encryption type to convert
|
|
7
|
+
* @returns The string representation of the encryption type
|
|
8
|
+
* @throws ECIESError if the type is invalid
|
|
9
|
+
*/
|
|
10
|
+
export function encryptionTypeToString(type) {
|
|
11
|
+
// if enum
|
|
12
|
+
let resultType;
|
|
13
|
+
if (typeof type === 'number') {
|
|
14
|
+
resultType = EciesEncryptionTypeEnumTypeMap[type];
|
|
15
|
+
if (resultType === undefined) {
|
|
16
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
resultType = type;
|
|
21
|
+
}
|
|
22
|
+
const result = EciesEncryptionTypeStringMap[resultType];
|
|
23
|
+
if (result === undefined) {
|
|
24
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts an encryption type enum to its type representation
|
|
30
|
+
* @param type The encryption type enum to convert
|
|
31
|
+
* @returns The type representation of the encryption type
|
|
32
|
+
* @throws ECIESError if the type is invalid
|
|
33
|
+
*/
|
|
34
|
+
export function encryptionTypeEnumToType(type) {
|
|
35
|
+
const result = EciesEncryptionTypeEnumTypeMap[type];
|
|
36
|
+
if (result === undefined) {
|
|
37
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validates that a value is a valid EciesEncryptionTypeEnum
|
|
43
|
+
* @param type The value to validate
|
|
44
|
+
* @returns true if the value is a valid EciesEncryptionTypeEnum, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
export function validateEciesEncryptionTypeEnum(type) {
|
|
47
|
+
return Object.values(EciesEncryptionTypeEnum).includes(type);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Ensures that a value is a valid EciesEncryptionTypeEnum
|
|
51
|
+
* @param type The value to validate
|
|
52
|
+
* @returns The validated EciesEncryptionTypeEnum
|
|
53
|
+
* @throws ECIESError if the type is invalid
|
|
54
|
+
*/
|
|
55
|
+
export function ensureEciesEncryptionTypeEnum(type) {
|
|
56
|
+
if (!validateEciesEncryptionTypeEnum(type)) {
|
|
57
|
+
throw new ECIESError(ECIESErrorTypeEnum.InvalidEncryptionType);
|
|
58
|
+
}
|
|
59
|
+
return type;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=encryption-type-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption-type-utils.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-ecies-lib/src/utils/encryption-type-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MA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