@digitaldefiance/node-ecies-lib 4.4.9 → 4.4.10

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 (385) hide show
  1. package/package.json +6 -5
  2. package/src/builders/ecies-builder.d.ts +11 -0
  3. package/src/builders/ecies-builder.d.ts.map +1 -0
  4. package/src/builders/ecies-builder.js +26 -0
  5. package/src/builders/ecies-builder.js.map +1 -0
  6. package/src/builders/{index.ts → index.d.ts} +1 -0
  7. package/src/builders/index.d.ts.map +1 -0
  8. package/src/builders/index.js +6 -0
  9. package/src/builders/index.js.map +1 -0
  10. package/src/builders/member-builder.d.ts +47 -0
  11. package/src/builders/member-builder.d.ts.map +1 -0
  12. package/src/builders/member-builder.js +99 -0
  13. package/src/builders/member-builder.js.map +1 -0
  14. package/src/constants.d.ts +38 -0
  15. package/src/constants.d.ts.map +1 -0
  16. package/src/constants.js +183 -0
  17. package/src/constants.js.map +1 -0
  18. package/src/core/errors/crypto-error.d.ts +6 -0
  19. package/src/core/errors/crypto-error.d.ts.map +1 -0
  20. package/src/core/errors/crypto-error.js +15 -0
  21. package/src/core/errors/crypto-error.js.map +1 -0
  22. package/src/core/{index.ts → index.d.ts} +1 -0
  23. package/src/core/index.d.ts.map +1 -0
  24. package/src/core/index.js +6 -0
  25. package/src/core/index.js.map +1 -0
  26. package/src/core/types/result.d.ts +8 -0
  27. package/src/core/types/result.d.ts.map +1 -0
  28. package/src/core/types/result.js +3 -0
  29. package/src/core/types/result.js.map +1 -0
  30. package/src/enumerations/index.d.ts +2 -0
  31. package/src/enumerations/index.d.ts.map +1 -0
  32. package/src/enumerations/index.js +5 -0
  33. package/src/enumerations/index.js.map +1 -0
  34. package/src/enumerations/pbkdf2-profile.d.ts +9 -0
  35. package/src/enumerations/pbkdf2-profile.d.ts.map +1 -0
  36. package/src/enumerations/pbkdf2-profile.js +13 -0
  37. package/src/enumerations/pbkdf2-profile.js.map +1 -0
  38. package/src/i18n/ecies-i18n-factory.d.ts +28 -0
  39. package/src/i18n/ecies-i18n-factory.d.ts.map +1 -0
  40. package/src/i18n/ecies-i18n-factory.js +89 -0
  41. package/src/i18n/ecies-i18n-factory.js.map +1 -0
  42. package/src/i18n/{index.ts → index.d.ts} +1 -3
  43. package/src/i18n/index.d.ts.map +1 -0
  44. package/src/i18n/index.js +8 -0
  45. package/src/i18n/index.js.map +1 -0
  46. package/src/i18n/node-ecies-i18n-setup.d.ts +5 -0
  47. package/src/i18n/node-ecies-i18n-setup.d.ts.map +1 -0
  48. package/src/i18n/node-ecies-i18n-setup.js +46 -0
  49. package/src/i18n/node-ecies-i18n-setup.js.map +1 -0
  50. package/src/i18n/node-keys.d.ts +57 -0
  51. package/src/i18n/node-keys.d.ts.map +1 -0
  52. package/src/i18n/node-keys.js +67 -0
  53. package/src/i18n/node-keys.js.map +1 -0
  54. package/src/i18n/translations/de.d.ts +3 -0
  55. package/src/i18n/translations/de.d.ts.map +1 -0
  56. package/src/i18n/translations/de.js +57 -0
  57. package/src/i18n/translations/de.js.map +1 -0
  58. package/src/i18n/translations/en-GB.d.ts +3 -0
  59. package/src/i18n/translations/en-GB.d.ts.map +1 -0
  60. package/src/i18n/translations/en-GB.js +61 -0
  61. package/src/i18n/translations/en-GB.js.map +1 -0
  62. package/src/i18n/translations/en-US.d.ts +6 -0
  63. package/src/i18n/translations/en-US.d.ts.map +1 -0
  64. package/src/i18n/translations/en-US.js +65 -0
  65. package/src/i18n/translations/en-US.js.map +1 -0
  66. package/src/i18n/translations/es.d.ts +3 -0
  67. package/src/i18n/translations/es.d.ts.map +1 -0
  68. package/src/i18n/translations/es.js +57 -0
  69. package/src/i18n/translations/es.js.map +1 -0
  70. package/src/i18n/translations/fr.d.ts +3 -0
  71. package/src/i18n/translations/fr.d.ts.map +1 -0
  72. package/src/i18n/translations/fr.js +57 -0
  73. package/src/i18n/translations/fr.js.map +1 -0
  74. package/src/i18n/translations/{index.ts → index.d.ts} +1 -0
  75. package/src/i18n/translations/index.d.ts.map +1 -0
  76. package/src/i18n/translations/index.js +20 -0
  77. package/src/i18n/translations/index.js.map +1 -0
  78. package/src/i18n/translations/ja.d.ts +3 -0
  79. package/src/i18n/translations/ja.d.ts.map +1 -0
  80. package/src/i18n/translations/ja.js +57 -0
  81. package/src/i18n/translations/ja.js.map +1 -0
  82. package/src/i18n/translations/uk.d.ts +3 -0
  83. package/src/i18n/translations/uk.d.ts.map +1 -0
  84. package/src/i18n/translations/uk.js +57 -0
  85. package/src/i18n/translations/uk.js.map +1 -0
  86. package/src/i18n/translations/zh-cn.d.ts +3 -0
  87. package/src/i18n/translations/zh-cn.d.ts.map +1 -0
  88. package/src/i18n/translations/zh-cn.js +57 -0
  89. package/src/i18n/translations/zh-cn.js.map +1 -0
  90. package/src/{index.ts → index.d.ts} +1 -5
  91. package/src/index.d.ts.map +1 -0
  92. package/src/index.js +31 -0
  93. package/src/index.js.map +1 -0
  94. package/src/interfaces/authenticated-cipher.d.ts +12 -0
  95. package/src/interfaces/authenticated-cipher.d.ts.map +1 -0
  96. package/src/interfaces/authenticated-cipher.js +3 -0
  97. package/src/interfaces/authenticated-cipher.js.map +1 -0
  98. package/src/interfaces/authenticated-decipher.d.ts +11 -0
  99. package/src/interfaces/authenticated-decipher.d.ts.map +1 -0
  100. package/src/interfaces/authenticated-decipher.js +3 -0
  101. package/src/interfaces/authenticated-decipher.js.map +1 -0
  102. package/src/interfaces/backend-member-operational.d.ts +48 -0
  103. package/src/interfaces/backend-member-operational.d.ts.map +1 -0
  104. package/src/interfaces/backend-member-operational.js +3 -0
  105. package/src/interfaces/backend-member-operational.js.map +1 -0
  106. package/src/interfaces/checksum-config.d.ts +5 -0
  107. package/src/interfaces/checksum-config.d.ts.map +1 -0
  108. package/src/interfaces/checksum-config.js +3 -0
  109. package/src/interfaces/checksum-config.js.map +1 -0
  110. package/src/interfaces/checksum-consts.d.ts +11 -0
  111. package/src/interfaces/checksum-consts.d.ts.map +1 -0
  112. package/src/interfaces/checksum-consts.js +3 -0
  113. package/src/interfaces/checksum-consts.js.map +1 -0
  114. package/src/interfaces/constants.d.ts +52 -0
  115. package/src/interfaces/constants.d.ts.map +1 -0
  116. package/src/interfaces/constants.js +3 -0
  117. package/src/interfaces/constants.js.map +1 -0
  118. package/src/interfaces/ecies-consts.d.ts +88 -0
  119. package/src/interfaces/ecies-consts.d.ts.map +1 -0
  120. package/src/interfaces/ecies-consts.js +3 -0
  121. package/src/interfaces/ecies-consts.js.map +1 -0
  122. package/src/interfaces/encrypted-chunk.d.ts +12 -0
  123. package/src/interfaces/encrypted-chunk.d.ts.map +1 -0
  124. package/src/interfaces/encrypted-chunk.js +3 -0
  125. package/src/interfaces/encrypted-chunk.js.map +1 -0
  126. package/src/interfaces/encryption-consts.d.ts +11 -0
  127. package/src/interfaces/encryption-consts.d.ts.map +1 -0
  128. package/src/interfaces/encryption-consts.js +3 -0
  129. package/src/interfaces/encryption-consts.js.map +1 -0
  130. package/src/interfaces/{index.ts → index.d.ts} +1 -0
  131. package/src/interfaces/index.d.ts.map +1 -0
  132. package/src/interfaces/index.js +30 -0
  133. package/src/interfaces/index.js.map +1 -0
  134. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +6 -0
  135. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +1 -0
  136. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js +3 -0
  137. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +1 -0
  138. package/src/interfaces/keyring-consts.d.ts +6 -0
  139. package/src/interfaces/keyring-consts.d.ts.map +1 -0
  140. package/src/interfaces/keyring-consts.js +3 -0
  141. package/src/interfaces/keyring-consts.js.map +1 -0
  142. package/src/interfaces/{member-with-mnemonic.ts → member-with-mnemonic.d.ts} +3 -3
  143. package/src/interfaces/member-with-mnemonic.d.ts.map +1 -0
  144. package/src/interfaces/member-with-mnemonic.js +3 -0
  145. package/src/interfaces/member-with-mnemonic.js.map +1 -0
  146. package/src/interfaces/member.d.ts +47 -0
  147. package/src/interfaces/member.d.ts.map +1 -0
  148. package/src/interfaces/member.js +3 -0
  149. package/src/interfaces/member.js.map +1 -0
  150. package/src/interfaces/{multi-encrypted-message.ts → multi-encrypted-message.d.ts} +5 -5
  151. package/src/interfaces/multi-encrypted-message.d.ts.map +1 -0
  152. package/src/interfaces/multi-encrypted-message.js +3 -0
  153. package/src/interfaces/multi-encrypted-message.js.map +1 -0
  154. package/src/interfaces/multi-encrypted-parsed-header.d.ts +27 -0
  155. package/src/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -0
  156. package/src/interfaces/multi-encrypted-parsed-header.js +3 -0
  157. package/src/interfaces/multi-encrypted-parsed-header.js.map +1 -0
  158. package/src/interfaces/multi-recipient-chunk.d.ts +26 -0
  159. package/src/interfaces/multi-recipient-chunk.d.ts.map +1 -0
  160. package/src/interfaces/multi-recipient-chunk.js +13 -0
  161. package/src/interfaces/multi-recipient-chunk.js.map +1 -0
  162. package/src/interfaces/{pbkdf-profiles.ts → pbkdf-profiles.d.ts} +2 -2
  163. package/src/interfaces/pbkdf-profiles.d.ts.map +1 -0
  164. package/src/interfaces/pbkdf-profiles.js +3 -0
  165. package/src/interfaces/pbkdf-profiles.js.map +1 -0
  166. package/src/interfaces/pbkdf2-result.d.ts +6 -0
  167. package/src/interfaces/pbkdf2-result.d.ts.map +1 -0
  168. package/src/interfaces/pbkdf2-result.js +3 -0
  169. package/src/interfaces/pbkdf2-result.js.map +1 -0
  170. package/src/interfaces/signing-key-private-key-info.d.ts +11 -0
  171. package/src/interfaces/signing-key-private-key-info.d.ts.map +1 -0
  172. package/src/interfaces/signing-key-private-key-info.js +3 -0
  173. package/src/interfaces/signing-key-private-key-info.js.map +1 -0
  174. package/src/interfaces/{simple-keypair-buffer.ts → simple-keypair-buffer.d.ts} +3 -3
  175. package/src/interfaces/simple-keypair-buffer.d.ts.map +1 -0
  176. package/src/interfaces/simple-keypair-buffer.js +3 -0
  177. package/src/interfaces/simple-keypair-buffer.js.map +1 -0
  178. package/src/interfaces/{simple-keypair.ts → simple-keypair.d.ts} +3 -3
  179. package/src/interfaces/simple-keypair.d.ts.map +1 -0
  180. package/src/interfaces/simple-keypair.js +3 -0
  181. package/src/interfaces/simple-keypair.js.map +1 -0
  182. package/src/interfaces/simple-public-key-only-buffer.d.ts +4 -0
  183. package/src/interfaces/simple-public-key-only-buffer.d.ts.map +1 -0
  184. package/src/interfaces/simple-public-key-only-buffer.js +3 -0
  185. package/src/interfaces/simple-public-key-only-buffer.js.map +1 -0
  186. package/src/interfaces/simple-public-key-only.d.ts +4 -0
  187. package/src/interfaces/simple-public-key-only.d.ts.map +1 -0
  188. package/src/interfaces/simple-public-key-only.js +3 -0
  189. package/src/interfaces/simple-public-key-only.js.map +1 -0
  190. package/src/interfaces/single-encrypted-parsed-header.d.ts +35 -0
  191. package/src/interfaces/single-encrypted-parsed-header.d.ts.map +1 -0
  192. package/src/interfaces/single-encrypted-parsed-header.js +3 -0
  193. package/src/interfaces/single-encrypted-parsed-header.js.map +1 -0
  194. package/src/interfaces/stream-config.d.ts +6 -0
  195. package/src/interfaces/stream-config.d.ts.map +1 -0
  196. package/src/interfaces/stream-config.js +8 -0
  197. package/src/interfaces/stream-config.js.map +1 -0
  198. package/src/interfaces/stream-progress.d.ts +8 -0
  199. package/src/interfaces/stream-progress.d.ts.map +1 -0
  200. package/src/interfaces/stream-progress.js +3 -0
  201. package/src/interfaces/stream-progress.js.map +1 -0
  202. package/src/interfaces/{wallet-seed.ts → wallet-seed.d.ts} +3 -3
  203. package/src/interfaces/wallet-seed.d.ts.map +1 -0
  204. package/src/interfaces/wallet-seed.js +3 -0
  205. package/src/interfaces/wallet-seed.js.map +1 -0
  206. package/src/interfaces/wrapped-key-consts.d.ts +7 -0
  207. package/src/interfaces/wrapped-key-consts.d.ts.map +1 -0
  208. package/src/interfaces/wrapped-key-consts.js +3 -0
  209. package/src/interfaces/wrapped-key-consts.js.map +1 -0
  210. package/src/lib/crypto-container.d.ts +13 -0
  211. package/src/lib/crypto-container.d.ts.map +1 -0
  212. package/src/lib/crypto-container.js +29 -0
  213. package/src/lib/crypto-container.js.map +1 -0
  214. package/src/lib/{index.ts → index.d.ts} +1 -0
  215. package/src/lib/index.d.ts.map +1 -0
  216. package/src/lib/index.js +7 -0
  217. package/src/lib/index.js.map +1 -0
  218. package/src/lib/invariant-validator.d.ts +62 -0
  219. package/src/lib/invariant-validator.d.ts.map +1 -0
  220. package/src/lib/invariant-validator.js +108 -0
  221. package/src/lib/invariant-validator.js.map +1 -0
  222. package/src/lib/invariants/{index.ts → index.d.ts} +2 -2
  223. package/src/lib/invariants/index.d.ts.map +1 -0
  224. package/src/lib/invariants/index.js +12 -0
  225. package/src/lib/invariants/index.js.map +1 -0
  226. package/src/lib/invariants/recipient-id-consistency.d.ts +22 -0
  227. package/src/lib/invariants/recipient-id-consistency.d.ts.map +1 -0
  228. package/src/lib/invariants/recipient-id-consistency.js +62 -0
  229. package/src/lib/invariants/recipient-id-consistency.js.map +1 -0
  230. package/src/member.d.ts +81 -0
  231. package/src/member.d.ts.map +1 -0
  232. package/src/member.js +285 -0
  233. package/src/member.js.map +1 -0
  234. package/src/services/aes-gcm.d.ts +66 -0
  235. package/src/services/aes-gcm.d.ts.map +1 -0
  236. package/src/services/aes-gcm.js +158 -0
  237. package/src/services/aes-gcm.js.map +1 -0
  238. package/src/services/chunk-processor.d.ts +15 -0
  239. package/src/services/chunk-processor.d.ts.map +1 -0
  240. package/src/services/chunk-processor.js +36 -0
  241. package/src/services/chunk-processor.js.map +1 -0
  242. package/src/services/ecies/crypto-core.d.ts +104 -0
  243. package/src/services/ecies/crypto-core.d.ts.map +1 -0
  244. package/src/services/ecies/crypto-core.js +237 -0
  245. package/src/services/ecies/crypto-core.js.map +1 -0
  246. package/src/services/ecies/file.d.ts +30 -0
  247. package/src/services/ecies/file.d.ts.map +1 -0
  248. package/src/services/ecies/file.js +112 -0
  249. package/src/services/ecies/file.js.map +1 -0
  250. package/src/services/ecies/{index.ts → index.d.ts} +1 -0
  251. package/src/services/ecies/index.d.ts.map +1 -0
  252. package/src/services/ecies/index.js +11 -0
  253. package/src/services/ecies/index.js.map +1 -0
  254. package/src/services/ecies/multi-recipient.d.ts +84 -0
  255. package/src/services/ecies/multi-recipient.d.ts.map +1 -0
  256. package/src/services/ecies/multi-recipient.js +496 -0
  257. package/src/services/ecies/multi-recipient.js.map +1 -0
  258. package/src/services/ecies/service.d.ts +69 -0
  259. package/src/services/ecies/service.d.ts.map +1 -0
  260. package/src/services/ecies/service.js +144 -0
  261. package/src/services/ecies/service.js.map +1 -0
  262. package/src/services/ecies/signature.d.ts +38 -0
  263. package/src/services/ecies/signature.d.ts.map +1 -0
  264. package/src/services/ecies/signature.js +69 -0
  265. package/src/services/ecies/signature.js.map +1 -0
  266. package/src/services/ecies/single-recipient.d.ts +83 -0
  267. package/src/services/ecies/single-recipient.d.ts.map +1 -0
  268. package/src/services/ecies/single-recipient.js +447 -0
  269. package/src/services/ecies/single-recipient.js.map +1 -0
  270. package/src/services/ecies/utilities.d.ts +33 -0
  271. package/src/services/ecies/utilities.d.ts.map +1 -0
  272. package/src/services/ecies/utilities.js +91 -0
  273. package/src/services/ecies/utilities.js.map +1 -0
  274. package/src/services/encryption-stream.d.ts +33 -0
  275. package/src/services/encryption-stream.d.ts.map +1 -0
  276. package/src/services/encryption-stream.js +207 -0
  277. package/src/services/encryption-stream.js.map +1 -0
  278. package/src/services/{index.ts → index.d.ts} +1 -0
  279. package/src/services/index.d.ts.map +1 -0
  280. package/src/services/index.js +11 -0
  281. package/src/services/index.js.map +1 -0
  282. package/src/services/multi-recipient-processor.d.ts +72 -0
  283. package/src/services/multi-recipient-processor.d.ts.map +1 -0
  284. package/src/services/multi-recipient-processor.js +322 -0
  285. package/src/services/multi-recipient-processor.js.map +1 -0
  286. package/src/services/pbkdf2.d.ts +105 -0
  287. package/src/services/pbkdf2.d.ts.map +1 -0
  288. package/src/services/pbkdf2.js +189 -0
  289. package/src/services/pbkdf2.js.map +1 -0
  290. package/src/services/progress-tracker.d.ts +9 -0
  291. package/src/services/progress-tracker.d.ts.map +1 -0
  292. package/src/services/progress-tracker.js +41 -0
  293. package/src/services/progress-tracker.js.map +1 -0
  294. package/src/test-mocks/index.d.ts +2 -0
  295. package/src/test-mocks/index.d.ts.map +1 -0
  296. package/src/test-mocks/index.js +5 -0
  297. package/src/test-mocks/index.js.map +1 -0
  298. package/src/test-mocks/mock-backend-member.d.ts +71 -0
  299. package/src/test-mocks/mock-backend-member.d.ts.map +1 -0
  300. package/src/test-mocks/mock-backend-member.js +133 -0
  301. package/src/test-mocks/mock-backend-member.js.map +1 -0
  302. package/src/testing.d.ts +2 -0
  303. package/src/testing.d.ts.map +1 -0
  304. package/src/testing.js +6 -0
  305. package/src/testing.js.map +1 -0
  306. package/src/types/id-guards.d.ts +39 -0
  307. package/src/types/id-guards.d.ts.map +1 -0
  308. package/src/types/id-guards.js +91 -0
  309. package/src/types/id-guards.js.map +1 -0
  310. package/src/types/index.d.ts +2 -0
  311. package/src/types/index.d.ts.map +1 -0
  312. package/src/types/index.js +5 -0
  313. package/src/types/index.js.map +1 -0
  314. package/src/{types.ts → types.d.ts} +9 -28
  315. package/src/types.d.ts.map +1 -0
  316. package/src/types.js +6 -0
  317. package/src/types.js.map +1 -0
  318. package/src/utils.d.ts +11 -0
  319. package/src/utils.d.ts.map +1 -0
  320. package/src/utils.js +82 -0
  321. package/src/utils.js.map +1 -0
  322. package/LICENSE +0 -21
  323. package/src/builders/ecies-builder.ts +0 -27
  324. package/src/builders/member-builder.ts +0 -158
  325. package/src/constants.ts +0 -251
  326. package/src/core/errors/crypto-error.ts +0 -10
  327. package/src/core/types/result.ts +0 -3
  328. package/src/enumerations/index.ts +0 -2
  329. package/src/enumerations/pbkdf2-profile.ts +0 -8
  330. package/src/i18n/ecies-i18n-factory.ts +0 -111
  331. package/src/i18n/node-ecies-i18n-setup.ts +0 -56
  332. package/src/i18n/node-keys.ts +0 -69
  333. package/src/i18n/translations/de.ts +0 -54
  334. package/src/i18n/translations/en-GB.ts +0 -83
  335. package/src/i18n/translations/en-US.ts +0 -88
  336. package/src/i18n/translations/es.ts +0 -54
  337. package/src/i18n/translations/fr.ts +0 -54
  338. package/src/i18n/translations/ja.ts +0 -54
  339. package/src/i18n/translations/uk.ts +0 -54
  340. package/src/i18n/translations/zh-cn.ts +0 -54
  341. package/src/interfaces/authenticated-cipher.ts +0 -10
  342. package/src/interfaces/authenticated-decipher.ts +0 -9
  343. package/src/interfaces/backend-member-operational.ts +0 -75
  344. package/src/interfaces/checksum-config.ts +0 -4
  345. package/src/interfaces/checksum-consts.ts +0 -13
  346. package/src/interfaces/constants.ts +0 -54
  347. package/src/interfaces/ecies-consts.ts +0 -99
  348. package/src/interfaces/encrypted-chunk.ts +0 -12
  349. package/src/interfaces/encryption-consts.ts +0 -10
  350. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.ts +0 -7
  351. package/src/interfaces/keyring-consts.ts +0 -5
  352. package/src/interfaces/member.ts +0 -76
  353. package/src/interfaces/multi-encrypted-parsed-header.ts +0 -28
  354. package/src/interfaces/multi-recipient-chunk.ts +0 -35
  355. package/src/interfaces/pbkdf2-result.ts +0 -5
  356. package/src/interfaces/signing-key-private-key-info.ts +0 -12
  357. package/src/interfaces/simple-public-key-only-buffer.ts +0 -3
  358. package/src/interfaces/simple-public-key-only.ts +0 -3
  359. package/src/interfaces/single-encrypted-parsed-header.ts +0 -35
  360. package/src/interfaces/stream-config.ts +0 -9
  361. package/src/interfaces/stream-progress.ts +0 -7
  362. package/src/interfaces/wrapped-key-consts.ts +0 -6
  363. package/src/lib/crypto-container.ts +0 -32
  364. package/src/lib/invariant-validator.ts +0 -124
  365. package/src/lib/invariants/recipient-id-consistency.ts +0 -77
  366. package/src/member.ts +0 -511
  367. package/src/services/aes-gcm.ts +0 -260
  368. package/src/services/chunk-processor.ts +0 -47
  369. package/src/services/ecies/crypto-core.ts +0 -319
  370. package/src/services/ecies/file.ts +0 -171
  371. package/src/services/ecies/multi-recipient.ts +0 -782
  372. package/src/services/ecies/service.ts +0 -316
  373. package/src/services/ecies/signature.ts +0 -91
  374. package/src/services/ecies/single-recipient.ts +0 -743
  375. package/src/services/ecies/utilities.ts +0 -128
  376. package/src/services/encryption-stream.ts +0 -432
  377. package/src/services/multi-recipient-processor.ts +0 -505
  378. package/src/services/pbkdf2.ts +0 -304
  379. package/src/services/progress-tracker.ts +0 -43
  380. package/src/test-mocks/index.ts +0 -1
  381. package/src/test-mocks/mock-backend-member.ts +0 -195
  382. package/src/testing.ts +0 -2
  383. package/src/types/id-guards.ts +0 -91
  384. package/src/types/index.ts +0 -1
  385. package/src/utils.ts +0 -124
