@digitaldefiance/node-ecies-lib 1.0.0

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 (182) hide show
  1. package/LICENSE +21 -0
  2. package/dist/constants.d.ts +29 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +129 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/enumerations/index.d.ts +2 -0
  7. package/dist/enumerations/index.d.ts.map +1 -0
  8. package/dist/enumerations/index.js +2 -0
  9. package/dist/enumerations/index.js.map +1 -0
  10. package/dist/enumerations/pbkdf2-profile.d.ts +8 -0
  11. package/dist/enumerations/pbkdf2-profile.d.ts.map +1 -0
  12. package/dist/enumerations/pbkdf2-profile.js +9 -0
  13. package/dist/enumerations/pbkdf2-profile.js.map +1 -0
  14. package/dist/index.d.ts +6 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +6 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/interfaces/authenticated-cipher.d.ts +10 -0
  19. package/dist/interfaces/authenticated-cipher.d.ts.map +1 -0
  20. package/dist/interfaces/authenticated-cipher.js +2 -0
  21. package/dist/interfaces/authenticated-cipher.js.map +1 -0
  22. package/dist/interfaces/authenticated-decipher.d.ts +9 -0
  23. package/dist/interfaces/authenticated-decipher.d.ts.map +1 -0
  24. package/dist/interfaces/authenticated-decipher.js +2 -0
  25. package/dist/interfaces/authenticated-decipher.js.map +1 -0
  26. package/dist/interfaces/checksum-config.d.ts +5 -0
  27. package/dist/interfaces/checksum-config.d.ts.map +1 -0
  28. package/dist/interfaces/checksum-config.js +2 -0
  29. package/dist/interfaces/checksum-config.js.map +1 -0
  30. package/dist/interfaces/checksum-consts.d.ts +11 -0
  31. package/dist/interfaces/checksum-consts.d.ts.map +1 -0
  32. package/dist/interfaces/checksum-consts.js +2 -0
  33. package/dist/interfaces/checksum-consts.js.map +1 -0
  34. package/dist/interfaces/constants.d.ts +42 -0
  35. package/dist/interfaces/constants.d.ts.map +1 -0
  36. package/dist/interfaces/constants.js +2 -0
  37. package/dist/interfaces/constants.js.map +1 -0
  38. package/dist/interfaces/ecies-consts.d.ts +88 -0
  39. package/dist/interfaces/ecies-consts.d.ts.map +1 -0
  40. package/dist/interfaces/ecies-consts.js +2 -0
  41. package/dist/interfaces/ecies-consts.js.map +1 -0
  42. package/dist/interfaces/encryption-consts.d.ts +11 -0
  43. package/dist/interfaces/encryption-consts.d.ts.map +1 -0
  44. package/dist/interfaces/encryption-consts.js +2 -0
  45. package/dist/interfaces/encryption-consts.js.map +1 -0
  46. package/dist/interfaces/fec-consts.d.ts +5 -0
  47. package/dist/interfaces/fec-consts.d.ts.map +1 -0
  48. package/dist/interfaces/fec-consts.js +2 -0
  49. package/dist/interfaces/fec-consts.js.map +1 -0
  50. package/dist/interfaces/index.d.ts +18 -0
  51. package/dist/interfaces/index.d.ts.map +1 -0
  52. package/dist/interfaces/index.js +18 -0
  53. package/dist/interfaces/index.js.map +1 -0
  54. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +6 -0
  55. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +1 -0
  56. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +2 -0
  57. package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +1 -0
  58. package/dist/interfaces/keyring-consts.d.ts +6 -0
  59. package/dist/interfaces/keyring-consts.d.ts.map +1 -0
  60. package/dist/interfaces/keyring-consts.js +2 -0
  61. package/dist/interfaces/keyring-consts.js.map +1 -0
  62. package/dist/interfaces/member-operational.d.ts +36 -0
  63. package/dist/interfaces/member-operational.d.ts.map +1 -0
  64. package/dist/interfaces/member-operational.js +2 -0
  65. package/dist/interfaces/member-operational.js.map +1 -0
  66. package/dist/interfaces/member-with-mnemonic.d.ts +7 -0
  67. package/dist/interfaces/member-with-mnemonic.d.ts.map +1 -0
  68. package/dist/interfaces/member-with-mnemonic.js +2 -0
  69. package/dist/interfaces/member-with-mnemonic.js.map +1 -0
  70. package/dist/interfaces/multi-encrypted-message.d.ts +8 -0
  71. package/dist/interfaces/multi-encrypted-message.d.ts.map +1 -0
  72. package/dist/interfaces/multi-encrypted-message.js +2 -0
  73. package/dist/interfaces/multi-encrypted-message.js.map +1 -0
  74. package/dist/interfaces/multi-encrypted-parsed-header.d.ts +24 -0
  75. package/dist/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -0
  76. package/dist/interfaces/multi-encrypted-parsed-header.js +2 -0
  77. package/dist/interfaces/multi-encrypted-parsed-header.js.map +1 -0
  78. package/dist/interfaces/pbkdf-profiles.d.ts +6 -0
  79. package/dist/interfaces/pbkdf-profiles.d.ts.map +1 -0
  80. package/dist/interfaces/pbkdf-profiles.js +2 -0
  81. package/dist/interfaces/pbkdf-profiles.js.map +1 -0
  82. package/dist/interfaces/signing-key-private-key-info.d.ts +11 -0
  83. package/dist/interfaces/signing-key-private-key-info.d.ts.map +1 -0
  84. package/dist/interfaces/signing-key-private-key-info.js +2 -0
  85. package/dist/interfaces/signing-key-private-key-info.js.map +1 -0
  86. package/dist/interfaces/simple-keypair-buffer.d.ts +6 -0
  87. package/dist/interfaces/simple-keypair-buffer.d.ts.map +1 -0
  88. package/dist/interfaces/simple-keypair-buffer.js +2 -0
  89. package/dist/interfaces/simple-keypair-buffer.js.map +1 -0
  90. package/dist/interfaces/simple-keypair.d.ts +6 -0
  91. package/dist/interfaces/simple-keypair.d.ts.map +1 -0
  92. package/dist/interfaces/simple-keypair.js +2 -0
  93. package/dist/interfaces/simple-keypair.js.map +1 -0
  94. package/dist/interfaces/simple-public-key-only-buffer.d.ts +4 -0
  95. package/dist/interfaces/simple-public-key-only-buffer.d.ts.map +1 -0
  96. package/dist/interfaces/simple-public-key-only-buffer.js +2 -0
  97. package/dist/interfaces/simple-public-key-only-buffer.js.map +1 -0
  98. package/dist/interfaces/simple-public-key-only.d.ts +4 -0
  99. package/dist/interfaces/simple-public-key-only.d.ts.map +1 -0
  100. package/dist/interfaces/simple-public-key-only.js +2 -0
  101. package/dist/interfaces/simple-public-key-only.js.map +1 -0
  102. package/dist/interfaces/single-encrypted-parsed-header.d.ts +35 -0
  103. package/dist/interfaces/single-encrypted-parsed-header.d.ts.map +1 -0
  104. package/dist/interfaces/single-encrypted-parsed-header.js +2 -0
  105. package/dist/interfaces/single-encrypted-parsed-header.js.map +1 -0
  106. package/dist/interfaces/wallet-seed.d.ts +7 -0
  107. package/dist/interfaces/wallet-seed.d.ts.map +1 -0
  108. package/dist/interfaces/wallet-seed.js +2 -0
  109. package/dist/interfaces/wallet-seed.js.map +1 -0
  110. package/dist/interfaces/wrapped-key-consts.d.ts +7 -0
  111. package/dist/interfaces/wrapped-key-consts.d.ts.map +1 -0
  112. package/dist/interfaces/wrapped-key-consts.js +2 -0
  113. package/dist/interfaces/wrapped-key-consts.js.map +1 -0
  114. package/dist/member.d.ts +67 -0
  115. package/dist/member.d.ts.map +1 -0
  116. package/dist/member.js +256 -0
  117. package/dist/member.js.map +1 -0
  118. package/dist/services/ecies/crypto-core.d.ts +55 -0
  119. package/dist/services/ecies/crypto-core.d.ts.map +1 -0
  120. package/dist/services/ecies/crypto-core.debug.d.ts +13 -0
  121. package/dist/services/ecies/crypto-core.debug.d.ts.map +1 -0
  122. package/dist/services/ecies/crypto-core.debug.js +91 -0
  123. package/dist/services/ecies/crypto-core.debug.js.map +1 -0
  124. package/dist/services/ecies/crypto-core.js +115 -0
  125. package/dist/services/ecies/crypto-core.js.map +1 -0
  126. package/dist/services/ecies/debug-aes-gcm.d.ts +2 -0
  127. package/dist/services/ecies/debug-aes-gcm.d.ts.map +1 -0
  128. package/dist/services/ecies/debug-aes-gcm.js +106 -0
  129. package/dist/services/ecies/debug-aes-gcm.js.map +1 -0
  130. package/dist/services/ecies/debug-ecdh.d.ts +2 -0
  131. package/dist/services/ecies/debug-ecdh.d.ts.map +1 -0
  132. package/dist/services/ecies/debug-ecdh.js +123 -0
  133. package/dist/services/ecies/debug-ecdh.js.map +1 -0
  134. package/dist/services/ecies/debug-ecies-burnbag.d.ts +2 -0
  135. package/dist/services/ecies/debug-ecies-burnbag.d.ts.map +1 -0
  136. package/dist/services/ecies/debug-ecies-burnbag.js +134 -0
  137. package/dist/services/ecies/debug-ecies-burnbag.js.map +1 -0
  138. package/dist/services/ecies/debug-ecies.d.ts +2 -0
  139. package/dist/services/ecies/debug-ecies.d.ts.map +1 -0
  140. package/dist/services/ecies/debug-ecies.js +110 -0
  141. package/dist/services/ecies/debug-ecies.js.map +1 -0
  142. package/dist/services/ecies/debug-test.d.ts +2 -0
  143. package/dist/services/ecies/debug-test.d.ts.map +1 -0
  144. package/dist/services/ecies/debug-test.js +57 -0
  145. package/dist/services/ecies/debug-test.js.map +1 -0
  146. package/dist/services/ecies/file.d.ts +15 -0
  147. package/dist/services/ecies/file.d.ts.map +1 -0
  148. package/dist/services/ecies/file.js +104 -0
  149. package/dist/services/ecies/file.js.map +1 -0
  150. package/dist/services/ecies/index.d.ts +8 -0
  151. package/dist/services/ecies/index.d.ts.map +1 -0
  152. package/dist/services/ecies/index.js +8 -0
  153. package/dist/services/ecies/index.js.map +1 -0
  154. package/dist/services/ecies/multi-recipient.d.ts +83 -0
  155. package/dist/services/ecies/multi-recipient.d.ts.map +1 -0
  156. package/dist/services/ecies/multi-recipient.js +355 -0
  157. package/dist/services/ecies/multi-recipient.js.map +1 -0
  158. package/dist/services/ecies/service.d.ts +70 -0
  159. package/dist/services/ecies/service.d.ts.map +1 -0
  160. package/dist/services/ecies/service.js +145 -0
  161. package/dist/services/ecies/service.js.map +1 -0
  162. package/dist/services/ecies/signature.d.ts +38 -0
  163. package/dist/services/ecies/signature.d.ts.map +1 -0
  164. package/dist/services/ecies/signature.js +64 -0
  165. package/dist/services/ecies/signature.js.map +1 -0
  166. package/dist/services/ecies/single-recipient.d.ts +85 -0
  167. package/dist/services/ecies/single-recipient.d.ts.map +1 -0
  168. package/dist/services/ecies/single-recipient.js +390 -0
  169. package/dist/services/ecies/single-recipient.js.map +1 -0
  170. package/dist/services/ecies/utilities.d.ts +22 -0
  171. package/dist/services/ecies/utilities.d.ts.map +1 -0
  172. package/dist/services/ecies/utilities.js +65 -0
  173. package/dist/services/ecies/utilities.js.map +1 -0
  174. package/dist/services/index.d.ts +2 -0
  175. package/dist/services/index.d.ts.map +1 -0
  176. package/dist/services/index.js +2 -0
  177. package/dist/services/index.js.map +1 -0
  178. package/dist/types.d.ts +25 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +2 -0
  181. package/dist/types.js.map +1 -0
  182. package/package.json +64 -0
