@eluvio/elv-client-js 4.2.30 → 4.2.31

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.
@@ -15,15 +15,13 @@ var UrlJoin = require("url-join");
15
15
  var objectPath = require("object-path");
16
16
  var HttpClient = require("../HttpClient");
17
17
  var ContentObjectAudit = require("../ContentObjectAudit");
18
- var bs58 = require("bs58");
19
18
  var _require = require("../Validation"),
20
19
  ValidateLibrary = _require.ValidateLibrary,
21
20
  ValidateObject = _require.ValidateObject,
22
21
  ValidateVersion = _require.ValidateVersion,
23
22
  ValidatePartHash = _require.ValidatePartHash,
24
23
  ValidateWriteToken = _require.ValidateWriteToken,
25
- ValidateParameters = _require.ValidateParameters,
26
- ValidatePresence = _require.ValidatePresence;
24
+ ValidateParameters = _require.ValidateParameters;
27
25
  var MergeWith = require("lodash/mergeWith");
28
26
  var LodashSet = require("lodash/set");
29
27
  var LodashGet = require("lodash/get");
@@ -4309,98 +4307,6 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
4309
4307
  };
4310
4308
  }();
4311
4309
 
4312
- /**
4313
- * Encrypt the owner encryption key using the new user details provided
4314
- *
4315
- * @methodGroup Encryption
4316
- * @namedParams
4317
- * @param {string=} libraryId - ID of a library
4318
- * @param {string=} objectId - ID of an object
4319
- * @param {string=} versionHash - Hash of an object version
4320
- * @param {string=} writeToken - The write token for the object
4321
- * @param {Object=} newEncodedUserPublicKey - raw public key or base-58 encoded publicKey of the new user prefixed 'kupk'
4322
- */
4323
- exports.MigrateEncryptionConkForUserProvided = /*#__PURE__*/function () {
4324
- var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref87) {
4325
- var libraryId, objectId, versionHash, writeToken, newEncodedUserPublicKey, publicKey, publicKeyBytes, existingCapKey, existingUserCap, encryptedConk, newUserCap;
4326
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
4327
- while (1) switch (_context48.prev = _context48.next) {
4328
- case 0:
4329
- libraryId = _ref87.libraryId, objectId = _ref87.objectId, versionHash = _ref87.versionHash, writeToken = _ref87.writeToken, newEncodedUserPublicKey = _ref87.newEncodedUserPublicKey;
4330
- if (!this.signer.remoteSigner) {
4331
- _context48.next = 3;
4332
- break;
4333
- }
4334
- return _context48.abrupt("return");
4335
- case 3:
4336
- ValidateParameters({
4337
- libraryId: libraryId,
4338
- objectId: objectId,
4339
- versionHash: versionHash
4340
- });
4341
- ValidateWriteToken(writeToken);
4342
- if (!objectId) {
4343
- objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4344
- }
4345
- ValidatePresence("newEncodedUserPublicKey", newEncodedUserPublicKey);
4346
- if (!newEncodedUserPublicKey.startsWith("kupk")) {
4347
- publicKey = newEncodedUserPublicKey;
4348
- } else {
4349
- publicKeyBytes = bs58.decode(newEncodedUserPublicKey.slice(4));
4350
- if (publicKeyBytes.length !== 65) {
4351
- publicKey = "0x" + Buffer.concat([Buffer.from([0x04]), publicKeyBytes]).toString("hex");
4352
- } else {
4353
- publicKey = "0x" + publicKeyBytes.toString("hex");
4354
- }
4355
- }
4356
-
4357
- // Decrypt using existing user key
4358
- existingCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
4359
- _context48.next = 11;
4360
- return this.ContentObjectMetadata({
4361
- libraryId: libraryId,
4362
- objectId: objectId,
4363
- writeToken: writeToken,
4364
- metadataSubtree: existingCapKey
4365
- });
4366
- case 11:
4367
- existingUserCap = _context48.sent;
4368
- if (existingUserCap) {
4369
- _context48.next = 14;
4370
- break;
4371
- }
4372
- throw "No encryption conk present for ".concat(objectId, " for user ").concat(this.signer.address);
4373
- case 14:
4374
- _context48.next = 16;
4375
- return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
4376
- case 16:
4377
- this.encryptionConks[objectId] = _context48.sent;
4378
- _context48.next = 19;
4379
- return this.Crypto.EncryptConk(this.encryptionConks[objectId], publicKey);
4380
- case 19:
4381
- encryptedConk = _context48.sent;
4382
- newUserCap = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.utils.PublicKeyToAddress(publicKey)));
4383
- _context48.next = 23;
4384
- return this.ReplaceMetadata({
4385
- libraryId: libraryId,
4386
- objectId: objectId,
4387
- writeToken: writeToken,
4388
- metadataSubtree: newUserCap,
4389
- metadata: encryptedConk
4390
- });
4391
- case 23:
4392
- return _context48.abrupt("return", this.encryptionConks[objectId]);
4393
- case 24:
4394
- case "end":
4395
- return _context48.stop();
4396
- }
4397
- }, _callee48, this);
4398
- }));
4399
- return function (_x44) {
4400
- return _ref88.apply(this, arguments);
4401
- };
4402
- }();
4403
-
4404
4310
  /**
4405
4311
  * Retrieve the encryption conk for the specified object. If one has not yet been created
4406
4312
  * and a writeToken has been specified, this method will create a new conk and
@@ -4419,12 +4325,12 @@ exports.MigrateEncryptionConkForUserProvided = /*#__PURE__*/function () {
4419
4325
  * @return Promise<Object> - The encryption conk for the object
4420
4326
  */
4421
4327
  exports.EncryptionConk = /*#__PURE__*/function () {
4422
- var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref89) {
4423
- var libraryId, objectId, versionHash, writeToken, _ref89$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
4424
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
4425
- while (1) switch (_context49.prev = _context49.next) {
4328
+ var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref87) {
4329
+ var libraryId, objectId, versionHash, writeToken, _ref87$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
4330
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
4331
+ while (1) switch (_context48.prev = _context48.next) {
4426
4332
  case 0:
4427
- libraryId = _ref89.libraryId, objectId = _ref89.objectId, versionHash = _ref89.versionHash, writeToken = _ref89.writeToken, _ref89$download = _ref89.download, download = _ref89$download === void 0 ? false : _ref89$download;
4333
+ libraryId = _ref87.libraryId, objectId = _ref87.objectId, versionHash = _ref87.versionHash, writeToken = _ref87.writeToken, _ref87$download = _ref87.download, download = _ref87$download === void 0 ? false : _ref87$download;
4428
4334
  ValidateParameters({
4429
4335
  libraryId: libraryId,
4430
4336
  objectId: objectId,
@@ -4436,14 +4342,14 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4436
4342
  if (!objectId) {
4437
4343
  objectId = client.DecodeVersionHash(versionHash).objectId;
4438
4344
  }
4439
- _context49.next = 6;
4345
+ _context48.next = 6;
4440
4346
  return this.authClient.Owner({
4441
4347
  id: objectId
4442
4348
  });
4443
4349
  case 6:
4444
- owner = _context49.sent;
4350
+ owner = _context48.sent;
4445
4351
  ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
4446
- _context49.next = 10;
4352
+ _context48.next = 10;
4447
4353
  return this.ContentObjectMetadata({
4448
4354
  libraryId: libraryId,
4449
4355
  objectId: objectId,
@@ -4452,39 +4358,39 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4452
4358
  metadataSubtree: ownerCapKey
4453
4359
  });
4454
4360
  case 10:
4455
- ownerCap = _context49.sent;
4361
+ ownerCap = _context48.sent;
4456
4362
  if (!(!this.utils.EqualAddress(owner, this.signer.address) && !ownerCap)) {
4457
- _context49.next = 21;
4363
+ _context48.next = 21;
4458
4364
  break;
4459
4365
  }
4460
4366
  if (!download) {
4461
- _context49.next = 18;
4367
+ _context48.next = 18;
4462
4368
  break;
4463
4369
  }
4464
- _context49.next = 15;
4370
+ _context48.next = 15;
4465
4371
  return this.authClient.ReEncryptionConk({
4466
4372
  libraryId: libraryId,
4467
4373
  objectId: objectId,
4468
4374
  versionHash: versionHash
4469
4375
  });
4470
4376
  case 15:
4471
- return _context49.abrupt("return", _context49.sent);
4377
+ return _context48.abrupt("return", _context48.sent);
4472
4378
  case 18:
4473
- _context49.next = 20;
4379
+ _context48.next = 20;
4474
4380
  return this.authClient.EncryptionConk({
4475
4381
  libraryId: libraryId,
4476
4382
  objectId: objectId,
4477
4383
  versionHash: versionHash
4478
4384
  });
4479
4385
  case 20:
4480
- return _context49.abrupt("return", _context49.sent);
4386
+ return _context48.abrupt("return", _context48.sent);
4481
4387
  case 21:
4482
4388
  if (this.encryptionConks[objectId]) {
4483
- _context49.next = 38;
4389
+ _context48.next = 38;
4484
4390
  break;
4485
4391
  }
4486
4392
  capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
4487
- _context49.next = 25;
4393
+ _context48.next = 25;
4488
4394
  return this.ContentObjectMetadata({
4489
4395
  libraryId: libraryId,
4490
4396
  objectId: objectId,
@@ -4494,23 +4400,23 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4494
4400
  metadataSubtree: capKey
4495
4401
  });
4496
4402
  case 25:
4497
- existingUserCap = _context49.sent;
4403
+ existingUserCap = _context48.sent;
4498
4404
  if (!existingUserCap) {
4499
- _context49.next = 32;
4405
+ _context48.next = 32;
4500
4406
  break;
4501
4407
  }
4502
- _context49.next = 29;
4408
+ _context48.next = 29;
4503
4409
  return this.Crypto.DecryptCap(existingUserCap, this.signer);
4504
4410
  case 29:
4505
- this.encryptionConks[objectId] = _context49.sent;
4506
- _context49.next = 38;
4411
+ this.encryptionConks[objectId] = _context48.sent;
4412
+ _context48.next = 38;
4507
4413
  break;
4508
4414
  case 32:
4509
4415
  if (!writeToken) {
4510
- _context49.next = 37;
4416
+ _context48.next = 37;
4511
4417
  break;
4512
4418
  }
4513
- _context49.next = 35;
4419
+ _context48.next = 35;
4514
4420
  return this.CreateEncryptionConk({
4515
4421
  libraryId: libraryId,
4516
4422
  objectId: objectId,
@@ -4519,20 +4425,20 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4519
4425
  createKMSConk: false
4520
4426
  });
4521
4427
  case 35:
4522
- _context49.next = 38;
4428
+ _context48.next = 38;
4523
4429
  break;
4524
4430
  case 37:
4525
4431
  throw "No encryption conk present for " + objectId;
4526
4432
  case 38:
4527
- return _context49.abrupt("return", this.encryptionConks[objectId]);
4433
+ return _context48.abrupt("return", this.encryptionConks[objectId]);
4528
4434
  case 39:
4529
4435
  case "end":
4530
- return _context49.stop();
4436
+ return _context48.stop();
4531
4437
  }
4532
- }, _callee49, this);
4438
+ }, _callee48, this);
4533
4439
  }));
