@eluvio/elv-client-js 4.2.10 → 4.2.11

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 (40) hide show
  1. package/dist/ElvClient-min.js +1 -1
  2. package/dist/ElvClient-node-min.js +1 -1
  3. package/dist/ElvFrameClient-min.js +1 -1
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +1 -1
  6. package/dist/ElvWalletClient-node-min.js +1 -1
  7. package/dist/src/AuthorizationClient.js +723 -710
  8. package/dist/src/ContentObjectAudit.js +56 -56
  9. package/dist/src/ContentObjectVerification.js +281 -0
  10. package/dist/src/Crypto.js +85 -85
  11. package/dist/src/ElvClient.js +500 -530
  12. package/dist/src/ElvWallet.js +28 -30
  13. package/dist/src/EthClient.js +311 -311
  14. package/dist/src/FrameClient.js +64 -63
  15. package/dist/src/HttpClient.js +60 -60
  16. package/dist/src/Id.js +2 -1
  17. package/dist/src/PermissionsClient.js +487 -499
  18. package/dist/src/RemoteSigner.js +163 -114
  19. package/dist/src/UserProfileClient.js +374 -392
  20. package/dist/src/Utils.js +66 -69
  21. package/dist/src/Validation.js +10 -10
  22. package/dist/src/client/ABRPublishing.js +238 -238
  23. package/dist/src/client/AccessGroups.js +474 -477
  24. package/dist/src/client/ContentAccess.js +1709 -1705
  25. package/dist/src/client/ContentManagement.js +871 -871
  26. package/dist/src/client/Contracts.js +578 -575
  27. package/dist/src/client/Files.js +684 -700
  28. package/dist/src/client/LiveConf.js +6 -1
  29. package/dist/src/client/LiveStream.js +686 -723
  30. package/dist/src/client/NFT.js +14 -14
  31. package/dist/src/client/NTP.js +84 -84
  32. package/dist/src/client/Shares.js +60 -53
  33. package/dist/src/walletClient/ClientMethods.js +951 -977
  34. package/dist/src/walletClient/Notifications.js +14 -14
  35. package/dist/src/walletClient/Profile.js +66 -66
  36. package/dist/src/walletClient/Utils.js +15 -15
  37. package/dist/src/walletClient/index.js +581 -579
  38. package/package.json +1 -1
  39. package/src/client/LiveConf.js +5 -1
  40. package/src/client/LiveStream.js +9 -39
@@ -1,7 +1,7 @@
1
1
  var _typeof = require("@babel/runtime/helpers/typeof");
2
2
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
3
3
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
4
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
4
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
5
5
  if (typeof globalThis.Buffer === "undefined") {
6
6
  globalThis.Buffer = require("buffer/").Buffer;
7
7
  }
@@ -26,40 +26,40 @@ if (typeof crypto === "undefined") {
26
26
  */
27
27
  var Crypto = {
28
28
  ElvCrypto: function () {
29
- var _ElvCrypto = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
30
- var _ElvCrypto2, _t;
31
- return _regeneratorRuntime.wrap(function (_context) {
29
+ var _ElvCrypto = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
30
+ var _ElvCrypto2;
31
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
32
32
  while (1) switch (_context.prev = _context.next) {
33
33
  case 0:
34
34
  _context.prev = 0;
35
35
  if (Crypto.elvCrypto) {
36
- _context.next = 3;
36
+ _context.next = 8;
37
37
  break;
38
38
  }
39
- _context.next = 1;
39
+ _context.next = 4;
40
40
  return Promise.resolve().then(function () {
41
41
  return _interopRequireWildcard(require("@eluvio/crypto"));
42
42
  });
43
- case 1:
43
+ case 4:
44
44
  _ElvCrypto2 = _context.sent["default"];
45
- _context.next = 2;
45
+ _context.next = 7;
46
46
  return new _ElvCrypto2().init();
47
- case 2:
47
+ case 7:
48
48
  Crypto.elvCrypto = _context.sent;
49
- case 3:
49
+ case 8:
50
50
  return _context.abrupt("return", Crypto.elvCrypto);
51
- case 4:
52
- _context.prev = 4;
53
- _t = _context["catch"](0);
51
+ case 11:
52
+ _context.prev = 11;
53
+ _context.t0 = _context["catch"](0);
54
54
  // eslint-disable-next-line no-console
55
55
  console.error("Error initializing ElvCrypto:");
56
56
  // eslint-disable-next-line no-console
57
- console.error(_t);
58
- case 5:
57
+ console.error(_context.t0);
58
+ case 15:
59
59
  case "end":
60
60
  return _context.stop();
61
61
  }
62
- }, _callee, null, [[0, 4]]);
62
+ }, _callee, null, [[0, 11]]);
63
63
  }));
