@digitaldefiance/node-ecies-lib 1.1.11 → 1.1.13
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 +9 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +44 -44
- package/dist/constants.js.map +1 -1
- package/dist/enumerations/index.js +17 -1
- package/dist/enumerations/index.js.map +1 -1
- package/dist/enumerations/pbkdf2-profile.js +5 -2
- package/dist/enumerations/pbkdf2-profile.js.map +1 -1
- package/dist/i18n/ecies-i18n-factory.js +27 -21
- package/dist/i18n/ecies-i18n-factory.js.map +1 -1
- package/dist/i18n/index.js +17 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces/authenticated-cipher.js +2 -1
- package/dist/interfaces/authenticated-decipher.js +2 -1
- package/dist/interfaces/checksum-config.js +2 -1
- package/dist/interfaces/checksum-consts.js +2 -1
- package/dist/interfaces/constants.js +2 -1
- package/dist/interfaces/ecies-consts.js +2 -1
- package/dist/interfaces/encryption-consts.js +2 -1
- package/dist/interfaces/index.js +33 -17
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +2 -1
- package/dist/interfaces/keyring-consts.js +2 -1
- package/dist/interfaces/member-operational.js +2 -1
- package/dist/interfaces/member-with-mnemonic.js +2 -1
- package/dist/interfaces/multi-encrypted-message.js +2 -1
- package/dist/interfaces/multi-encrypted-parsed-header.js +2 -1
- package/dist/interfaces/pbkdf-profiles.js +2 -1
- package/dist/interfaces/pbkdf2-result.js +2 -1
- package/dist/interfaces/signing-key-private-key-info.js +2 -1
- package/dist/interfaces/simple-keypair-buffer.js +2 -1
- package/dist/interfaces/simple-keypair.js +2 -1
- package/dist/interfaces/simple-public-key-only-buffer.js +2 -1
- package/dist/interfaces/simple-public-key-only.js +2 -1
- package/dist/interfaces/single-encrypted-parsed-header.js +2 -1
- package/dist/interfaces/wallet-seed.js +2 -1
- package/dist/interfaces/wrapped-key-consts.js +2 -1
- package/dist/member.js +35 -30
- package/dist/member.js.map +1 -1
- package/dist/services/aes-gcm.js +14 -10
- package/dist/services/aes-gcm.js.map +1 -1
- package/dist/services/ecies/crypto-core.js +29 -25
- package/dist/services/ecies/crypto-core.js.map +1 -1
- package/dist/services/ecies/file.js +39 -2
- package/dist/services/ecies/file.js.map +1 -1
- package/dist/services/ecies/index.js +23 -7
- package/dist/services/ecies/index.js.map +1 -1
- package/dist/services/ecies/multi-recipient.js +50 -46
- package/dist/services/ecies/multi-recipient.js.map +1 -1
- package/dist/services/ecies/service.js +25 -21
- package/dist/services/ecies/service.js.map +1 -1
- package/dist/services/ecies/signature.js +15 -11
- package/dist/services/ecies/signature.js.map +1 -1
- package/dist/services/ecies/single-recipient.js +60 -56
- package/dist/services/ecies/single-recipient.js.map +1 -1
- package/dist/services/ecies/utilities.js +17 -13
- package/dist/services/ecies/utilities.js.map +1 -1
- package/dist/services/index.js +19 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/pbkdf2.js +25 -20
- package/dist/services/pbkdf2.js.map +1 -1
- package/dist/types.js +2 -1
- package/dist/utils.js +26 -22
- package/dist/utils.js.map +1 -1
- package/package.json +3 -4
- package/dist/interfaces/fec-consts.d.ts +0 -5
- package/dist/interfaces/fec-consts.d.ts.map +0 -1
- package/dist/interfaces/fec-consts.js +0 -2
- package/dist/interfaces/fec-consts.js.map +0 -1
- package/dist/services/ecies/crypto-core.debug.d.ts +0 -13
- package/dist/services/ecies/crypto-core.debug.d.ts.map +0 -1
- package/dist/services/ecies/crypto-core.debug.js +0 -91
- package/dist/services/ecies/crypto-core.debug.js.map +0 -1
- package/dist/services/ecies/debug-aes-gcm.d.ts +0 -2
- package/dist/services/ecies/debug-aes-gcm.d.ts.map +0 -1
- package/dist/services/ecies/debug-aes-gcm.js +0 -106
- package/dist/services/ecies/debug-aes-gcm.js.map +0 -1
- package/dist/services/ecies/debug-ecdh.d.ts +0 -2
- package/dist/services/ecies/debug-ecdh.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecdh.js +0 -123
- package/dist/services/ecies/debug-ecdh.js.map +0 -1
- package/dist/services/ecies/debug-ecies-burnbag.d.ts +0 -2
- package/dist/services/ecies/debug-ecies-burnbag.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecies-burnbag.js +0 -134
- package/dist/services/ecies/debug-ecies-burnbag.js.map +0 -1
- package/dist/services/ecies/debug-ecies.d.ts +0 -2
- package/dist/services/ecies/debug-ecies.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecies.js +0 -110
- package/dist/services/ecies/debug-ecies.js.map +0 -1
- package/dist/services/ecies/debug-test.d.ts +0 -2
- package/dist/services/ecies/debug-test.d.ts.map +0 -1
- package/dist/services/ecies/debug-test.js +0 -57
- package/dist/services/ecies/debug-test.js.map +0 -1
package/dist/services/pbkdf2.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pbkdf2Service = exports.NodePbkdf2Error = void 0;
|
|
4
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
const util_1 = require("util");
|
|
7
|
+
const ecies_i18n_factory_1 = require("../i18n/ecies-i18n-factory");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
6
9
|
/**
|
|
7
10
|
* Custom PBKDF2 error class that works with the plugin i18n system
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
class NodePbkdf2Error extends Error {
|
|
10
13
|
type;
|
|
11
14
|
constructor(message, type) {
|
|
12
15
|
super(message);
|
|
@@ -14,6 +17,7 @@ export class NodePbkdf2Error extends Error {
|
|
|
14
17
|
this.name = 'NodePbkdf2Error';
|
|
15
18
|
}
|
|
16
19
|
}
|
|
20
|
+
exports.NodePbkdf2Error = NodePbkdf2Error;
|
|
17
21
|
/**
|
|
18
22
|
* Service for handling PBKDF2 (Password-Based Key Derivation Function 2) operations.
|
|
19
23
|
* This service provides functionality for:
|
|
@@ -22,15 +26,15 @@ export class NodePbkdf2Error extends Error {
|
|
|
22
26
|
* - Managing salt and iteration parameters
|
|
23
27
|
* - Both synchronous and asynchronous key derivation
|
|
24
28
|
*/
|
|
25
|
-
|
|
29
|
+
class Pbkdf2Service {
|
|
26
30
|
engine;
|
|
27
31
|
profiles;
|
|
28
32
|
eciesConsts;
|
|
29
33
|
pbkdf2Consts;
|
|
30
|
-
constructor(engine, profiles, eciesParams = Constants.ECIES, pbkdf2Params = Constants.PBKDF2) {
|
|
34
|
+
constructor(engine, profiles, eciesParams = constants_1.Constants.ECIES, pbkdf2Params = constants_1.Constants.PBKDF2) {
|
|
31
35
|
this.engine = engine;
|
|
32
36
|
this.profiles = profiles ? { ...profiles } : {};
|
|
33
|
-
const runtimeDefaults = getNodeRuntimeConfiguration();
|
|
37
|
+
const runtimeDefaults = (0, constants_1.getNodeRuntimeConfiguration)();
|
|
34
38
|
this.eciesConsts = eciesParams ?? runtimeDefaults.ECIES;
|
|
35
39
|
this.pbkdf2Consts =
|
|
36
40
|
pbkdf2Params ?? runtimeDefaults.PBKDF2;
|
|
@@ -64,8 +68,8 @@ export class Pbkdf2Service {
|
|
|
64
68
|
* @returns A new Pbkdf2Service instance
|
|
65
69
|
*/
|
|
66
70
|
static fromConstants(constants) {
|
|
67
|
-
const engine = createEciesTranslationEngine();
|
|
68
|
-
const runtimeDefaults = getNodeRuntimeConfiguration();
|
|
71
|
+
const engine = (0, ecies_i18n_factory_1.createEciesTranslationEngine)();
|
|
72
|
+
const runtimeDefaults = (0, constants_1.getNodeRuntimeConfiguration)();
|
|
69
73
|
return new Pbkdf2Service(engine, constants.PBKDF2_PROFILES, runtimeDefaults.ECIES, constants.PBKDF2);
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
@@ -76,7 +80,7 @@ export class Pbkdf2Service {
|
|
|
76
80
|
getProfileConfig(profile) {
|
|
77
81
|
const profileConfig = this.profiles[profile];
|
|
78
82
|
if (!profileConfig) {
|
|
79
|
-
throw new NodePbkdf2Error(getNodeEciesTranslation(NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), Pbkdf2ErrorType.InvalidProfile);
|
|
83
|
+
throw new NodePbkdf2Error((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), ecies_lib_1.Pbkdf2ErrorType.InvalidProfile);
|
|
80
84
|
}
|
|
81
85
|
return {
|
|
82
86
|
hashBytes: profileConfig.hashBytes,
|
|
@@ -122,13 +126,13 @@ export class Pbkdf2Service {
|
|
|
122
126
|
*/
|
|
123
127
|
deriveKeyFromPassword(password, salt, iterations, saltBytes, keySize, algorithm) {
|
|
124
128
|
const config = this.getConfig(iterations, saltBytes, keySize, algorithm);
|
|
125
|
-
const saltBytes_ = salt ?? randomBytes(config.saltBytes);
|
|
129
|
+
const saltBytes_ = salt ?? (0, crypto_1.randomBytes)(config.saltBytes);
|
|
126
130
|
if (saltBytes_.length !== config.saltBytes) {
|
|
127
|
-
throw new NodePbkdf2Error(getNodeEciesTranslation(NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), Pbkdf2ErrorType.InvalidSaltLength);
|
|
131
|
+
throw new NodePbkdf2Error((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), ecies_lib_1.Pbkdf2ErrorType.InvalidSaltLength);
|
|
128
132
|
}
|
|
129
|
-
const hashBytes = pbkdf2Sync(password, saltBytes_, config.iterations, config.hashBytes, config.algorithm);
|
|
133
|
+
const hashBytes = (0, crypto_1.pbkdf2Sync)(password, saltBytes_, config.iterations, config.hashBytes, config.algorithm);
|
|
130
134
|
if (hashBytes.length !== config.hashBytes) {
|
|
131
|
-
throw new NodePbkdf2Error(getNodeEciesTranslation(NodeEciesStringKey.Error_Pbkdf2_InvalidHashLength), Pbkdf2ErrorType.InvalidHashLength);
|
|
135
|
+
throw new NodePbkdf2Error((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_Pbkdf2_InvalidHashLength), ecies_lib_1.Pbkdf2ErrorType.InvalidHashLength);
|
|
132
136
|
}
|
|
133
137
|
return {
|
|
134
138
|
salt: saltBytes_,
|
|
@@ -149,14 +153,14 @@ export class Pbkdf2Service {
|
|
|
149
153
|
*/
|
|
150
154
|
async deriveKeyFromPasswordAsync(password, salt, iterations, saltBytes, keySize, algorithm) {
|
|
151
155
|
const config = this.getConfig(iterations, saltBytes, keySize, algorithm);
|
|
152
|
-
const saltBytes_ = salt ?? randomBytes(config.saltBytes);
|
|
156
|
+
const saltBytes_ = salt ?? (0, crypto_1.randomBytes)(config.saltBytes);
|
|
153
157
|
if (saltBytes_.length !== config.saltBytes) {
|
|
154
|
-
throw new NodePbkdf2Error(getNodeEciesTranslation(NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), Pbkdf2ErrorType.InvalidSaltLength);
|
|
158
|
+
throw new NodePbkdf2Error((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength), ecies_lib_1.Pbkdf2ErrorType.InvalidSaltLength);
|
|
155
159
|
}
|
|
156
|
-
const pbkdf2 = promisify(
|
|
160
|
+
const pbkdf2 = (0, util_1.promisify)(crypto_1.pbkdf2);
|
|
157
161
|
const hashBytes = (await pbkdf2(password, saltBytes_, config.iterations, config.hashBytes, config.algorithm));
|
|
158
162
|
if (hashBytes.length !== config.hashBytes) {
|
|
159
|
-
throw new NodePbkdf2Error(getNodeEciesTranslation(NodeEciesStringKey.Error_Pbkdf2_InvalidHashLength), Pbkdf2ErrorType.InvalidHashLength);
|
|
163
|
+
throw new NodePbkdf2Error((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_Pbkdf2_InvalidHashLength), ecies_lib_1.Pbkdf2ErrorType.InvalidHashLength);
|
|
160
164
|
}
|
|
161
165
|
return {
|
|
162
166
|
salt: saltBytes_,
|
|
@@ -187,4 +191,5 @@ export class Pbkdf2Service {
|
|
|
187
191
|
return this.deriveKeyFromPasswordAsync(password, salt, config.iterations, config.saltBytes, config.hashBytes, config.algorithm);
|
|
188
192
|
}
|
|
189
193
|
}
|
|
194
|
+
exports.Pbkdf2Service = Pbkdf2Service;
|
|
190
195
|
//# sourceMappingURL=pbkdf2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src/services/pbkdf2.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src/services/pbkdf2.ts"],"names":[],"mappings":";;;AAEA,0DAIoC;AACpC,mCAAwE;AACxE,+BAAiC;AAGjC,mEAAuH;AAGvH,4CAAsE;AAEtE;;GAEG;AACH,MAAa,eAAgB,SAAQ,KAAK;IACK;IAA7C,YAAY,OAAe,EAAkB,IAAqB;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,SAAI,GAAJ,IAAI,CAAiB;QAEhE,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED;;;;;;;GAOG;AACH,MAAa,aAAa;IACL,MAAM,CAAoC;IAC1C,QAAQ,CAAgC;IACxC,WAAW,CAAe;IAC1B,YAAY,CAAgB;IAE/C,YACE,MAAyC,EACzC,QAAwC,EACxC,cAA4B,qBAAS,CAAC,KAAK,EAC3C,eAA8B,qBAAS,CAAC,MAAM;QAE9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAA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,iBAAiB,CAClC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,gCAAgC,CACrC,QAAgB,EAChB,OAA0B,EAC1B,IAAa;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,qBAAqB,CAC/B,QAAQ,EACR,IAAI,EACJ,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,SAAS,CACjB,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,qCAAqC,CAChD,QAAgB,EAChB,OAA0B,EAC1B,IAAa;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,0BAA0B,CACpC,QAAQ,EACR,IAAI,EACJ,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,SAAS,CACjB,CAAC;IACJ,CAAC;CACF;AAhRD,sCAgRC"}
|
package/dist/types.js
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lengthEncodeData = lengthEncodeData;
|
|
4
|
+
exports.decodeLengthEncodedData = decodeLengthEncodedData;
|
|
5
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
6
|
+
const ecies_i18n_factory_1 = require("./i18n/ecies-i18n-factory");
|
|
3
7
|
/**
|
|
4
8
|
* Custom error class for length encoding errors
|
|
5
9
|
*/
|
|
@@ -14,61 +18,61 @@ class LengthEncodingError extends Error {
|
|
|
14
18
|
* @param buffer The buffer to encode
|
|
15
19
|
* @returns The encoded buffer
|
|
16
20
|
*/
|
|
17
|
-
|
|
18
|
-
const lengthType = getLengthEncodingTypeForLength(buffer.length);
|
|
19
|
-
const lengthTypeSize = getLengthForLengthType(lengthType);
|
|
21
|
+
function lengthEncodeData(buffer) {
|
|
22
|
+
const lengthType = (0, ecies_lib_1.getLengthEncodingTypeForLength)(buffer.length);
|
|
23
|
+
const lengthTypeSize = (0, ecies_lib_1.getLengthForLengthType)(lengthType);
|
|
20
24
|
const result = Buffer.alloc(1 + lengthTypeSize + buffer.length);
|
|
21
25
|
result.writeUInt8(lengthType, 0);
|
|
22
26
|
switch (lengthType) {
|
|
23
|
-
case LengthEncodingType.UInt8:
|
|
27
|
+
case ecies_lib_1.LengthEncodingType.UInt8:
|
|
24
28
|
result.writeUInt8(buffer.length, 1);
|
|
25
29
|
break;
|
|
26
|
-
case LengthEncodingType.UInt16:
|
|
30
|
+
case ecies_lib_1.LengthEncodingType.UInt16:
|
|
27
31
|
result.writeUInt16BE(buffer.length, 1);
|
|
28
32
|
break;
|
|
29
|
-
case LengthEncodingType.UInt32:
|
|
33
|
+
case ecies_lib_1.LengthEncodingType.UInt32:
|
|
30
34
|
result.writeUInt32BE(buffer.length, 1);
|
|
31
35
|
break;
|
|
32
|
-
case LengthEncodingType.UInt64:
|
|
36
|
+
case ecies_lib_1.LengthEncodingType.UInt64:
|
|
33
37
|
result.writeBigUInt64BE(BigInt(buffer.length), 1);
|
|
34
38
|
break;
|
|
35
39
|
}
|
|
36
40
|
buffer.copy(result, 1 + lengthTypeSize);
|
|
37
41
|
return result;
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
const pluginEngine = getEciesPluginI18nEngine();
|
|
43
|
+
function decodeLengthEncodedData(buffer) {
|
|
44
|
+
const pluginEngine = (0, ecies_i18n_factory_1.getEciesPluginI18nEngine)();
|
|
41
45
|
if (buffer.length < 1) {
|
|
42
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShort));
|
|
46
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShort));
|
|
43
47
|
}
|
|
44
|
-
const lengthType = getLengthEncodingTypeFromValue(buffer.readUint8(0));
|
|
45
|
-
const lengthTypeSize = getLengthForLengthType(lengthType);
|
|
48
|
+
const lengthType = (0, ecies_lib_1.getLengthEncodingTypeFromValue)(buffer.readUint8(0));
|
|
49
|
+
const lengthTypeSize = (0, ecies_lib_1.getLengthForLengthType)(lengthType);
|
|
46
50
|
if (buffer.length < 1 + lengthTypeSize) {
|
|
47
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShortToReadFullLengthValue));
|
|
51
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShortToReadFullLengthValue));
|
|
48
52
|
}
|
|
49
53
|
let length;
|
|
50
54
|
switch (lengthType) {
|
|
51
|
-
case LengthEncodingType.UInt8:
|
|
55
|
+
case ecies_lib_1.LengthEncodingType.UInt8:
|
|
52
56
|
length = buffer.readUint8(1);
|
|
53
57
|
break;
|
|
54
|
-
case LengthEncodingType.UInt16:
|
|
58
|
+
case ecies_lib_1.LengthEncodingType.UInt16:
|
|
55
59
|
length = buffer.readUint16BE(1);
|
|
56
60
|
break;
|
|
57
|
-
case LengthEncodingType.UInt32:
|
|
61
|
+
case ecies_lib_1.LengthEncodingType.UInt32:
|
|
58
62
|
length = buffer.readUint32BE(1);
|
|
59
63
|
break;
|
|
60
|
-
case LengthEncodingType.UInt64:
|
|
64
|
+
case ecies_lib_1.LengthEncodingType.UInt64:
|
|
61
65
|
length = buffer.readBigUInt64BE(1);
|
|
62
66
|
if (Number(length) > Number.MAX_SAFE_INTEGER) {
|
|
63
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_LengthExceedsMaximumSafeInteger));
|
|
67
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_LengthExceedsMaximumSafeInteger));
|
|
64
68
|
}
|
|
65
69
|
break;
|
|
66
70
|
default:
|
|
67
|
-
throw new LengthEncodingError(getNodeEciesTranslation(NodeEciesStringKey.Error_LengthError_LengthIsInvalidType));
|
|
71
|
+
throw new LengthEncodingError((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_LengthError_LengthIsInvalidType));
|
|
68
72
|
}
|
|
69
73
|
const totalLength = 1 + lengthTypeSize + Number(length);
|
|
70
74
|
if (totalLength > buffer.length) {
|
|
71
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShortForDeclaredDataLength));
|
|
75
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShortForDeclaredDataLength));
|
|
72
76
|
}
|
|
73
77
|
return {
|
|
74
78
|
data: buffer.subarray(1 + lengthTypeSize, totalLength),
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AA4BA,4CAuBC;AAED,0DAkDC;AAvGD,0DAKoC;AACpC,kEAKmC;AAEnC;;GAEG;AACH,MAAM,mBAAoB,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;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,MAAM,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,yCAAoB,EAAE,uCAAkB,CAAC,2CAA2C,CAAC,CAAC,CAAC;IACrI,CAAC;IACD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,cAAc,EAAE,WAAW,CAAC;QACtD,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-ecies-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Digital Defiance Node ECIES Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,11 +50,10 @@
|
|
|
50
50
|
],
|
|
51
51
|
"author": "Digital Defiance",
|
|
52
52
|
"license": "MIT",
|
|
53
|
-
"type": "module",
|
|
54
53
|
"packageManager": "yarn@4.10.3",
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@digitaldefiance/ecies-lib": "1.1.
|
|
57
|
-
"@digitaldefiance/i18n-lib": "1.3.
|
|
55
|
+
"@digitaldefiance/ecies-lib": "1.1.16",
|
|
56
|
+
"@digitaldefiance/i18n-lib": "1.3.5",
|
|
58
57
|
"@ethereumjs/wallet": "^10.0.0",
|
|
59
58
|
"@noble/curves": "^2.0.1",
|
|
60
59
|
"@noble/hashes": "^2.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fec-consts.d.ts","sourceRoot":"","sources":["../../src/interfaces/fec-consts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fec-consts.js","sourceRoot":"","sources":["../../src/interfaces/fec-consts.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helper for crypto-core debugging - this is a simpler implementation
|
|
3
|
-
* that will help us understand what's happening with the encryption/decryption cycle
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Simple function to encrypt a message with a public key
|
|
7
|
-
*/
|
|
8
|
-
export declare function encryptDebug(receiverPublicKey: Buffer, message: Buffer): Buffer;
|
|
9
|
-
/**
|
|
10
|
-
* Simple function to decrypt a message with a private key
|
|
11
|
-
*/
|
|
12
|
-
export declare function decryptDebug(privateKey: Buffer, encryptedData: Buffer): Buffer;
|
|
13
|
-
//# sourceMappingURL=crypto-core.debug.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-core.debug.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAwDR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,MAAM,CAyDR"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helper for crypto-core debugging - this is a simpler implementation
|
|
3
|
-
* that will help us understand what's happening with the encryption/decryption cycle
|
|
4
|
-
*/
|
|
5
|
-
import { ECIES } from '@digitaldefiance/ecies-lib';
|
|
6
|
-
import { createCipheriv, createDecipheriv, createECDH, randomBytes, } from 'crypto';
|
|
7
|
-
/**
|
|
8
|
-
* Simple function to encrypt a message with a public key
|
|
9
|
-
*/
|
|
10
|
-
export function encryptDebug(receiverPublicKey, message) {
|
|
11
|
-
// Create a new ephemeral key pair for this message
|
|
12
|
-
const ecdh = createECDH(ECIES.CURVE_NAME);
|
|
13
|
-
ecdh.generateKeys();
|
|
14
|
-
// Normalize receiver's public key
|
|
15
|
-
let normalizedPublicKey = receiverPublicKey;
|
|
16
|
-
if (normalizedPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
|
|
17
|
-
normalizedPublicKey = Buffer.concat([
|
|
18
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
|
|
19
|
-
normalizedPublicKey,
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
console.log('DEBUG: Receiver public key length:', normalizedPublicKey.length);
|
|
23
|
-
// Compute the shared secret
|
|
24
|
-
const sharedSecret = ecdh.computeSecret(normalizedPublicKey);
|
|
25
|
-
console.log('DEBUG: Shared secret length:', sharedSecret.length);
|
|
26
|
-
// Get ephemeral public key with correct format
|
|
27
|
-
let ephemeralPublicKey = ecdh.getPublicKey();
|
|
28
|
-
if (ephemeralPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
|
|
29
|
-
ephemeralPublicKey = Buffer.concat([
|
|
30
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
|
|
31
|
-
ephemeralPublicKey,
|
|
32
|
-
]);
|
|
33
|
-
}
|
|
34
|
-
console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
|
|
35
|
-
// Generate random IV
|
|
36
|
-
const iv = randomBytes(ECIES.IV_SIZE);
|
|
37
|
-
console.log('DEBUG: IV length:', iv.length);
|
|
38
|
-
// Create cipher
|
|
39
|
-
const cipher = createCipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
|
|
40
|
-
cipher.setAutoPadding(true);
|
|
41
|
-
// Encrypt the message
|
|
42
|
-
let encrypted = cipher.update(message);
|
|
43
|
-
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
44
|
-
console.log('DEBUG: Encrypted data length:', encrypted.length);
|
|
45
|
-
// Get authentication tag
|
|
46
|
-
const authTag = cipher.getAuthTag();
|
|
47
|
-
console.log('DEBUG: Auth tag length:', authTag.length);
|
|
48
|
-
// Format the final encrypted buffer
|
|
49
|
-
const output = Buffer.concat([ephemeralPublicKey, iv, authTag, encrypted]);
|
|
50
|
-
console.log('DEBUG: Full output length:', output.length);
|
|
51
|
-
return output;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Simple function to decrypt a message with a private key
|
|
55
|
-
*/
|
|
56
|
-
export function decryptDebug(privateKey, encryptedData) {
|
|
57
|
-
console.log('DEBUG: Input encrypted data length:', encryptedData.length);
|
|
58
|
-
// Parse header components
|
|
59
|
-
const ephemeralPublicKey = encryptedData.subarray(0, ECIES.PUBLIC_KEY_LENGTH);
|
|
60
|
-
console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
|
|
61
|
-
const iv = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE);
|
|
62
|
-
console.log('DEBUG: IV length:', iv.length);
|
|
63
|
-
const authTag = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
|
|
64
|
-
console.log('DEBUG: Auth tag length:', authTag.length);
|
|
65
|
-
// Extract the ciphertext
|
|
66
|
-
const encrypted = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
|
|
67
|
-
console.log('DEBUG: Ciphertext length:', encrypted.length);
|
|
68
|
-
// Set up ECDH
|
|
69
|
-
const ecdh = createECDH(ECIES.CURVE_NAME);
|
|
70
|
-
ecdh.setPrivateKey(privateKey);
|
|
71
|
-
// Compute shared secret
|
|
72
|
-
const sharedSecret = ecdh.computeSecret(ephemeralPublicKey);
|
|
73
|
-
console.log('DEBUG: Shared secret length:', sharedSecret.length);
|
|
74
|
-
// Create decipher
|
|
75
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
|
|
76
|
-
// Set authentication tag
|
|
77
|
-
decipher.setAuthTag(authTag);
|
|
78
|
-
// Decrypt the data
|
|
79
|
-
try {
|
|
80
|
-
let decrypted = decipher.update(encrypted);
|
|
81
|
-
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
82
|
-
console.log('DEBUG: Decrypted data length:', decrypted.length);
|
|
83
|
-
return decrypted;
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.error('DEBUG: Decryption failed:', error);
|
|
87
|
-
console.log('DEBUG: First few bytes of ciphertext:', encrypted.subarray(0, 16));
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=crypto-core.debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-core.debug.js","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,QAAQ,CAAC;AAIhB;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,iBAAyB,EACzB,OAAe;IAEf,mDAAmD;IACnD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;IAEpB,kCAAkC;IAClC,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;IAC5C,IAAI,mBAAmB,CAAC,MAAM,KAAK,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAC/D,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,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,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAC1B,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-aes-gcm.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/debug-aes-gcm.ts"],"names":[],"mappings":""}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ECIES } from '@digitaldefiance/ecies-lib';
|
|
2
|
-
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
|
3
|
-
/**
|
|
4
|
-
* This script isolates the symmetric encryption (AES-GCM) part of ECIES
|
|
5
|
-
* to help diagnose issues with the implementation.
|
|
6
|
-
*/
|
|
7
|
-
function debugAesGcm() {
|
|
8
|
-
console.log('=== AES-GCM Encryption/Decryption Debug Test ===\n');
|
|
9
|
-
try {
|
|
10
|
-
// Create a test message
|
|
11
|
-
const message = Buffer.from('This is a test message for AES-GCM encryption/decryption');
|
|
12
|
-
console.log(`Original Message (${message.length} bytes): ${message.toString()}`);
|
|
13
|
-
// Generate a random key (32 bytes for AES-256-GCM) and IV (16 bytes)
|
|
14
|
-
const key = randomBytes(32);
|
|
15
|
-
const iv = randomBytes(16);
|
|
16
|
-
console.log(`\nKey (${key.length} bytes): ${key.toString('hex').substring(0, 32)}...`);
|
|
17
|
-
console.log(`IV (${iv.length} bytes): ${iv.toString('hex')}`);
|
|
18
|
-
// Step 1: Encrypt using AES-GCM
|
|
19
|
-
console.log('\nStep 1: Encrypting message...');
|
|
20
|
-
// Create cipher with the key and IV
|
|
21
|
-
const cipher = createCipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
22
|
-
// Encrypt the message
|
|
23
|
-
const encrypted = Buffer.concat([cipher.update(message), cipher.final()]);
|
|
24
|
-
// Get the authentication tag
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
const authTag = cipher.getAuthTag();
|
|
27
|
-
console.log(`Encrypted size: ${encrypted.length} bytes`);
|
|
28
|
-
console.log(`Encrypted data (hex): ${encrypted.toString('hex').substring(0, 32)}...`);
|
|
29
|
-
console.log(`Auth Tag (${authTag.length} bytes): ${authTag.toString('hex')}`);
|
|
30
|
-
// Step 2: Decrypt using AES-GCM
|
|
31
|
-
console.log('\nStep 2: Decrypting message...');
|
|
32
|
-
try {
|
|
33
|
-
// Create decipher with the same key and IV
|
|
34
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
35
|
-
// Set the authentication tag
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
-
decipher.setAuthTag(authTag);
|
|
38
|
-
// Decrypt the message
|
|
39
|
-
const decrypted = Buffer.concat([
|
|
40
|
-
decipher.update(encrypted),
|
|
41
|
-
decipher.final(),
|
|
42
|
-
]);
|
|
43
|
-
console.log(`Decrypted Message (${decrypted.length} bytes): ${decrypted.toString()}`);
|
|
44
|
-
// Verify that the decrypted message matches the original
|
|
45
|
-
if (decrypted.equals(message)) {
|
|
46
|
-
console.log('✅ Decrypted message matches original!');
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
console.log('❌ Decrypted message does NOT match original!');
|
|
50
|
-
console.log(`Original: ${message.toString('hex')}`);
|
|
51
|
-
console.log(`Decrypted: ${decrypted.toString('hex')}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error('Decryption failed:', error);
|
|
56
|
-
}
|
|
57
|
-
// Step 3: Test with incomplete data
|
|
58
|
-
console.log('\nStep 3: Testing with incomplete data...');
|
|
59
|
-
try {
|
|
60
|
-
// Create decipher with the same key and IV
|
|
61
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
62
|
-
// Set the authentication tag
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
decipher.setAuthTag(authTag);
|
|
65
|
-
// Try to decrypt with incomplete data (missing the last byte)
|
|
66
|
-
const incompleteEncrypted = encrypted.subarray(0, encrypted.length - 1);
|
|
67
|
-
console.log(`Incomplete encrypted size: ${incompleteEncrypted.length} bytes (missing 1 byte)`);
|
|
68
|
-
const decrypted = Buffer.concat([
|
|
69
|
-
decipher.update(incompleteEncrypted),
|
|
70
|
-
decipher.final(),
|
|
71
|
-
]);
|
|
72
|
-
console.log(`Decrypted from incomplete data: ${decrypted.toString()}`);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.error('Decryption of incomplete data failed:', error);
|
|
76
|
-
console.log('✅ Expected failure for incomplete data!');
|
|
77
|
-
}
|
|
78
|
-
// Step 4: Test with incorrect auth tag
|
|
79
|
-
console.log('\nStep 4: Testing with incorrect auth tag...');
|
|
80
|
-
try {
|
|
81
|
-
// Create decipher with the same key and IV
|
|
82
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
83
|
-
// Set an incorrect authentication tag
|
|
84
|
-
const wrongAuthTag = Buffer.from(authTag);
|
|
85
|
-
wrongAuthTag[0] = (wrongAuthTag[0] + 1) % 256; // Change the first byte
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
decipher.setAuthTag(wrongAuthTag);
|
|
88
|
-
console.log(`Incorrect Auth Tag: ${wrongAuthTag.toString('hex')}`);
|
|
89
|
-
const decrypted = Buffer.concat([
|
|
90
|
-
decipher.update(encrypted),
|
|
91
|
-
decipher.final(),
|
|
92
|
-
]);
|
|
93
|
-
console.log(`Decrypted with wrong auth tag: ${decrypted.toString()}`);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
console.error('Decryption with wrong auth tag failed:', error);
|
|
97
|
-
console.log('✅ Expected failure for incorrect auth tag!');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
console.error('Debug test failed:', error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Run the debug test
|
|
105
|
-
debugAesGcm();
|
|
106
|
-
//# sourceMappingURL=debug-aes-gcm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-aes-gcm.js","sourceRoot":"","sources":["../../../src/services/ecies/debug-aes-gcm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEvE;;;GAGG;AACH,SAAS,WAAW;IAClB,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAElE,IAAI,CAAC;QACH,wBAAwB;QACxB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,0DAA0D,CAC3D,CAAC;QACF,OAAO,CAAC,GAAG,CACT,qBAAqB,OAAO,CAAC,MAAM,YAAY,OAAO,CAAC,QAAQ,EAAE,EAAE,CACpE,CAAC;QAEF,qEAAqE;QACrE,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAE3B,OAAO,CAAC,GAAG,CACT,UAAU,GAAG,CAAC,MAAM,YAAY,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAC1E,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM,YAAY,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAE9D,gCAAgC;QAChC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAE/C,oCAAoC;QACpC,MAAM,MAAM,GAAG,cAAc,CAC3B,KAAK,CAAC,iCAAiC,EACvC,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