@digitaldefiance/ecies-lib 4.2.6 → 4.2.7
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 +4 -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/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
|
@@ -305,6 +305,10 @@ This release focuses on eliminating type safety escape hatches while maintaining
|
|
|
305
305
|
|
|
306
306
|
**Migration Guide:** No migration needed - this is a drop-in replacement for 4.2.x versions
|
|
307
307
|
|
|
308
|
+
### v4.2.7
|
|
309
|
+
|
|
310
|
+
- Minor bump. Fix tests
|
|
311
|
+
|
|
308
312
|
### v4.2.6
|
|
309
313
|
|
|
310
314
|
- 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.7",
|
|
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/digit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MAAM,+BAA+B,CAAC;AACtE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,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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AC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,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;AAKhE,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;AAEtE,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,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,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAmD;IAEnD,UAAU;IACV,IAAI,UAA+B,CAAC;IACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,UAAU,GAAG,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,MAAM,MAAM,GAAG,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAAC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