@digitaldefiance/node-ecies-lib 1.1.21 → 1.1.22

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 (211) hide show
  1. package/README.md +4 -0
  2. package/package.json +14 -35
  3. package/src/constants.ts +182 -0
  4. package/src/enumerations/index.ts +1 -0
  5. package/src/enumerations/pbkdf2-profile.ts +8 -0
  6. package/src/i18n/ecies-i18n-factory.ts +435 -0
  7. package/{dist/i18n/index.d.ts → src/i18n/index.ts} +0 -1
  8. package/{dist/index.d.ts → src/index.ts} +0 -1
  9. package/src/interfaces/authenticated-cipher.ts +9 -0
  10. package/src/interfaces/authenticated-decipher.ts +8 -0
  11. package/src/interfaces/checksum-config.ts +4 -0
  12. package/src/interfaces/checksum-consts.ts +13 -0
  13. package/src/interfaces/constants.ts +43 -0
  14. package/src/interfaces/ecies-consts.ts +99 -0
  15. package/src/interfaces/encryption-consts.ts +10 -0
  16. package/{dist/interfaces/index.d.ts → src/interfaces/index.ts} +0 -1
  17. package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.ts +7 -0
  18. package/src/interfaces/keyring-consts.ts +5 -0
  19. package/src/interfaces/member-operational.ts +52 -0
  20. package/{dist/interfaces/member-with-mnemonic.d.ts → src/interfaces/member-with-mnemonic.ts} +3 -3
  21. package/{dist/interfaces/multi-encrypted-message.d.ts → src/interfaces/multi-encrypted-message.ts} +5 -5
  22. package/src/interfaces/multi-encrypted-parsed-header.ts +24 -0
  23. package/{dist/interfaces/pbkdf-profiles.d.ts → src/interfaces/pbkdf-profiles.ts} +2 -2
  24. package/src/interfaces/pbkdf2-result.ts +5 -0
  25. package/src/interfaces/signing-key-private-key-info.ts +12 -0
  26. package/{dist/interfaces/simple-keypair-buffer.d.ts → src/interfaces/simple-keypair-buffer.ts} +3 -3
  27. package/{dist/interfaces/simple-keypair.d.ts → src/interfaces/simple-keypair.ts} +3 -3
  28. package/src/interfaces/simple-public-key-only-buffer.ts +3 -0
  29. package/src/interfaces/simple-public-key-only.ts +3 -0
  30. package/src/interfaces/single-encrypted-parsed-header.ts +35 -0
  31. package/{dist/interfaces/wallet-seed.d.ts → src/interfaces/wallet-seed.ts} +3 -3
  32. package/src/interfaces/wrapped-key-consts.ts +6 -0
  33. package/src/member.ts +463 -0
  34. package/src/services/aes-gcm.ts +160 -0
  35. package/src/services/ecies/crypto-core.ts +213 -0
  36. package/src/services/ecies/file.ts +174 -0
  37. package/{dist/services/ecies/index.d.ts → src/services/ecies/index.ts} +0 -1
  38. package/src/services/ecies/multi-recipient.ts +583 -0
  39. package/src/services/ecies/service.ts +351 -0
  40. package/src/services/ecies/signature.ts +91 -0
  41. package/src/services/ecies/single-recipient.ts +676 -0
  42. package/src/services/ecies/utilities.ts +111 -0
  43. package/src/services/index.ts +3 -0
  44. package/src/services/pbkdf2.ts +307 -0
  45. package/{dist/types.d.ts → src/types.ts} +26 -9
  46. package/src/utils.ts +104 -0
  47. package/dist/constants.d.ts +0 -32
  48. package/dist/constants.d.ts.map +0 -1
  49. package/dist/constants.js +0 -137
  50. package/dist/constants.js.map +0 -1
  51. package/dist/enumerations/index.d.ts +0 -2
  52. package/dist/enumerations/index.d.ts.map +0 -1
  53. package/dist/enumerations/index.js +0 -18
  54. package/dist/enumerations/index.js.map +0 -1
  55. package/dist/enumerations/pbkdf2-profile.d.ts +0 -9
  56. package/dist/enumerations/pbkdf2-profile.d.ts.map +0 -1
  57. package/dist/enumerations/pbkdf2-profile.js +0 -13
  58. package/dist/enumerations/pbkdf2-profile.js.map +0 -1
  59. package/dist/i18n/ecies-i18n-factory.d.ts +0 -54
  60. package/dist/i18n/ecies-i18n-factory.d.ts.map +0 -1
  61. package/dist/i18n/ecies-i18n-factory.js +0 -333
  62. package/dist/i18n/ecies-i18n-factory.js.map +0 -1
  63. package/dist/i18n/index.d.ts.map +0 -1
  64. package/dist/i18n/index.js +0 -18
  65. package/dist/i18n/index.js.map +0 -1
  66. package/dist/index.d.ts.map +0 -1
  67. package/dist/index.js +0 -24
  68. package/dist/index.js.map +0 -1
  69. package/dist/interfaces/authenticated-cipher.d.ts +0 -10
  70. package/dist/interfaces/authenticated-cipher.d.ts.map +0 -1
  71. package/dist/interfaces/authenticated-cipher.js +0 -3
  72. package/dist/interfaces/authenticated-cipher.js.map +0 -1
  73. package/dist/interfaces/authenticated-decipher.d.ts +0 -9
  74. package/dist/interfaces/authenticated-decipher.d.ts.map +0 -1
  75. package/dist/interfaces/authenticated-decipher.js +0 -3
  76. package/dist/interfaces/authenticated-decipher.js.map +0 -1
  77. package/dist/interfaces/checksum-config.d.ts +0 -5
  78. package/dist/interfaces/checksum-config.d.ts.map +0 -1
  79. package/dist/interfaces/checksum-config.js +0 -3
  80. package/dist/interfaces/checksum-config.js.map +0 -1
  81. package/dist/interfaces/checksum-consts.d.ts +0 -11
  82. package/dist/interfaces/checksum-consts.d.ts.map +0 -1
  83. package/dist/interfaces/checksum-consts.js +0 -3
  84. package/dist/interfaces/checksum-consts.js.map +0 -1
  85. package/dist/interfaces/constants.d.ts +0 -43
  86. package/dist/interfaces/constants.d.ts.map +0 -1
  87. package/dist/interfaces/constants.js +0 -3
  88. package/dist/interfaces/constants.js.map +0 -1
  89. package/dist/interfaces/ecies-consts.d.ts +0 -88
  90. package/dist/interfaces/ecies-consts.d.ts.map +0 -1
  91. package/dist/interfaces/ecies-consts.js +0 -3
  92. package/dist/interfaces/ecies-consts.js.map +0 -1
  93. package/dist/interfaces/encryption-consts.d.ts +0 -11
  94. package/dist/interfaces/encryption-consts.d.ts.map +0 -1
  95. package/dist/interfaces/encryption-consts.js +0 -3
  96. package/dist/interfaces/encryption-consts.js.map +0 -1
  97. package/dist/interfaces/index.d.ts.map +0 -1
  98. package/dist/interfaces/index.js +0 -34
  99. package/dist/interfaces/index.js.map +0 -1
  100. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +0 -6
  101. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +0 -1
  102. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +0 -3
  103. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +0 -1
  104. package/dist/interfaces/keyring-consts.d.ts +0 -6
  105. package/dist/interfaces/keyring-consts.d.ts.map +0 -1
  106. package/dist/interfaces/keyring-consts.js +0 -3
  107. package/dist/interfaces/keyring-consts.js.map +0 -1
  108. package/dist/interfaces/member-operational.d.ts +0 -36
  109. package/dist/interfaces/member-operational.d.ts.map +0 -1
  110. package/dist/interfaces/member-operational.js +0 -3
  111. package/dist/interfaces/member-operational.js.map +0 -1
  112. package/dist/interfaces/member-with-mnemonic.d.ts.map +0 -1
  113. package/dist/interfaces/member-with-mnemonic.js +0 -3
  114. package/dist/interfaces/member-with-mnemonic.js.map +0 -1
  115. package/dist/interfaces/multi-encrypted-message.d.ts.map +0 -1
  116. package/dist/interfaces/multi-encrypted-message.js +0 -3
  117. package/dist/interfaces/multi-encrypted-message.js.map +0 -1
  118. package/dist/interfaces/multi-encrypted-parsed-header.d.ts +0 -24
  119. package/dist/interfaces/multi-encrypted-parsed-header.d.ts.map +0 -1
  120. package/dist/interfaces/multi-encrypted-parsed-header.js +0 -3
  121. package/dist/interfaces/multi-encrypted-parsed-header.js.map +0 -1
  122. package/dist/interfaces/pbkdf-profiles.d.ts.map +0 -1
  123. package/dist/interfaces/pbkdf-profiles.js +0 -3
  124. package/dist/interfaces/pbkdf-profiles.js.map +0 -1
  125. package/dist/interfaces/pbkdf2-result.d.ts +0 -6
  126. package/dist/interfaces/pbkdf2-result.d.ts.map +0 -1
  127. package/dist/interfaces/pbkdf2-result.js +0 -3
  128. package/dist/interfaces/pbkdf2-result.js.map +0 -1
  129. package/dist/interfaces/signing-key-private-key-info.d.ts +0 -11
  130. package/dist/interfaces/signing-key-private-key-info.d.ts.map +0 -1
  131. package/dist/interfaces/signing-key-private-key-info.js +0 -3
  132. package/dist/interfaces/signing-key-private-key-info.js.map +0 -1
  133. package/dist/interfaces/simple-keypair-buffer.d.ts.map +0 -1
  134. package/dist/interfaces/simple-keypair-buffer.js +0 -3
  135. package/dist/interfaces/simple-keypair-buffer.js.map +0 -1
  136. package/dist/interfaces/simple-keypair.d.ts.map +0 -1
  137. package/dist/interfaces/simple-keypair.js +0 -3
  138. package/dist/interfaces/simple-keypair.js.map +0 -1
  139. package/dist/interfaces/simple-public-key-only-buffer.d.ts +0 -4
  140. package/dist/interfaces/simple-public-key-only-buffer.d.ts.map +0 -1
  141. package/dist/interfaces/simple-public-key-only-buffer.js +0 -3
  142. package/dist/interfaces/simple-public-key-only-buffer.js.map +0 -1
  143. package/dist/interfaces/simple-public-key-only.d.ts +0 -4
  144. package/dist/interfaces/simple-public-key-only.d.ts.map +0 -1
  145. package/dist/interfaces/simple-public-key-only.js +0 -3
  146. package/dist/interfaces/simple-public-key-only.js.map +0 -1
  147. package/dist/interfaces/single-encrypted-parsed-header.d.ts +0 -35
  148. package/dist/interfaces/single-encrypted-parsed-header.d.ts.map +0 -1
  149. package/dist/interfaces/single-encrypted-parsed-header.js +0 -3
  150. package/dist/interfaces/single-encrypted-parsed-header.js.map +0 -1
  151. package/dist/interfaces/wallet-seed.d.ts.map +0 -1
  152. package/dist/interfaces/wallet-seed.js +0 -3
  153. package/dist/interfaces/wallet-seed.js.map +0 -1
  154. package/dist/interfaces/wrapped-key-consts.d.ts +0 -7
  155. package/dist/interfaces/wrapped-key-consts.d.ts.map +0 -1
  156. package/dist/interfaces/wrapped-key-consts.js +0 -3
  157. package/dist/interfaces/wrapped-key-consts.js.map +0 -1
  158. package/dist/member.d.ts +0 -74
  159. package/dist/member.d.ts.map +0 -1
  160. package/dist/member.js +0 -273
  161. package/dist/member.js.map +0 -1
  162. package/dist/services/aes-gcm.d.ts +0 -66
  163. package/dist/services/aes-gcm.d.ts.map +0 -1
  164. package/dist/services/aes-gcm.js +0 -115
  165. package/dist/services/aes-gcm.js.map +0 -1
  166. package/dist/services/ecies/crypto-core.d.ts +0 -83
  167. package/dist/services/ecies/crypto-core.d.ts.map +0 -1
  168. package/dist/services/ecies/crypto-core.js +0 -166
  169. package/dist/services/ecies/crypto-core.js.map +0 -1
  170. package/dist/services/ecies/file.d.ts +0 -30
  171. package/dist/services/ecies/file.d.ts.map +0 -1
  172. package/dist/services/ecies/file.js +0 -144
  173. package/dist/services/ecies/file.js.map +0 -1
  174. package/dist/services/ecies/index.d.ts.map +0 -1
  175. package/dist/services/ecies/index.js +0 -24
  176. package/dist/services/ecies/index.js.map +0 -1
  177. package/dist/services/ecies/multi-recipient.d.ts +0 -82
  178. package/dist/services/ecies/multi-recipient.d.ts.map +0 -1
  179. package/dist/services/ecies/multi-recipient.js +0 -360
  180. package/dist/services/ecies/multi-recipient.js.map +0 -1
  181. package/dist/services/ecies/service.d.ts +0 -70
  182. package/dist/services/ecies/service.d.ts.map +0 -1
  183. package/dist/services/ecies/service.js +0 -167
  184. package/dist/services/ecies/service.js.map +0 -1
  185. package/dist/services/ecies/signature.d.ts +0 -38
  186. package/dist/services/ecies/signature.d.ts.map +0 -1
  187. package/dist/services/ecies/signature.js +0 -69
  188. package/dist/services/ecies/signature.js.map +0 -1
  189. package/dist/services/ecies/single-recipient.d.ts +0 -85
  190. package/dist/services/ecies/single-recipient.d.ts.map +0 -1
  191. package/dist/services/ecies/single-recipient.js +0 -399
  192. package/dist/services/ecies/single-recipient.js.map +0 -1
  193. package/dist/services/ecies/utilities.d.ts +0 -22
  194. package/dist/services/ecies/utilities.d.ts.map +0 -1
  195. package/dist/services/ecies/utilities.js +0 -75
  196. package/dist/services/ecies/utilities.js.map +0 -1
  197. package/dist/services/index.d.ts +0 -4
  198. package/dist/services/index.d.ts.map +0 -1
  199. package/dist/services/index.js +0 -20
  200. package/dist/services/index.js.map +0 -1
  201. package/dist/services/pbkdf2.d.ts +0 -106
  202. package/dist/services/pbkdf2.d.ts.map +0 -1
  203. package/dist/services/pbkdf2.js +0 -195
  204. package/dist/services/pbkdf2.js.map +0 -1
  205. package/dist/types.d.ts.map +0 -1
  206. package/dist/types.js +0 -3
  207. package/dist/types.js.map +0 -1
  208. package/dist/utils.d.ts +0 -11
  209. package/dist/utils.d.ts.map +0 -1
  210. package/dist/utils.js +0 -82
  211. package/dist/utils.js.map +0 -1
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AESGCMService = void 0;
4
- const crypto_1 = require("crypto");
5
- const i18n_1 = require("../i18n");
6
- const constants_1 = require("../constants");
7
- class AESGCMService {
8
- algorithmName;
9
- mode;
10
- keyBits;
11
- ivSize;
12
- keyringAlgorithmConfiguration;
13
- constructor(constants = constants_1.Constants) {
14
- this.algorithmName = constants.KEYRING.ALGORITHM;
15
- this.mode = constants.KEYRING.MODE;
16
- this.keyBits = constants.KEYRING.KEY_BITS;
17
- this.ivSize = constants.WRAPPED_KEY.IV_SIZE;
18
- this.keyringAlgorithmConfiguration = constants.KEYRING_ALGORITHM_CONFIGURATION;
19
- }
20
- get ALGORITHM_NAME() {
21
- return this.algorithmName;
22
- }
23
- get MODE() {
24
- return this.mode;
25
- }
26
- get KEY_BITS() {
27
- return this.keyBits;
28
- }
29
- /**
30
- * Encrypt data using AES-GCM
31
- * @param data Data to encrypt
32
- * @param key Key to use for encryption (must be 16, 24 or 32 bytes for AES)
33
- * @param authTag Whether to return separate auth tag
34
- * @returns Encrypted data with IV and optional separate auth tag
35
- */
36
- encrypt(data, key, authTag = false) {
37
- const iv = (0, crypto_1.randomBytes)(this.ivSize);
38
- const cipher = (0, crypto_1.createCipheriv)(this.keyringAlgorithmConfiguration, key, iv);
39
- const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
40
- const tag = cipher.getAuthTag();
41
- if (!authTag) {
42
- const encryptedWithTag = Buffer.concat([encrypted, tag]);
43
- return { encrypted: encryptedWithTag, iv: iv };
44
- }
45
- return {
46
- encrypted: encrypted,
47
- iv: iv,
48
- tag: tag,
49
- };
50
- }
51
- /**
52
- * Combine encrypted data and auth tag into a single Buffer
53
- * @param encryptedData The encrypted data
54
- * @param authTag The authentication tag
55
- * @returns The combined Buffer
56
- */
57
- combineEncryptedDataAndTag(encryptedData, authTag) {
58
- return Buffer.concat([encryptedData, authTag]);
59
- }
60
- /**
61
- * Combine IV and encrypted data (with optional auth tag) into a single Buffer
62
- * @param iv The initialization vector
63
- * @param encryptedDataWithTag The encrypted data with auth tag already appended (if applicable)
64
- * @returns The combined Buffer
65
- */
66
- combineIvAndEncryptedData(iv, encryptedDataWithTag) {
67
- return Buffer.concat([iv, encryptedDataWithTag]);
68
- }
69
- /**
70
- * Combine IV, encrypted data and auth tag into a single Buffer
71
- * @param iv The initialization vector
72
- * @param encryptedData The encrypted data
73
- * @param authTag The authentication tag
74
- * @returns The combined Buffer
75
- */
76
- combineIvTagAndEncryptedData(iv, encryptedData, authTag) {
77
- const encryptedWithTag = this.combineEncryptedDataAndTag(encryptedData, authTag);
78
- return this.combineIvAndEncryptedData(iv, encryptedWithTag);
79
- }
80
- /**
81
- * Split combined encrypted data back into its components
82
- * @param combinedData The combined data containing IV, encrypted data, and optionally auth tag
83
- * @param hasAuthTag Whether the combined data includes an authentication tag
84
- * @returns Object containing the split components
85
- */
86
- splitEncryptedData(combinedData, hasAuthTag = true) {
87
- const ivLength = this.ivSize;
88
- const minLength = ivLength + (hasAuthTag ? 16 : 0);
89
- if (combinedData.length < minLength) {
90
- const pluginEngine = (0, i18n_1.getEciesPluginI18nEngine)();
91
- throw new Error(pluginEngine.translate(i18n_1.NodeEciesComponentId, i18n_1.NodeEciesStringKey.Error_CombinedDataTooShort));
92
- }
93
- const iv = combinedData.subarray(0, ivLength);
94
- const encryptedDataWithTag = combinedData.subarray(ivLength);
95
- return { iv, encryptedDataWithTag };
96
- }
97
- /**
98
- * Decrypt data using AES-GCM
99
- * @param iv The initialization vector
100
- * @param encryptedData Data to decrypt (with auth tag appended)
101
- * @param key Key to use for decryption (must be 16, 24 or 32 bytes for AES)
102
- * @param authTag Whether the encrypted data includes an authentication tag
103
- * @returns Decrypted data
104
- */
105
- decrypt(iv, encryptedData, key, authTag = false) {
106
- const decipher = (0, crypto_1.createDecipheriv)(this.keyringAlgorithmConfiguration, key, iv);
107
- const tagLength = 16;
108
- const tag = encryptedData.subarray(-tagLength);
109
- const ciphertext = encryptedData.subarray(0, -tagLength);
110
- decipher.setAuthTag(tag);
111
- return Buffer.concat([decipher.update(ciphertext), decipher.final()]);
112
- }
113
- }
114
- exports.AESGCMService = AESGCMService;
115
- //# sourceMappingURL=aes-gcm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-gcm.js","sourceRoot":"","sources":["../../src/services/aes-gcm.ts"],"names":[],"mappings":";;;AAAA,mCAAuE;AAGvE,kCAA6F;AAC7F,4CAAyC;AAEzC,MAAa,aAAa;IACP,aAAa,CAAS;IACtB,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,6BAA6B,CAAiB;IAE/D,YAAY,YAAwB,qBAAS;QAC3C,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAC5C,IAAI,CAAC,6BAA6B,GAAG,SAAS,CAAC,+BAA+B,CAAC;IACjF,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CACZ,IAAY,EACZ,GAAW,EACX,UAAmB,KAAK;QAExB,MAAM,EAAE,GAAG,IAAA,oBAAW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IECIESConfig, IECIESConstants, SecureString } from '@digitaldefiance/ecies-lib';
2
- import { Wallet } from '@ethereumjs/wallet';
3
- import { ISimpleKeyPairBuffer } from '../../interfaces/simple-keypair-buffer';
4
- import { IWalletSeed } from '../../interfaces/wallet-seed';
5
- /**
6
- * Core encryption and decryption functions for ECIES
7
- * Includes coverage for simple and single modes, does not cover multiple mode which is in a separate module
8
- */
9
- export declare class EciesCryptoCore {
10
- protected readonly _config: IECIESConfig;
11
- protected readonly _consts: IECIESConstants;
12
- get config(): IECIESConfig;
13
- get consts(): IECIESConstants;
14
- constructor(config: IECIESConfig, eciesParams?: IECIESConstants);
15
- /**
16
- * Validates and normalizes a public key for ECIES operations
17
- * @param publicKey The public key to normalize
18
- * @returns Properly formatted public key
19
- */
20
- normalizePublicKey(publicKey: Buffer): Buffer;
21
- /**
22
- * Generate a new mnemonic
23
- * @returns {SecureString} The new mnemonic
24
- */
25
- generateNewMnemonic(): SecureString;
26
- /**
27
- * Generate a new wallet from a seed
28
- * @param seed {Buffer} The seed to generate the wallet from
29
- * @returns {Wallet} The new wallet
30
- */
31
- walletFromSeed(seed: Buffer): Wallet;
32
- /**
33
- * Generate a new wallet and seed from a mnemonic
34
- * @param mnemonic {SecureString} The mnemonic to generate the wallet and seed from
35
- * @returns {IWalletSeed} The new wallet and seed
36
- */
37
- walletAndSeedFromMnemonic(mnemonic: SecureString): IWalletSeed;
38
- /**
39
- * Generate a new wallet and seed from a mnemonic
40
- * @param wallet {Wallet} The wallet to generate the key pair from
41
- * @returns {ISimpleKeyPairBuffer} The new key pair
42
- */
43
- walletToSimpleKeyPairBuffer(wallet: Wallet): ISimpleKeyPairBuffer;
44
- /**
45
- * Create a simple key pair from a seed
46
- * @param seed {Buffer} The seed to generate the key pair from
47
- * @returns {ISimpleKeyPairBuffer} The new key pair
48
- */
49
- seedToSimpleKeyPairBuffer(seed: Buffer): ISimpleKeyPairBuffer;
50
- /**
51
- * Create a simple key pair from a mnemonic
52
- * @param mnemonic {SecureString} The mnemonic to generate the key pair from
53
- * @returns {ISimpleKeyPairBuffer} The new key pair
54
- */
55
- mnemonicToSimpleKeyPairBuffer(mnemonic: SecureString): ISimpleKeyPairBuffer;
56
- /**
57
- * Generate a random private key
58
- * @returns {Buffer} The new private key
59
- */
60
- generatePrivateKey(): Buffer;
61
- /**
62
- * Get public key from private key
63
- * @param privateKey {Buffer} The private key
64
- * @returns {Buffer} The public key
65
- */
66
- getPublicKey(privateKey: Buffer): Buffer;
67
- /**
68
- * Generate ephemeral key pair for ECIES
69
- * @returns {Promise<ISimpleKeyPairBuffer>} The key pair
70
- */
71
- generateEphemeralKeyPair(): Promise<{
72
- privateKey: Buffer;
73
- publicKey: Buffer;
74
- }>;
75
- /**
76
- * Compute ECDH shared secret
77
- * @param privateKey {Buffer} The private key
78
- * @param publicKey {Buffer} The public key
79
- * @returns {Buffer} The shared secret
80
- */
81
- computeSharedSecret(privateKey: Buffer, publicKey: Buffer): Buffer;
82
- }
83
- //# sourceMappingURL=crypto-core.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-core.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,eAAe,EAEf,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAS,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAInD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D;;;GAGG;AACH,qBAAa,eAAe;IAC1B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAC5C,IAAW,MAAM,IAAI,YAAY,CAEhC;IAED,IAAW,MAAM,IAAI,eAAe,CAEnC;gBAEW,MAAM,EAAE,YAAY,EAAE,WAAW,GAAE,eAAiC;IAKhF;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAiDpD;;;OAGG;IACI,mBAAmB,IAAI,YAAY;IAI1C;;;;OAIG;IACI,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO3C;;;;OAIG;IACI,yBAAyB,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW;IAiBrE;;;;OAIG;IACI,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB;IAYxE;;;;OAIG;IACI,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB;IAKpE;;;;OAIG;IACI,6BAA6B,CAClC,QAAQ,EAAE,YAAY,GACrB,oBAAoB;IAKvB;;;OAGG;IACI,kBAAkB,IAAI,MAAM;IAInC;;;;OAIG;IACI,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAK/C;;;OAGG;IACU,wBAAwB,IAAI,OAAO,CAAC;QAC/C,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAMF;;;;;OAKG;IACI,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;CAI1E"}
@@ -1,166 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EciesCryptoCore = void 0;
4
- const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
5
- const wallet_1 = require("@ethereumjs/wallet");
6
- const bip39_1 = require("bip39");
7
- const secp256k1_js_1 = require("ethereum-cryptography/secp256k1.js");
8
- const ecies_i18n_factory_1 = require("../../i18n/ecies-i18n-factory");
9
- const constants_1 = require("../../constants");
10
- /**
11
- * Core encryption and decryption functions for ECIES
12
- * Includes coverage for simple and single modes, does not cover multiple mode which is in a separate module
13
- */
14
- class EciesCryptoCore {
15
- _config;
16
- _consts;
17
- get config() {
18
- return this._config;
19
- }
20
- get consts() {
21
- return this._consts;
22
- }
23
- constructor(config, eciesParams = constants_1.Constants.ECIES) {
24
- this._config = config;
25
- this._consts = eciesParams;
26
- }
27
- /**
28
- * Validates and normalizes a public key for ECIES operations
29
- * @param publicKey The public key to normalize
30
- * @returns Properly formatted public key
31
- */
32
- normalizePublicKey(publicKey) {
33
- if (!publicKey) {
34
- const engine = (0, ecies_i18n_factory_1.createEciesTranslationEngine)();
35
- const pluginEngine = (0, ecies_i18n_factory_1.getEciesPluginI18nEngine)();
36
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEphemeralPublicKey, engine, undefined, undefined, {
37
- error: pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_InvalidPublicKey),
38
- });
39
- }
40
- const keyLength = publicKey.length;
41
- // Already in correct format (65 bytes with 0x04 prefix)
42
- if (keyLength === this._consts.PUBLIC_KEY_LENGTH &&
43
- publicKey[0] === this._consts.PUBLIC_KEY_MAGIC) {
44
- return publicKey;
45
- }
46
- // Raw key without prefix (64 bytes) - add the 0x04 prefix
47
- if (keyLength === this._consts.RAW_PUBLIC_KEY_LENGTH) {
48
- return Buffer.concat([Buffer.from([this._consts.PUBLIC_KEY_MAGIC]), publicKey]);
49
- }
50
- const engine = (0, ecies_i18n_factory_1.createEciesTranslationEngine)();
51
- const pluginEngine = (0, ecies_i18n_factory_1.getEciesPluginI18nEngine)();
52
- // Invalid format
53
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidEphemeralPublicKey, engine, undefined, undefined, {
54
- error: pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_InvalidPublicKeyFormat),
55
- keyLength: String(keyLength),
56
- expectedLength64: String(this._consts.RAW_PUBLIC_KEY_LENGTH),
57
- expectedLength65: String(this._consts.PUBLIC_KEY_LENGTH),
58
- keyPrefix: keyLength > 0 ? String(publicKey[0]) : 'N/A',
59
- expectedPrefix: String(this._consts.PUBLIC_KEY_MAGIC),
60
- });
61
- }
62
- /**
63
- * Generate a new mnemonic
64
- * @returns {SecureString} The new mnemonic
65
- */
66
- generateNewMnemonic() {
67
- return new ecies_lib_1.SecureString((0, bip39_1.generateMnemonic)(this._config.mnemonicStrength));
68
- }
69
- /**
70
- * Generate a new wallet from a seed
71
- * @param seed {Buffer} The seed to generate the wallet from
72
- * @returns {Wallet} The new wallet
73
- */
74
- walletFromSeed(seed) {
75
- const hdWallet = wallet_1.hdkey.EthereumHDKey.fromMasterSeed(seed);
76
- return hdWallet
77
- .derivePath(this._config.primaryKeyDerivationPath)
78
- .getWallet();
79
- }
80
- /**
81
- * Generate a new wallet and seed from a mnemonic
82
- * @param mnemonic {SecureString} The mnemonic to generate the wallet and seed from
83
- * @returns {IWalletSeed} The new wallet and seed
84
- */
85
- walletAndSeedFromMnemonic(mnemonic) {
86
- if (!mnemonic.value || !(0, bip39_1.validateMnemonic)(mnemonic.value)) {
87
- throw new ecies_lib_1.ECIESError(ecies_lib_1.ECIESErrorTypeEnum.InvalidMnemonic, (0, ecies_i18n_factory_1.createEciesTranslationEngine)());
88
- }
89
- const seed = (0, bip39_1.mnemonicToSeedSync)(mnemonic.value);
90
- const wallet = this.walletFromSeed(seed);
91
- return {
92
- seed: new ecies_lib_1.SecureBuffer(seed),
93
- wallet,
94
- };
95
- }
96
- /**
97
- * Generate a new wallet and seed from a mnemonic
98
- * @param wallet {Wallet} The wallet to generate the key pair from
99
- * @returns {ISimpleKeyPairBuffer} The new key pair
100
- */
101
- walletToSimpleKeyPairBuffer(wallet) {
102
- const privateKey = Buffer.from(wallet.getPrivateKey());
103
- const buf04 = new Uint8Array(1);
104
- buf04[0] = this._consts.PUBLIC_KEY_MAGIC;
105
- const publicKey = Buffer.concat([buf04, wallet.getPublicKey()]);
106
- return {
107
- privateKey,
108
- publicKey,
109
- };
110
- }
111
- /**
112
- * Create a simple key pair from a seed
113
- * @param seed {Buffer} The seed to generate the key pair from
114
- * @returns {ISimpleKeyPairBuffer} The new key pair
115
- */
116
- seedToSimpleKeyPairBuffer(seed) {
117
- const wallet = this.walletFromSeed(seed);
118
- return this.walletToSimpleKeyPairBuffer(wallet);
119
- }
120
- /**
121
- * Create a simple key pair from a mnemonic
122
- * @param mnemonic {SecureString} The mnemonic to generate the key pair from
123
- * @returns {ISimpleKeyPairBuffer} The new key pair
124
- */
125
- mnemonicToSimpleKeyPairBuffer(mnemonic) {
126
- const { seed } = this.walletAndSeedFromMnemonic(mnemonic);
127
- return this.seedToSimpleKeyPairBuffer(Buffer.from(seed.value));
128
- }
129
- /**
130
- * Generate a random private key
131
- * @returns {Buffer} The new private key
132
- */
133
- generatePrivateKey() {
134
- return Buffer.from(secp256k1_js_1.secp256k1.utils.randomPrivateKey());
135
- }
136
- /**
137
- * Get public key from private key
138
- * @param privateKey {Buffer} The private key
139
- * @returns {Buffer} The public key
140
- */
141
- getPublicKey(privateKey) {
142
- const publicKey = secp256k1_js_1.secp256k1.getPublicKey(privateKey, false);
143
- return Buffer.from(publicKey);
144
- }
145
- /**
146
- * Generate ephemeral key pair for ECIES
147
- * @returns {Promise<ISimpleKeyPairBuffer>} The key pair
148
- */
149
- async generateEphemeralKeyPair() {
150
- const privateKey = this.generatePrivateKey();
151
- const publicKey = this.getPublicKey(privateKey);
152
- return { privateKey, publicKey };
153
- }
154
- /**
155
- * Compute ECDH shared secret
156
- * @param privateKey {Buffer} The private key
157
- * @param publicKey {Buffer} The public key
158
- * @returns {Buffer} The shared secret
159
- */
160
- computeSharedSecret(privateKey, publicKey) {
161
- const sharedSecret = secp256k1_js_1.secp256k1.getSharedSecret(privateKey, publicKey, true);
162
- return Buffer.from(sharedSecret.slice(1)); // Remove the 0x02/0x03 prefix
163
- }
164
- }
165
- exports.EciesCryptoCore = EciesCryptoCore;
166
- //# sourceMappingURL=crypto-core.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-core.js","sourceRoot":"","sources":["../../../src/services/ec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KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,wBAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,UAAkB;QACpC,MAAM,SAAS,GAAG,wBAAS,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,wBAAwB;QAInC,MAAM,UAAU,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAChD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,mBAAmB,CAAC,UAAkB,EAAE,SAAiB;QAC9D,MAAM,YAAY,GAAG,wBAAS,CAAC,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B;IAC3E,CAAC;CACF;AAhMD,0CAgMC"}
@@ -1,30 +0,0 @@
1
- import { ECIESService } from './service';
2
- interface ChunkedFileHeader {
3
- version: number;
4
- chunkSize: number;
5
- totalChunks: number;
6
- originalSize: number;
7
- }
8
- export declare class EciesFileService {
9
- protected readonly eciesService: ECIESService;
10
- protected readonly userPrivateKey: Buffer;
11
- protected readonly config: {
12
- chunkSize: number;
13
- headerSize: number;
14
- };
15
- constructor(eciesService: ECIESService, userPrivateKey: Buffer, config?: {
16
- chunkSize: number;
17
- headerSize: number;
18
- });
19
- decryptFile(encryptedData: Buffer): Buffer;
20
- encryptFileFromPath(filePath: string, recipientPublicKey: Buffer): Buffer;
21
- decryptFileToPath(encryptedData: Buffer, outputPath: string): void;
22
- protected serializeHeader(header: ChunkedFileHeader): Buffer;
23
- protected deserializeHeader(data: Buffer): ChunkedFileHeader;
24
- protected parseEncryptedFile(encryptedData: Buffer): {
25
- header: ChunkedFileHeader;
26
- chunks: Buffer[];
27
- };
28
- }
29
- export {};
30
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,gBAAgB;IAC3B,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;gBAGnE,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAG9C;IAOH,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAuB1C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM;IA4CzE,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAwBlE,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAS5D,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;IAS5D,SAAS,CAAC,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG;QACnD,MAAM,EAAE,iBAAiB,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB;CAiCF"}
@@ -1,144 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.EciesFileService = void 0;
37
- const fs = __importStar(require("fs"));
38
- class EciesFileService {
39
- eciesService;
40
- userPrivateKey;
41
- config;
42
- constructor(eciesService, userPrivateKey, config = {
43
- chunkSize: 1024 * 1024, // 1MB chunks
44
- headerSize: 20,
45
- }) {
46
- this.eciesService = eciesService;
47
- this.userPrivateKey = userPrivateKey;
48
- this.config = Object.freeze(config);
49
- }
50
- decryptFile(encryptedData) {
51
- const { header, chunks } = this.parseEncryptedFile(encryptedData);
52
- const decryptedChunks = [];
53
- for (const chunk of chunks) {
54
- const decrypted = this.eciesService.decryptSimpleOrSingleWithHeader(false, this.userPrivateKey, chunk);
55
- decryptedChunks.push(decrypted);
56
- }
57
- const result = Buffer.alloc(header.originalSize);
58
- let offset = 0;
59
- for (const chunk of decryptedChunks) {
60
- const copyLength = Math.min(chunk.length, header.originalSize - offset);
61
- chunk.copy(result, offset, 0, copyLength);
62
- offset += copyLength;
63
- }
64
- return result;
65
- }
66
- encryptFileFromPath(filePath, recipientPublicKey) {
67
- const stats = fs.statSync(filePath);
68
- const totalChunks = Math.ceil(stats.size / this.config.chunkSize);
69
- const header = {
70
- version: 1,
71
- chunkSize: this.config.chunkSize,
72
- totalChunks,
73
- originalSize: stats.size,
74
- };
75
- const headerBytes = this.serializeHeader(header);
76
- const encryptedHeader = this.eciesService.encryptSimpleOrSingle(false, recipientPublicKey, headerBytes);
77
- const chunks = [encryptedHeader];
78
- const fd = fs.openSync(filePath, 'r');
79
- try {
80
- for (let i = 0; i < totalChunks; i++) {
81
- const offset = i * this.config.chunkSize;
82
- const chunkSize = Math.min(this.config.chunkSize, stats.size - offset);
83
- const chunkData = Buffer.alloc(chunkSize);
84
- fs.readSync(fd, chunkData, 0, chunkSize, offset);
85
- const encryptedChunk = this.eciesService.encryptSimpleOrSingle(false, recipientPublicKey, chunkData);
86
- chunks.push(encryptedChunk);
87
- }
88
- }
89
- finally {
90
- fs.closeSync(fd);
91
- }
92
- return Buffer.concat(chunks);
93
- }
94
- decryptFileToPath(encryptedData, outputPath) {
95
- const { header, chunks } = this.parseEncryptedFile(encryptedData);
96
- const fd = fs.openSync(outputPath, 'w');
97
- let offset = 0;
98
- try {
99
- for (const chunk of chunks) {
100
- const decrypted = this.eciesService.decryptSimpleOrSingleWithHeader(false, this.userPrivateKey, chunk);
101
- const writeLength = Math.min(decrypted.length, header.originalSize - offset);
102
- fs.writeSync(fd, decrypted, 0, writeLength, offset);
103
- offset += writeLength;
104
- }
105
- }
106
- finally {
107
- fs.closeSync(fd);
108
- }
109
- }
110
- serializeHeader(header) {
111
- const buffer = Buffer.alloc(this.config.headerSize);
112
- buffer.writeUInt32BE(header.version, 0);
113
- buffer.writeUInt32BE(header.chunkSize, 4);
114
- buffer.writeUInt32BE(header.totalChunks, 8);
115
- buffer.writeUInt32BE(header.originalSize, 12);
116
- return buffer;
117
- }
118
- deserializeHeader(data) {
119
- return {
120
- version: data.readUInt32BE(0),
121
- chunkSize: data.readUInt32BE(4),
122
- totalChunks: data.readUInt32BE(8),
123
- originalSize: data.readUInt32BE(12),
124
- };
125
- }
126
- parseEncryptedFile(encryptedData) {
127
- const headerLength = this.eciesService.computeEncryptedLengthFromDataLength(this.config.headerSize, 'single');
128
- const encryptedHeader = encryptedData.subarray(0, headerLength);
129
- const decryptedHeaderBytes = this.eciesService.decryptSimpleOrSingleWithHeader(false, this.userPrivateKey, encryptedHeader);
130
- const header = this.deserializeHeader(decryptedHeaderBytes);
131
- const chunks = [];
132
- let offset = headerLength;
133
- for (let i = 0; i < header.totalChunks; i++) {
134
- const chunkLength = this.eciesService.computeEncryptedLengthFromDataLength(i === header.totalChunks - 1
135
- ? header.originalSize % header.chunkSize || header.chunkSize
136
- : header.chunkSize, 'single');
137
- chunks.push(encryptedData.subarray(offset, offset + chunkLength));
138
- offset += chunkLength;
139
- }
140
- return { header, chunks };
141
- }
142
- }
143
- exports.EciesFileService = EciesFileService;
144
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/services/ecies/file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAUzB,MAAa,gBAAgB;IACR,YAAY,CAAe;IAC3B,cAAc,CAAS;IACvB,MAAM,CAA4C;IAErE,YACE,YAA0B,EAC1B,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,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;YAClE,MAAM,IAAI,WAAW,CAAC;QACxB,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF;AAnKD,4CAmKC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./crypto-core"), exports);
18
- __exportStar(require("./file"), exports);
19
- __exportStar(require("./multi-recipient"), exports);
20
- __exportStar(require("./service"), exports);
21
- __exportStar(require("./signature"), exports);
22
- __exportStar(require("./single-recipient"), exports);
23
- __exportStar(require("./utilities"), exports);
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/ecies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,yCAAuB;AACvB,oDAAkC;AAClC,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,8CAA4B"}