@digitaldefiance/node-ecies-lib 3.0.8 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +232 -408
- package/package.json +3 -3
- package/src/builders/member-builder.d.ts +1 -2
- package/src/builders/member-builder.d.ts.map +1 -1
- package/src/builders/member-builder.js.map +1 -1
- package/src/constants.d.ts.map +1 -1
- package/src/constants.js +38 -9
- package/src/constants.js.map +1 -1
- package/src/i18n/ecies-i18n-factory.d.ts +2 -52
- package/src/i18n/ecies-i18n-factory.d.ts.map +1 -1
- package/src/i18n/ecies-i18n-factory.js +9 -63
- package/src/i18n/ecies-i18n-factory.js.map +1 -1
- package/src/i18n/node-ecies-i18n-setup.d.ts.map +1 -1
- package/src/i18n/node-ecies-i18n-setup.js +5 -53
- package/src/i18n/node-ecies-i18n-setup.js.map +1 -1
- package/src/i18n/node-keys.d.ts +57 -0
- package/src/i18n/node-keys.d.ts.map +1 -0
- package/src/i18n/node-keys.js +67 -0
- package/src/i18n/node-keys.js.map +1 -0
- package/src/i18n/translations/de.d.ts +1 -1
- package/src/i18n/translations/de.d.ts.map +1 -1
- package/src/i18n/translations/de.js +51 -46
- package/src/i18n/translations/de.js.map +1 -1
- package/src/i18n/translations/en-GB.d.ts +1 -1
- package/src/i18n/translations/en-GB.d.ts.map +1 -1
- package/src/i18n/translations/en-GB.js +51 -46
- package/src/i18n/translations/en-GB.js.map +1 -1
- package/src/i18n/translations/en-US.d.ts +1 -1
- package/src/i18n/translations/en-US.d.ts.map +1 -1
- package/src/i18n/translations/en-US.js +52 -46
- package/src/i18n/translations/en-US.js.map +1 -1
- package/src/i18n/translations/es.d.ts +1 -1
- package/src/i18n/translations/es.d.ts.map +1 -1
- package/src/i18n/translations/es.js +51 -46
- package/src/i18n/translations/es.js.map +1 -1
- package/src/i18n/translations/fr.d.ts +1 -1
- package/src/i18n/translations/fr.d.ts.map +1 -1
- package/src/i18n/translations/fr.js +51 -46
- package/src/i18n/translations/fr.js.map +1 -1
- package/src/i18n/translations/index.d.ts +2 -0
- package/src/i18n/translations/index.d.ts.map +1 -1
- package/src/i18n/translations/index.js +5 -1
- package/src/i18n/translations/index.js.map +1 -1
- package/src/i18n/translations/ja.d.ts +1 -1
- package/src/i18n/translations/ja.d.ts.map +1 -1
- package/src/i18n/translations/ja.js +51 -46
- package/src/i18n/translations/ja.js.map +1 -1
- package/src/i18n/translations/uk.d.ts +1 -1
- package/src/i18n/translations/uk.d.ts.map +1 -1
- package/src/i18n/translations/uk.js +51 -46
- package/src/i18n/translations/uk.js.map +1 -1
- package/src/i18n/translations/zh-cn.d.ts +1 -1
- package/src/i18n/translations/zh-cn.d.ts.map +1 -1
- package/src/i18n/translations/zh-cn.js +51 -46
- package/src/i18n/translations/zh-cn.js.map +1 -1
- package/src/interfaces/authenticated-cipher.d.ts +3 -0
- package/src/interfaces/authenticated-cipher.d.ts.map +1 -1
- package/src/interfaces/authenticated-decipher.d.ts +3 -0
- package/src/interfaces/authenticated-decipher.d.ts.map +1 -1
- package/src/interfaces/backend-member-operational.d.ts +1 -1
- package/src/interfaces/backend-member-operational.d.ts.map +1 -1
- package/src/interfaces/constants.d.ts +26 -17
- package/src/interfaces/constants.d.ts.map +1 -1
- package/src/interfaces/multi-encrypted-parsed-header.d.ts +5 -2
- package/src/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -1
- package/src/interfaces/multi-recipient-chunk.d.ts +16 -0
- package/src/interfaces/multi-recipient-chunk.d.ts.map +1 -1
- package/src/interfaces/multi-recipient-chunk.js +10 -0
- package/src/interfaces/multi-recipient-chunk.js.map +1 -1
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.d.ts.map +1 -1
- package/src/lib/index.js +2 -0
- package/src/lib/index.js.map +1 -1
- package/src/lib/invariant-validator.d.ts +62 -0
- package/src/lib/invariant-validator.d.ts.map +1 -0
- package/src/lib/invariant-validator.js +108 -0
- package/src/lib/invariant-validator.js.map +1 -0
- package/src/lib/invariants/index.d.ts +8 -0
- package/src/lib/invariants/index.d.ts.map +1 -0
- package/src/lib/invariants/index.js +12 -0
- package/src/lib/invariants/index.js.map +1 -0
- package/src/lib/invariants/recipient-id-consistency.d.ts +22 -0
- package/src/lib/invariants/recipient-id-consistency.d.ts.map +1 -0
- package/src/lib/invariants/recipient-id-consistency.js +62 -0
- package/src/lib/invariants/recipient-id-consistency.js.map +1 -0
- package/src/member.d.ts +6 -6
- package/src/member.d.ts.map +1 -1
- package/src/member.js +13 -20
- package/src/member.js.map +1 -1
- package/src/services/aes-gcm.d.ts +2 -2
- package/src/services/aes-gcm.d.ts.map +1 -1
- package/src/services/aes-gcm.js +8 -2
- package/src/services/aes-gcm.js.map +1 -1
- package/src/services/ecies/crypto-core.d.ts +21 -0
- package/src/services/ecies/crypto-core.d.ts.map +1 -1
- package/src/services/ecies/crypto-core.js +62 -7
- package/src/services/ecies/crypto-core.js.map +1 -1
- package/src/services/ecies/multi-recipient.d.ts +11 -7
- package/src/services/ecies/multi-recipient.d.ts.map +1 -1
- package/src/services/ecies/multi-recipient.js +200 -71
- package/src/services/ecies/multi-recipient.js.map +1 -1
- package/src/services/ecies/service.d.ts +1 -1
- package/src/services/ecies/service.d.ts.map +1 -1
- package/src/services/ecies/service.js +2 -2
- package/src/services/ecies/service.js.map +1 -1
- package/src/services/ecies/single-recipient.d.ts +1 -1
- package/src/services/ecies/single-recipient.d.ts.map +1 -1
- package/src/services/ecies/single-recipient.js +76 -43
- package/src/services/ecies/single-recipient.js.map +1 -1
- package/src/services/encryption-stream.js +3 -4
- package/src/services/encryption-stream.js.map +1 -1
- package/src/services/multi-recipient-processor.d.ts +42 -9
- package/src/services/multi-recipient-processor.d.ts.map +1 -1
- package/src/services/multi-recipient-processor.js +273 -177
- package/src/services/multi-recipient-processor.js.map +1 -1
- package/src/test-mocks/mock-backend-member.d.ts +7 -8
- package/src/test-mocks/mock-backend-member.d.ts.map +1 -1
- package/src/test-mocks/mock-backend-member.js +4 -4
- package/src/test-mocks/mock-backend-member.js.map +1 -1
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mandarinTranslations = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_keys_1 = require("../node-keys");
|
|
5
5
|
exports.mandarinTranslations = {
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
6
|
+
[node_keys_1.NodeEciesStringKey.Error_LengthError_LengthIsInvalidType]: '长度编码类型无效',
|
|
7
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_MissingMemberName]: '需要成员名称',
|
|
8
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_InvalidMemberNameWhitespace]: '成员名称不能有前导或尾随空格',
|
|
9
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_NoWallet]: '没有可用的钱包',
|
|
10
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_WalletAlreadyLoaded]: '钱包已加载',
|
|
11
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_InvalidMnemonic]: '无效的助记词',
|
|
12
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_MissingPrivateKey]: '缺少私钥',
|
|
13
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_MissingEncryptionData]: '缺少加密数据',
|
|
14
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_EncryptionDataTooLarge]: '加密数据过大',
|
|
15
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_MissingEmail]: '需要电子邮件地址',
|
|
16
|
+
[node_keys_1.NodeEciesStringKey.Error_Member_InvalidEmailWhitespace]: '电子邮件地址不能有前导或尾随空格',
|
|
17
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidPublicKey]: '收到空或未定义的公钥',
|
|
18
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidPublicKeyFormat]: '无效的公钥格式或长度',
|
|
19
|
+
[node_keys_1.NodeEciesStringKey.Error_MessageLengthExceedsMaximumAllowedSize]: '消息长度超过最大允许长度',
|
|
20
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidEncryptionTypeOrNumberOfRecipients]: '无效的加密类型或接收者数量',
|
|
21
|
+
[node_keys_1.NodeEciesStringKey.Error_EncryptedDataLengthMismatch]: '加密数据长度不匹配',
|
|
22
|
+
[node_keys_1.NodeEciesStringKey.Error_EphemeralPublicKeyLengthMismatch]: '临时公钥在规范化后长度不正确',
|
|
23
|
+
[node_keys_1.NodeEciesStringKey.Error_EncryptedDataIsEmpty]: '加密数据为空',
|
|
24
|
+
[node_keys_1.NodeEciesStringKey.Error_CombinedDataTooShort]: '组合数据太短,无法包含所需组件',
|
|
25
|
+
[node_keys_1.NodeEciesStringKey.Error_BufferIsTooShort]: '缓冲区太短,无法读取长度类型',
|
|
26
|
+
[node_keys_1.NodeEciesStringKey.Error_BufferIsTooShortToReadFullLengthValue]: '缓冲区太短,无法读取完整的长度值',
|
|
27
|
+
[node_keys_1.NodeEciesStringKey.Error_LengthExceedsMaximumSafeInteger]: '长度超过最大安全整数值',
|
|
28
|
+
[node_keys_1.NodeEciesStringKey.Error_BufferIsTooShortForDeclaredDataLength]: '缓冲区太短,无法读取声明的数据长度',
|
|
29
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidChecksumConstants]: '无效的校验和常量',
|
|
30
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidAESKeyLength]: 'AES密钥必须为16、24或32字节',
|
|
31
|
+
[node_keys_1.NodeEciesStringKey.Error_CannotEncryptEmptyData]: '无法加密空或未定义的数据',
|
|
32
|
+
[node_keys_1.NodeEciesStringKey.Error_CannotDecryptEmptyData]: '无法解密空或未定义的数据',
|
|
33
|
+
[node_keys_1.NodeEciesStringKey.Error_InvalidIVLength]: 'IV必须为16字节',
|
|
34
|
+
[node_keys_1.NodeEciesStringKey.Error_MessageTooLarge]: '消息超过最大大小2GB',
|
|
35
|
+
[node_keys_1.NodeEciesStringKey.Error_EncryptedSizeExceedsExpected]: '加密数据大小超过预期最大值',
|
|
36
|
+
[node_keys_1.NodeEciesStringKey.Error_Pbkdf2_InvalidSaltLength]: '无效的盐长度',
|
|
37
|
+
[node_keys_1.NodeEciesStringKey.Error_Pbkdf2_InvalidHashLength]: '无效的哈希长度',
|
|
38
|
+
[node_keys_1.NodeEciesStringKey.Error_Builder_ECIESServiceMustBeSetBeforeGeneratingMnemonic]: '在生成助记词之前必须设置ECIESService',
|
|
39
|
+
[node_keys_1.NodeEciesStringKey.Error_Builder_ECIESServiceIsRequired]: '需要ECIESService',
|
|
40
|
+
[node_keys_1.NodeEciesStringKey.Error_Builder_TypeNameAndEmailAreRequired]: '需要类型、名称和电子邮件',
|
|
41
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_InvalidPublicKeyLength]: '无效的公钥:必须为33(压缩)或65(未压缩)字节',
|
|
42
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_EncryptionCancelled]: '加密已取消',
|
|
43
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_BufferOverflow]: '缓冲区溢出:源块超过最大大小',
|
|
44
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_AtLeastOneRecipientRequired]: '至少需要一个接收者',
|
|
45
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_MaxRecipientsExceeded]: '最多支持65535个接收者',
|
|
46
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_InvalidRecipientPublicKeyLength]: '无效的接收者公钥:必须为33(压缩)或65(未压缩)字节',
|
|
47
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_InvalidRecipientIdLength]: '无效的接收者ID:必须为32字节',
|
|
48
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_InvalidPrivateKeyLength]: '无效的私钥:必须为32字节',
|
|
49
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_DecryptionCancelled]: '解密已取消',
|
|
50
|
+
[node_keys_1.NodeEciesStringKey.Error_Stream_ChunkSequenceError]: '块序列错误',
|
|
51
|
+
[node_keys_1.NodeEciesStringKey.Error_Invariant_ConfigurationValidationFailedTemplate]: 'Node.js configuration validation failed:\n{failures}',
|
|
52
|
+
[node_keys_1.NodeEciesStringKey.Error_Invariant_NodeRecipientIdConsistency_FailedTemplate]: "Invariant 'NodeRecipientIdConsistency' failed:\n {issues}",
|
|
53
|
+
[node_keys_1.NodeEciesStringKey.Error_Invariant_MemberIdLengthMismatchTemplate]: 'MEMBER_ID_LENGTH ({actual}) !== idProvider.byteLength ({expected})',
|
|
54
|
+
[node_keys_1.NodeEciesStringKey.Error_Invariant_EciesMultipleRecipientIdSizeMismatchTemplate]: 'ECIES.MULTIPLE.RECIPIENT_ID_SIZE ({actual}) !== idProvider.byteLength ({expected})',
|
|
55
|
+
[node_keys_1.NodeEciesStringKey.Error_Invariant_EncryptionRecipientIdSizeMismatchTemplate]: 'ENCRYPTION.RECIPIENT_ID_SIZE ({actual}) !== idProvider.byteLength ({expected})',
|
|
51
56
|
};
|
|
52
57
|
//# sourceMappingURL=zh-cn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-cn.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/translations/zh-cn.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"zh-cn.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/i18n/translations/zh-cn.ts"],"names":[],"mappings":";;;AAAA,4CAAkD;AAErC,QAAA,oBAAoB,GAAuC;IACtE,CAAC,8BAAkB,CAAC,qCAAqC,CAAC,EAAE,UAAU;IACtE,CAAC,8BAAkB,CAAC,8BAA8B,CAAC,EAAE,QAAQ;IAC7D,CAAC,8BAAkB,CAAC,wCAAwC,CAAC,EAAE,gBAAgB;IAC/E,CAAC,8BAAkB,CAAC,qBAAqB,CAAC,EAAE,SAAS;IACrD,CAAC,8BAAkB,CAAC,gCAAgC,CAAC,EAAE,OAAO;IAC9D,CAAC,8BAAkB,CAAC,4BAA4B,CAAC,EAAE,QAAQ;IAC3D,CAAC,8BAAkB,CAAC,8BAA8B,CAAC,EAAE,MAAM;IAC3D,CAAC,8BAAkB,CAAC,kCAAkC,CAAC,EAAE,QAAQ;IACjE,CAAC,8BAAkB,CAAC,mCAAmC,CAAC,EAAE,QAAQ;IAClE,CAAC,8BAAkB,CAAC,yBAAyB,CAAC,EAAE,UAAU;IAC1D,CAAC,8BAAkB,CAAC,mCAAmC,CAAC,EAAE,kBAAkB;IAC5E,CAAC,8BAAkB,CAAC,sBAAsB,CAAC,EAAE,YAAY;IACzD,CAAC,8BAAkB,CAAC,4BAA4B,CAAC,EAAE,YAAY;IAC/D,CAAC,8BAAkB,CAAC,4CAA4C,CAAC,EAAE,cAAc;IACjF,CAAC,8BAAkB,CAAC,+CAA+C,CAAC,EAAE,eAAe;IACrF,CAAC,8BAAkB,CAAC,iCAAiC,CAAC,EAAE,WAAW;IACnE,CAAC,8BAAkB,CAAC,sCAAsC,CAAC,EAAE,gBAAgB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AkC,CAAC,EAAE,eAAe;IACxE,CAAC,8BAAkB,CAAC,4CAA4C,CAAC,EAAE,8BAA8B;IACjG,CAAC,8BAAkB,CAAC,qCAAqC,CAAC,EAAE,kBAAkB;IAC9E,CAAC,8BAAkB,CAAC,oCAAoC,CAAC,EAAE,eAAe;IAC1E,CAAC,8BAAkB,CAAC,gCAAgC,CAAC,EAAE,OAAO;IAC9D,CAAC,8BAAkB,CAAC,+BAA+B,CAAC,EAAE,OAAO;IAC7D,CAAC,8BAAkB,CAAC,qDAAqD,CAAC,EAAE,sDAAsD;IAClI,CAAC,8BAAkB,CAAC,yDAAyD,CAAC,EAAE,4DAA4D;IAC5I,CAAC,8BAAkB,CAAC,8CAA8C,CAAC,EAAE,oEAAoE;IACzI,CAAC,8BAAkB,CAAC,4DAA4D,CAAC,EAAE,oFAAoF;IACvK,CAAC,8BAAkB,CAAC,yDAAyD,CAAC,EAAE,gFAAgF;CACjK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-cipher.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/authenticated-cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,IAAI,MAAM,CAAC;IAChB,UAAU,IAAI,MAAM,CAAC;IACrB,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticated-cipher.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/authenticated-cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,IAAI,MAAM,CAAC;IAChB,UAAU,IAAI,MAAM,CAAC;IACrB,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticated-decipher.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/authenticated-decipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,IAAI,MAAM,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticated-decipher.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/authenticated-decipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,IAAI,MAAM,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACrE"}
|
|
@@ -7,7 +7,7 @@ import { IStreamProgress } from './stream-progress';
|
|
|
7
7
|
/**
|
|
8
8
|
* Operational interface for member - defines getters and methods
|
|
9
9
|
*/
|
|
10
|
-
export interface IBackendMemberOperational<I extends string | Types.ObjectId> {
|
|
10
|
+
export interface IBackendMemberOperational<I extends string | Types.ObjectId | Buffer | Uint8Array> {
|
|
11
11
|
get id(): I;
|
|
12
12
|
get type(): MemberType;
|
|
13
13
|
get name(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-member-operational.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/backend-member-operational.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"backend-member-operational.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/backend-member-operational.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,UAAU;IAEhG,IAAI,EAAE,IAAI,CAAC,CAAC;IACZ,IAAI,IAAI,IAAI,UAAU,CAAC;IACvB,IAAI,IAAI,IAAI,MAAM,CAAC;IACnB,IAAI,KA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I,IAAI,CAAC;IACzB,YAAY,IAAI,IAAI,CAAC;IACrB,yBAAyB,IAAI,IAAI,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,+BACf,SAAQ,yBAAyB,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjD,IAAI,QAAQ,IAAI,YAAY,GAAG,SAAS,CAAC;CAC1C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IPBkdf2Consts } from '@digitaldefiance/ecies-lib';
|
|
2
1
|
import { CipherGCMTypes } from 'crypto';
|
|
3
2
|
import { IChecksumConsts } from './checksum-consts';
|
|
4
3
|
import { IEncryptionConsts } from './encryption-consts';
|
|
@@ -6,38 +5,48 @@ import { IKeyringConsts } from './keyring-consts';
|
|
|
6
5
|
import { PbkdfProfiles } from './pbkdf-profiles';
|
|
7
6
|
import { IWrappedKeyConsts } from './wrapped-key-consts';
|
|
8
7
|
import { IConstants as IBaseConstants } from '@digitaldefiance/ecies-lib';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Node.js-specific constants interface.
|
|
10
|
+
* Extends base ECIES constants with Node-specific additions.
|
|
11
|
+
*
|
|
12
|
+
* Inherited from IBaseConstants:
|
|
13
|
+
* - idProvider: IIdProvider
|
|
14
|
+
* - OBJECT_ID_LENGTH: number
|
|
15
|
+
* - MEMBER_ID_LENGTH: number
|
|
16
|
+
* - PBKDF2: IPBkdf2Consts (overridden with Node crypto implementation)
|
|
17
|
+
* - PBKDF2_PROFILES: Pbkdf2Profiles (overridden with Node profiles)
|
|
18
|
+
* - CHECKSUM: IChecksumConsts (overridden)
|
|
19
|
+
* - ECIES: IECIESConstants
|
|
20
|
+
* - And other base constants...
|
|
21
|
+
*/
|
|
22
|
+
export interface IConstants extends Omit<IBaseConstants, 'PBKDF2_PROFILES' | 'CHECKSUM'> {
|
|
23
|
+
/**
|
|
24
|
+
* PBKDF2 configuration profiles (Node.js-specific)
|
|
25
|
+
* Overrides base profiles with Node crypto implementations
|
|
20
26
|
*/
|
|
21
27
|
PBKDF2_PROFILES: PbkdfProfiles;
|
|
22
28
|
/**
|
|
23
|
-
* Checksum constants
|
|
29
|
+
* Checksum constants (Node.js-specific)
|
|
30
|
+
* Overrides base checksum with Node crypto implementations
|
|
24
31
|
*/
|
|
25
32
|
CHECKSUM: IChecksumConsts;
|
|
26
33
|
/**
|
|
27
|
-
* Wrapped Key constants used for the key wrapping service
|
|
34
|
+
* Wrapped Key constants used for the key wrapping service (Node.js-only)
|
|
28
35
|
*/
|
|
29
36
|
WRAPPED_KEY: IWrappedKeyConsts;
|
|
30
37
|
/**
|
|
31
|
-
* Keyring constants used for key management
|
|
38
|
+
* Keyring constants used for key management (Node.js-only)
|
|
32
39
|
*/
|
|
33
40
|
KEYRING: IKeyringConsts;
|
|
34
41
|
/**
|
|
35
|
-
* Encryption constants used for encrypted data
|
|
42
|
+
* Encryption constants used for encrypted data (Node.js-only)
|
|
36
43
|
*/
|
|
37
44
|
ENCRYPTION: IEncryptionConsts;
|
|
38
45
|
/**
|
|
39
|
-
* Algorithm configuration string for keyring operations
|
|
46
|
+
* Algorithm configuration string for keyring operations (Node.js-only)
|
|
40
47
|
*/
|
|
41
48
|
KEYRING_ALGORITHM_CONFIGURATION: CipherGCMTypes;
|
|
49
|
+
ECIES_VERSION_SIZE: number;
|
|
50
|
+
ECIES_CIPHER_SUITE_SIZE: number;
|
|
42
51
|
}
|
|
43
52
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,EAAE,iBAAiB,GAAG,UAAU,CAAC;IACtF;;;OAGG;IACH,eAAe,EAAE,aAAa,CAAC;IAC/B;;;OAGG;IACH,QAAQ,EAAE,eAAe,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,iBAAiB,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,UAAU,EAAE,iBAAiB,CAAC;IAC9B;;OAEG;IACH,+BAA+B,EAAE,cAAc,CAAC;IAEhD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;CACjC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Types } from 'mongoose';
|
|
2
1
|
export interface IMultiEncryptedParsedHeader {
|
|
3
2
|
/**
|
|
4
3
|
* The length of the data before encryption
|
|
@@ -11,7 +10,7 @@ export interface IMultiEncryptedParsedHeader {
|
|
|
11
10
|
/**
|
|
12
11
|
* The IDs of the recipients
|
|
13
12
|
*/
|
|
14
|
-
readonly recipientIds:
|
|
13
|
+
readonly recipientIds: Buffer[];
|
|
15
14
|
/**
|
|
16
15
|
* An encrypted version of the symmetric key for each recipient
|
|
17
16
|
*/
|
|
@@ -20,5 +19,9 @@ export interface IMultiEncryptedParsedHeader {
|
|
|
20
19
|
* The size of the header, up to the encrypted message start (excludes encrypted message IV+auth tag)
|
|
21
20
|
*/
|
|
22
21
|
readonly headerSize: number;
|
|
22
|
+
/**
|
|
23
|
+
* The ephemeral public key used for encryption
|
|
24
|
+
*/
|
|
25
|
+
readonly ephemeralPublicKey?: Buffer;
|
|
23
26
|
}
|
|
24
27
|
//# sourceMappingURL=multi-encrypted-parsed-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-encrypted-parsed-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-encrypted-parsed-header.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multi-encrypted-parsed-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-encrypted-parsed-header.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC"}
|
|
@@ -2,9 +2,25 @@ export interface IMultiRecipientChunkHeader {
|
|
|
2
2
|
chunkIndex: number;
|
|
3
3
|
flags: number;
|
|
4
4
|
recipientCount: number;
|
|
5
|
+
magic?: number;
|
|
6
|
+
version?: number;
|
|
7
|
+
originalSize?: number;
|
|
8
|
+
encryptedSize?: number;
|
|
5
9
|
}
|
|
6
10
|
export interface IMultiRecipientChunk {
|
|
7
11
|
header: IMultiRecipientChunkHeader;
|
|
8
12
|
data: Buffer;
|
|
13
|
+
isLast?: boolean;
|
|
14
|
+
recipientCount?: number;
|
|
15
|
+
index?: number;
|
|
9
16
|
}
|
|
17
|
+
export interface IMultiRecipientConstants {
|
|
18
|
+
MAGIC: number;
|
|
19
|
+
VERSION: number;
|
|
20
|
+
HEADER_SIZE: number;
|
|
21
|
+
KEY_SIZE_BYTES: number;
|
|
22
|
+
FLAG_IS_LAST: number;
|
|
23
|
+
MAX_RECIPIENTS: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const getMultiRecipientConstants: (recipientIdSize: number) => IMultiRecipientConstants;
|
|
10
26
|
//# sourceMappingURL=multi-recipient-chunk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-recipient-chunk.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-recipient-chunk.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,0BAA0B,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"multi-recipient-chunk.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-recipient-chunk.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,0BAA0B,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,0BAA0B,GAAI,iBAAiB,MAAM,KAAG,wBAOnE,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMultiRecipientConstants = void 0;
|
|
4
|
+
const getMultiRecipientConstants = (recipientIdSize) => ({
|
|
5
|
+
MAGIC: 0x45434945, // 'ECIE'
|
|
6
|
+
VERSION: 1,
|
|
7
|
+
HEADER_SIZE: 64, // Fixed header size before recipient list
|
|
8
|
+
KEY_SIZE_BYTES: 2, // Size of the key size field
|
|
9
|
+
FLAG_IS_LAST: 1,
|
|
10
|
+
MAX_RECIPIENTS: 65535,
|
|
11
|
+
});
|
|
12
|
+
exports.getMultiRecipientConstants = getMultiRecipientConstants;
|
|
3
13
|
//# sourceMappingURL=multi-recipient-chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-recipient-chunk.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-recipient-chunk.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"multi-recipient-chunk.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-recipient-chunk.ts"],"names":[],"mappings":";;;AA2BO,MAAM,0BAA0B,GAAG,CAAC,eAAuB,EAA4B,EAAE,CAAC,CAAC;IAChG,KAAK,EAAE,UAAU,EAAE,SAAS;IAC5B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,EAAE,EAAE,0CAA0C;IAC3D,cAAc,EAAE,CAAC,EAAE,6BAA6B;IAChD,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,KAAK;CACtB,CAAC,CAAC;AAPU,QAAA,0BAA0B,8BAOpC"}
|
package/src/lib/index.d.ts
CHANGED
package/src/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
package/src/lib/index.js
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./crypto-container"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./invariant-validator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./invariants"), exports);
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/src/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,gEAAsC;AACtC,uDAA6B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IInvariant } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { IConstants } from '../interfaces/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js-specific invariant validator.
|
|
5
|
+
*
|
|
6
|
+
* Extends the base ecies-lib validator with Node.js-specific invariants.
|
|
7
|
+
* Validates configuration consistency to prevent bugs like the 12 vs 32-byte
|
|
8
|
+
* recipient ID discrepancy.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { InvariantValidator } from '@digitaldefiance/node-ecies-lib';
|
|
13
|
+
* import { MyCustomInvariant } from './my-invariants';
|
|
14
|
+
*
|
|
15
|
+
* // Register a custom invariant
|
|
16
|
+
* InvariantValidator.registerInvariant(new MyCustomInvariant());
|
|
17
|
+
*
|
|
18
|
+
* // Validate configuration
|
|
19
|
+
* InvariantValidator.validateAll(config); // throws if any invariant fails
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class InvariantValidator {
|
|
23
|
+
/**
|
|
24
|
+
* Node-specific invariants registered by default.
|
|
25
|
+
*/
|
|
26
|
+
private static readonly NODE_DEFAULT_INVARIANTS;
|
|
27
|
+
private static customInvariants;
|
|
28
|
+
/**
|
|
29
|
+
* Register a custom invariant to be checked during validation.
|
|
30
|
+
*
|
|
31
|
+
* @param invariant - The invariant to register
|
|
32
|
+
*/
|
|
33
|
+
static registerInvariant(invariant: IInvariant): void;
|
|
34
|
+
/**
|
|
35
|
+
* Unregister a custom invariant by name.
|
|
36
|
+
*
|
|
37
|
+
* @param name - The name of the invariant to unregister
|
|
38
|
+
* @returns true if the invariant was found and removed, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
static unregisterInvariant(name: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get all registered invariants (default + custom).
|
|
43
|
+
*/
|
|
44
|
+
static getAllInvariants(): readonly IInvariant[];
|
|
45
|
+
/**
|
|
46
|
+
* Validate all registered invariants against a configuration.
|
|
47
|
+
*
|
|
48
|
+
* This checks both:
|
|
49
|
+
* - Base ecies-lib invariants (via BaseInvariantValidator)
|
|
50
|
+
* - Node-specific invariants
|
|
51
|
+
*
|
|
52
|
+
* @param config - The configuration to validate
|
|
53
|
+
* @throws Error if any invariant check fails
|
|
54
|
+
*/
|
|
55
|
+
static validateAll(config: IConstants): void;
|
|
56
|
+
/**
|
|
57
|
+
* Clear all custom invariants.
|
|
58
|
+
* Default invariants are not affected.
|
|
59
|
+
*/
|
|
60
|
+
static clearCustomInvariants(): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=invariant-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant-validator.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariant-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAE7C;IAEF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IAEnD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;IAMrD;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASjD;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,SAAS,UAAU,EAAE;IAIhD;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAkC5C;;;OAGG;IACH,MAAM,CAAC,qBAAqB,IAAI,IAAI;CAGrC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvariantValidator = void 0;
|
|
4
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
5
|
+
const i18n_lib_1 = require("@digitaldefiance/i18n-lib");
|
|
6
|
+
const recipient_id_consistency_1 = require("./invariants/recipient-id-consistency");
|
|
7
|
+
const node_keys_1 = require("../i18n/node-keys");
|
|
8
|
+
const node_ecies_i18n_setup_1 = require("../i18n/node-ecies-i18n-setup");
|
|
9
|
+
/**
|
|
10
|
+
* Node.js-specific invariant validator.
|
|
11
|
+
*
|
|
12
|
+
* Extends the base ecies-lib validator with Node.js-specific invariants.
|
|
13
|
+
* Validates configuration consistency to prevent bugs like the 12 vs 32-byte
|
|
14
|
+
* recipient ID discrepancy.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { InvariantValidator } from '@digitaldefiance/node-ecies-lib';
|
|
19
|
+
* import { MyCustomInvariant } from './my-invariants';
|
|
20
|
+
*
|
|
21
|
+
* // Register a custom invariant
|
|
22
|
+
* InvariantValidator.registerInvariant(new MyCustomInvariant());
|
|
23
|
+
*
|
|
24
|
+
* // Validate configuration
|
|
25
|
+
* InvariantValidator.validateAll(config); // throws if any invariant fails
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class InvariantValidator {
|
|
29
|
+
/**
|
|
30
|
+
* Node-specific invariants registered by default.
|
|
31
|
+
*/
|
|
32
|
+
static NODE_DEFAULT_INVARIANTS = [
|
|
33
|
+
new recipient_id_consistency_1.RecipientIdConsistencyInvariant(),
|
|
34
|
+
];
|
|
35
|
+
static customInvariants = [];
|
|
36
|
+
/**
|
|
37
|
+
* Register a custom invariant to be checked during validation.
|
|
38
|
+
*
|
|
39
|
+
* @param invariant - The invariant to register
|
|
40
|
+
*/
|
|
41
|
+
static registerInvariant(invariant) {
|
|
42
|
+
this.customInvariants.push(invariant);
|
|
43
|
+
// Also register with base validator for consistency
|
|
44
|
+
ecies_lib_1.InvariantValidator.registerInvariant(invariant);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Unregister a custom invariant by name.
|
|
48
|
+
*
|
|
49
|
+
* @param name - The name of the invariant to unregister
|
|
50
|
+
* @returns true if the invariant was found and removed, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
static unregisterInvariant(name) {
|
|
53
|
+
const index = this.customInvariants.findIndex((inv) => inv.name === name);
|
|
54
|
+
if (index === -1) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
this.customInvariants.splice(index, 1);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get all registered invariants (default + custom).
|
|
62
|
+
*/
|
|
63
|
+
static getAllInvariants() {
|
|
64
|
+
return [...this.NODE_DEFAULT_INVARIANTS, ...this.customInvariants];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate all registered invariants against a configuration.
|
|
68
|
+
*
|
|
69
|
+
* This checks both:
|
|
70
|
+
* - Base ecies-lib invariants (via BaseInvariantValidator)
|
|
71
|
+
* - Node-specific invariants
|
|
72
|
+
*
|
|
73
|
+
* @param config - The configuration to validate
|
|
74
|
+
* @throws Error if any invariant check fails
|
|
75
|
+
*/
|
|
76
|
+
static validateAll(config) {
|
|
77
|
+
const failures = [];
|
|
78
|
+
// First, validate base ecies-lib invariants, excluding the one we are replacing
|
|
79
|
+
const baseInvariants = ecies_lib_1.InvariantValidator.getAllInvariants();
|
|
80
|
+
for (const invariant of baseInvariants) {
|
|
81
|
+
if (invariant.name === 'RecipientIdConsistency') {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!invariant.check(config)) {
|
|
85
|
+
failures.push(invariant.errorMessage(config));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Then validate Node-specific invariants
|
|
89
|
+
for (const invariant of this.getAllInvariants()) {
|
|
90
|
+
if (!invariant.check(config)) {
|
|
91
|
+
failures.push(invariant.errorMessage(config));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (failures.length > 0) {
|
|
95
|
+
const engine = (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
96
|
+
throw i18n_lib_1.TranslatableGenericError.withEngine(engine, node_keys_1.NodeEciesComponentId, node_keys_1.NodeEciesStringKey.Error_Invariant_ConfigurationValidationFailedTemplate, { failures: failures.join('\n\n') }, undefined, { invariantCount: failures.length });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clear all custom invariants.
|
|
101
|
+
* Default invariants are not affected.
|
|
102
|
+
*/
|
|
103
|
+
static clearCustomInvariants() {
|
|
104
|
+
this.customInvariants = [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.InvariantValidator = InvariantValidator;
|
|
108
|
+
//# sourceMappingURL=invariant-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant-validator.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariant-validator.ts"],"names":[],"mappings":";;;AAAA,0DAGoC;AACpC,wDAAqE;AAErE,oFAAwF;AACxF,iDAA6E;AAC7E,yEAAuE;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,kBAAkB;IAC7B;;OAEG;IACK,MAAM,CAAU,uBAAuB,GAAiB;QAC9D,IAAI,0DAA+B,EAAE;KACtC,CAAC;IAEM,MAAM,CAAC,gBAAgB,GAAiB,EAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAqB;QAC5C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,oDAAoD;QACpD,8BAAsB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAA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D,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,IAAA,8CAAsB,GAAE,CAAC;YACxC,MAAM,mCAAwB,CAAC,UAAU,CACvC,MAAM,EACN,gCAAoB,EACpB,8BAAkB,CAAC,qDAAqD,EACxE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EACnC,SAAS,EACT,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,CACpC,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,qBAAqB;QAC1B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC7B,CAAC;;AA7FH,gDA8FC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js-specific invariants for configuration validation.
|
|
3
|
+
*
|
|
4
|
+
* These invariants extend and complement the base ecies-lib invariants
|
|
5
|
+
* with Node.js-specific validation rules.
|
|
6
|
+
*/
|
|
7
|
+
export { RecipientIdConsistencyInvariant } from './recipient-id-consistency';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariants/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node.js-specific invariants for configuration validation.
|
|
4
|
+
*
|
|
5
|
+
* These invariants extend and complement the base ecies-lib invariants
|
|
6
|
+
* with Node.js-specific validation rules.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RecipientIdConsistencyInvariant = void 0;
|
|
10
|
+
var recipient_id_consistency_1 = require("./recipient-id-consistency");
|
|
11
|
+
Object.defineProperty(exports, "RecipientIdConsistencyInvariant", { enumerable: true, get: function () { return recipient_id_consistency_1.RecipientIdConsistencyInvariant; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariants/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uEAA6E;AAApE,2IAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseInvariant } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { IConstants } from '../../interfaces/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js-specific recipient ID consistency invariant.
|
|
5
|
+
*
|
|
6
|
+
* Extends the base ecies-lib invariant to also validate node-specific
|
|
7
|
+
* ENCRYPTION.RECIPIENT_ID_SIZE constant.
|
|
8
|
+
*
|
|
9
|
+
* This invariant would have caught the 12 vs 32 byte discrepancy.
|
|
10
|
+
*
|
|
11
|
+
* Checks:
|
|
12
|
+
* - MEMBER_ID_LENGTH === idProvider.byteLength
|
|
13
|
+
* - ECIES.MULTIPLE.RECIPIENT_ID_SIZE === idProvider.byteLength
|
|
14
|
+
* - ENCRYPTION.RECIPIENT_ID_SIZE === idProvider.byteLength (Node-specific)
|
|
15
|
+
* - All values must be in sync
|
|
16
|
+
*/
|
|
17
|
+
export declare class RecipientIdConsistencyInvariant extends BaseInvariant {
|
|
18
|
+
constructor();
|
|
19
|
+
check(config: IConstants): boolean;
|
|
20
|
+
errorMessage(config: IConstants): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=recipient-id-consistency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient-id-consistency.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariants/recipient-id-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD;;;;;;;;;;;;;GAaG;AACH,qBAAa,+BAAgC,SAAQ,aAAa;;IAQhE,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAalC,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;CAoCzC"}
|