64
64
  function ElvCrypto() {
65
65
  return _ElvCrypto.apply(this, arguments);
@@ -90,27 +90,27 @@ var Crypto = {
90
90
  return reencrypt ? encryptedBlockSize + targetEncBlockOverhead : encryptedBlockSize + primaryEncBlockOverhead;
91
91
  },
92
92
  EncryptConk: function EncryptConk(conk, publicKey) {
93
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
93
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
94
94
  var elvCrypto, _yield$elvCrypto$encr, data, ephemeralKey, tag, cap;
95
- return _regeneratorRuntime.wrap(function (_context2) {
95
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
96
96
  while (1) switch (_context2.prev = _context2.next) {
97
97
  case 0:
98
- _context2.next = 1;
98
+ _context2.next = 2;
99
99
  return Crypto.ElvCrypto();
100
- case 1:
100
+ case 2:
101
101
  elvCrypto = _context2.sent;
102
102
  publicKey = new Uint8Array(Buffer.from(publicKey.replace("0x", ""), "hex"));
103
103
  conk = new Uint8Array(Buffer.from(JSON.stringify(conk)));
104
- _context2.next = 2;
104
+ _context2.next = 7;
105
105
  return elvCrypto.encryptECIES(conk, publicKey);
106
- case 2:
106
+ case 7:
107
107
  _yield$elvCrypto$encr = _context2.sent;
108
108
  data = _yield$elvCrypto$encr.data;
109
109
  ephemeralKey = _yield$elvCrypto$encr.ephemeralKey;
110
110
  tag = _yield$elvCrypto$encr.tag;
111
111
  cap = Buffer.concat([Buffer.from(ephemeralKey), Buffer.from(tag), Buffer.from(data)]);
112
112
  return _context2.abrupt("return", Utils.B64(cap));
113
- case 3:
113
+ case 13:
114
114
  case "end":
115
115
  return _context2.stop();
116
116
  }
@@ -118,14 +118,14 @@ var Crypto = {
118
118
  }))();
119
119
  },
120
120
  DecryptCap: function DecryptCap(encryptedCap, privateKey) {
121
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
121
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
122
122
  var elvCrypto, ephemeralKey, tag, data, cap;
123
- return _regeneratorRuntime.wrap(function (_context3) {
123
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
124
124
  while (1) switch (_context3.prev = _context3.next) {
125
125
  case 0:
126
- _context3.next = 1;
126
+ _context3.next = 2;
127
127
  return Crypto.ElvCrypto();
128
- case 1:
128
+ case 2:
129
129
  elvCrypto = _context3.sent;
130
130
  privateKey = new Uint8Array(Buffer.from(privateKey.replace("0x", ""), "hex"));
131
131
  encryptedCap = Buffer.from(encryptedCap, "base64");
@@ -134,7 +134,7 @@ var Crypto = {
134
134
  data = encryptedCap.slice(81);
135
135
  cap = elvCrypto.decryptECIES(new Uint8Array(data), privateKey, new Uint8Array(ephemeralKey), new Uint8Array(tag));
136
136
  return _context3.abrupt("return", JSON.parse(Buffer.from(cap).toString()));
137
- case 2:
137
+ case 10:
138
138
  case "end":
139
139
  return _context3.stop();
140
140
  }
@@ -142,15 +142,15 @@ var Crypto = {
142
142
  }))();
143
143
  },
144
144
  GeneratePrimaryConk: function GeneratePrimaryConk(_ref) {
145
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
145
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
146
146
  var spaceId, objectId, elvCrypto, _elvCrypto$generatePr, secretKey, publicKey, symmetricKey;
147
- return _regeneratorRuntime.wrap(function (_context4) {
147
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
148
148
  while (1) switch (_context4.prev = _context4.next) {
149
149
  case 0:
150
150
  spaceId = _ref.spaceId, objectId = _ref.objectId;
151
- _context4.next = 1;
151
+ _context4.next = 3;
152
152
  return Crypto.ElvCrypto();
153
- case 1:
153
+ case 3:
154
154
  elvCrypto = _context4.sent;
155
155
  _elvCrypto$generatePr = elvCrypto.generatePrimaryKeys(), secretKey = _elvCrypto$generatePr.secretKey, publicKey = _elvCrypto$generatePr.publicKey;
156
156
  symmetricKey = elvCrypto.generateSymmetricKey().key;
@@ -161,7 +161,7 @@ var Crypto = {
161
161
  sid: spaceId,
162
162
  qid: objectId
163
163
  });
164
- case 2:
164
+ case 7:
165
165
  case "end":
166
166
  return _context4.stop();
167
167
  }
@@ -169,21 +169,21 @@ var Crypto = {
169
169
  }))();
170
170
  },
171
171
  GenerateTargetConk: function GenerateTargetConk() {
172
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
172
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
173
173
  var elvCrypto, _elvCrypto$generateTa, secretKey, publicKey;
174
- return _regeneratorRuntime.wrap(function (_context5) {
174
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
175
175
  while (1) switch (_context5.prev = _context5.next) {
176
176
  case 0:
177
- _context5.next = 1;
177
+ _context5.next = 2;
178
178
  return Crypto.ElvCrypto();
179
- case 1:
179
+ case 2:
180
180
  elvCrypto = _context5.sent;
181
181
  _elvCrypto$generateTa = elvCrypto.generateTargetKeys(), secretKey = _elvCrypto$generateTa.secretKey, publicKey = _elvCrypto$generateTa.publicKey;
182
182
  return _context5.abrupt("return", {
183
183
  secret_key: "kpsk".concat(bs58.encode(Buffer.from(secretKey))),
184
184
  public_key: "ktpk".concat(bs58.encode(Buffer.from(publicKey)))
185
185
  });
186
- case 2:
186
+ case 5:
187
187
  case "end":
188
188
  return _context5.stop();
189
189
  }
@@ -201,14 +201,14 @@ var Crypto = {
201
201
  };
202
202
  },
203
203
  EncryptionContext: function EncryptionContext(cap) {
204
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
204
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
205
205
  var elvCrypto, _Crypto$CapToConk, symmetricKey, secretKey, publicKey, context, type;
206
- return _regeneratorRuntime.wrap(function (_context6) {
206
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
207
207
  while (1) switch (_context6.prev = _context6.next) {
208
208
  case 0:
209
- _context6.next = 1;
209
+ _context6.next = 2;
210
210
  return Crypto.ElvCrypto();
211
- case 1:
211
+ case 2:
212
212
  elvCrypto = _context6.sent;
213
213
  _Crypto$CapToConk = Crypto.CapToConk(cap), symmetricKey = _Crypto$CapToConk.symmetricKey, secretKey = _Crypto$CapToConk.secretKey, publicKey = _Crypto$CapToConk.publicKey;
214
214
  if (publicKey.length === elvCrypto.PRIMARY_PK_KEY_SIZE) {
@@ -224,7 +224,7 @@ var Crypto = {
224
224
  context: context,
225
225
  type: type
226
226
  });
227
- case 2:
227
+ case 6:
228
228
  case "end":
229
229
  return _context6.stop();
230
230
  }
@@ -241,26 +241,26 @@ var Crypto = {
241
241
  * @returns {Promise<Buffer>} - Decrypted data
242
242
  */
243
243
  Encrypt: function () {
244
- var _Encrypt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(cap, data) {
245
- var stream, dataArray, i, end, encryptedChunks, _t2, _t3;
246
- return _regeneratorRuntime.wrap(function (_context7) {
244
+ var _Encrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(cap, data) {
245
+ var stream, dataArray, i, end, encryptedChunks;
246
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
247
247
  while (1) switch (_context7.prev = _context7.next) {
248
248
  case 0:
249
- _context7.next = 1;
249
+ _context7.next = 2;
250
250
  return Crypto.OpenEncryptionStream(cap);
251
- case 1:
251
+ case 2:
252
252
  stream = _context7.sent;
253
253
  if (!(!Buffer.isBuffer(data) && !(data instanceof ArrayBuffer))) {
254
- _context7.next = 3;
254
+ _context7.next = 9;
255
255
  break;
256
256
  }
257
- _t2 = Buffer;
258
- _context7.next = 2;
257
+ _context7.t0 = Buffer;
258
+ _context7.next = 7;
259
259
  return new Response(data).arrayBuffer();
260
- case 2:
261
- _t3 = _context7.sent;
262
- data = _t2.from.call(_t2, _t3);
263
- case 3:
260
+ case 7:
261
+ _context7.t1 = _context7.sent;
262
+ data = _context7.t0.from.call(_context7.t0, _context7.t1);
263
+ case 9:
264
264
  dataArray = new Uint8Array(data);
265
265
  for (i = 0; i < dataArray.length; i += 1000000) {
266
266
  end = Math.min(dataArray.length, i + 1000000);
@@ -268,7 +268,7 @@ var Crypto = {
268
268
  }
269
269
  stream.end();
270
270
  encryptedChunks = [];
271
- _context7.next = 4;
271
+ _context7.next = 15;
272
272
  return new Promise(function (resolve, reject) {
273
273
  stream.on("data", function (chunk) {
274
274
  encryptedChunks.push(chunk);
@@ -278,9 +278,9 @@ var Crypto = {
278
278
  reject(e);
279
279
  });
280
280
  });
281
- case 4:
281
+ case 15:
282
282
  return _context7.abrupt("return", Buffer.concat(encryptedChunks));
283
- case 5:
283
+ case 16:
284
284
  case "end":
285
285
  return _context7.stop();
286
286
  }
@@ -292,18 +292,18 @@ var Crypto = {
292
292
  return Encrypt;
293
293
  }(),
294
294
  OpenEncryptionStream: function () {
295
- var _OpenEncryptionStream = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(cap) {
295
+ var _OpenEncryptionStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(cap) {
296
296
  var elvCrypto, _yield$Crypto$Encrypt, context, stream, cipher;
297
- return _regeneratorRuntime.wrap(function (_context8) {
297
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
298
298
  while (1) switch (_context8.prev = _context8.next) {
299
299
  case 0:
300
- _context8.next = 1;
300
+ _context8.next = 2;
301
301
  return Crypto.ElvCrypto();
302
- case 1:
302
+ case 2:
303
303
  elvCrypto = _context8.sent;
304
- _context8.next = 2;
304
+ _context8.next = 5;
305
305
  return Crypto.EncryptionContext(cap);
306
- case 2:
306
+ case 5:
307
307
  _yield$Crypto$Encrypt = _context8.sent;
308
308
  context = _yield$Crypto$Encrypt.context;
309
309
  stream = new Stream.PassThrough();
@@ -313,7 +313,7 @@ var Crypto = {
313
313
  }).on("error", function (e) {
314
314
  throw Error(e);
315
315
  }));
316
- case 3:
316
+ case 10:
317
317
  case "end":
318
318
  return _context8.stop();
319
319
  }
@@ -334,14 +334,14 @@ var Crypto = {
334
334
  * @returns {Promise<Buffer>} - Decrypted data
335
335
  */
336
336
  Decrypt: function () {
337
- var _Decrypt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(cap, encryptedData) {
337
+ var _Decrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(cap, encryptedData) {
338
338
  var stream, dataArray, i, end, decryptedChunks;
339
- return _regeneratorRuntime.wrap(function (_context9) {
339
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
340
340
  while (1) switch (_context9.prev = _context9.next) {
341
341
  case 0:
342
- _context9.next = 1;
342
+ _context9.next = 2;
343
343
  return Crypto.OpenDecryptionStream(cap);
344
- case 1:
344
+ case 2:
345
345
  stream = _context9.sent;
346
346
  dataArray = new Uint8Array(encryptedData);
347
347
  for (i = 0; i < dataArray.length; i += 1000000) {
@@ -350,7 +350,7 @@ var Crypto = {
350
350
  }
351
351
  stream.end();
352
352
  decryptedChunks = [];
353
- _context9.next = 2;
353
+ _context9.next = 9;
354
354
  return new Promise(function (resolve, reject) {
355
355
  stream.on("data", function (chunk) {
356
356
  decryptedChunks.push(chunk);
@@ -360,9 +360,9 @@ var Crypto = {
360
360
  reject(e);
361
361
  });
362
362
  });
363
- case 2:
363
+ case 9:
364
364
  return _context9.abrupt("return", Buffer.concat(decryptedChunks));
365
- case 3:
365
+ case 10:
366
366
  case "end":
367
367
  return _context9.stop();
368
368
  }
@@ -374,33 +374,33 @@ var Crypto = {
374
374
  return Decrypt;
375
375
  }(),
376
376
  OpenDecryptionStream: function () {
377
- var _OpenDecryptionStream = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(cap) {
377
+ var _OpenDecryptionStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(cap) {
378
378
  var elvCrypto, _yield$Crypto$Encrypt2, context, type, stream, decipher;
379
- return _regeneratorRuntime.wrap(function (_context0) {
380
- while (1) switch (_context0.prev = _context0.next) {
379
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
380
+ while (1) switch (_context10.prev = _context10.next) {
381
381
  case 0:
382
- _context0.next = 1;
382
+ _context10.next = 2;
383
383
  return Crypto.ElvCrypto();
384
- case 1:
385
- elvCrypto = _context0.sent;
386
- _context0.next = 2;
387
- return Crypto.EncryptionContext(cap);
388
384
  case 2:
389
- _yield$Crypto$Encrypt2 = _context0.sent;
385
+ elvCrypto = _context10.sent;
386
+ _context10.next = 5;
387
+ return Crypto.EncryptionContext(cap);
388
+ case 5:
389
+ _yield$Crypto$Encrypt2 = _context10.sent;
390
390
  context = _yield$Crypto$Encrypt2.context;
391
391
  type = _yield$Crypto$Encrypt2.type;
392
392
  stream = new Stream.PassThrough();
393
393
  decipher = elvCrypto.createDecipher(type, context);
394
- return _context0.abrupt("return", stream.pipe(decipher).on("finish", function () {
394
+ return _context10.abrupt("return", stream.pipe(decipher).on("finish", function () {
395
395
  context.free();
396
396
  }).on("error", function (e) {
397
397
  throw Error(e);
398
398
  }));
399
- case 3:
399
+ case 11:
400
400
  case "end":
401
- return _context0.stop();
401
+ return _context10.stop();
402
402
  }
403
- }, _callee0);
403
+ }, _callee10);
404
404
  }));
405
405
  function OpenDecryptionStream(_x6) {
406
406
  return _OpenDecryptionStream.apply(this, arguments);