@digitaldefiance/node-ecies-lib 4.4.23 → 4.5.17

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.
Files changed (321) hide show
  1. package/package.json +14 -2
  2. package/src/builders/ecies-builder.d.ts +0 -11
  3. package/src/builders/ecies-builder.d.ts.map +0 -1
  4. package/src/builders/ecies-builder.js +0 -26
  5. package/src/builders/ecies-builder.js.map +0 -1
  6. package/src/builders/index.d.ts +0 -3
  7. package/src/builders/index.d.ts.map +0 -1
  8. package/src/builders/index.js +0 -6
  9. package/src/builders/index.js.map +0 -1
  10. package/src/builders/member-builder.d.ts +0 -47
  11. package/src/builders/member-builder.d.ts.map +0 -1
  12. package/src/builders/member-builder.js +0 -99
  13. package/src/builders/member-builder.js.map +0 -1
  14. package/src/constants.d.ts +0 -38
  15. package/src/constants.d.ts.map +0 -1
  16. package/src/constants.js +0 -191
  17. package/src/constants.js.map +0 -1
  18. package/src/core/errors/crypto-error.d.ts +0 -6
  19. package/src/core/errors/crypto-error.d.ts.map +0 -1
  20. package/src/core/errors/crypto-error.js +0 -15
  21. package/src/core/errors/crypto-error.js.map +0 -1
  22. package/src/core/index.d.ts +0 -3
  23. package/src/core/index.d.ts.map +0 -1
  24. package/src/core/index.js +0 -6
  25. package/src/core/index.js.map +0 -1
  26. package/src/core/types/result.d.ts +0 -8
  27. package/src/core/types/result.d.ts.map +0 -1
  28. package/src/core/types/result.js +0 -3
  29. package/src/core/types/result.js.map +0 -1
  30. package/src/enumerations/index.d.ts +0 -2
  31. package/src/enumerations/index.d.ts.map +0 -1
  32. package/src/enumerations/index.js +0 -5
  33. package/src/enumerations/index.js.map +0 -1
  34. package/src/enumerations/pbkdf2-profile.d.ts +0 -9
  35. package/src/enumerations/pbkdf2-profile.d.ts.map +0 -1
  36. package/src/enumerations/pbkdf2-profile.js +0 -13
  37. package/src/enumerations/pbkdf2-profile.js.map +0 -1
  38. package/src/i18n/ecies-i18n-factory.d.ts +0 -28
  39. package/src/i18n/ecies-i18n-factory.d.ts.map +0 -1
  40. package/src/i18n/ecies-i18n-factory.js +0 -90
  41. package/src/i18n/ecies-i18n-factory.js.map +0 -1
  42. package/src/i18n/index.d.ts +0 -3
  43. package/src/i18n/index.d.ts.map +0 -1
  44. package/src/i18n/index.js +0 -8
  45. package/src/i18n/index.js.map +0 -1
  46. package/src/i18n/node-ecies-i18n-setup.d.ts +0 -5
  47. package/src/i18n/node-ecies-i18n-setup.d.ts.map +0 -1
  48. package/src/i18n/node-ecies-i18n-setup.js +0 -48
  49. package/src/i18n/node-ecies-i18n-setup.js.map +0 -1
  50. package/src/i18n/node-keys.d.ts +0 -57
  51. package/src/i18n/node-keys.d.ts.map +0 -1
  52. package/src/i18n/node-keys.js +0 -67
  53. package/src/i18n/node-keys.js.map +0 -1
  54. package/src/i18n/translations/de.d.ts +0 -3
  55. package/src/i18n/translations/de.d.ts.map +0 -1
  56. package/src/i18n/translations/de.js +0 -57
  57. package/src/i18n/translations/de.js.map +0 -1
  58. package/src/i18n/translations/en-GB.d.ts +0 -3
  59. package/src/i18n/translations/en-GB.d.ts.map +0 -1
  60. package/src/i18n/translations/en-GB.js +0 -61
  61. package/src/i18n/translations/en-GB.js.map +0 -1
  62. package/src/i18n/translations/en-US.d.ts +0 -6
  63. package/src/i18n/translations/en-US.d.ts.map +0 -1
  64. package/src/i18n/translations/en-US.js +0 -65
  65. package/src/i18n/translations/en-US.js.map +0 -1
  66. package/src/i18n/translations/es.d.ts +0 -3
  67. package/src/i18n/translations/es.d.ts.map +0 -1
  68. package/src/i18n/translations/es.js +0 -57
  69. package/src/i18n/translations/es.js.map +0 -1
  70. package/src/i18n/translations/fr.d.ts +0 -3
  71. package/src/i18n/translations/fr.d.ts.map +0 -1
  72. package/src/i18n/translations/fr.js +0 -57
  73. package/src/i18n/translations/fr.js.map +0 -1
  74. package/src/i18n/translations/index.d.ts +0 -9
  75. package/src/i18n/translations/index.d.ts.map +0 -1
  76. package/src/i18n/translations/index.js +0 -20
  77. package/src/i18n/translations/index.js.map +0 -1
  78. package/src/i18n/translations/ja.d.ts +0 -3
  79. package/src/i18n/translations/ja.d.ts.map +0 -1
  80. package/src/i18n/translations/ja.js +0 -57
  81. package/src/i18n/translations/ja.js.map +0 -1
  82. package/src/i18n/translations/uk.d.ts +0 -3
  83. package/src/i18n/translations/uk.d.ts.map +0 -1
  84. package/src/i18n/translations/uk.js +0 -57
  85. package/src/i18n/translations/uk.js.map +0 -1
  86. package/src/i18n/translations/zh-cn.d.ts +0 -3
  87. package/src/i18n/translations/zh-cn.d.ts.map +0 -1
  88. package/src/i18n/translations/zh-cn.js +0 -57
  89. package/src/i18n/translations/zh-cn.js.map +0 -1
  90. package/src/index.d.ts +0 -17
  91. package/src/index.d.ts.map +0 -1
  92. package/src/index.js +0 -30
  93. package/src/index.js.map +0 -1
  94. package/src/interfaces/authenticated-cipher.d.ts +0 -12
  95. package/src/interfaces/authenticated-cipher.d.ts.map +0 -1
  96. package/src/interfaces/authenticated-cipher.js +0 -3
  97. package/src/interfaces/authenticated-cipher.js.map +0 -1
  98. package/src/interfaces/authenticated-decipher.d.ts +0 -11
  99. package/src/interfaces/authenticated-decipher.d.ts.map +0 -1
  100. package/src/interfaces/authenticated-decipher.js +0 -3
  101. package/src/interfaces/authenticated-decipher.js.map +0 -1
  102. package/src/interfaces/backend-member-operational.d.ts +0 -48
  103. package/src/interfaces/backend-member-operational.d.ts.map +0 -1
  104. package/src/interfaces/backend-member-operational.js +0 -3
  105. package/src/interfaces/backend-member-operational.js.map +0 -1
  106. package/src/interfaces/checksum-config.d.ts +0 -5
  107. package/src/interfaces/checksum-config.d.ts.map +0 -1
  108. package/src/interfaces/checksum-config.js +0 -3
  109. package/src/interfaces/checksum-config.js.map +0 -1
  110. package/src/interfaces/checksum-consts.d.ts +0 -11
  111. package/src/interfaces/checksum-consts.d.ts.map +0 -1
  112. package/src/interfaces/checksum-consts.js +0 -3
  113. package/src/interfaces/checksum-consts.js.map +0 -1
  114. package/src/interfaces/constants.d.ts +0 -52
  115. package/src/interfaces/constants.d.ts.map +0 -1
  116. package/src/interfaces/constants.js +0 -3
  117. package/src/interfaces/constants.js.map +0 -1
  118. package/src/interfaces/ecies-consts.d.ts +0 -88
  119. package/src/interfaces/ecies-consts.d.ts.map +0 -1
  120. package/src/interfaces/ecies-consts.js +0 -3
  121. package/src/interfaces/ecies-consts.js.map +0 -1
  122. package/src/interfaces/encrypted-chunk.d.ts +0 -12
  123. package/src/interfaces/encrypted-chunk.d.ts.map +0 -1
  124. package/src/interfaces/encrypted-chunk.js +0 -3
  125. package/src/interfaces/encrypted-chunk.js.map +0 -1
  126. package/src/interfaces/encryption-consts.d.ts +0 -11
  127. package/src/interfaces/encryption-consts.d.ts.map +0 -1
  128. package/src/interfaces/encryption-consts.js +0 -3
  129. package/src/interfaces/encryption-consts.js.map +0 -1
  130. package/src/interfaces/index.d.ts +0 -29
  131. package/src/interfaces/index.d.ts.map +0 -1
  132. package/src/interfaces/index.js +0 -30
  133. package/src/interfaces/index.js.map +0 -1
  134. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +0 -6
  135. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +0 -1
  136. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js +0 -3
  137. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +0 -1
  138. package/src/interfaces/keyring-consts.d.ts +0 -6
  139. package/src/interfaces/keyring-consts.d.ts.map +0 -1
  140. package/src/interfaces/keyring-consts.js +0 -3
  141. package/src/interfaces/keyring-consts.js.map +0 -1
  142. package/src/interfaces/member-with-mnemonic.d.ts +0 -7
  143. package/src/interfaces/member-with-mnemonic.d.ts.map +0 -1
  144. package/src/interfaces/member-with-mnemonic.js +0 -3
  145. package/src/interfaces/member-with-mnemonic.js.map +0 -1
  146. package/src/interfaces/member.d.ts +0 -47
  147. package/src/interfaces/member.d.ts.map +0 -1
  148. package/src/interfaces/member.js +0 -3
  149. package/src/interfaces/member.js.map +0 -1
  150. package/src/interfaces/multi-encrypted-message.d.ts +0 -8
  151. package/src/interfaces/multi-encrypted-message.d.ts.map +0 -1
  152. package/src/interfaces/multi-encrypted-message.js +0 -3
  153. package/src/interfaces/multi-encrypted-message.js.map +0 -1
  154. package/src/interfaces/multi-encrypted-parsed-header.d.ts +0 -27
  155. package/src/interfaces/multi-encrypted-parsed-header.d.ts.map +0 -1
  156. package/src/interfaces/multi-encrypted-parsed-header.js +0 -3
  157. package/src/interfaces/multi-encrypted-parsed-header.js.map +0 -1
  158. package/src/interfaces/multi-recipient-chunk.d.ts +0 -26
  159. package/src/interfaces/multi-recipient-chunk.d.ts.map +0 -1
  160. package/src/interfaces/multi-recipient-chunk.js +0 -15
  161. package/src/interfaces/multi-recipient-chunk.js.map +0 -1
  162. package/src/interfaces/pbkdf-profiles.d.ts +0 -6
  163. package/src/interfaces/pbkdf-profiles.d.ts.map +0 -1
  164. package/src/interfaces/pbkdf-profiles.js +0 -3
  165. package/src/interfaces/pbkdf-profiles.js.map +0 -1
  166. package/src/interfaces/pbkdf2-result.d.ts +0 -6
  167. package/src/interfaces/pbkdf2-result.d.ts.map +0 -1
  168. package/src/interfaces/pbkdf2-result.js +0 -3
  169. package/src/interfaces/pbkdf2-result.js.map +0 -1
  170. package/src/interfaces/signing-key-private-key-info.d.ts +0 -11
  171. package/src/interfaces/signing-key-private-key-info.d.ts.map +0 -1
  172. package/src/interfaces/signing-key-private-key-info.js +0 -3
  173. package/src/interfaces/signing-key-private-key-info.js.map +0 -1
  174. package/src/interfaces/simple-keypair-buffer.d.ts +0 -6
  175. package/src/interfaces/simple-keypair-buffer.d.ts.map +0 -1
  176. package/src/interfaces/simple-keypair-buffer.js +0 -3
  177. package/src/interfaces/simple-keypair-buffer.js.map +0 -1
  178. package/src/interfaces/simple-keypair.d.ts +0 -6
  179. package/src/interfaces/simple-keypair.d.ts.map +0 -1
  180. package/src/interfaces/simple-keypair.js +0 -3
  181. package/src/interfaces/simple-keypair.js.map +0 -1
  182. package/src/interfaces/simple-public-key-only-buffer.d.ts +0 -4
  183. package/src/interfaces/simple-public-key-only-buffer.d.ts.map +0 -1
  184. package/src/interfaces/simple-public-key-only-buffer.js +0 -3
  185. package/src/interfaces/simple-public-key-only-buffer.js.map +0 -1
  186. package/src/interfaces/simple-public-key-only.d.ts +0 -4
  187. package/src/interfaces/simple-public-key-only.d.ts.map +0 -1
  188. package/src/interfaces/simple-public-key-only.js +0 -3
  189. package/src/interfaces/simple-public-key-only.js.map +0 -1
  190. package/src/interfaces/single-encrypted-parsed-header.d.ts +0 -35
  191. package/src/interfaces/single-encrypted-parsed-header.d.ts.map +0 -1
  192. package/src/interfaces/single-encrypted-parsed-header.js +0 -3
  193. package/src/interfaces/single-encrypted-parsed-header.js.map +0 -1
  194. package/src/interfaces/stream-config.d.ts +0 -6
  195. package/src/interfaces/stream-config.d.ts.map +0 -1
  196. package/src/interfaces/stream-config.js +0 -8
  197. package/src/interfaces/stream-config.js.map +0 -1
  198. package/src/interfaces/stream-progress.d.ts +0 -8
  199. package/src/interfaces/stream-progress.d.ts.map +0 -1
  200. package/src/interfaces/stream-progress.js +0 -3
  201. package/src/interfaces/stream-progress.js.map +0 -1
  202. package/src/interfaces/wallet-seed.d.ts +0 -7
  203. package/src/interfaces/wallet-seed.d.ts.map +0 -1
  204. package/src/interfaces/wallet-seed.js +0 -3
  205. package/src/interfaces/wallet-seed.js.map +0 -1
  206. package/src/interfaces/wrapped-key-consts.d.ts +0 -7
  207. package/src/interfaces/wrapped-key-consts.d.ts.map +0 -1
  208. package/src/interfaces/wrapped-key-consts.js +0 -3
  209. package/src/interfaces/wrapped-key-consts.js.map +0 -1
  210. package/src/lib/crypto-container.d.ts +0 -13
  211. package/src/lib/crypto-container.d.ts.map +0 -1
  212. package/src/lib/crypto-container.js +0 -32
  213. package/src/lib/crypto-container.js.map +0 -1
  214. package/src/lib/index.d.ts +0 -4
  215. package/src/lib/index.d.ts.map +0 -1
  216. package/src/lib/index.js +0 -7
  217. package/src/lib/index.js.map +0 -1
  218. package/src/lib/invariant-validator.d.ts +0 -69
  219. package/src/lib/invariant-validator.d.ts.map +0 -1
  220. package/src/lib/invariant-validator.js +0 -98
  221. package/src/lib/invariant-validator.js.map +0 -1
  222. package/src/lib/invariants/index.d.ts +0 -8
  223. package/src/lib/invariants/index.d.ts.map +0 -1
  224. package/src/lib/invariants/index.js +0 -12
  225. package/src/lib/invariants/index.js.map +0 -1
  226. package/src/lib/invariants/recipient-id-consistency.d.ts +0 -41
  227. package/src/lib/invariants/recipient-id-consistency.d.ts.map +0 -1
  228. package/src/lib/invariants/recipient-id-consistency.js +0 -75
  229. package/src/lib/invariants/recipient-id-consistency.js.map +0 -1
  230. package/src/member.d.ts +0 -81
  231. package/src/member.d.ts.map +0 -1
  232. package/src/member.js +0 -282
  233. package/src/member.js.map +0 -1
  234. package/src/services/aes-gcm.d.ts +0 -66
  235. package/src/services/aes-gcm.d.ts.map +0 -1
  236. package/src/services/aes-gcm.js +0 -161
  237. package/src/services/aes-gcm.js.map +0 -1
  238. package/src/services/chunk-processor.d.ts +0 -15
  239. package/src/services/chunk-processor.d.ts.map +0 -1
  240. package/src/services/chunk-processor.js +0 -36
  241. package/src/services/chunk-processor.js.map +0 -1
  242. package/src/services/ecies/crypto-core.d.ts +0 -104
  243. package/src/services/ecies/crypto-core.d.ts.map +0 -1
  244. package/src/services/ecies/crypto-core.js +0 -234
  245. package/src/services/ecies/crypto-core.js.map +0 -1
  246. package/src/services/ecies/file.d.ts +0 -30
  247. package/src/services/ecies/file.d.ts.map +0 -1
  248. package/src/services/ecies/file.js +0 -112
  249. package/src/services/ecies/file.js.map +0 -1
  250. package/src/services/ecies/index.d.ts +0 -8
  251. package/src/services/ecies/index.d.ts.map +0 -1
  252. package/src/services/ecies/index.js +0 -11
  253. package/src/services/ecies/index.js.map +0 -1
  254. package/src/services/ecies/multi-recipient.d.ts +0 -84
  255. package/src/services/ecies/multi-recipient.d.ts.map +0 -1
  256. package/src/services/ecies/multi-recipient.js +0 -494
  257. package/src/services/ecies/multi-recipient.js.map +0 -1
  258. package/src/services/ecies/service.d.ts +0 -75
  259. package/src/services/ecies/service.d.ts.map +0 -1
  260. package/src/services/ecies/service.js +0 -152
  261. package/src/services/ecies/service.js.map +0 -1
  262. package/src/services/ecies/signature.d.ts +0 -38
  263. package/src/services/ecies/signature.d.ts.map +0 -1
  264. package/src/services/ecies/signature.js +0 -69
  265. package/src/services/ecies/signature.js.map +0 -1
  266. package/src/services/ecies/single-recipient.d.ts +0 -83
  267. package/src/services/ecies/single-recipient.d.ts.map +0 -1
  268. package/src/services/ecies/single-recipient.js +0 -448
  269. package/src/services/ecies/single-recipient.js.map +0 -1
  270. package/src/services/ecies/utilities.d.ts +0 -33
  271. package/src/services/ecies/utilities.d.ts.map +0 -1
  272. package/src/services/ecies/utilities.js +0 -91
  273. package/src/services/ecies/utilities.js.map +0 -1
  274. package/src/services/encryption-stream.d.ts +0 -33
  275. package/src/services/encryption-stream.d.ts.map +0 -1
  276. package/src/services/encryption-stream.js +0 -211
  277. package/src/services/encryption-stream.js.map +0 -1
  278. package/src/services/index.d.ts +0 -8
  279. package/src/services/index.d.ts.map +0 -1
  280. package/src/services/index.js +0 -11
  281. package/src/services/index.js.map +0 -1
  282. package/src/services/multi-recipient-processor.d.ts +0 -72
  283. package/src/services/multi-recipient-processor.d.ts.map +0 -1
  284. package/src/services/multi-recipient-processor.js +0 -321
  285. package/src/services/multi-recipient-processor.js.map +0 -1
  286. package/src/services/pbkdf2.d.ts +0 -105
  287. package/src/services/pbkdf2.d.ts.map +0 -1
  288. package/src/services/pbkdf2.js +0 -191
  289. package/src/services/pbkdf2.js.map +0 -1
  290. package/src/services/progress-tracker.d.ts +0 -9
  291. package/src/services/progress-tracker.d.ts.map +0 -1
  292. package/src/services/progress-tracker.js +0 -41
  293. package/src/services/progress-tracker.js.map +0 -1
  294. package/src/test-mocks/index.d.ts +0 -2
  295. package/src/test-mocks/index.d.ts.map +0 -1
  296. package/src/test-mocks/index.js +0 -5
  297. package/src/test-mocks/index.js.map +0 -1
  298. package/src/test-mocks/mock-backend-member.d.ts +0 -76
  299. package/src/test-mocks/mock-backend-member.d.ts.map +0 -1
  300. package/src/test-mocks/mock-backend-member.js +0 -139
  301. package/src/test-mocks/mock-backend-member.js.map +0 -1
  302. package/src/testing.d.ts +0 -2
  303. package/src/testing.d.ts.map +0 -1
  304. package/src/testing.js +0 -6
  305. package/src/testing.js.map +0 -1
  306. package/src/types/id-guards.d.ts +0 -39
  307. package/src/types/id-guards.d.ts.map +0 -1
  308. package/src/types/id-guards.js +0 -91
  309. package/src/types/id-guards.js.map +0 -1
  310. package/src/types/index.d.ts +0 -2
  311. package/src/types/index.d.ts.map +0 -1
  312. package/src/types/index.js +0 -5
  313. package/src/types/index.js.map +0 -1
  314. package/src/types.d.ts +0 -26
  315. package/src/types.d.ts.map +0 -1
  316. package/src/types.js +0 -6
  317. package/src/types.js.map +0 -1
  318. package/src/utils.d.ts +0 -11
  319. package/src/utils.d.ts.map +0 -1
  320. package/src/utils.js +0 -82
  321. package/src/utils.js.map +0 -1