4534
- return function (_x45) {
4535
- return _ref90.apply(this, arguments);
4440
+ return function (_x44) {
4441
+ return _ref88.apply(this, arguments);
4536
4442
  };
4537
4443
  }();
4538
4444
 
@@ -4550,37 +4456,37 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4550
4456
  * @return {Promise<ArrayBuffer>}
4551
4457
  */
4552
4458
  exports.Encrypt = /*#__PURE__*/function () {
4553
- var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref91) {
4459
+ var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref89) {
4554
4460
  var libraryId, objectId, writeToken, chunk, conk, data;
4555
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
4556
- while (1) switch (_context50.prev = _context50.next) {
4461
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
4462
+ while (1) switch (_context49.prev = _context49.next) {
4557
4463
  case 0:
4558
- libraryId = _ref91.libraryId, objectId = _ref91.objectId, writeToken = _ref91.writeToken, chunk = _ref91.chunk;
4464
+ libraryId = _ref89.libraryId, objectId = _ref89.objectId, writeToken = _ref89.writeToken, chunk = _ref89.chunk;
4559
4465
  ValidateParameters({
4560
4466
  libraryId: libraryId,
4561
4467
  objectId: objectId
4562
4468
  });
4563
- _context50.next = 4;
4469
+ _context49.next = 4;
4564
4470
  return this.EncryptionConk({
4565
4471
  libraryId: libraryId,
4566
4472
  objectId: objectId,
4567
4473
  writeToken: writeToken
4568
4474
  });
4569
4475
  case 4:
4570
- conk = _context50.sent;
4571
- _context50.next = 7;
4476
+ conk = _context49.sent;
4477
+ _context49.next = 7;
4572
4478
  return this.Crypto.Encrypt(conk, chunk);
4573
4479
  case 7:
4574
- data = _context50.sent;
4575
- return _context50.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4480
+ data = _context49.sent;
4481
+ return _context49.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4576
4482
  case 9:
4577
4483
  case "end":
4578
- return _context50.stop();
4484
+ return _context49.stop();
4579
4485
  }
4580
- }, _callee50, this);
4486
+ }, _callee49, this);
4581
4487
  }));