package/dist/member.js ADDED
@@ -0,0 +1,256 @@
1
+ import { ECIES, EmailString, getEciesI18nEngine, MemberError, MemberErrorType, MemberType, SecureBuffer, } from '@digitaldefiance/ecies-lib';
2
+ // Removed: import { ServiceProvider } from './services/service.provider';
3
+ import { ObjectId } from 'mongodb';
4
+ /**
5
+ * A member of Brightchain.
6
+ * In the Owner Free Filesystem (OFF), members are used to:
7
+ * 1. Sign and verify data
8
+ * 2. Encrypt and decrypt data
9
+ * 3. Participate in voting
10
+ * 4. Establish ownership of data
11
+ */
12
+ export class Member {
13
+ _eciesService;
14
+ _id;
15
+ _type;
16
+ _name;
17
+ _email;
18
+ _publicKey;
19
+ _creatorId;
20
+ _dateCreated;
21
+ _dateUpdated;
22
+ _privateKey;
23
+ _wallet;
24
+ constructor(
25
+ // Add injected services as parameters
26
+ eciesService,
27
+ // Original parameters
28
+ type, name, email, publicKey, privateKey, wallet, id, dateCreated, dateUpdated, creatorId) {
29
+ // Assign injected services
30
+ this._eciesService = eciesService;
31
+ // Assign original parameters
32
+ this._type = type;
33
+ this._id = id ?? new ObjectId();
34
+ this._name = name;
35
+ if (!this._name || this._name.length == 0) {
36
+ throw new MemberError(MemberErrorType.MissingMemberName, getEciesI18nEngine());
37
+ }
38
+ if (this._name.trim() != this._name) {
39
+ throw new MemberError(MemberErrorType.InvalidMemberNameWhitespace, getEciesI18nEngine());
40
+ }
41
+ this._email = email;
42
+ this._publicKey = publicKey;
43
+ this._privateKey = privateKey;
44
+ this._wallet = wallet;
45
+ // don't create a new date object with nearly identical values to the existing one
46
+ let _now = null;
47
+ const now = function () {
48
+ if (!_now) {
49
+ _now = new Date();
50
+ }
51
+ return _now;
52
+ };
53
+ this._dateCreated = dateCreated ?? now();
54
+ this._dateUpdated = dateUpdated ?? now();
55
+ this._creatorId = creatorId ?? this._id;
56
+ }
57
+ // Required getters
58
+ get id() {
59
+ return this._id;
60
+ }
61
+ get type() {
62
+ return this._type;
63
+ }
64
+ get name() {
65
+ return this._name;
66
+ }
67
+ get email() {
68
+ return this._email;
69
+ }
70
+ get publicKey() {
71
+ return this._publicKey;
72
+ }
73
+ get creatorId() {
74
+ return this._creatorId;
75
+ }
76
+ get dateCreated() {
77
+ return this._dateCreated;
78
+ }
79
+ get dateUpdated() {
80
+ return this._dateUpdated;
81
+ }
82
+ // Optional private data getters
83
+ get privateKey() {
84
+ return this._privateKey;
85
+ }
86
+ get wallet() {
87
+ if (!this._wallet) {
88
+ throw new MemberError(MemberErrorType.NoWallet, getEciesI18nEngine());
89
+ }
90
+ return this._wallet;
91
+ }
92
+ // State getters
93
+ get hasPrivateKey() {
94
+ return this._privateKey !== undefined;
95
+ }
96
+ unloadPrivateKey() {
97
+ // Do not dispose here; tests expect the same SecureBuffer instance to remain usable
98
+ // when reloaded into another member in the same process.
99
+ this._privateKey = undefined;
100
+ }
101
+ unloadWallet() {
102
+ this._wallet = undefined;
103
+ }
104
+ unloadWalletAndPrivateKey() {
105
+ this.unloadWallet();
106
+ this.unloadPrivateKey();
107
+ }
108
+ loadWallet(mnemonic) {
109
+ if (this._wallet) {
110
+ throw new MemberError(MemberErrorType.WalletAlreadyLoaded, getEciesI18nEngine());
111
+ }
112
+ const { wallet } = this._eciesService.walletAndSeedFromMnemonic(mnemonic);
113
+ const privateKey = wallet.getPrivateKey();
114
+ const publicKey = wallet.getPublicKey();
115
+ const publicKeyWithPrefix = Buffer.concat([
116
+ Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
117
+ publicKey,
118
+ ]);
119
+ if (publicKeyWithPrefix.toString('hex') !== this._publicKey.toString('hex')) {
120
+ throw new MemberError(MemberErrorType.InvalidMnemonic, getEciesI18nEngine());
121
+ }
122
+ this._wallet = wallet;
123
+ this._privateKey = new SecureBuffer(privateKey);
124
+ }
125
+ /**
126
+ * Loads the private key and optionally the voting private key.
127
+ *
128
+ * @param privateKey The private key to load.
129
+ * @param votingPrivateKey The voting private key to load.
130
+ */
131
+ loadPrivateKey(privateKey) {
132
+ this._privateKey = privateKey;
133
+ }
134
+ sign(data) {
135
+ if (!this._privateKey) {
136
+ throw new MemberError(MemberErrorType.MissingPrivateKey, getEciesI18nEngine());
137
+ }
138
+ return this._eciesService.signMessage(Buffer.from(this._privateKey.value), data);
139
+ }
140
+ signData(data) {
141
+ if (!this._privateKey) {
142
+ throw new MemberError(MemberErrorType.MissingPrivateKey, getEciesI18nEngine());
143
+ }
144
+ return this._eciesService.signMessage(Buffer.from(this._privateKey.value), data);
145
+ }
146
+ verify(signature, data) {
147
+ return this._eciesService.verifyMessage(this._publicKey, data, signature);
148
+ }
149
+ verifySignature(data, signature, publicKey) {
150
+ return this._eciesService.verifyMessage(publicKey, data, signature);
151
+ }
152
+ static MAX_ENCRYPTION_SIZE = 1024 * 1024 * 10; // 10MB limit
153
+ static VALID_STRING_REGEX = /^[\x20-\x7E\n\r\t]*$/; // Printable ASCII + common whitespace
154
+ encryptData(data, recipientPublicKey) {
155
+ // Validate input
156
+ if (!data) {
157
+ throw new MemberError(MemberErrorType.MissingEncryptionData, getEciesI18nEngine());
158
+ }
159
+ // Check size limit
160
+ const dataSize = Buffer.isBuffer(data)
161
+ ? data.length
162
+ : Buffer.byteLength(data);
163
+ if (dataSize > Member.MAX_ENCRYPTION_SIZE) {
164
+ throw new MemberError(MemberErrorType.EncryptionDataTooLarge, getEciesI18nEngine());
165
+ }
166
+ // Create buffer from data
167
+ const bufferData = Buffer.isBuffer(data) ? data : Buffer.from(data);
168
+ // Use recipient public key or self public key
169
+ const targetPublicKey = recipientPublicKey || this._publicKey;
170
+ return this._eciesService.encryptSimpleOrSingle(false, targetPublicKey, bufferData);
171
+ }
172
+ decryptData(encryptedData) {
173
+ if (!this._privateKey) {
174
+ throw new MemberError(MemberErrorType.MissingPrivateKey, getEciesI18nEngine());
175
+ }
176
+ // decryptSingleWithHeader now returns the Buffer directly
177
+ return this._eciesService.decryptSimpleOrSingleWithHeader(false, Buffer.from(this._privateKey.value), encryptedData);
178
+ }
179
+ toJson() {
180
+ const storage = {
181
+ id: this._id.toString(),
182
+ type: this._type,
183
+ name: this._name,
184
+ email: this._email.toString(),
185
+ publicKey: this._publicKey.toString('base64'),
186
+ creatorId: this._creatorId.toString(),
187
+ dateCreated: this._dateCreated.toISOString(),
188
+ dateUpdated: this._dateUpdated.toISOString(),
189
+ };
190
+ return JSON.stringify(storage);
191
+ }
192
+ dispose() {
193
+ // Ensure secret material is zeroized when disposing
194
+ try {
195
+ this._privateKey?.dispose();
196
+ }
197
+ finally {
198
+ this.unloadWalletAndPrivateKey();
199
+ }
200
+ }
201
+ static fromJson(json,
202
+ // Add injected services as parameters
203
+ eciesService) {
204
+ const storage = JSON.parse(json);
205
+ const email = new EmailString(storage.email);
206
+ // Pass injected services to constructor
207
+ const dateCreated = new Date(storage.dateCreated);
208
+ return new Member(eciesService, storage.type, storage.name, email, Buffer.from(storage.publicKey, 'base64'), undefined, undefined, new ObjectId(storage.id), dateCreated, new Date(storage.dateUpdated), new ObjectId(storage.creatorId));
209
+ }
210
+ static fromMnemonic(mnemonic, eciesService) {
211
+ const { wallet } = eciesService.walletAndSeedFromMnemonic(mnemonic);
212
+ const privateKey = wallet.getPrivateKey();
213
+ const publicKeyWithPrefix = Buffer.concat([
214
+ Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
215
+ wallet.getPublicKey(),
216
+ ]);
217
+ return new Member(eciesService, MemberType.User, 'Test User', new EmailString('test@example.com'), publicKeyWithPrefix, new SecureBuffer(privateKey), wallet);
218
+ }
219
+ static newMember(
220
+ // Add injected services as parameters
221
+ eciesService,
222
+ // Original parameters
223
+ type, name, email, forceMnemonic, createdBy) {
224
+ // Validate inputs first
225
+ if (!name || name.length == 0) {
226
+ throw new MemberError(MemberErrorType.MissingMemberName, getEciesI18nEngine());
227
+ }
228
+ if (name.trim() != name) {
229
+ throw new MemberError(MemberErrorType.InvalidMemberNameWhitespace, getEciesI18nEngine());
230
+ }
231
+ if (!email || email.toString().length == 0) {
232
+ throw new MemberError(MemberErrorType.MissingEmail, getEciesI18nEngine());
233
+ }
234
+ if (email.toString().trim() != email.toString()) {
235
+ throw new MemberError(MemberErrorType.InvalidEmailWhitespace, getEciesI18nEngine());
236
+ }
237
+ // Use injected services
238
+ const mnemonic = forceMnemonic ?? eciesService.generateNewMnemonic();
239
+ const { wallet } = eciesService.walletAndSeedFromMnemonic(mnemonic);
240
+ // Get private key from wallet
241
+ const privateKey = wallet.getPrivateKey();
242
+ // Get public key with 0x04 prefix
243
+ const publicKeyWithPrefix = Buffer.concat([
244
+ Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
245
+ wallet.getPublicKey(),
246
+ ]);
247
+ const newId = new ObjectId();
248
+ const dateCreated = new Date();
249
+ return {
250
+ // Pass injected services to constructor
251
+ member: new Member(eciesService, type, name, email, publicKeyWithPrefix, new SecureBuffer(privateKey), wallet, newId, dateCreated, dateCreated, createdBy ?? newId),
252
+ mnemonic,
253
+ };
254
+ }
255
+ }
256
+ //# sourceMappingURL=member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.js","sourceRoot":"","sources":["../src/member.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX,kBAAkB,EAElB,WAAW,EACX,eAAe,EACf,UAAU,EACV,YAAY,GAEb,MAAM,4BAA4B,CAAC;AAIpC,0EAA0E;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAA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AK,CAAC,QAAQ,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC,sBAAsB,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACtF,CAAC;QAED,wBAAwB;QACxB,MAAM,QAAQ,GAAG,aAAa,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;QAEpE,8BAA8B;QAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QAC1C,kCAAkC;QAClC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACrC,MAAM,CAAC,YAAY,EAAE;SACtB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;QAC/B,OAAO;YACL,wCAAwC;YACxC,MAAM,EAAE,IAAI,MAAM,CAChB,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,mBAAmB,EACnB,IAAI,YAAY,CAAC,UAAU,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,IAAI,KAAK,CACnB;YACD,QAAQ;SACT,CAAC;IACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { IECIESConfig, 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
+ private readonly _config;
11
+ get config(): IECIESConfig;
12
+ constructor(config: IECIESConfig);
13
+ /**
14
+ * Validates and normalizes a public key for ECIES operations
15
+ * @param publicKey The public key to normalize
16
+ * @returns Properly formatted public key
17
+ */
18
+ normalizePublicKey(publicKey: Buffer): Buffer;
19
+ /**
20
+ * Generate a new mnemonic
21
+ * @returns {SecureString} The new mnemonic
22
+ */
23
+ generateNewMnemonic(): SecureString;
24
+ /**
25
+ * Generate a new wallet from a seed
26
+ * @param seed {Buffer} The seed to generate the wallet from
27
+ * @returns {Wallet} The new wallet
28
+ */
29
+ walletFromSeed(seed: Buffer): Wallet;
30
+ /**
31
+ * Generate a new wallet and seed from a mnemonic
32
+ * @param mnemonic {SecureString} The mnemonic to generate the wallet and seed from
33
+ * @returns {IWalletSeed} The new wallet and seed
34
+ */
35
+ walletAndSeedFromMnemonic(mnemonic: SecureString): IWalletSeed;
36
+ /**
37
+ * Generate a new wallet and seed from a mnemonic
38
+ * @param wallet {Wallet} The wallet to generate the key pair from
39
+ * @returns {ISimpleKeyPairBuffer} The new key pair
40
+ */
41
+ walletToSimpleKeyPairBuffer(wallet: Wallet): ISimpleKeyPairBuffer;
42
+ /**
43
+ * Create a simple key pair from a seed
44
+ * @param seed {Buffer} The seed to generate the key pair from
45
+ * @returns {ISimpleKeyPairBuffer} The new key pair
46
+ */
47
+ seedToSimpleKeyPairBuffer(seed: Buffer): ISimpleKeyPairBuffer;
48
+ /**
49
+ * Create a simple key pair from a mnemonic
50
+ * @param mnemonic {SecureString} The mnemonic to generate the key pair from
51
+ * @returns {ISimpleKeyPairBuffer} The new key pair
52
+ */
53
+ mnemonicToSimpleKeyPairBuffer(mnemonic: SecureString): ISimpleKeyPairBuffer;
54
+ }
55
+ //# sourceMappingURL=crypto-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-core.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAEZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAS,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,IAAW,MAAM,IAAI,YAAY,CAEhC;gBAEW,MAAM,EAAE,YAAY;IAIhC;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IA6CpD;;;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;CAIxB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Test helper for crypto-core debugging - this is a simpler implementation
3
+ * that will help us understand what's happening with the encryption/decryption cycle
4
+ */
5
+ /**
6
+ * Simple function to encrypt a message with a public key
7
+ */
8
+ export declare function encryptDebug(receiverPublicKey: Buffer, message: Buffer): Buffer;
9
+ /**
10
+ * Simple function to decrypt a message with a private key
11
+ */
12
+ export declare function decryptDebug(privateKey: Buffer, encryptedData: Buffer): Buffer;
13
+ //# sourceMappingURL=crypto-core.debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-core.debug.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAwDR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,MAAM,CAyDR"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Test helper for crypto-core debugging - this is a simpler implementation
3
+ * that will help us understand what's happening with the encryption/decryption cycle
4
+ */
5
+ import { ECIES } from '@digitaldefiance/ecies-lib';
6
+ import { createCipheriv, createDecipheriv, createECDH, randomBytes, } from 'crypto';
7
+ /**
8
+ * Simple function to encrypt a message with a public key
9
+ */
10
+ export function encryptDebug(receiverPublicKey, message) {
11
+ // Create a new ephemeral key pair for this message
12
+ const ecdh = createECDH(ECIES.CURVE_NAME);
13
+ ecdh.generateKeys();
14
+ // Normalize receiver's public key
15
+ let normalizedPublicKey = receiverPublicKey;
16
+ if (normalizedPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
17
+ normalizedPublicKey = Buffer.concat([
18
+ Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
19
+ normalizedPublicKey,
20
+ ]);
21
+ }
22
+ console.log('DEBUG: Receiver public key length:', normalizedPublicKey.length);
23
+ // Compute the shared secret
24
+ const sharedSecret = ecdh.computeSecret(normalizedPublicKey);
25
+ console.log('DEBUG: Shared secret length:', sharedSecret.length);
26
+ // Get ephemeral public key with correct format
27
+ let ephemeralPublicKey = ecdh.getPublicKey();
28
+ if (ephemeralPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
29
+ ephemeralPublicKey = Buffer.concat([
30
+ Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
31
+ ephemeralPublicKey,
32
+ ]);
33
+ }
34
+ console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
35
+ // Generate random IV
36
+ const iv = randomBytes(ECIES.IV_SIZE);
37
+ console.log('DEBUG: IV length:', iv.length);
38
+ // Create cipher
39
+ const cipher = createCipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
40
+ cipher.setAutoPadding(true);
41
+ // Encrypt the message
42
+ let encrypted = cipher.update(message);
43
+ encrypted = Buffer.concat([encrypted, cipher.final()]);
44
+ console.log('DEBUG: Encrypted data length:', encrypted.length);
45
+ // Get authentication tag
46
+ const authTag = cipher.getAuthTag();
47
+ console.log('DEBUG: Auth tag length:', authTag.length);
48
+ // Format the final encrypted buffer
49
+ const output = Buffer.concat([ephemeralPublicKey, iv, authTag, encrypted]);
50
+ console.log('DEBUG: Full output length:', output.length);
51
+ return output;
52
+ }
53
+ /**
54
+ * Simple function to decrypt a message with a private key
55
+ */
56
+ export function decryptDebug(privateKey, encryptedData) {
57
+ console.log('DEBUG: Input encrypted data length:', encryptedData.length);
58
+ // Parse header components
59
+ const ephemeralPublicKey = encryptedData.subarray(0, ECIES.PUBLIC_KEY_LENGTH);
60
+ console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
61
+ const iv = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE);
62
+ console.log('DEBUG: IV length:', iv.length);
63
+ const authTag = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
64
+ console.log('DEBUG: Auth tag length:', authTag.length);
65
+ // Extract the ciphertext
66
+ const encrypted = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
67
+ console.log('DEBUG: Ciphertext length:', encrypted.length);
68
+ // Set up ECDH
69
+ const ecdh = createECDH(ECIES.CURVE_NAME);
70
+ ecdh.setPrivateKey(privateKey);
71
+ // Compute shared secret
72
+ const sharedSecret = ecdh.computeSecret(ephemeralPublicKey);
73
+ console.log('DEBUG: Shared secret length:', sharedSecret.length);
74
+ // Create decipher
75
+ const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
76
+ // Set authentication tag
77
+ decipher.setAuthTag(authTag);
78
+ // Decrypt the data
79
+ try {
80
+ let decrypted = decipher.update(encrypted);
81
+ decrypted = Buffer.concat([decrypted, decipher.final()]);
82
+ console.log('DEBUG: Decrypted data length:', decrypted.length);
83
+ return decrypted;
84
+ }
85
+ catch (error) {
86
+ console.error('DEBUG: Decryption failed:', error);
87
+ console.log('DEBUG: First few bytes of ciphertext:', encrypted.subarray(0, 16));
88
+ throw error;
89
+ }
90
+ }
91
+ //# sourceMappingURL=crypto-core.debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-core.debug.js","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,QAAQ,CAAC;AAIhB;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,iBAAyB,EACzB,OAAe;IAEf,mDAAmD;IACnD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;IAEpB,kCAAkC;IAClC,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;IAC5C,IAAI,mBAAmB,CAAC,MAAM,KAAK,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAC/D,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACrC,mBAAmB;SACpB,CAAC,CAAC;IACL,CAAC;IACD,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1B,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { ECIES, ECIESError, ECIESErrorTypeEnum, getEciesI18nEngine, SecureBuffer, SecureString, } from '@digitaldefiance/ecies-lib';
2
+ import { hdkey } from '@ethereumjs/wallet';
3
+ import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from 'bip39';
4
+ /**
5
+ * Core encryption and decryption functions for ECIES
6
+ * Includes coverage for simple and single modes, does not cover multiple mode which is in a separate module
7
+ */
8
+ export class EciesCryptoCore {
9
+ _config;
10
+ get config() {
11
+ return this._config;
12
+ }
13
+ constructor(config) {
14
+ this._config = config;
15
+ }
16
+ /**
17
+ * Validates and normalizes a public key for ECIES operations
18
+ * @param publicKey The public key to normalize
19
+ * @returns Properly formatted public key
20
+ */
21
+ normalizePublicKey(publicKey) {
22
+ if (!publicKey) {
23
+ throw new ECIESError(ECIESErrorTypeEnum.InvalidEphemeralPublicKey, getEciesI18nEngine(), undefined, undefined, {
24
+ error: 'Received null or undefined public key',
25
+ });
26
+ }
27
+ const keyLength = publicKey.length;
28
+ // Already in correct format (65 bytes with 0x04 prefix)
29
+ if (keyLength === ECIES.PUBLIC_KEY_LENGTH &&
30
+ publicKey[0] === ECIES.PUBLIC_KEY_MAGIC) {
31
+ return publicKey;
32
+ }
33
+ // Raw key without prefix (64 bytes) - add the 0x04 prefix
34
+ if (keyLength === ECIES.RAW_PUBLIC_KEY_LENGTH) {
35
+ return Buffer.concat([Buffer.from([ECIES.PUBLIC_KEY_MAGIC]), publicKey]);
36
+ }
37
+ // Invalid format
38
+ throw new ECIESError(ECIESErrorTypeEnum.InvalidEphemeralPublicKey, getEciesI18nEngine(), undefined, undefined, {
39
+ error: 'Invalid public key format or length',
40
+ keyLength: String(keyLength),
41
+ expectedLength64: String(ECIES.RAW_PUBLIC_KEY_LENGTH),
42
+ expectedLength65: String(ECIES.PUBLIC_KEY_LENGTH),
43
+ keyPrefix: keyLength > 0 ? String(publicKey[0]) : 'N/A',
44
+ expectedPrefix: String(ECIES.PUBLIC_KEY_MAGIC),
45
+ });
46
+ }
47
+ /**
48
+ * Generate a new mnemonic
49
+ * @returns {SecureString} The new mnemonic
50
+ */
51
+ generateNewMnemonic() {
52
+ return new SecureString(generateMnemonic(this._config.mnemonicStrength));
53
+ }
54
+ /**
55
+ * Generate a new wallet from a seed
56
+ * @param seed {Buffer} The seed to generate the wallet from
57
+ * @returns {Wallet} The new wallet
58
+ */
59
+ walletFromSeed(seed) {
60
+ const hdWallet = hdkey.EthereumHDKey.fromMasterSeed(seed);
61
+ return hdWallet
62
+ .derivePath(this._config.primaryKeyDerivationPath)
63
+ .getWallet();
64
+ }
65
+ /**
66
+ * Generate a new wallet and seed from a mnemonic
67
+ * @param mnemonic {SecureString} The mnemonic to generate the wallet and seed from
68
+ * @returns {IWalletSeed} The new wallet and seed
69
+ */
70
+ walletAndSeedFromMnemonic(mnemonic) {
71
+ if (!mnemonic.value || !validateMnemonic(mnemonic.value)) {
72
+ throw new ECIESError(ECIESErrorTypeEnum.InvalidMnemonic, getEciesI18nEngine());
73
+ }
74
+ const seed = mnemonicToSeedSync(mnemonic.value);
75
+ const wallet = this.walletFromSeed(seed);
76
+ return {
77
+ seed: new SecureBuffer(seed),
78
+ wallet,
79
+ };
80
+ }
81
+ /**
82
+ * Generate a new wallet and seed from a mnemonic
83
+ * @param wallet {Wallet} The wallet to generate the key pair from
84
+ * @returns {ISimpleKeyPairBuffer} The new key pair
85
+ */
86
+ walletToSimpleKeyPairBuffer(wallet) {
87
+ const privateKey = Buffer.from(wallet.getPrivateKey());
88
+ const buf04 = new Uint8Array(1);
89
+ buf04[0] = ECIES.PUBLIC_KEY_MAGIC;
90
+ const publicKey = Buffer.concat([buf04, wallet.getPublicKey()]);
91
+ return {
92
+ privateKey,
93
+ publicKey,
94
+ };
95
+ }
96
+ /**
97
+ * Create a simple key pair from a seed
98
+ * @param seed {Buffer} The seed to generate the key pair from
99
+ * @returns {ISimpleKeyPairBuffer} The new key pair
100
+ */
101
+ seedToSimpleKeyPairBuffer(seed) {
102
+ const wallet = this.walletFromSeed(seed);
103
+ return this.walletToSimpleKeyPairBuffer(wallet);
104
+ }
105
+ /**
106
+ * Create a simple key pair from a mnemonic
107
+ * @param mnemonic {SecureString} The mnemonic to generate the key pair from
108
+ * @returns {ISimpleKeyPairBuffer} The new key pair
109
+ */
110
+ mnemonicToSimpleKeyPairBuffer(mnemonic) {
111
+ const { seed } = this.walletAndSeedFromMnemonic(mnemonic);
112
+ return this.seedToSimpleKeyPairBuffer(Buffer.from(seed.value));
113
+ }
114
+ }
115
+ //# sourceMappingURL=crypto-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-core.js","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAElB,YAAY,EACZ,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,EAAU,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI/E;;;GAGG;AACH,MAAM,OAAO,eAAe;IACT,OAAO,CAAe;IACvC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,SAAiB;QACzC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,UAAU,CAClB,kBAAkB,CAAC,yBAAyB,EAC5C,kBAAkB,EAAE,EACpB,SAAS,EACT,SAAS,EACT;gBACE,KAAK,EAAE,uCAAuC;aAC/C,CACF,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC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,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=debug-aes-gcm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-aes-gcm.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/debug-aes-gcm.ts"],"names":[],"mappings":""}