@@ -1,494 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EciesMultiRecipient = void 0;
4
- const crypto_1 = require("crypto");
5
- const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
6
- const single_recipient_1 = require("./single-recipient");
7
- /**
8
- * Multiple recipient encryption/decryption functions for ECIES
9
- */
10
- class EciesMultiRecipient {
11
- cryptoCore;
12
- singleRecipientCore;
13
- constructor(cryptoCore) {
14
- this.cryptoCore = cryptoCore;
15
- this.singleRecipientCore = new single_recipient_1.EciesSingleRecipientCore(cryptoCore.config);
16
- }
17
- /**
18
- * Get the size of the header for a given encryption type
19
- * @param recipientCount The number of recipients
20
- * @returns
21
- */
22
- getHeaderSize(recipientCount) {
23
- return (this.cryptoCore.consts.VERSION_SIZE +
24
- this.cryptoCore.consts.CIPHER_SUITE_SIZE +
25
- this.cryptoCore.consts.ENCRYPTION_TYPE_SIZE +
26
- this.cryptoCore.consts.PUBLIC_KEY_LENGTH + // Shared ephemeral public key
27
- this.cryptoCore.consts.MULTIPLE.DATA_LENGTH_SIZE +
28
- this.cryptoCore.consts.MULTIPLE.RECIPIENT_COUNT_SIZE +
29
- recipientCount * this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE +
30
- recipientCount * this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE);
31
- }
32
- /**
33
- * Encrypt a message symmetric key with a public key
34
- * @param receiverPublicKey The public key of the receiver
35
- * @param messageSymmetricKey The message to encrypt
36
- * @param ephemeralPrivateKey The ephemeral private key to use for encryption
37
- * @param aad Additional Authenticated Data (optional)
38
- * @returns The encrypted message
39
- */
40
- encryptKey(receiverPublicKey, messageSymmetricKey, ephemeralPrivateKey, aad) {
41
- // Compute shared secret
42
- let sharedSecret;
43
- try {
44
- // Make sure we normalize the receiver's public key
45
- const normalizedReceiverPublicKey = this.cryptoCore.normalizePublicKey(receiverPublicKey);
46
- // Create ECDH instance with the ephemeral private key
47
- const ecdh = (0, crypto_1.createECDH)(this.cryptoCore.config.curveName);
48
- ecdh.setPrivateKey(ephemeralPrivateKey);
49
- // Ensure we're using the properly formatted public key (with 0x04 prefix)
50
- sharedSecret = ecdh.computeSecret(normalizedReceiverPublicKey);
51
- }
52
- catch (error) {
53
- console.error('[ERROR][encrypt] Failed to compute shared secret:', error);
54
- if (error instanceof Error) {
55
- if ('code' in error &&
56
- error.code === 'ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY') {
57
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidRecipientPublicKey, undefined, undefined, {
58
- nodeError: error.code,
59
- });
60
- }
61
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.SecretComputationFailed, undefined, undefined, {
62
- error: error.message,
63
- });
64
- }
65
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.SecretComputationFailed);
66
- }
67
- // Use HKDF to derive the key
68
- const symKey = this.cryptoCore.deriveSharedKey(sharedSecret, Buffer.alloc(0), // No salt
69
- Buffer.from('ecies-v2-key-derivation'), // Info
70
- this.cryptoCore.consts.SYMMETRIC.KEY_SIZE);
71
- const iv = (0, crypto_1.randomBytes)(this.cryptoCore.consts.IV_SIZE);
72
- // Create cipher with the derived symmetric key
73
- const cipher = (0, crypto_1.createCipheriv)(this.cryptoCore.consts.SYMMETRIC_ALGORITHM_CONFIGURATION, symKey, iv);
74
- // Ensure auto padding is enabled
75
- cipher.setAutoPadding(true);
76
- // Set AAD if provided
77
- if (aad) {
78
- cipher.setAAD(aad);
79
- }
80
- // Encrypt the message
81
- let encrypted = cipher.update(messageSymmetricKey);
82
- encrypted = Buffer.concat([encrypted, cipher.final()]);
83
- // Get and explicitly set the authentication tag to max tag length for consistency
84
- const authTag = cipher.getAuthTag();
85
- // Format: iv (16) | authTag (16) | encryptedData (32)
86
- // Note: Ephemeral public key is now in the main header, not per-recipient
87
- return Buffer.concat([iv, authTag, encrypted]);
88
- }
89
- /**
90
- * Decrypts symmetric key encrypted with ECIES using a header
91
- * @param privateKey The private key to decrypt the data
92
- * @param encryptedKey The data to decrypt
93
- * @param ephemeralPublicKey The ephemeral public key from the header
94
- * @param aad Additional Authenticated Data (optional)
95
- * @returns The decrypted data buffer
96
- */
97
- decryptKey(privateKey, encryptedKey, ephemeralPublicKey, aad) {
98
- if (encryptedKey.length !== this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE) {
99
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEncryptedKeyLength, undefined, undefined, {
100
- expected: String(this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE),
101
- actual: String(encryptedKey.length),
102
- });
103
- }
104
- const iv = encryptedKey.subarray(0, this.cryptoCore.consts.IV_SIZE);
105
- const authTag = encryptedKey.subarray(this.cryptoCore.consts.IV_SIZE, this.cryptoCore.consts.IV_SIZE + this.cryptoCore.consts.AUTH_TAG_SIZE);
106
- const encrypted = encryptedKey.subarray(this.cryptoCore.consts.IV_SIZE + this.cryptoCore.consts.AUTH_TAG_SIZE);
107
- // Normalize the public key (ensuring 0x04 prefix)
108
- const normalizedKey = this.cryptoCore.normalizePublicKey(ephemeralPublicKey);
109
- // Compute shared secret
110
- const ecdh = (0, crypto_1.createECDH)(this.cryptoCore.config.curveName);
111
- ecdh.setPrivateKey(privateKey);
112
- const sharedSecret = ecdh.computeSecret(normalizedKey);
113
- // Use HKDF to derive the key
114
- const symKey = this.cryptoCore.deriveSharedKey(sharedSecret, Buffer.alloc(0), // No salt
115
- Buffer.from('ecies-v2-key-derivation'), // Info
116
- this.cryptoCore.consts.SYMMETRIC.KEY_SIZE);
117
- // Decrypt
118
- const decipher = (0, crypto_1.createDecipheriv)(this.cryptoCore.consts.SYMMETRIC_ALGORITHM_CONFIGURATION, symKey, iv);
119
- decipher.setAuthTag(authTag);
120
- if (aad) {
121
- decipher.setAAD(aad);
122
- }
123
- const decrypted = decipher.update(encrypted);
124
- const final = decipher.final();
125
- const decryptedMessage = Buffer.concat([decrypted, final]);
126
- if (decryptedMessage.length !== this.cryptoCore.consts.SYMMETRIC.KEY_SIZE) {
127
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength, undefined, undefined, {
128
- expected: String(this.cryptoCore.consts.SYMMETRIC.KEY_SIZE),
129
- actual: String(decryptedMessage.length),
130
- });
131
- }
132
- return decryptedMessage;
133
- }
134
- /**
135
- * Encrypts a message for multiple recipients.
136
- * @param recipients The recipients to encrypt the message for.
137
- * @param message The message to encrypt.
138
- * @param preamble Optional preamble to include in the encrypted message.
139
- * @param senderPrivateKey Optional sender private key for signing.
140
- * @returns The encrypted message.
141
- * @throws EciesError if the number of recipients is greater than 65535.
142
- */
143
- encryptMultiple(recipients, message, preamble, senderPrivateKey) {
144
- if (recipients.length > ecies_lib_1.Constants.UINT16_MAX) {
145
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.TooManyRecipients);
146
- }
147
- // Sign-then-Encrypt: If sender key provided, sign the message and prepend signature
148
- let messageToEncrypt = message;
149
- if (senderPrivateKey) {
150
- const signature = this.cryptoCore.sign(senderPrivateKey, message);
151
- messageToEncrypt = Buffer.concat([signature, message]);
152
- }
153
- if (messageToEncrypt.length > this.cryptoCore.consts.MAX_RAW_DATA_SIZE) {
154
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.FileSizeTooLarge);
155
- }
156
- const messageTypeBuffer = Buffer.alloc(1);
157
- messageTypeBuffer.writeUint8(ecies_lib_1.EciesEncryptionTypeEnum.Multiple);
158
- // Generate a random symmetric key
159
- const symmetricKey = (0, crypto_1.randomBytes)(this.cryptoCore.consts.SYMMETRIC.KEY_SIZE);
160
- // Generate ONE ephemeral key pair for all recipients
161
- const ecdh = (0, crypto_1.createECDH)(this.cryptoCore.config.curveName);
162
- ecdh.generateKeys();
163
- const ephemeralPrivateKey = ecdh.getPrivateKey();
164
- let ephemeralPublicKey = ecdh.getPublicKey(null, 'compressed');
165
- // Ensure public key has 0x04 prefix
166
- if (ephemeralPublicKey.length === this.cryptoCore.consts.RAW_PUBLIC_KEY_LENGTH) {
167
- ephemeralPublicKey = Buffer.concat([
168
- Buffer.from([this.cryptoCore.consts.PUBLIC_KEY_MAGIC]),
169
- ephemeralPublicKey,
170
- ]);
171
- }
172
- const encryptionResults = recipients.map((member) => ({
173
- id: member.id,
174
- encryptedKey: this.encryptKey(member.publicKey, symmetricKey, ephemeralPrivateKey, member.id),
175
- }));
176
- const recipientIds = encryptionResults.map(({ id }) => id);
177
- const recipientKeys = encryptionResults.map(({ encryptedKey }) => encryptedKey);
178
- // Calculate header size
179
- const headerSize = this.calculateECIESMultipleRecipientOverhead(recipients.length, false, recipientKeys);
180
- // Build the header to use as AAD for message encryption
181
- // We need to construct a temporary object to build the header
182
- const tempHeaderData = {
183
- dataLength: messageToEncrypt.length,
184
- recipientCount: recipients.length,
185
- recipientIds,
186
- recipientKeys,
187
- encryptedMessage: Buffer.alloc(0), // Placeholder
188
- headerSize,
189
- ephemeralPublicKey,
190
- };
191
- const headerBytes = this.buildECIESMultipleRecipientHeader(tempHeaderData);
192
- // Encrypt the message with the symmetric key and Header as AAD
193
- const iv = (0, crypto_1.randomBytes)(this.cryptoCore.consts.IV_SIZE);
194
- const cipher = (0, crypto_1.createCipheriv)(this.cryptoCore.consts.SYMMETRIC_ALGORITHM_CONFIGURATION, symmetricKey, iv);
195
- cipher.setAAD(headerBytes);
196
- const encrypted = cipher.update(messageToEncrypt);
197
- const final = cipher.final();
198
- const authTag = cipher.getAuthTag();
199
- const encryptedMessage = Buffer.concat([encrypted, final]);
200
- const storedMessage = Buffer.concat([
201
- preamble ?? Buffer.alloc(0),
202
- iv,
203
- authTag,
204
- encryptedMessage,
205
- ]);
206
- // Verify the encrypted message size (just the encrypted content)
207
- if (encryptedMessage.length !== messageToEncrypt.length) {
208
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.MessageLengthMismatch);
209
- }
210
- return {
211
- dataLength: messageToEncrypt.length,
212
- recipientCount: recipients.length,
213
- recipientIds,
214
- recipientKeys,
215
- encryptedMessage: storedMessage,
216
- headerSize,
217
- ephemeralPublicKey,
218
- };
219
- }
220
- /**
221
- * Decrypts a message encrypted with multiple ECIE for a recipient.
222
- * @param encryptedData The encrypted data.
223
- * @param recipient The recipient.
224
- * @param senderPublicKey Optional sender public key for verification.
225
- * @returns The decrypted message.
226
- */
227
- decryptMultipleECIEForRecipient(encryptedData, recipient, senderPublicKey) {
228
- if (recipient.privateKey === undefined) {
229
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.PrivateKeyNotLoaded);
230
- }
231
- // Find this recipient's encrypted key
232
- const recipientIndex = encryptedData.recipientIds.findIndex((id) => id.equals(recipient.id));
233
- if (recipientIndex === -1) {
234
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.RecipientNotFound);
235
- }
236
- const encryptedKey = encryptedData.recipientKeys[recipientIndex];
237
- if (!encryptedData.ephemeralPublicKey) {
238
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEphemeralPublicKey);
239
- }
240
- // Decrypt the symmetric key using the detected encryption type
241
- const symmetricKey = this.decryptKey(Buffer.from(recipient.privateKey.value), encryptedKey, encryptedData.ephemeralPublicKey, recipient.id);
242
- // Rebuild header to use as AAD
243
- const headerBytes = this.buildECIESMultipleRecipientHeader(encryptedData);
244
- // Extract the IV and auth tag from the encrypted message
245
- const iv = encryptedData.encryptedMessage.subarray(0, this.cryptoCore.consts.IV_SIZE);
246
- const authTag = encryptedData.encryptedMessage.subarray(this.cryptoCore.consts.IV_SIZE, this.cryptoCore.consts.IV_SIZE + this.cryptoCore.consts.AUTH_TAG_SIZE);
247
- // Extract the encrypted content (no CRC, AES-GCM provides authentication)
248
- const encrypted = encryptedData.encryptedMessage.subarray(this.cryptoCore.consts.IV_SIZE + this.cryptoCore.consts.AUTH_TAG_SIZE);
249
- // Decrypt the content with the symmetric key
250
- const decipher = (0, crypto_1.createDecipheriv)(this.cryptoCore.consts.SYMMETRIC_ALGORITHM_CONFIGURATION, symmetricKey, iv);
251
- decipher.setAuthTag(authTag);
252
- decipher.setAAD(headerBytes);
253
- const decrypted = decipher.update(encrypted);
254
- const final = decipher.final();
255
- const decryptedMessage = Buffer.concat([decrypted, final]);
256
- // The decrypted message should match the original data length
257
- if (decryptedMessage.length !== encryptedData.dataLength) {
258
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength);
259
- }
260
- // If sender public key is provided, verify signature
261
- if (senderPublicKey) {
262
- // Expect [Signature (64)][Message]
263
- if (decryptedMessage.length < 64) {
264
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidSignature);
265
- }
266
- const signature = decryptedMessage.subarray(0, 64);
267
- const message = decryptedMessage.subarray(64);
268
- const isValid = this.cryptoCore.verify(senderPublicKey, message, signature);
269
- if (!isValid) {
270
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidSignature);
271
- }
272
- return message;
273
- }
274
- return decryptedMessage;
275
- }
276
- /**
277
- * Calculate the overhead for a message encrypted for multiple recipients
278
- * @param recipientCount number of recipients
279
- * @param includeMessageOverhead whether to include the overhead for the encrypted message
280
- * @param encryptedKeys optional array of encrypted keys to calculate actual size
281
- * @returns the overhead size in bytes
282
- */
283
- calculateECIESMultipleRecipientOverhead(recipientCount, includeMessageOverhead, encryptedKeys) {
284
- if (recipientCount < 1) {
285
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidRecipientCount);
286
- }
287
- // Calculate encrypted keys size
288
- let encryptedKeysSize;
289
- if (encryptedKeys) {
290
- encryptedKeysSize = encryptedKeys.reduce((total, key) => total + key.length, 0);
291
- }
292
- else {
293
- // Default assumption: all keys use Simple encryption type (more efficient)
294
- encryptedKeysSize =
295
- recipientCount * this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE;
296
- }
297
- const baseOverhead = this.cryptoCore.consts.VERSION_SIZE +
298
- this.cryptoCore.consts.CIPHER_SUITE_SIZE +
299
- this.cryptoCore.consts.ENCRYPTION_TYPE_SIZE +
300
- this.cryptoCore.consts.MULTIPLE.DATA_LENGTH_SIZE +
301
- this.cryptoCore.consts.MULTIPLE.RECIPIENT_COUNT_SIZE +
302
- recipientCount * this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE + // recipient ids (dynamic based on ID provider)
303
- encryptedKeysSize; // actual encrypted keys size
304
- return includeMessageOverhead
305
- ? baseOverhead + this.cryptoCore.consts.MULTIPLE.FIXED_OVERHEAD_SIZE
306
- : baseOverhead;
307
- }
308
- /**
309
- * Builds the header for a message encrypted for multiple recipients
310
- * @param data The encrypted message data including recipients and encrypted keys
311
- * @returns The header buffer for the message
312
- * @throws EciesError if the number of recipients is greater than the maximum allowed
313
- * @throws EciesError if the number of encrypted keys does not match the number of recipients
314
- */
315
- buildECIESMultipleRecipientHeader(data) {
316
- if (data.recipientIds.length > this.cryptoCore.consts.MULTIPLE.MAX_RECIPIENTS) {
317
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.TooManyRecipients);
318
- }
319
- else if (data.recipientIds.length !== data.recipientKeys.length) {
320
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.RecipientKeyCountMismatch);
321
- }
322
- else if (data.dataLength < 0 ||
323
- data.dataLength > this.cryptoCore.consts.MAX_RAW_DATA_SIZE) {
324
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.FileSizeTooLarge);
325
- }
326
- if (!data.ephemeralPublicKey) {
327
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEphemeralPublicKey);
328
- }
329
- // Create version buffer
330
- const versionBuffer = Buffer.alloc(this.cryptoCore.consts.VERSION_SIZE);
331
- versionBuffer.writeUInt8(ecies_lib_1.EciesVersionEnum.V1);
332
- // Create cipher suite buffer
333
- const cipherSuiteBuffer = Buffer.alloc(this.cryptoCore.consts.CIPHER_SUITE_SIZE);
334
- cipherSuiteBuffer.writeUInt8(ecies_lib_1.EciesCipherSuiteEnum.Secp256k1_Aes256Gcm_Sha256);
335
- // Create encryption type buffer
336
- const encryptionTypeBuffer = Buffer.alloc(this.cryptoCore.consts.ENCRYPTION_TYPE_SIZE);
337
- encryptionTypeBuffer.writeUInt8(ecies_lib_1.EciesEncryptionTypeEnum.Multiple);
338
- // Create data length buffer
339
- // We use the most significant byte (MSB) to store the recipient ID size
340
- const recipientIdSize = this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE;
341
- if (recipientIdSize > 255) {
342
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidRecipientCount);
343
- }
344
- const dataLengthBigInt = BigInt(data.dataLength);
345
- const recipientIdSizeBigInt = BigInt(recipientIdSize);
346
- const combinedLength = (recipientIdSizeBigInt << 56n) | dataLengthBigInt;
347
- const dataLengthBuffer = Buffer.alloc(this.cryptoCore.consts.MULTIPLE.DATA_LENGTH_SIZE);
348
- dataLengthBuffer.writeBigUInt64BE(combinedLength);
349
- // Create recipient count buffer
350
- const recipientCountBuffer = Buffer.alloc(this.cryptoCore.consts.MULTIPLE.RECIPIENT_COUNT_SIZE);
351
- recipientCountBuffer.writeUInt16BE(data.recipientIds.length);
352
- // Create recipients buffer
353
- const recipientsBuffer = Buffer.alloc(data.recipientIds.length *
354
- this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE);
355
- data.recipientIds.forEach((recipientId, index) => {
356
- recipientsBuffer.set(recipientId, index * this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE);
357
- });
358
- // Validate encrypted key lengths based on their encryption type
359
- data.recipientKeys.forEach((encryptedKey) => {
360
- if (encryptedKey.length === 0) {
361
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEncryptedKeyLength);
362
- }
363
- if (encryptedKey.length !==
364
- this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE) {
365
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEncryptedKeyLength, undefined, undefined, {
366
- expected: String(this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE),
367
- actual: String(encryptedKey.length),
368
- });
369
- }
370
- });
371
- // Create encrypted keys buffer with variable-length keys
372
- const encryptedKeysBuffer = Buffer.concat(data.recipientKeys);
373
- // Combine all buffers to form the header
374
- return Buffer.concat([
375
- versionBuffer,
376
- cipherSuiteBuffer,
377
- encryptionTypeBuffer,
378
- data.ephemeralPublicKey,
379
- dataLengthBuffer,
380
- recipientCountBuffer,
381
- recipientsBuffer,
382
- encryptedKeysBuffer,
383
- ]);
384
- }
385
- /**
386
- * Parses a multi-encrypted header.
387
- * @param data - The data to parse.
388
- * @returns The parsed header.
389
- */
390
- parseMultiEncryptedHeader(data) {
391
- // Ensure there's enough data to read headers
392
- // minimum: 1 (ver) + 1 (suite) + 1 (type) + 33 (pubkey) + 8 (len) + 2 (count) = 46
393
- if (data.length < 46) {
394
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength);
395
- }
396
- let offset = 0;
397
- // Read Version
398
- const version = data.readUInt8(offset);
399
- offset += this.cryptoCore.consts.VERSION_SIZE;
400
- if (version !== ecies_lib_1.EciesVersionEnum.V1) {
401
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidVersion, undefined, undefined, { version: String(version) });
402
- }
403
- // Read CipherSuite
404
- const cipherSuite = data.readUInt8(offset);
405
- offset += this.cryptoCore.consts.CIPHER_SUITE_SIZE;
406
- if (cipherSuite !== ecies_lib_1.EciesCipherSuiteEnum.Secp256k1_Aes256Gcm_Sha256) {
407
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidCipherSuite, undefined, undefined, { cipherSuite: String(cipherSuite) });
408
- }
409
- // Read Encryption Type
410
- const encryptionType = data.readUInt8(offset);
411
- offset += this.cryptoCore.consts.ENCRYPTION_TYPE_SIZE;
412
- if (encryptionType !== ecies_lib_1.EciesEncryptionTypeEnum.Multiple) {
413
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEncryptionType, undefined, undefined, { encryptionType: encryptionType.toString(16) });
414
- }
415
- // Read Ephemeral Public Key
416
- const ephemeralPublicKey = data.subarray(offset, offset + this.cryptoCore.consts.PUBLIC_KEY_LENGTH);
417
- offset += this.cryptoCore.consts.PUBLIC_KEY_LENGTH;
418
- // Read data length and recipient ID size
419
- const combinedLength = data.readBigUInt64BE(offset);
420
- offset += this.cryptoCore.consts.MULTIPLE.DATA_LENGTH_SIZE; // 8 bytes
421
- // Extract recipient ID size from MSB (top 8 bits)
422
- const storedRecipientIdSize = Number(combinedLength >> 56n);
423
- // Extract data length from lower 56 bits
424
- const dataLength = Number(combinedLength & 0x00ffffffffffffffn);
425
- if (dataLength <= 0 ||
426
- dataLength > this.cryptoCore.consts.MAX_RAW_DATA_SIZE) {
427
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength);
428
- }
429
- // Use stored recipient ID size if available (non-legacy), otherwise fallback to config
430
- const recipientIdSize = storedRecipientIdSize > 0
431
- ? storedRecipientIdSize
432
- : this.cryptoCore.consts.MULTIPLE.RECIPIENT_ID_SIZE;
433
- // Read recipient count
434
- const recipientCount = data.readUInt16BE(offset);
435
- if (recipientCount <= 0 ||
436
- recipientCount > this.cryptoCore.consts.MULTIPLE.MAX_RECIPIENTS) {
437
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidRecipientCount);
438
- }
439
- offset += this.cryptoCore.consts.MULTIPLE.RECIPIENT_COUNT_SIZE; // 2 bytes
440
- // Ensure there's enough data for all recipients
441
- // Note: We can't use calculateECIESMultipleRecipientOverhead here easily because it assumes fixed ID size
442
- // But we can calculate manually
443
- const remainingHeaderSize = recipientCount * recipientIdSize +
444
- recipientCount * this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE;
445
- if (data.length < offset + remainingHeaderSize) {
446
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength);
447
- }
448
- // Read recipient IDs
449
- const recipientIds = [];
450
- for (let i = 0; i < recipientCount; i++) {
451
- recipientIds.push(data.subarray(offset, offset + recipientIdSize));
452
- offset += recipientIdSize;
453
- }
454
- // Read encrypted keys with variable lengths based on encryption type
455
- const recipientKeys = [];
456
- for (let i = 0; i < recipientCount; i++) {
457
- if (offset >= data.length) {
458
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength);
459
- }
460
- if (offset + this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE >
461
- data.length) {
462
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidDataLength, undefined, undefined, {
463
- required: String(this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE),
464
- available: String(data.length - offset),
465
- });
466
- }
467
- recipientKeys.push(data.subarray(offset, offset + this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE));
468
- offset += this.cryptoCore.consts.MULTIPLE.ENCRYPTED_KEY_SIZE;
469
- }
470
- return {
471
- dataLength,
472
- recipientCount,
473
- recipientIds,
474
- recipientKeys,
475
- headerSize: offset,
476
- ephemeralPublicKey,
477
- };
478
- }
479
- /**
480
- * Parses a multi-encrypted buffer into its components.
481
- * @param data - The multi-encrypted buffer to parse.
482
- * @returns The parsed multi-encrypted buffer.
483
- */
484
- parseMultiEncryptedBuffer(data) {
485
- const header = this.parseMultiEncryptedHeader(data);
486
- const encryptedMessage = data.subarray(header.headerSize);
487
- return {
488
- ...header,
489
- encryptedMessage,
490
- };
491
- }
492
- }
493
- exports.EciesMultiRecipient = EciesMultiRecipient;
494
- //# sourceMappingURL=multi-recipient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multi-recipient.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/services/ecies/multi-recipient.ts"],"names":[],"mappings":";;;AAAA,mCAKgB;AAEhB,0DAOoC;AASpC,yDAA8D;AAE9D;;GAEG;AACH,MAAa,mBAAmB;IACX,UAAU,CAAkB;IAC5B,mBAAmB,CAA2B;IAEjE,YAAY,UAA2B;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,mBAAmB,GAAG,IAAI,2CAAwB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IA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d,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CACnD;oBACD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;iBACxC,CACF,CAAC;YACJ,CAAC;YAED,aAAa,CAAC,IAAI,CAChB,IAAI,CAAC,QAAQ,CACX,MAAM,EACN,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAC5D,CACF,CAAC;YACF,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAC/D,CAAC;QAED,OAAO;YACL,UAAU;YACV,cAAc;YACd,YAAY;YACZ,aAAa;YACb,UAAU,EAAE,MAAM;YAClB,kBAAkB;SACnB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,yBAAyB,CAAC,IAAY;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE1D,OAAO;YACL,GAAG,MAAM;YACT,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF;AApvBD,kDAovBC"}
@@ -1,75 +0,0 @@
1
- import { EciesEncryptionType, EciesEncryptionTypeEnum, HexString, IECIESConfig, IECIESConstants, SecureString } from '@digitaldefiance/ecies-lib';
2
- import { Wallet } from '@ethereumjs/wallet';
3
- import type { IMember } from '../../interfaces/member';
4
- import type { IMultiEncryptedMessage } from '../../interfaces/multi-encrypted-message';
5
- import type { IMultiEncryptedParsedHeader } from '../../interfaces/multi-encrypted-parsed-header';
6
- import type { ISingleEncryptedParsedHeader } from '../../interfaces/single-encrypted-parsed-header';
7
- import type { IWalletSeed } from '../../interfaces/wallet-seed';
8
- import { SignatureBuffer, SignatureString } from '../../types';
9
- import { EciesCryptoCore } from './crypto-core';
10
- import { EciesMultiRecipient } from './multi-recipient';
11
- import { EciesSignature } from './signature';
12
- import { EciesSingleRecipientCore } from './single-recipient';
13
- import { EciesUtilities } from './utilities';
14
- /**
15
- * Unified ECIES service that integrates all the modular components
16
- */
17
- export declare class ECIESService {
18
- protected readonly _config: IECIESConfig;
19
- protected readonly cryptoCore: EciesCryptoCore;
20
- protected readonly signature: EciesSignature;
21
- protected readonly singleRecipient: EciesSingleRecipientCore;
22
- protected readonly multiRecipient: EciesMultiRecipient;
23
- protected readonly utilities: EciesUtilities;
24
- constructor(config?: Partial<IECIESConfig>, eciesParams?: IECIESConstants);
25
- get core(): EciesCryptoCore;
26
- get config(): IECIESConfig;
27
- /**
28
- * The name of the elliptic curve used for ECIES encryption/decryption
29
- */
30
- get curveName(): string;
31
- generateNewMnemonic(): SecureString;
32
- walletFromSeed(seed: Buffer): Wallet;
33
- walletAndSeedFromMnemonic(mnemonic: SecureString): IWalletSeed;
34
- walletToSimpleKeyPairBuffer(wallet: Wallet): import("../..").ISimpleKeyPairBuffer;
35
- seedToSimpleKeyPairBuffer(seed: Buffer): import("../..").ISimpleKeyPairBuffer;
36
- mnemonicToSimpleKeyPairBuffer(mnemonic: SecureString): import("../..").ISimpleKeyPairBuffer;
37
- mnemonicToSimpleKeyPair(mnemonic: SecureString): import("../..").ISimpleKeyPairBuffer;
38
- /**
39
- * Get compressed public key from private key
40
- * @param privateKey The private key
41
- * @returns Compressed public key (33 bytes with prefix)
42
- */
43
- getPublicKey(privateKey: Buffer): Buffer;
44
- encryptSimpleOrSingle(encryptSimple: boolean, receiverPublicKey: Buffer, message: Buffer, preamble?: Buffer): Buffer;
45
- parseSingleEncryptedHeader(encryptionType: EciesEncryptionTypeEnum, data: Buffer, preambleSize?: number, options?: {
46
- dataLength?: number;
47
- }): ISingleEncryptedParsedHeader;
48
- decryptSimpleOrSingleWithHeader(decryptSimple: boolean, privateKey: Buffer, encryptedData: Buffer, preambleSize?: number, options?: {
49
- dataLength?: number;
50
- }): Buffer;
51
- decryptSimpleOrSingleWithHeaderEx(encryptionType: EciesEncryptionTypeEnum, privateKey: Buffer, encryptedData: Buffer, preambleSize?: number, options?: {
52
- dataLength?: number;
53
- }): {
54
- decrypted: Buffer;
55
- consumedBytes: number;
56
- };
57
- decryptSingleWithComponents(privateKey: Buffer, ephemeralPublicKey: Buffer, iv: Buffer, authTag: Buffer, encrypted: Buffer, aad?: Buffer): {
58
- decrypted: Buffer;
59
- ciphertextLength?: number;
60
- };
61
- signMessage(privateKey: Buffer, data: Buffer): SignatureBuffer;
62
- verifyMessage(publicKey: Buffer, data: Buffer, signature: SignatureBuffer): boolean;
63
- signatureStringToSignatureBuffer(signatureString: HexString): SignatureBuffer;
64
- signatureBufferToSignatureString(signatureBuffer: SignatureBuffer): SignatureString;
65
- encryptMultiple(recipients: Array<IMember>, message: Buffer, preamble?: Buffer): Promise<IMultiEncryptedMessage>;
66
- decryptMultipleECIEForRecipient(encryptedData: IMultiEncryptedMessage, recipient: IMember): Buffer;
67
- calculateECIESMultipleRecipientOverhead(recipientCount: number, includeMessageOverhead: boolean): number;
68
- buildECIESMultipleRecipientHeader(data: IMultiEncryptedMessage): Buffer;
69
- parseMultiEncryptedHeader(data: Buffer): IMultiEncryptedParsedHeader;
70
- parseMultiEncryptedBuffer(data: Buffer): IMultiEncryptedMessage;
71
- computeEncryptedLengthFromDataLength(dataLength: number, encryptionMode: EciesEncryptionType, recipientCount?: number): number;
72
- computeDecryptedLengthFromEncryptedDataLength(encryptedDataLength: number, padding?: number): number;
73
- encrypt(encryptionType: EciesEncryptionType, recipient: IMember, message: Buffer, preamble?: Buffer): Buffer;
74
- }
75
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/services/ecies/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,uBAAuB,EAGvB,SAAS,EACT,YAAY,EACZ,eAA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