4582
- return function (_x46) {
4583
- return _ref92.apply(this, arguments);
4488
+ return function (_x45) {
4489
+ return _ref90.apply(this, arguments);
4584
4490
  };
4585
4491
  }();
4586
4492
 
@@ -4598,17 +4504,17 @@ exports.Encrypt = /*#__PURE__*/function () {
4598
4504
  * @return {Promise<ArrayBuffer>}
4599
4505
  */
4600
4506
  exports.Decrypt = /*#__PURE__*/function () {
4601
- var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref93) {
4507
+ var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref91) {
4602
4508
  var libraryId, objectId, writeToken, chunk, conk, data;
4603
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
4604
- while (1) switch (_context51.prev = _context51.next) {
4509
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
4510
+ while (1) switch (_context50.prev = _context50.next) {
4605
4511
  case 0:
4606
- libraryId = _ref93.libraryId, objectId = _ref93.objectId, writeToken = _ref93.writeToken, chunk = _ref93.chunk;
4512
+ libraryId = _ref91.libraryId, objectId = _ref91.objectId, writeToken = _ref91.writeToken, chunk = _ref91.chunk;
4607
4513
  ValidateParameters({
4608
4514
  libraryId: libraryId,
4609
4515
  objectId: objectId
4610
4516
  });
4611
- _context51.next = 4;
4517
+ _context50.next = 4;
4612
4518
  return this.EncryptionConk({
4613
4519
  libraryId: libraryId,
4614
4520
  objectId: objectId,
@@ -4616,20 +4522,20 @@ exports.Decrypt = /*#__PURE__*/function () {
4616
4522
  download: true
4617
4523
  });
4618
4524
  case 4:
4619
- conk = _context51.sent;
4620
- _context51.next = 7;
4525
+ conk = _context50.sent;
4526
+ _context50.next = 7;
4621
4527
  return this.Crypto.Decrypt(conk, chunk);
4622
4528
  case 7:
4623
- data = _context51.sent;
4624
- return _context51.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4529
+ data = _context50.sent;
4530
+ return _context50.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4625
4531
  case 9:
4626
4532
  case "end":
4627
- return _context51.stop();
4533
+ return _context50.stop();
4628
4534
  }
4629
- }, _callee51, this);
4535
+ }, _callee50, this);
4630
4536
  }));
4631
- return function (_x47) {
4632
- return _ref94.apply(this, arguments);
4537
+ return function (_x46) {
4538
+ return _ref92.apply(this, arguments);
4633
4539
  };
4634
4540
  }();
4635
4541
 