@@ -0,0 +1 @@
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"}
@@ -1,6 +1,6 @@
1
1
  import type { IPbkdf2Config } from '@digitaldefiance/ecies-lib';
2
2
  import type { Pbkdf2ProfileEnum } from '../enumerations/pbkdf2-profile';
3
-
4
3
  export type PbkdfProfiles = {
5
- [key in Pbkdf2ProfileEnum]: IPbkdf2Config;
4
+ [key in Pbkdf2ProfileEnum]: IPbkdf2Config;
6
5
  };
6
+ //# sourceMappingURL=pbkdf-profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pbkdf-profiles.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,iBAAiB,GAAG,aAAa;CAC1C,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pbkdf-profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pbkdf-profiles.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface IPbkdf2Result {
2
+ salt: Buffer;
3
+ hash: Buffer;
4
+ iterations: number;
5
+ }
6
+ //# sourceMappingURL=pbkdf2-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pbkdf2-result.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf2-result.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pbkdf2-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pbkdf2-result.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf2-result.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { ec } from 'elliptic';
2
+ import type { IKeyPairBufferWithUnEncryptedPrivateKey } from './keypair-buffer-with-un-encrypted-private-key';
3
+ export interface ISigningKeyPrivateKeyInfo extends IKeyPairBufferWithUnEncryptedPrivateKey {
4
+ keyPair: ec.KeyPair;
5
+ publicKey: Buffer;
6
+ privateKey: Buffer;
7
+ seedHex: string;
8
+ entropy: string;
9
+ mnemonic: string;
10
+ }
11
+ //# sourceMappingURL=signing-key-private-key-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing-key-private-key-info.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,gDAAgD,CAAC;AAE9G,MAAM,WAAW,yBACf,SAAQ,uCAAuC;IAC/C,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=signing-key-private-key-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing-key-private-key-info.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import type { ISimplePublicKeyOnlyBuffer } from './simple-public-key-only-buffer';
2
-
3
2
  export interface ISimpleKeyPairBuffer extends ISimplePublicKeyOnlyBuffer {
4
- publicKey: Buffer;
5
- privateKey: Buffer;
3
+ publicKey: Buffer;
4
+ privateKey: Buffer;
6
5
  }
