@eluvio/elv-client-js 3.1.72 → 3.1.76

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.
@@ -241,7 +241,7 @@ function () {
241
241
  }, {
242
242
  key: "GenerateAuthorizationToken",
243
243
  value: function GenerateAuthorizationToken(_ref3) {
244
- var libraryId, objectId, versionHash, partHash, encryption, _ref3$update, update, _ref3$noAuth, noAuth, publicKey, owner, cap, token, _ref4, transactionHash, signature, multiSig;
244
+ var libraryId, objectId, versionHash, partHash, encryption, _ref3$update, update, _ref3$noAuth, noAuth, publicKey, owner, ownerCapKey, ownerCap, cap, token, _ref4, transactionHash, signature, multiSig;
245
245
 
246
246
  return _regeneratorRuntime.async(function GenerateAuthorizationToken$(_context3) {
247
247
  while (1) {
@@ -271,7 +271,7 @@ function () {
271
271
 
272
272
  case 9:
273
273
  if (!_context3.t0) {
274
- _context3.next = 18;
274
+ _context3.next = 22;
275
275
  break;
276
276
  }
277
277
 
@@ -282,34 +282,44 @@ function () {
282
282
 
283
283
  case 12:
284
284
  owner = _context3.sent;
285
+ ownerCapKey = "eluv.caps.iusr".concat(Utils.AddressToHash(this.client.signer.address));
286
+ _context3.next = 16;
287
+ return _regeneratorRuntime.awrap(client.ContentObjectMetadata({
288
+ libraryId: libraryId,
289
+ objectId: objectId,
290
+ metadataSubtree: ownerCapKey
291
+ }));
285
292
 
286
- if (Utils.EqualAddress(owner, this.client.signer.address)) {
287
- _context3.next = 18;
293
+ case 16:
294
+ ownerCap = _context3.sent;
295
+
296
+ if (!(!Utils.EqualAddress(owner, this.client.signer.address) && !ownerCap)) {
297
+ _context3.next = 22;
288
298
  break;
289
299
  }
290
300
 
291
- _context3.next = 16;
301
+ _context3.next = 20;
292
302
  return _regeneratorRuntime.awrap(this.ReEncryptionConk({
293
303
  libraryId: libraryId,
294
304
  objectId: objectId
295
305
  }));
296
306
 
297
- case 16:
307
+ case 20:
298
308
  cap = _context3.sent;
299
309
  publicKey = cap.public_key;
300
310
 
301
- case 18:
311
+ case 22:
302
312
  token = {
303
313
  qspace_id: this.contentSpaceId,
304
314
  addr: Utils.FormatAddress(this.client.signer && this.client.signer.address || "")
305
315
  };
306
316
 
307
317
  if (this.noAuth || noAuth) {
308
- _context3.next = 25;
318
+ _context3.next = 29;
309
319
  break;
310
320
  }
311
321
 
312
- _context3.next = 22;
322
+ _context3.next = 26;
313
323
  return _regeneratorRuntime.awrap(this.MakeAccessRequest({
314
324
  libraryId: libraryId,
315
325
  objectId: objectId,
@@ -320,7 +330,7 @@ function () {
320
330
  noAuth: this.noAuth || noAuth
321
331
  }));
322
332
 
323
- case 22:
333
+ case 26:
324
334
  _ref4 = _context3.sent;
325
335
  transactionHash = _ref4.transactionHash;
326
336
 
@@ -328,7 +338,7 @@ function () {
328
338
  token.tx_id = transactionHash;
329
339
  }
330
340
 
331
- case 25:
341
+ case 29:
332
342
  if (libraryId) {
333
343
  token.qlib_id = libraryId;
334
344
  }
@@ -342,15 +352,15 @@ function () {
342
352
  }
343
353
 
344
354
  token = Utils.B64(JSON.stringify(token));
345
- _context3.next = 31;
355
+ _context3.next = 35;
346
356
  return _regeneratorRuntime.awrap(this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(token))));
347
357
 
348
- case 31:
358
+ case 35:
349
359
  signature = _context3.sent;
350
360
  multiSig = Utils.FormatSignature(signature);
351
361
  return _context3.abrupt("return", "".concat(token, ".").concat(Utils.B64(multiSig)));
352
362
 
353
- case 34:
363
+ case 38:
354
364
  case "end":
355
365
  return _context3.stop();
356
366
  }
@@ -445,7 +445,7 @@ function () {
445
445
  * @returns {Array<string>} - List of ElvClient methods available to a FrameClient
446
446
  */
447
447
  value: function AllowedMethods() {
448
- return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFiles", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
448
+ return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFiles", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
449
449
  }
450
450
  }, {
451
451
  key: "AllowedUserProfileMethods",
@@ -944,9 +944,8 @@ exports.LibraryContentTypes = function _callee13(_ref8) {
944
944
  * @param {object=} filterOptions - Pagination, sorting and filtering options
945
945
  * @param {number=} filterOptions.start - Start index for pagination
946
946
  * @param {number=} filterOptions.limit - Max number of objects to return
947
- * @param {string=} filterOptions.cacheId - Cache ID corresponding a previous query
948
947
  * @param {(Array<string> | string)=} filterOptions.sort - Sort by the specified key(s)
949
- * * @param {boolean=} filterOptions.sortDesc=false - Sort in descending order
948
+ * @param {boolean=} filterOptions.sortDesc - Sort in descending order
950
949
  * @param {(Array<string> | string)=} filterOptions.select - Include only the specified metadata keys (all must start with /public)
951
950
  * @param {(Array<object> | object)=} filterOptions.filter - Filter objects by metadata
952
951
  * @param {string=} filterOptions.filter.key - Key to filter on (must start with /public)
@@ -4259,7 +4258,7 @@ exports.CreateEncryptionConk = function _callee46(_ref39) {
4259
4258
 
4260
4259
 
4261
4260
  exports.EncryptionConk = function _callee47(_ref40) {
4262
- var libraryId, objectId, versionHash, writeToken, _ref40$download, download, owner, capKey, existingUserCap;
4261
+ var libraryId, objectId, versionHash, writeToken, _ref40$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
4263
4262
 
4264
4263
  return _regeneratorRuntime.async(function _callee47$(_context47) {
4265
4264
  while (1) {
@@ -4287,46 +4286,56 @@ exports.EncryptionConk = function _callee47(_ref40) {
4287
4286
 
4288
4287
  case 6:
4289
4288
  owner = _context47.sent;
4289
+ ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
4290
+ _context47.next = 10;
4291
+ return _regeneratorRuntime.awrap(this.ContentObjectMetadata({
4292
+ libraryId: libraryId,
4293
+ objectId: objectId,
4294
+ metadataSubtree: ownerCapKey
4295
+ }));
4290
4296
 
4291
- if (this.utils.EqualAddress(owner, this.signer.address)) {
4292
- _context47.next = 17;
4297
+ case 10:
4298
+ ownerCap = _context47.sent;
4299
+
4300
+ if (!(!this.utils.EqualAddress(owner, this.signer.address) && !ownerCap)) {
4301
+ _context47.next = 21;
4293
4302
  break;
4294
4303
  }
4295
4304
 
4296
4305
  if (!download) {
4297
- _context47.next = 14;
4306
+ _context47.next = 18;
4298
4307
  break;
4299
4308
  }
4300
4309
 
4301
- _context47.next = 11;
4310
+ _context47.next = 15;
4302
4311
  return _regeneratorRuntime.awrap(this.authClient.ReEncryptionConk({
4303
4312
  libraryId: libraryId,
4304
4313
  objectId: objectId,
4305
4314
  versionHash: versionHash
4306
4315
  }));
4307
4316
 
4308
- case 11:
4317
+ case 15:
4309
4318
  return _context47.abrupt("return", _context47.sent);
4310
4319
 
4311
- case 14:
4312
- _context47.next = 16;
4320
+ case 18:
4321
+ _context47.next = 20;
4313
4322
  return _regeneratorRuntime.awrap(this.authClient.EncryptionConk({
4314
4323
  libraryId: libraryId,
4315
4324
  objectId: objectId,
4316
4325
  versionHash: versionHash
4317
4326
  }));
4318
4327
 
4319
- case 16:
4328
+ case 20:
4320
4329
  return _context47.abrupt("return", _context47.sent);
4321
4330
 
4322
- case 17:
4331
+ case 21:
4323
4332
  if (this.encryptionConks[objectId]) {
4324
- _context47.next = 34;
4333
+ _context47.next = 38;
4325
4334
  break;
4326
4335
  }
4327
4336
 
4328
4337
  capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
4329
- _context47.next = 21;
4338
+ _context47.next = 25;
4330
4339
  return _regeneratorRuntime.awrap(this.ContentObjectMetadata({
4331
4340
  libraryId: libraryId,
4332
4341
  objectId: objectId,
@@ -4336,29 +4345,29 @@ exports.EncryptionConk = function _callee47(_ref40) {
4336
4345
  metadataSubtree: capKey
4337
4346
  }));
4338
4347
 
4339
- case 21:
4348
+ case 25:
4340
4349
  existingUserCap = _context47.sent;
4341
4350
 
4342
4351
  if (!existingUserCap) {
4343
- _context47.next = 28;
4352
+ _context47.next = 32;
4344
4353
  break;
4345
4354
  }
4346
4355
 
4347
- _context47.next = 25;
4356
+ _context47.next = 29;
4348
4357
  return _regeneratorRuntime.awrap(this.Crypto.DecryptCap(existingUserCap, this.signer.signingKey.privateKey));
4349
4358
 
4350
- case 25:
4359
+ case 29:
4351
4360
  this.encryptionConks[objectId] = _context47.sent;
4352
- _context47.next = 34;
4361
+ _context47.next = 38;
4353
4362
  break;
4354
4363
 
4355
- case 28:
4364
+ case 32:
4356
4365
  if (!writeToken) {
4357
- _context47.next = 33;
4366
+ _context47.next = 37;
4358
4367
  break;
4359
4368
  }
4360
4369
 
4361
- _context47.next = 31;
4370
+ _context47.next = 35;
4362
4371
  return _regeneratorRuntime.awrap(this.CreateEncryptionConk({
4363
4372
  libraryId: libraryId,
4364
4373
  objectId: objectId,
@@ -4367,17 +4376,17 @@ exports.EncryptionConk = function _callee47(_ref40) {
4367
4376
  createKMSConk: false
4368
4377
  }));
4369
4378
 
4370
- case 31:
4371
- _context47.next = 34;
4379
+ case 35:
4380
+ _context47.next = 38;
4372
4381
  break;
4373
4382
 
4374
- case 33:
4383
+ case 37:
4375
4384
  throw "No encryption conk present for " + objectId;
4376
4385
 
4377
- case 34:
4386
+ case 38:
4378
4387
  return _context47.abrupt("return", this.encryptionConks[objectId]);
4379
4388
 
4380
- case 35:
4389
+ case 39:
4381
4390
  case "end":
4382
4391
  return _context47.stop();
4383
4392
  }