@@ -4645,24 +4551,24 @@ exports.Decrypt = /*#__PURE__*/function () {
4645
4551
  * @return {Promise<string>} - Contract type of the item - "space", "library", "type", "object", "wallet", "group", or "other"
4646
4552
  */
4647
4553
  exports.AccessType = /*#__PURE__*/function () {
4648
- var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref95) {
4554
+ var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref93) {
4649
4555
  var id;
4650
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
4651
- while (1) switch (_context52.prev = _context52.next) {
4556
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
4557
+ while (1) switch (_context51.prev = _context51.next) {
4652
4558
  case 0:
4653
- id = _ref95.id;
4654
- _context52.next = 3;
4559
+ id = _ref93.id;
4560
+ _context51.next = 3;
4655
4561
  return this.authClient.AccessType(id);
4656
4562
  case 3:
4657
- return _context52.abrupt("return", _context52.sent);
4563
+ return _context51.abrupt("return", _context51.sent);
4658
4564
  case 4:
4659
4565
  case "end":
4660
- return _context52.stop();
4566
+ return _context51.stop();
4661
4567
  }
4662
- }, _callee52, this);
4568
+ }, _callee51, this);
4663
4569
  }));
4664
- return function (_x48) {
4665
- return _ref96.apply(this, arguments);
4570
+ return function (_x47) {
4571
+ return _ref94.apply(this, arguments);
4666
4572
  };
4667
4573
  }();
4668
4574
 
@@ -4678,12 +4584,12 @@ exports.AccessType = /*#__PURE__*/function () {
4678
4584
  *
4679
4585
  * @return {Promise<Object>} - Info about the access charge and whether or not the object is accessible to the current user */
4680
4586
  exports.AccessInfo = /*#__PURE__*/function () {
4681
- var _ref98 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref97) {
4587
+ var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref95) {
4682
4588
  var objectId, args, info;
4683
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
4684
- while (1) switch (_context53.prev = _context53.next) {
4589
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
4590
+ while (1) switch (_context52.prev = _context52.next) {
4685
4591
  case 0:
4686
- objectId = _ref97.objectId, args = _ref97.args;
4592
+ objectId = _ref95.objectId, args = _ref95.args;
4687
4593
  ValidateObject(objectId);
4688
4594
  if (!args) {
4689
4595
  args = [0,
@@ -4695,16 +4601,16 @@ exports.AccessInfo = /*#__PURE__*/function () {
4695
4601
  }
4696
4602
 
4697
4603
  this.Log("Retrieving access info: ".concat(objectId));
4698
- _context53.next = 6;
4604
+ _context52.next = 6;
4699
4605
  return this.ethClient.CallContractMethod({
4700
4606
  contractAddress: this.utils.HashToAddress(objectId),
4701
4607
  methodName: "getAccessInfo",
4702
4608
  methodArgs: args
4703
4609
  });
4704
4610
  case 6:
4705
- info = _context53.sent;
4611
+ info = _context52.sent;
4706
4612
  this.Log(info);
4707
- return _context53.abrupt("return", {
4613
+ return _context52.abrupt("return", {
4708
4614
  visibilityCode: info[0],
4709
4615
  visible: info[0] >= 1,
4710
4616
  accessible: info[0] >= 10,
@@ -4715,12 +4621,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
4715
4621
  });
4716
4622
  case 9:
4717
4623
  case "end":
4718
- return _context53.stop();
4624
+ return _context52.stop();
4719
4625
  }
4720
- }, _callee53, this);
4626
+ }, _callee52, this);
4721
4627
  }));
4722
- return function (_x49) {
4723
- return _ref98.apply(this, arguments);
4628
+ return function (_x48) {
4629
+ return _ref96.apply(this, arguments);
4724
4630
  };
4725
4631
  }();
4726
4632
 
@@ -4748,12 +4654,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
4748
4654
  * @return {Promise<Object>} - Resultant AccessRequest or UpdateRequest event
4749
4655
  */
4750
4656
  exports.AccessRequest = /*#__PURE__*/function () {
4751
- var _ref100 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref99) {
4752
- var libraryId, objectId, versionHash, _ref99$args, args, _ref99$update, update, _ref99$noCache, noCache;
4753
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
4754
- while (1) switch (_context54.prev = _context54.next) {
4657
+ var _ref98 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref97) {
4658
+ var libraryId, objectId, versionHash, _ref97$args, args, _ref97$update, update, _ref97$noCache, noCache;
4659
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
4660
+ while (1) switch (_context53.prev = _context53.next) {
4755
4661
  case 0:
4756
- libraryId = _ref99.libraryId, objectId = _ref99.objectId, versionHash = _ref99.versionHash, _ref99$args = _ref99.args, args = _ref99$args === void 0 ? [] : _ref99$args, _ref99$update = _ref99.update, update = _ref99$update === void 0 ? false : _ref99$update, _ref99$noCache = _ref99.noCache, noCache = _ref99$noCache === void 0 ? false : _ref99$noCache;
4662
+ libraryId = _ref97.libraryId, objectId = _ref97.objectId, versionHash = _ref97.versionHash, _ref97$args = _ref97.args, args = _ref97$args === void 0 ? [] : _ref97$args, _ref97$update = _ref97.update, update = _ref97$update === void 0 ? false : _ref97$update, _ref97$noCache = _ref97.noCache, noCache = _ref97$noCache === void 0 ? false : _ref97$noCache;
4757
4663
  ValidateParameters({
4758
4664
  libraryId: libraryId,
4759
4665
  objectId: objectId,
@@ -4762,7 +4668,7 @@ exports.AccessRequest = /*#__PURE__*/function () {
4762
4668
  if (versionHash) {
4763
4669
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4764
4670
  }
4765
- _context54.next = 5;
4671
+ _context53.next = 5;
4766
4672
  return this.authClient.MakeAccessRequest({
4767
4673
  libraryId: libraryId,
4768
4674
  objectId: objectId,
@@ -4773,15 +4679,15 @@ exports.AccessRequest = /*#__PURE__*/function () {
4773
4679
  noCache: noCache
4774
4680
  });
4775
4681
  case 5:
4776
- return _context54.abrupt("return", _context54.sent);
4682
+ return _context53.abrupt("return", _context53.sent);
4777
4683
  case 6:
4778
4684
  case "end":
4779
- return _context54.stop();
4685
+ return _context53.stop();
4780
4686
  }
4781
- }, _callee54, this);
4687
+ }, _callee53, this);
4782
4688
  }));