6
+ //# sourceMappingURL=simple-keypair-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-keypair-buffer.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,oBAAqB,SAAQ,0BAA0B;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=simple-keypair-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-keypair-buffer.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import type { ISimplePublicKeyOnly } from './simple-public-key-only';
2
-
3
2
  export interface ISimpleKeyPair extends ISimplePublicKeyOnly {
4
- publicKey: string;
5
- privateKey: Buffer;
3
+ publicKey: string;
4
+ privateKey: Buffer;
6
5
  }
6
+ //# sourceMappingURL=simple-keypair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-keypair.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=simple-keypair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-keypair.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface ISimplePublicKeyOnlyBuffer {
2
+ publicKey: Buffer;
3
+ }
4
+ //# sourceMappingURL=simple-public-key-only-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-public-key-only-buffer.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only-buffer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=simple-public-key-only-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-public-key-only-buffer.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only-buffer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface ISimplePublicKeyOnly {
2
+ publicKey: string;
3
+ }
4
+ //# sourceMappingURL=simple-public-key-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-public-key-only.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=simple-public-key-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-public-key-only.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import { EciesEncryptionTypeEnum } from '@digitaldefiance/ecies-lib';
2
+ /**
3
+ * Interface for encrypted messages
4
+ */
5
+ export interface ISingleEncryptedParsedHeader {
6
+ /**
7
+ * The optional preamble, if specified/relevant
8
+ */
9
+ readonly preamble?: Buffer;
10
+ /**
11
+ * The encryption type used to encrypt the data
12
+ */
13
+ readonly encryptionType: EciesEncryptionTypeEnum;
14
+ /**
15
+ * The ephemeral public key used to encrypt the data
16
+ */
17
+ readonly ephemeralPublicKey: Buffer;
18
+ /**
19
+ * The initialization vector used to encrypt the data
20
+ */
21
+ readonly iv: Buffer;
22
+ /**
23
+ * The authentication tag used to encrypt the data
24
+ */
25
+ readonly authTag: Buffer;
26
+ /**
27
+ * The length of the encrypted data
28
+ */
29
+ readonly dataLength: number;
30
+ /**
31
+ * The size of the encrypted data header
32
+ */
33
+ readonly headerSize: number;
34
+ }
35
+ //# sourceMappingURL=single-encrypted-parsed-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-encrypted-parsed-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/single-encrypted-parsed-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;IACjD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=single-encrypted-parsed-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-encrypted-parsed-header.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/single-encrypted-parsed-header.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface IStreamConfig {
2
+ chunkSize: number;
3
+ includeChecksums: boolean;
4
+ }
5
+ export declare const DEFAULT_STREAM_CONFIG: IStreamConfig;
6
+ //# sourceMappingURL=stream-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-config.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,qBAAqB,EAAE,aAGnC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_STREAM_CONFIG = void 0;
4
+ exports.DEFAULT_STREAM_CONFIG = {
5
+ chunkSize: 65536, // 64KB
6
+ includeChecksums: false,
7
+ };
8
+ //# sourceMappingURL=stream-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-config.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-config.ts"],"names":[],"mappings":";;;AAKa,QAAA,qBAAqB,GAAkB;IAClD,SAAS,EAAE,KAAK,EAAE,OAAO;IACzB,gBAAgB,EAAE,KAAK;CACxB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface IStreamProgress {
2
+ processedBytes: number;
3
+ totalBytes: number;
4
+ percentComplete: number;
5
+ throughputBytesPerSec: number;
6
+ estimatedTimeRemainingMs: number;
7
+ }
8
+ //# sourceMappingURL=stream-progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-progress.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-progress.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=stream-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-progress.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-progress.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { SecureBuffer } from '@digitaldefiance/ecies-lib';
2
2
  import { Wallet } from '@ethereumjs/wallet';