4783
- return function (_x50) {
4784
- return _ref100.apply(this, arguments);
4689
+ return function (_x49) {
4690
+ return _ref98.apply(this, arguments);
4785
4691
  };
4786
4692
  }();
4787
4693
 
@@ -4793,8 +4699,8 @@ exports.AccessRequest = /*#__PURE__*/function () {
4793
4699
  * @param {Object=} context - Additional context to include in state channel requests
4794
4700
  * - Note: Context must be a map of string->string
4795
4701
  */
4796
- exports.SetAuthContext = function (_ref101) {
4797
- var context = _ref101.context;
4702
+ exports.SetAuthContext = function (_ref99) {
4703
+ var context = _ref99.context;
4798
4704
  if (context && Object.values(context).find(function (value) {
4799
4705
  return typeof value !== "string";
4800
4706
  })) {
@@ -4818,34 +4724,34 @@ exports.SetAuthContext = function (_ref101) {
4818
4724
  * @return {Promise<string>} - The state channel token
4819
4725
  */
4820
4726
  exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4821
- var _ref103 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref102) {
4822
- var objectId, versionHash, context, _ref102$noCache, noCache;
4823
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
4824
- while (1) switch (_context55.prev = _context55.next) {
4727
+ var _ref101 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref100) {
4728
+ var objectId, versionHash, context, _ref100$noCache, noCache;
4729
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
4730
+ while (1) switch (_context54.prev = _context54.next) {
4825
4731
  case 0:
4826
- objectId = _ref102.objectId, versionHash = _ref102.versionHash, context = _ref102.context, _ref102$noCache = _ref102.noCache, noCache = _ref102$noCache === void 0 ? false : _ref102$noCache;
4732
+ objectId = _ref100.objectId, versionHash = _ref100.versionHash, context = _ref100.context, _ref100$noCache = _ref100.noCache, noCache = _ref100$noCache === void 0 ? false : _ref100$noCache;
4827
4733
  versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
4828
4734
  if (!versionHash) {
4829
- _context55.next = 6;
4735
+ _context54.next = 6;
4830
4736
  break;
4831
4737
  }
4832
4738
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4833
- _context55.next = 10;
4739
+ _context54.next = 10;
4834
4740
  break;
4835
4741
  case 6:
4836
4742
  if (this.stateChannelAccess[objectId]) {
4837
- _context55.next = 10;
4743
+ _context54.next = 10;
4838
4744
  break;
4839
4745
  }
4840
- _context55.next = 9;
4746
+ _context54.next = 9;
4841
4747
  return this.LatestVersionHash({
4842
4748
  objectId: objectId
4843
4749
  });
4844
4750
  case 9:
4845
- versionHash = _context55.sent;
4751
+ versionHash = _context54.sent;
4846
4752
  case 10:
4847
4753
  this.stateChannelAccess[objectId] = versionHash;
4848
- _context55.next = 13;
4754
+ _context54.next = 13;
4849
4755
  return this.authClient.AuthorizationToken({
4850
4756
  objectId: objectId,
4851
4757
  channelAuth: true,
@@ -4854,15 +4760,15 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4854
4760
  noCache: noCache
4855
4761
  });
4856
4762
  case 13:
4857
- return _context55.abrupt("return", _context55.sent);
4763
+ return _context54.abrupt("return", _context54.sent);
4858
4764
  case 14:
4859
4765
  case "end":
4860
- return _context55.stop();
4766
+ return _context54.stop();
4861
4767
  }
4862
- }, _callee55, this);
4768
+ }, _callee54, this);
4863
4769
  }));
4864
- return function (_x51) {
4865
- return _ref103.apply(this, arguments);
4770
+ return function (_x50) {
4771
+ return _ref101.apply(this, arguments);
4866
4772
  };
4867
4773
  }();
4868
4774
 
@@ -4876,38 +4782,38 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4876
4782
  * @param {number} percentComplete - Completion percentage of the content
4877
4783
  */
4878
4784
  exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4879
- var _ref105 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref104) {
4785
+ var _ref103 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref102) {
4880
4786
  var objectId, versionHash, percentComplete;
4881
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
4882
- while (1) switch (_context56.prev = _context56.next) {
4787
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
4788
+ while (1) switch (_context55.prev = _context55.next) {
4883
4789
  case 0:
4884
- objectId = _ref104.objectId, versionHash = _ref104.versionHash, percentComplete = _ref104.percentComplete;
4790
+ objectId = _ref102.objectId, versionHash = _ref102.versionHash, percentComplete = _ref102.percentComplete;
4885
4791
  versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
4886
4792
  if (!versionHash) {
4887
- _context56.next = 6;
4793
+ _context55.next = 6;
4888
4794
  break;
4889
4795
  }
4890
4796
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4891
- _context56.next = 13;
4797
+ _context55.next = 13;
4892
4798
  break;
4893
4799
  case 6:
4894
4800
  if (!this.stateChannelAccess[objectId]) {
4895
- _context56.next = 10;
4801
+ _context55.next = 10;
4896
4802
  break;
4897
4803
  }
4898
4804
  versionHash = this.stateChannelAccess[objectId];
4899
- _context56.next = 13;
4805
+ _context55.next = 13;
4900
4806
  break;
4901
4807
  case 10:
4902
- _context56.next = 12;
4808
+ _context55.next = 12;
4903
4809
  return this.LatestVersionHash({
4904
4810
  objectId: objectId
4905
4811
  });
4906
4812
  case 12:
4907
- versionHash = _context56.sent;
4813
+ versionHash = _context55.sent;
4908
4814
  case 13:
4909
4815
  this.stateChannelAccess[objectId] = undefined;
4910
- _context56.next = 16;
4816
+ _context55.next = 16;
4911
4817
  return this.authClient.ChannelContentFinalize({
4912
4818
  objectId: objectId,
4913
4819
  versionHash: versionHash,
@@ -4915,12 +4821,12 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4915
4821
  });
4916
4822
  case 16:
4917
4823
  case "end":
4918
- return _context56.stop();
4824
+ return _context55.stop();
4919
4825
  }
4920
- }, _callee56, this);
4826
+ }, _callee55, this);
4921
4827
  }));
4922
- return function (_x52) {
4923
- return _ref105.apply(this, arguments);
4828
+ return function (_x51) {
4829
+ return _ref103.apply(this, arguments);
4924
4830
  };
4925
4831
  }();
4926
4832
 
@@ -4937,34 +4843,34 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4937
4843
  * @returns {Promise<Object>} - Transaction log of the AccessComplete event
4938
4844
  */
4939
4845
  exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
4940
- var _ref107 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(_ref106) {
4941
- var objectId, _ref106$score, score;
4942
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
4943
- while (1) switch (_context57.prev = _context57.next) {
4846
+ var _ref105 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref104) {
4847
+ var objectId, _ref104$score, score;
4848
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
4849
+ while (1) switch (_context56.prev = _context56.next) {
4944
4850
  case 0:
4945
- objectId = _ref106.objectId, _ref106$score = _ref106.score, score = _ref106$score === void 0 ? 100 : _ref106$score;
4851
+ objectId = _ref104.objectId, _ref104$score = _ref104.score, score = _ref104$score === void 0 ? 100 : _ref104$score;
4946
4852
  ValidateObject(objectId);
4947
4853
  if (!(score < 0 || score > 100)) {
4948
- _context57.next = 4;
4854
+ _context56.next = 4;
4949
4855
  break;
4950
4856
  }
4951
4857
  throw Error("Invalid AccessComplete score: " + score);
4952
4858
  case 4:
4953
- _context57.next = 6;
4859
+ _context56.next = 6;
4954
4860
  return this.authClient.AccessComplete({
4955
4861
  id: objectId,
4956
4862
  score: score
4957
4863
  });
4958
4864
  case 6:
4959
- return _context57.abrupt("return", _context57.sent);
4865
+ return _context56.abrupt("return", _context56.sent);
4960
4866
  case 7:
4961
4867
  case "end":
4962
- return _context57.stop();
4868
+ return _context56.stop();
4963
4869
  }
4964
- }, _callee57, this);
4870
+ }, _callee56, this);
4965
4871
  }));
4966
- return function (_x53) {
4967
- return _ref107.apply(this, arguments);
4872
+ return function (_x52) {
4873
+ return _ref105.apply(this, arguments);
4968
4874
  };
4969
4875
  }();
4970
4876
 
@@ -4986,62 +4892,62 @@ exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
4986
4892
  * @return {Promise<Array<string>>} - List of addresses of available items
4987
4893
  */