3
-
4
3
  export interface IWalletSeed {
5
- wallet: Wallet;
6
- seed: SecureBuffer;
4
+ wallet: Wallet;
5
+ seed: SecureBuffer;
7
6
  }
7
+ //# sourceMappingURL=wallet-seed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-seed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wallet-seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=wallet-seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-seed.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wallet-seed.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface IWrappedKeyConsts {
2
+ SALT_SIZE: number;
3
+ IV_SIZE: number;
4
+ MASTER_KEY_SIZE: number;
5
+ MIN_ITERATIONS: number;
6
+ }
7
+ //# sourceMappingURL=wrapped-key-consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapped-key-consts.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wrapped-key-consts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=wrapped-key-consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapped-key-consts.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wrapped-key-consts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { IConstants } from '../interfaces/constants';
2
+ export declare enum CryptoServiceKey {
3
+ ECIES = "ecies",
4
+ PBKDF2 = "pbkdf2",
5
+ AES_GCM = "aes-gcm"
6
+ }
7
+ export declare class CryptoContainer {
8
+ private services;
9
+ private constructor();
10
+ static create(config?: IConstants): CryptoContainer;
11
+ get<T>(key: CryptoServiceKey): T;
12
+ }
13
+ //# sourceMappingURL=crypto-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-container.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/crypto-container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAwC;IAExD,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,MAAM,GAAE,UAAsB,GAAG,eAAe;IAI9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,GAAG,CAAC;CAGjC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CryptoContainer = exports.CryptoServiceKey = void 0;
4
+ const ecies_1 = require("../services/ecies");
5
+ const pbkdf2_1 = require("../services/pbkdf2");
6
+ const aes_gcm_1 = require("../services/aes-gcm");
7
+ const constants_1 = require("../constants");
8
+ var CryptoServiceKey;
9
+ (function (CryptoServiceKey) {
10
+ CryptoServiceKey["ECIES"] = "ecies";
11
+ CryptoServiceKey["PBKDF2"] = "pbkdf2";
12
+ CryptoServiceKey["AES_GCM"] = "aes-gcm";
13
+ })(CryptoServiceKey || (exports.CryptoServiceKey = CryptoServiceKey = {}));
14
+ class CryptoContainer {
15
+ services = new Map();
16
+ constructor(config) {
17
+ this.services.set(CryptoServiceKey.ECIES, new ecies_1.ECIESService(undefined, config.ECIES));
18
+ this.services.set(CryptoServiceKey.PBKDF2, new pbkdf2_1.Pbkdf2Service(config.PBKDF2_PROFILES, config.ECIES, config.PBKDF2));
19
+ this.services.set(CryptoServiceKey.AES_GCM, new aes_gcm_1.AESGCMService(config));
20
+ }
21
+ static create(config = constants_1.Constants) {
22
+ return new CryptoContainer(config);
23
+ }
24
+ get(key) {
25
+ return this.services.get(key);
26
+ }
27
+ }
28
+ exports.CryptoContainer = CryptoContainer;
29
+ //# sourceMappingURL=crypto-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-container.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/crypto-container.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AACjD,+CAAmD;AACnD,iDAAoD;AAEpD,4CAAyC;AAEzC,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B;AAED,MAAa,eAAe;IAClB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAExD,YAAoB,MAAkB;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,oBAAY,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,gBAAgB,CAAC,MAAM,EACvB,IAAI,sBAAa,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CACvE,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,uBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,SAAqB,qBAAS;QAC1C,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,GAAG,CAAI,GAAqB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;IACrC,CAAC;CACF;AAnBD,0CAmBC"}
@@ -1,3 +1,4 @@
1
1
  export * from './crypto-container';
2
2
  export * from './invariant-validator';
3
3
  export * from './invariants';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./crypto-container"), exports);
5
+ tslib_1.__exportStar(require("./invariant-validator"), exports);
6
+ tslib_1.__exportStar(require("./invariants"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAY;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC1E,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,CAAC,GAAG,IAAI,CAAC,uBAAuB,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAAC,MAAkB;QACnC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,gFAAgF;QAChF,MAAM,cAAc,GAAG,8BAAsB,CAAC,gBAAgB,EAAE,CAAC;QACjE,KAAK,MAAM,SAAS,IAAI,cAAc,EAAE,CAAC;YACvC,IAAI,SAAS,CAAC,IAAI,KAAK,wBAAwB,EAAE,CAAC;gBAChD,SAAS;YACX,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QAED,yCAAyC;QACzC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YAChD,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"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Node.js-specific invariants for configuration validation.
3
- *
3
+ *
4
4
  * These invariants extend and complement the base ecies-lib invariants
5
5
  * with Node.js-specific validation rules.
6
6
  */
7
-
8
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