4988
4894
  exports.Collection = /*#__PURE__*/function () {
4989
- var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(_ref108) {
4895
+ var _ref107 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(_ref106) {
4990
4896
  var collectionType, validCollectionTypes, walletAddress;
4991
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
4992
- while (1) switch (_context58.prev = _context58.next) {
4897
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
4898
+ while (1) switch (_context57.prev = _context57.next) {
4993
4899
  case 0:
4994
- collectionType = _ref108.collectionType;
4900
+ collectionType = _ref106.collectionType;
4995
4901
  validCollectionTypes = ["accessGroups", "contentObjects", "contentTypes", "contracts", "libraries"];
4996
4902
  if (validCollectionTypes.includes(collectionType)) {
4997
- _context58.next = 4;
4903
+ _context57.next = 4;
4998
4904
  break;
4999
4905
  }
5000
4906
  throw new Error("Invalid collection type: " + collectionType);
5001
4907
  case 4:
5002
4908
  if (!this.signer) {
5003
- _context58.next = 10;
4909
+ _context57.next = 10;
5004
4910
  break;
5005
4911
  }
5006
- _context58.next = 7;
4912
+ _context57.next = 7;
5007
4913
  return this.userProfileClient.WalletAddress();
5008
4914
  case 7:
5009
- _context58.t0 = _context58.sent;
5010
- _context58.next = 11;
4915
+ _context57.t0 = _context57.sent;
4916
+ _context57.next = 11;
5011
4917
  break;
5012
4918
  case 10:
5013
- _context58.t0 = undefined;
4919
+ _context57.t0 = undefined;
5014
4920
  case 11:
5015
- walletAddress = _context58.t0;
4921
+ walletAddress = _context57.t0;
5016
4922
  if (walletAddress) {
5017
- _context58.next = 14;
4923
+ _context57.next = 14;
5018
4924
  break;
5019
4925
  }
5020
4926
  throw new Error("Unable to get collection: User wallet doesn't exist");
5021
4927
  case 14:
5022
4928
  this.Log("Retrieving ".concat(collectionType, " contract collection for user ").concat(this.signer.address));
5023
- _context58.next = 17;
4929
+ _context57.next = 17;
5024
4930
  return this.ethClient.MakeProviderCall({
5025
4931
  methodName: "send",
5026
4932
  args: ["elv_getWalletCollection", [this.contentSpaceId, "iusr".concat(this.utils.AddressToHash(this.signer.address)), collectionType]]
5027
4933
  });
5028
4934
  case 17:
5029
- _context58.t1 = _context58.sent;
5030
- if (_context58.t1) {
5031
- _context58.next = 20;
4935
+ _context57.t1 = _context57.sent;
4936
+ if (_context57.t1) {
4937
+ _context57.next = 20;
5032
4938
  break;
5033
4939
  }
5034
- _context58.t1 = [];
4940
+ _context57.t1 = [];
5035
4941
  case 20:
5036
- return _context58.abrupt("return", _context58.t1);
4942
+ return _context57.abrupt("return", _context57.t1);
5037
4943
  case 21:
5038
4944
  case "end":
5039
- return _context58.stop();
4945
+ return _context57.stop();
5040
4946
  }
5041
- }, _callee58, this);
4947
+ }, _callee57, this);
5042
4948
  }));
5043
- return function (_x54) {
5044
- return _ref109.apply(this, arguments);
4949
+ return function (_x53) {
4950
+ return _ref107.apply(this, arguments);
5045
4951
  };
5046
4952
  }();
5047
4953
 
@@ -5062,13 +4968,13 @@ exports.Collection = /*#__PURE__*/function () {
5062
4968
  * @returns {Promise<Object>} - Response describing audit results
5063
4969
  */
5064
4970
  exports.AuditContentObject = /*#__PURE__*/function () {
5065
- var _ref111 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref110) {
4971
+ var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(_ref108) {
5066
4972
  var libraryId, objectId, versionHash, salt, samples, authorizationToken;
5067
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
5068
- while (1) switch (_context59.prev = _context59.next) {
4973
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
4974
+ while (1) switch (_context58.prev = _context58.next) {
5069
4975
  case 0:
5070
- libraryId = _ref110.libraryId, objectId = _ref110.objectId, versionHash = _ref110.versionHash, salt = _ref110.salt, samples = _ref110.samples, authorizationToken = _ref110.authorizationToken;
5071
- _context59.next = 3;
4976
+ libraryId = _ref108.libraryId, objectId = _ref108.objectId, versionHash = _ref108.versionHash, salt = _ref108.salt, samples = _ref108.samples, authorizationToken = _ref108.authorizationToken;
4977
+ _context58.next = 3;
5072
4978
  return ContentObjectAudit.AuditContentObject({
5073
4979
  client: this,
5074
4980
  libraryId: libraryId,
@@ -5079,15 +4985,15 @@ exports.AuditContentObject = /*#__PURE__*/function () {
5079
4985
  authorizationToken: authorizationToken
5080
4986
  });
5081
4987
  case 3:
5082
- return _context59.abrupt("return", _context59.sent);
4988
+ return _context58.abrupt("return", _context58.sent);
5083
4989
  case 4:
5084
4990
  case "end":
5085
- return _context59.stop();
4991
+ return _context58.stop();
5086
4992
  }
5087
- }, _callee59, this);
4993
+ }, _callee58, this);
5088
4994
  }));
5089
- return function (_x55) {
5090
- return _ref111.apply(this, arguments);
4995
+ return function (_x54) {
4996
+ return _ref109.apply(this, arguments);
5091
4997
  };
5092
4998
  }();
5093
4999
 
@@ -5104,12 +5010,12 @@ exports.AuditContentObject = /*#__PURE__*/function () {
5104
5010
  * @returns {Promise<Object>} - Response containing proof information
5105
5011
  */
5106
5012
  exports.Proofs = /*#__PURE__*/function () {
5107
- var _ref113 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(_ref112) {
5013
+ var _ref111 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref110) {
5108
5014
  var libraryId, objectId, versionHash, partHash, path;
5109
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
5110
- while (1) switch (_context60.prev = _context60.next) {
5015
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
5016
+ while (1) switch (_context59.prev = _context59.next) {
5111
5017
  case 0:
5112
- libraryId = _ref112.libraryId, objectId = _ref112.objectId, versionHash = _ref112.versionHash, partHash = _ref112.partHash;
5018
+ libraryId = _ref110.libraryId, objectId = _ref110.objectId, versionHash = _ref110.versionHash, partHash = _ref110.partHash;
5113
5019
  ValidateParameters({
5114
5020
  libraryId: libraryId,
5115
5021
  objectId: objectId,
@@ -5120,32 +5026,32 @@ exports.Proofs = /*#__PURE__*/function () {
5120
5026
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
5121
5027
  }
5122
5028
  path = UrlJoin("q", versionHash || objectId, "data", partHash, "proofs");
5123
- _context60.t0 = this.utils;
5124
- _context60.t1 = this.HttpClient;
5125
- _context60.next = 9;
5029
+ _context59.t0 = this.utils;
5030
+ _context59.t1 = this.HttpClient;
5031
+ _context59.next = 9;
5126
5032
  return this.authClient.AuthorizationHeader({
5127
5033
  libraryId: libraryId,
5128
5034
  objectId: objectId,
5129
5035
  versionHash: versionHash
5130
5036
  });
5131
5037
  case 9:
5132
- _context60.t2 = _context60.sent;
5133
- _context60.t3 = path;
5134
- _context60.t4 = {
5135
- headers: _context60.t2,
5038
+ _context59.t2 = _context59.sent;
5039
+ _context59.t3 = path;
5040
+ _context59.t4 = {
5041
+ headers: _context59.t2,
5136
5042
  method: "GET",
5137
- path: _context60.t3
5043
+ path: _context59.t3
5138
5044
  };
5139
- _context60.t5 = _context60.t1.Request.call(_context60.t1, _context60.t4);
5140
- return _context60.abrupt("return", _context60.t0.ResponseToJson.call(_context60.t0, _context60.t5));
5045
+ _context59.t5 = _context59.t1.Request.call(_context59.t1, _context59.t4);
5046
+ return _context59.abrupt("return", _context59.t0.ResponseToJson.call(_context59.t0, _context59.t5));
5141
5047
  case 14:
5142
5048
  case "end":
5143
- return _context60.stop();
5049
+ return _context59.stop();
5144
5050
  }
5145
- }, _callee60, this);
5051
+ }, _callee59, this);
5146
5052
  }));
5147
- return function (_x56) {
5148
- return _ref113.apply(this, arguments);
5053
+ return function (_x55) {
5054
+ return _ref111.apply(this, arguments);
5149
5055
  };
5150
5056
  }();
5151
5057
 
@@ -5162,12 +5068,12 @@ exports.Proofs = /*#__PURE__*/function () {
5162
5068
  * @returns {Promise<Format>} - Response containing the CBOR response in the specified format
5163
5069
  */
5164
5070
  exports.QParts = /*#__PURE__*/function () {
5165
- var _ref115 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(_ref114) {
5166
- var libraryId, objectId, partHash, _ref114$format, format, path;
5167
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
5168
- while (1) switch (_context61.prev = _context61.next) {
5071
+ var _ref113 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(_ref112) {
5072
+ var libraryId, objectId, partHash, _ref112$format, format, path;
5073
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
5074
+ while (1) switch (_context60.prev = _context60.next) {
5169
5075
  case 0:
5170
- libraryId = _ref114.libraryId, objectId = _ref114.objectId, partHash = _ref114.partHash, _ref114$format = _ref114.format, format = _ref114$format === void 0 ? "blob" : _ref114$format;
5076
+ libraryId = _ref112.libraryId, objectId = _ref112.objectId, partHash = _ref112.partHash, _ref112$format = _ref112.format, format = _ref112$format === void 0 ? "blob" : _ref112$format;
5171
5077
  ValidateParameters({
5172
5078
  libraryId: libraryId,
5173
5079
  objectId: objectId,
@@ -5175,32 +5081,32 @@ exports.QParts = /*#__PURE__*/function () {
5175
5081
  });
5176
5082
  ValidatePartHash(partHash);
5177
5083
  path = UrlJoin("qparts", partHash);
5178
- _context61.t0 = this.utils;
5179
- _context61.t1 = format;
5180
- _context61.t2 = this.HttpClient;
5181
- _context61.next = 9;
5084
+ _context60.t0 = this.utils;
5085
+ _context60.t1 = format;
5086
+ _context60.t2 = this.HttpClient;
5087
+ _context60.next = 9;
5182
5088
  return this.authClient.AuthorizationHeader({
5183
5089
  libraryId: libraryId,
5184
5090
  objectId: objectId,
5185
5091
  partHash: partHash
5186
5092
  });
5187
5093
  case 9:
5188
- _context61.t3 = _context61.sent;
5189
- _context61.t4 = path;
5190
- _context61.t5 = {
5191
- headers: _context61.t3,
5094
+ _context60.t3 = _context60.sent;
5095
+ _context60.t4 = path;
5096
+ _context60.t5 = {
5097
+ headers: _context60.t3,
5192
5098
  method: "GET",
5193
- path: _context61.t4
5099
+ path: _context60.t4
5194
5100
  };
5195
- _context61.t6 = _context61.t2.Request.call(_context61.t2, _context61.t5);
5196
- return _context61.abrupt("return", _context61.t0.ResponseToFormat.call(_context61.t0, _context61.t1, _context61.t6));
5101
+ _context60.t6 = _context60.t2.Request.call(_context60.t2, _context60.t5);
5102
+ return _context60.abrupt("return", _context60.t0.ResponseToFormat.call(_context60.t0, _context60.t1, _context60.t6));
5197
5103
  case 14:
5198
5104
  case "end":
5199
- return _context61.stop();
5105
+ return _context60.stop();
5200
5106
  }
5201
- }, _callee61, this);
5107
+ }, _callee60, this);
5202
5108
  }));
5203
- return function (_x57) {
5204
- return _ref115.apply(this, arguments);
5109
+ return function (_x56) {
5110
+ return _ref113.apply(this, arguments);
5205
5111
  };
5206
5112
  }();