@eluvio/elv-client-js 3.2.38 → 3.2.40
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.
- package/dist/ElvClient-min.js +6 -6
- package/dist/ElvClient-node-min.js +9 -9
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +7 -7
- package/dist/ElvWalletClient-min.js +6 -6
- package/dist/ElvWalletClient-node-min.js +9 -9
- package/dist/src/AuthorizationClient.js +599 -507
- package/dist/src/Utils.js +2 -1
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/ContentManagement.js +45 -5
- package/dist/src/walletClient/Utils.js +16 -5
- package/package.json +1 -1
- package/src/AuthorizationClient.js +43 -0
- package/src/Utils.js +2 -2
- package/src/client/ABRPublishing.js +2 -2
- package/src/client/ContentManagement.js +29 -2
- package/src/walletClient/Utils.js +9 -2
- package/testScripts/CreateProductionMaster.js +14 -6
- package/testScripts/abr_profile_4k_clear_store_encrypted.json +111 -0
- package/testScripts/{abr_profile_4k_clear.json → abr_profile_4k_clear_store_unencrypted.json} +0 -0
- package/testScripts/abr_profile_clear_store_encrypted.json +1945 -0
- package/testScripts/{abr_profile_clear.json → abr_profile_clear_store_unencrypted.json} +0 -0
- package/utilities/ProductionMasterCreate.js +18 -6
- package/utilities/example_files/abr_profile_4k_clear_store_encrypted.json +111 -0
- package/utilities/example_files/{abr_profile_4k_clear.json → abr_profile_4k_clear_store_unencrypted.json} +0 -0
- package/utilities/example_files/abr_profile_clear_hls_only_store_encrypted.json +1892 -0
- package/utilities/example_files/{abr_profile_clear_hls_only.json → abr_profile_clear_hls_only_store_unencrypted.json} +0 -0
- package/utilities/example_files/abr_profile_clear_store_encrypted.json +1899 -0
- /package/utilities/example_files/{abr_profile_clear.json → abr_profile_clear_store_unencrypted.json} +0 -0
|
@@ -24,6 +24,11 @@ var UrlJoin = require("url-join");
|
|
|
24
24
|
|
|
25
25
|
var _require = require("./LogMessage"),
|
|
26
26
|
LogMessage = _require.LogMessage;
|
|
27
|
+
|
|
28
|
+
var _require2 = require("./Validation"),
|
|
29
|
+
ValidateObject = _require2.ValidateObject;
|
|
30
|
+
|
|
31
|
+
var Pako = require("pako");
|
|
27
32
|
/*
|
|
28
33
|
// -- Contract javascript files built using build/BuildContracts.js
|
|
29
34
|
const SpaceContract = require("./contracts/BaseContentSpace");
|
|
@@ -413,51 +418,138 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
413
418
|
|
|
414
419
|
return GenerateAuthorizationToken;
|
|
415
420
|
}()
|
|
421
|
+
}, {
|
|
422
|
+
key: "GenerateSignedLinkToken",
|
|
423
|
+
value: function () {
|
|
424
|
+
var _GenerateSignedLinkToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
425
|
+
var containerId, versionHash, link, canEdit, _Utils$DecodeVersionH, objectId, signerAddress, token, compressedToken, signature;
|
|
426
|
+
|
|
427
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
428
|
+
while (1) {
|
|
429
|
+
switch (_context4.prev = _context4.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
containerId = _ref5.containerId, versionHash = _ref5.versionHash, link = _ref5.link;
|
|
432
|
+
ValidateObject(containerId);
|
|
433
|
+
_context4.next = 4;
|
|
434
|
+
return this.client.CallContractMethod({
|
|
435
|
+
contractAddress: Utils.HashToAddress(containerId),
|
|
436
|
+
methodName: "canEdit"
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
case 4:
|
|
440
|
+
canEdit = _context4.sent;
|
|
441
|
+
_Utils$DecodeVersionH = Utils.DecodeVersionHash(versionHash), objectId = _Utils$DecodeVersionH.objectId;
|
|
442
|
+
|
|
443
|
+
if (canEdit) {
|
|
444
|
+
_context4.next = 8;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
throw Error("Current user does not have permission to edit content object ".concat(objectId));
|
|
449
|
+
|
|
450
|
+
case 8:
|
|
451
|
+
signerAddress = this.client.CurrentAccountAddress();
|
|
452
|
+
_context4.t0 = Utils.B64(signerAddress.replace("0x", ""), "hex");
|
|
453
|
+
_context4.next = 12;
|
|
454
|
+
return this.client.ContentSpaceId();
|
|
455
|
+
|
|
456
|
+
case 12:
|
|
457
|
+
_context4.t1 = _context4.sent;
|
|
458
|
+
_context4.next = 15;
|
|
459
|
+
return this.client.ContentObjectLibraryId({
|
|
460
|
+
objectId: objectId
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
case 15:
|
|
464
|
+
_context4.t2 = _context4.sent;
|
|
465
|
+
_context4.t3 = objectId;
|
|
466
|
+
_context4.t4 = Utils.FormatAddress(signerAddress);
|
|
467
|
+
_context4.t5 = Date.now();
|
|
468
|
+
_context4.t6 = Date.now() + 3600000;
|
|
469
|
+
_context4.t7 = {
|
|
470
|
+
elv: {
|
|
471
|
+
lnk: link,
|
|
472
|
+
src: containerId
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
token = {
|
|
476
|
+
adr: _context4.t0,
|
|
477
|
+
spc: _context4.t1,
|
|
478
|
+
lib: _context4.t2,
|
|
479
|
+
qid: _context4.t3,
|
|
480
|
+
sub: _context4.t4,
|
|
481
|
+
gra: "read",
|
|
482
|
+
iat: _context4.t5,
|
|
483
|
+
exp: _context4.t6,
|
|
484
|
+
ctx: _context4.t7
|
|
485
|
+
};
|
|
486
|
+
compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
|
|
487
|
+
_context4.next = 25;
|
|
488
|
+
return this.Sign(Ethers.utils.keccak256(compressedToken));
|
|
489
|
+
|
|
490
|
+
case 25:
|
|
491
|
+
signature = _context4.sent;
|
|
492
|
+
return _context4.abrupt("return", "aslsjc".concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
|
|
493
|
+
|
|
494
|
+
case 27:
|
|
495
|
+
case "end":
|
|
496
|
+
return _context4.stop();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}, _callee4, this);
|
|
500
|
+
}));
|
|
501
|
+
|
|
502
|
+
function GenerateSignedLinkToken(_x4) {
|
|
503
|
+
return _GenerateSignedLinkToken.apply(this, arguments);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return GenerateSignedLinkToken;
|
|
507
|
+
}()
|
|
416
508
|
}, {
|
|
417
509
|
key: "MakeAccessRequest",
|
|
418
510
|
value: function () {
|
|
419
|
-
var _MakeAccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
511
|
+
var _MakeAccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref6) {
|
|
420
512
|
var _this = this;
|
|
421
513
|
|
|
422
|
-
var libraryId, objectId, versionHash,
|
|
514
|
+
var libraryId, objectId, versionHash, _ref6$args, args, _ref6$publicKey, publicKey, _ref6$update, update, _ref6$skipCache, skipCache, _ref6$noCache, noCache, cacheOnly, walletContractAddress, walletCreated, id, _yield$this$ContractI, isV3, accessType, abi, _yield$this$AccessInf, accessArgs, checkAccessCharge, address, elapsed, _cache, accessRequest, cache;
|
|
423
515
|
|
|
424
|
-
return _regeneratorRuntime.wrap(function
|
|
516
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
425
517
|
while (1) {
|
|
426
|
-
switch (
|
|
518
|
+
switch (_context5.prev = _context5.next) {
|
|
427
519
|
case 0:
|
|
428
|
-
libraryId =
|
|
520
|
+
libraryId = _ref6.libraryId, objectId = _ref6.objectId, versionHash = _ref6.versionHash, _ref6$args = _ref6.args, args = _ref6$args === void 0 ? [] : _ref6$args, _ref6$publicKey = _ref6.publicKey, publicKey = _ref6$publicKey === void 0 ? "" : _ref6$publicKey, _ref6$update = _ref6.update, update = _ref6$update === void 0 ? false : _ref6$update, _ref6$skipCache = _ref6.skipCache, skipCache = _ref6$skipCache === void 0 ? false : _ref6$skipCache, _ref6$noCache = _ref6.noCache, noCache = _ref6$noCache === void 0 ? false : _ref6$noCache, cacheOnly = _ref6.cacheOnly;
|
|
429
521
|
|
|
430
522
|
if (this.client.signer) {
|
|
431
|
-
|
|
523
|
+
_context5.next = 3;
|
|
432
524
|
break;
|
|
433
525
|
}
|
|
434
526
|
|
|
435
|
-
return
|
|
527
|
+
return _context5.abrupt("return", {
|
|
436
528
|
transactionHash: ""
|
|
437
529
|
});
|
|
438
530
|
|
|
439
531
|
case 3:
|
|
440
|
-
|
|
532
|
+
_context5.next = 5;
|
|
441
533
|
return this.client.userProfileClient.UserWalletAddress({
|
|
442
534
|
address: this.client.signer.address
|
|
443
535
|
});
|
|
444
536
|
|
|
445
537
|
case 5:
|
|
446
|
-
walletContractAddress =
|
|
538
|
+
walletContractAddress = _context5.sent;
|
|
447
539
|
|
|
448
540
|
if (walletContractAddress) {
|
|
449
|
-
|
|
541
|
+
_context5.next = 12;
|
|
450
542
|
break;
|
|
451
543
|
}
|
|
452
544
|
|
|
453
|
-
|
|
545
|
+
_context5.next = 9;
|
|
454
546
|
return this.client.userProfileClient.WalletAddress();
|
|
455
547
|
|
|
456
548
|
case 9:
|
|
457
|
-
walletCreated =
|
|
549
|
+
walletCreated = _context5.sent;
|
|
458
550
|
|
|
459
551
|
if (walletCreated) {
|
|
460
|
-
|
|
552
|
+
_context5.next = 12;
|
|
461
553
|
break;
|
|
462
554
|
}
|
|
463
555
|
|
|
@@ -469,26 +561,26 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
469
561
|
}
|
|
470
562
|
|
|
471
563
|
id = objectId || libraryId || this.contentSpaceId;
|
|
472
|
-
|
|
564
|
+
_context5.next = 16;
|
|
473
565
|
return this.ContractInfo({
|
|
474
566
|
id: id
|
|
475
567
|
});
|
|
476
568
|
|
|
477
569
|
case 16:
|
|
478
|
-
_yield$this$ContractI =
|
|
570
|
+
_yield$this$ContractI = _context5.sent;
|
|
479
571
|
isV3 = _yield$this$ContractI.isV3;
|
|
480
572
|
accessType = _yield$this$ContractI.accessType;
|
|
481
573
|
abi = _yield$this$ContractI.abi;
|
|
482
574
|
|
|
483
575
|
if (!(typeof accessType === "undefined")) {
|
|
484
|
-
|
|
576
|
+
_context5.next = 22;
|
|
485
577
|
break;
|
|
486
578
|
}
|
|
487
579
|
|
|
488
580
|
throw Error("Unable to determine contract info for ".concat(id, " (").concat(this.client.utils.HashToAddress(id), ") - Wrong network?"));
|
|
489
581
|
|
|
490
582
|
case 22:
|
|
491
|
-
|
|
583
|
+
_context5.next = 24;
|
|
492
584
|
return this.AccessInfo({
|
|
493
585
|
accessType: accessType,
|
|
494
586
|
publicKey: publicKey,
|
|
@@ -498,7 +590,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
498
590
|
});
|
|
499
591
|
|
|
500
592
|
case 24:
|
|
501
|
-
_yield$this$AccessInf =
|
|
593
|
+
_yield$this$AccessInf = _context5.sent;
|
|
502
594
|
accessArgs = _yield$this$AccessInf.accessArgs;
|
|
503
595
|
checkAccessCharge = _yield$this$AccessInf.checkAccessCharge;
|
|
504
596
|
address = Utils.HashToAddress(id);
|
|
@@ -506,11 +598,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
506
598
|
|
|
507
599
|
case 29:
|
|
508
600
|
if (!this.transactionLocks[id]) {
|
|
509
|
-
|
|
601
|
+
_context5.next = 36;
|
|
510
602
|
break;
|
|
511
603
|
}
|
|
512
604
|
|
|
513
|
-
|
|
605
|
+
_context5.next = 32;
|
|
514
606
|
return new Promise(function (resolve) {
|
|
515
607
|
return setTimeout(resolve, 100);
|
|
516
608
|
});
|
|
@@ -523,31 +615,31 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
523
615
|
delete this.transactionLocks[id];
|
|
524
616
|
}
|
|
525
617
|
|
|
526
|
-
|
|
618
|
+
_context5.next = 29;
|
|
527
619
|
break;
|
|
528
620
|
|
|
529
621
|
case 36:
|
|
530
|
-
|
|
622
|
+
_context5.prev = 36;
|
|
531
623
|
this.transactionLocks[id] = true; // Check cache for existing transaction
|
|
532
624
|
|
|
533
625
|
if (!(!noCache && !skipCache)) {
|
|
534
|
-
|
|
626
|
+
_context5.next = 46;
|
|
535
627
|
break;
|
|
536
628
|
}
|
|
537
629
|
|
|
538
630
|
_cache = update ? this.modifyTransactions : this.accessTransactions;
|
|
539
631
|
|
|
540
632
|
if (!_cache[address]) {
|
|
541
|
-
|
|
633
|
+
_context5.next = 46;
|
|
542
634
|
break;
|
|
543
635
|
}
|
|
544
636
|
|
|
545
637
|
if (!(_cache[address].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
546
|
-
|
|
638
|
+
_context5.next = 45;
|
|
547
639
|
break;
|
|
548
640
|
}
|
|
549
641
|
|
|
550
|
-
return
|
|
642
|
+
return _context5.abrupt("return", _cache[address]);
|
|
551
643
|
|
|
552
644
|
case 45:
|
|
553
645
|
// Token expired
|
|
@@ -555,33 +647,33 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
555
647
|
|
|
556
648
|
case 46:
|
|
557
649
|
if (!cacheOnly) {
|
|
558
|
-
|
|
650
|
+
_context5.next = 48;
|
|
559
651
|
break;
|
|
560
652
|
}
|
|
561
653
|
|
|
562
|
-
return
|
|
654
|
+
return _context5.abrupt("return");
|
|
563
655
|
|
|
564
656
|
case 48:
|
|
565
657
|
if (!update) {
|
|
566
|
-
|
|
658
|
+
_context5.next = 55;
|
|
567
659
|
break;
|
|
568
660
|
}
|
|
569
661
|
|
|
570
662
|
this.Log("Making update request on ".concat(accessType, " ").concat(id));
|
|
571
|
-
|
|
663
|
+
_context5.next = 52;
|
|
572
664
|
return this.UpdateRequest({
|
|
573
665
|
id: id,
|
|
574
666
|
abi: abi
|
|
575
667
|
});
|
|
576
668
|
|
|
577
669
|
case 52:
|
|
578
|
-
accessRequest =
|
|
579
|
-
|
|
670
|
+
accessRequest = _context5.sent;
|
|
671
|
+
_context5.next = 59;
|
|
580
672
|
break;
|
|
581
673
|
|
|
582
674
|
case 55:
|
|
583
675
|
this.Log("Making access request on ".concat(accessType, " ").concat(id));
|
|
584
|
-
|
|
676
|
+
_context5.next = 58;
|
|
585
677
|
return this.AccessRequest({
|
|
586
678
|
id: id,
|
|
587
679
|
args: accessArgs,
|
|
@@ -589,11 +681,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
589
681
|
});
|
|
590
682
|
|
|
591
683
|
case 58:
|
|
592
|
-
accessRequest =
|
|
684
|
+
accessRequest = _context5.sent;
|
|
593
685
|
|
|
594
686
|
case 59:
|
|
595
687
|
cache = update ? this.modifyTransactions : this.accessTransactions;
|
|
596
|
-
|
|
688
|
+
_context5.prev = 60;
|
|
597
689
|
|
|
598
690
|
if (!noCache) {
|
|
599
691
|
cache[address] = {
|
|
@@ -609,32 +701,32 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
609
701
|
});
|
|
610
702
|
}
|
|
611
703
|
|
|
612
|
-
return
|
|
704
|
+
return _context5.abrupt("return", accessRequest);
|
|
613
705
|
|
|
614
706
|
case 65:
|
|
615
|
-
|
|
616
|
-
|
|
707
|
+
_context5.prev = 65;
|
|
708
|
+
_context5.t0 = _context5["catch"](60);
|
|
617
709
|
|
|
618
710
|
if (!noCache) {
|
|
619
711
|
delete cache[address];
|
|
620
712
|
}
|
|
621
713
|
|
|
622
|
-
throw
|
|
714
|
+
throw _context5.t0;
|
|
623
715
|
|
|
624
716
|
case 69:
|
|
625
|
-
|
|
717
|
+
_context5.prev = 69;
|
|
626
718
|
delete this.transactionLocks[id];
|
|
627
|
-
return
|
|
719
|
+
return _context5.finish(69);
|
|
628
720
|
|
|
629
721
|
case 72:
|
|
630
722
|
case "end":
|
|
631
|
-
return
|
|
723
|
+
return _context5.stop();
|
|
632
724
|
}
|
|
633
725
|
}
|
|
634
|
-
},
|
|
726
|
+
}, _callee5, this, [[36,, 69, 72], [60, 65]]);
|
|
635
727
|
}));
|
|
636
728
|
|
|
637
|
-
function MakeAccessRequest(
|
|
729
|
+
function MakeAccessRequest(_x5) {
|
|
638
730
|
return _MakeAccessRequest.apply(this, arguments);
|
|
639
731
|
}
|
|
640
732
|
|
|
@@ -643,21 +735,21 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
643
735
|
}, {
|
|
644
736
|
key: "AccessRequest",
|
|
645
737
|
value: function () {
|
|
646
|
-
var _AccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
647
|
-
var id,
|
|
738
|
+
var _AccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref7) {
|
|
739
|
+
var id, _ref7$args, args, _ref7$checkAccessChar, checkAccessCharge, _yield$this$ContractI2, isV3, accessType, abi, accessCharge, owner, accessChargeArgs, event, methodName, contractAddress;
|
|
648
740
|
|
|
649
|
-
return _regeneratorRuntime.wrap(function
|
|
741
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
650
742
|
while (1) {
|
|
651
|
-
switch (
|
|
743
|
+
switch (_context6.prev = _context6.next) {
|
|
652
744
|
case 0:
|
|
653
|
-
id =
|
|
654
|
-
|
|
745
|
+
id = _ref7.id, _ref7$args = _ref7.args, args = _ref7$args === void 0 ? [] : _ref7$args, _ref7$checkAccessChar = _ref7.checkAccessCharge, checkAccessCharge = _ref7$checkAccessChar === void 0 ? false : _ref7$checkAccessChar;
|
|
746
|
+
_context6.next = 3;
|
|
655
747
|
return this.ContractInfo({
|
|
656
748
|
id: id
|
|
657
749
|
});
|
|
658
750
|
|
|
659
751
|
case 3:
|
|
660
|
-
_yield$this$ContractI2 =
|
|
752
|
+
_yield$this$ContractI2 = _context6.sent;
|
|
661
753
|
isV3 = _yield$this$ContractI2.isV3;
|
|
662
754
|
accessType = _yield$this$ContractI2.accessType;
|
|
663
755
|
abi = _yield$this$ContractI2.abi;
|
|
@@ -665,46 +757,46 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
665
757
|
accessCharge = 0;
|
|
666
758
|
|
|
667
759
|
if (!(checkAccessCharge && accessType === ACCESS_TYPES.OBJECT)) {
|
|
668
|
-
|
|
760
|
+
_context6.next = 26;
|
|
669
761
|
break;
|
|
670
762
|
}
|
|
671
763
|
|
|
672
|
-
|
|
764
|
+
_context6.next = 11;
|
|
673
765
|
return this.Owner({
|
|
674
766
|
id: id,
|
|
675
767
|
abi: abi
|
|
676
768
|
});
|
|
677
769
|
|
|
678
770
|
case 11:
|
|
679
|
-
owner =
|
|
771
|
+
owner = _context6.sent;
|
|
680
772
|
|
|
681
773
|
if (Utils.EqualAddress(this.client.signer.address, owner)) {
|
|
682
|
-
|
|
774
|
+
_context6.next = 26;
|
|
683
775
|
break;
|
|
684
776
|
}
|
|
685
777
|
|
|
686
|
-
|
|
778
|
+
_context6.prev = 13;
|
|
687
779
|
// Extract level, custom values and stakeholders from accessRequest arguments
|
|
688
780
|
accessChargeArgs = isV3 ? [0, [], []] : [args[0], args[3], args[4]]; // Access charge is in wei, but methods take ether - convert to charge to ether
|
|
689
781
|
|
|
690
|
-
|
|
691
|
-
|
|
782
|
+
_context6.t0 = Utils;
|
|
783
|
+
_context6.next = 18;
|
|
692
784
|
return this.GetAccessCharge({
|
|
693
785
|
objectId: id,
|
|
694
786
|
args: accessChargeArgs
|
|
695
787
|
});
|
|
696
788
|
|
|
697
789
|
case 18:
|
|
698
|
-
|
|
699
|
-
accessCharge =
|
|
700
|
-
|
|
790
|
+
_context6.t1 = _context6.sent;
|
|
791
|
+
accessCharge = _context6.t0.WeiToEther.call(_context6.t0, _context6.t1);
|
|
792
|
+
_context6.next = 26;
|
|
701
793
|
break;
|
|
702
794
|
|
|
703
795
|
case 22:
|
|
704
|
-
|
|
705
|
-
|
|
796
|
+
_context6.prev = 22;
|
|
797
|
+
_context6.t2 = _context6["catch"](13);
|
|
706
798
|
this.Log("Failed to get access charge for", id);
|
|
707
|
-
this.Log(
|
|
799
|
+
this.Log(_context6.t2);
|
|
708
800
|
|
|
709
801
|
case 26:
|
|
710
802
|
if (accessCharge > 0) {
|
|
@@ -719,7 +811,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
719
811
|
methodName = "accessRequest";
|
|
720
812
|
}
|
|
721
813
|
|
|
722
|
-
|
|
814
|
+
_context6.next = 31;
|
|
723
815
|
return this.ContractHasMethod({
|
|
724
816
|
contractAddress: contractAddress,
|
|
725
817
|
abi: abi,
|
|
@@ -727,19 +819,19 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
727
819
|
});
|
|
728
820
|
|
|
729
821
|
case 31:
|
|
730
|
-
if (
|
|
731
|
-
|
|
822
|
+
if (_context6.sent) {
|
|
823
|
+
_context6.next = 34;
|
|
732
824
|
break;
|
|
733
825
|
}
|
|
734
826
|
|
|
735
827
|
this.Log("".concat(accessType, " ").concat(id, " has no ").concat(methodName, " method. Skipping"));
|
|
736
|
-
return
|
|
828
|
+
return _context6.abrupt("return", {
|
|
737
829
|
transactionHash: "",
|
|
738
830
|
logs: []
|
|
739
831
|
});
|
|
740
832
|
|
|
741
833
|
case 34:
|
|
742
|
-
|
|
834
|
+
_context6.next = 36;
|
|
743
835
|
return this.client.CallContractMethodAndWait({
|
|
744
836
|
contractAddress: contractAddress,
|
|
745
837
|
abi: abi,
|
|
@@ -749,27 +841,27 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
749
841
|
});
|
|
750
842
|
|
|
751
843
|
case 36:
|
|
752
|
-
event =
|
|
844
|
+
event = _context6.sent;
|
|
753
845
|
|
|
754
846
|
if (!(event.logs.length === 0)) {
|
|
755
|
-
|
|
847
|
+
_context6.next = 39;
|
|
756
848
|
break;
|
|
757
849
|
}
|
|
758
850
|
|
|
759
851
|
throw Error("Access denied (".concat(id, ")"));
|
|
760
852
|
|
|
761
853
|
case 39:
|
|
762
|
-
return
|
|
854
|
+
return _context6.abrupt("return", event);
|
|
763
855
|
|
|
764
856
|
case 40:
|
|
765
857
|
case "end":
|
|
766
|
-
return
|
|
858
|
+
return _context6.stop();
|
|
767
859
|
}
|
|
768
860
|
}
|
|
769
|
-
},
|
|
861
|
+
}, _callee6, this, [[13, 22]]);
|
|
770
862
|
}));
|
|
771
863
|
|
|
772
|
-
function AccessRequest(
|
|
864
|
+
function AccessRequest(_x6) {
|
|
773
865
|
return _AccessRequest.apply(this, arguments);
|
|
774
866
|
}
|
|
775
867
|
|
|
@@ -778,14 +870,14 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
778
870
|
}, {
|
|
779
871
|
key: "UpdateRequest",
|
|
780
872
|
value: function () {
|
|
781
|
-
var _UpdateRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
873
|
+
var _UpdateRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
|
|
782
874
|
var id, abi, event, updateRequestEvent;
|
|
783
|
-
return _regeneratorRuntime.wrap(function
|
|
875
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
784
876
|
while (1) {
|
|
785
|
-
switch (
|
|
877
|
+
switch (_context7.prev = _context7.next) {
|
|
786
878
|
case 0:
|
|
787
|
-
id =
|
|
788
|
-
|
|
879
|
+
id = _ref8.id, abi = _ref8.abi;
|
|
880
|
+
_context7.next = 3;
|
|
789
881
|
return this.client.CallContractMethodAndWait({
|
|
790
882
|
contractAddress: Utils.HashToAddress(id),
|
|
791
883
|
abi: abi,
|
|
@@ -794,7 +886,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
794
886
|
});
|
|
795
887
|
|
|
796
888
|
case 3:
|
|
797
|
-
event =
|
|
889
|
+
event = _context7.sent;
|
|
798
890
|
updateRequestEvent = this.client.ExtractEventFromLogs({
|
|
799
891
|
abi: abi,
|
|
800
892
|
event: event,
|
|
@@ -802,24 +894,24 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
802
894
|
});
|
|
803
895
|
|
|
804
896
|
if (!(event.logs.length === 0 || !updateRequestEvent)) {
|
|
805
|
-
|
|
897
|
+
_context7.next = 7;
|
|
806
898
|
break;
|
|
807
899
|
}
|
|
808
900
|
|
|
809
901
|
throw Error("Update request denied for ".concat(id));
|
|
810
902
|
|
|
811
903
|
case 7:
|
|
812
|
-
return
|
|
904
|
+
return _context7.abrupt("return", event);
|
|
813
905
|
|
|
814
906
|
case 8:
|
|
815
907
|
case "end":
|
|
816
|
-
return
|
|
908
|
+
return _context7.stop();
|
|
817
909
|
}
|
|
818
910
|
}
|
|
819
|
-
},
|
|
911
|
+
}, _callee7, this);
|
|
820
912
|
}));
|
|
821
913
|
|
|
822
|
-
function UpdateRequest(
|
|
914
|
+
function UpdateRequest(_x7) {
|
|
823
915
|
return _UpdateRequest.apply(this, arguments);
|
|
824
916
|
}
|
|
825
917
|
|
|
@@ -827,14 +919,14 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
827
919
|
}()
|
|
828
920
|
}, {
|
|
829
921
|
key: "AudienceData",
|
|
830
|
-
value: function AudienceData(
|
|
831
|
-
var objectId =
|
|
832
|
-
versionHash =
|
|
833
|
-
|
|
834
|
-
protocols =
|
|
835
|
-
|
|
836
|
-
drms =
|
|
837
|
-
context =
|
|
922
|
+
value: function AudienceData(_ref9) {
|
|
923
|
+
var objectId = _ref9.objectId,
|
|
924
|
+
versionHash = _ref9.versionHash,
|
|
925
|
+
_ref9$protocols = _ref9.protocols,
|
|
926
|
+
protocols = _ref9$protocols === void 0 ? [] : _ref9$protocols,
|
|
927
|
+
_ref9$drms = _ref9.drms,
|
|
928
|
+
drms = _ref9$drms === void 0 ? [] : _ref9$drms,
|
|
929
|
+
context = _ref9.context;
|
|
838
930
|
this.Log("Retrieving audience data: ".concat(objectId));
|
|
839
931
|
context = context || this.client.authContext || {};
|
|
840
932
|
|
|
@@ -865,41 +957,41 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
865
957
|
}, {
|
|
866
958
|
key: "GenerateChannelContentToken",
|
|
867
959
|
value: function () {
|
|
868
|
-
var _GenerateChannelContentToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
869
|
-
var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken,
|
|
960
|
+
var _GenerateChannelContentToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
|
|
961
|
+
var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref10$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams, payload, signature, multiSig;
|
|
870
962
|
|
|
871
|
-
return _regeneratorRuntime.wrap(function
|
|
963
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
872
964
|
while (1) {
|
|
873
|
-
switch (
|
|
965
|
+
switch (_context8.prev = _context8.next) {
|
|
874
966
|
case 0:
|
|
875
|
-
objectId =
|
|
967
|
+
objectId = _ref10.objectId, versionHash = _ref10.versionHash, issuer = _ref10.issuer, code = _ref10.code, email = _ref10.email, audienceData = _ref10.audienceData, context = _ref10.context, oauthToken = _ref10.oauthToken, _ref10$value = _ref10.value, value = _ref10$value === void 0 ? 0 : _ref10$value;
|
|
876
968
|
|
|
877
969
|
if (!oauthToken) {
|
|
878
|
-
|
|
970
|
+
_context8.next = 5;
|
|
879
971
|
break;
|
|
880
972
|
}
|
|
881
973
|
|
|
882
|
-
|
|
974
|
+
_context8.next = 4;
|
|
883
975
|
return this.GenerateOauthChannelToken({
|
|
884
976
|
objectId: objectId,
|
|
885
977
|
token: oauthToken
|
|
886
978
|
});
|
|
887
979
|
|
|
888
980
|
case 4:
|
|
889
|
-
return
|
|
981
|
+
return _context8.abrupt("return", _context8.sent);
|
|
890
982
|
|
|
891
983
|
case 5:
|
|
892
984
|
if (!(!this.noCache && this.channelContentTokens[objectId])) {
|
|
893
|
-
|
|
985
|
+
_context8.next = 11;
|
|
894
986
|
break;
|
|
895
987
|
}
|
|
896
988
|
|
|
897
989
|
if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
898
|
-
|
|
990
|
+
_context8.next = 10;
|
|
899
991
|
break;
|
|
900
992
|
}
|
|
901
993
|
|
|
902
|
-
return
|
|
994
|
+
return _context8.abrupt("return", this.channelContentTokens[objectId].token);
|
|
903
995
|
|
|
904
996
|
case 10:
|
|
905
997
|
// Token expired
|
|
@@ -909,45 +1001,45 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
909
1001
|
this.Log("Making state channel access request: ".concat(objectId));
|
|
910
1002
|
|
|
911
1003
|
if (!issuer) {
|
|
912
|
-
|
|
1004
|
+
_context8.next = 43;
|
|
913
1005
|
break;
|
|
914
1006
|
}
|
|
915
1007
|
|
|
916
1008
|
// Ticket API
|
|
917
1009
|
tenantId = issuer.replace(/^\//, "").split("/")[2];
|
|
918
|
-
|
|
919
|
-
|
|
1010
|
+
_context8.prev = 14;
|
|
1011
|
+
_context8.next = 17;
|
|
920
1012
|
return this.client.CallContractMethod({
|
|
921
1013
|
contractAddress: Utils.HashToAddress(tenantId),
|
|
922
1014
|
methodName: "addressKMS"
|
|
923
1015
|
});
|
|
924
1016
|
|
|
925
1017
|
case 17:
|
|
926
|
-
kmsAddress =
|
|
1018
|
+
kmsAddress = _context8.sent;
|
|
927
1019
|
|
|
928
1020
|
if (kmsAddress) {
|
|
929
|
-
|
|
1021
|
+
_context8.next = 20;
|
|
930
1022
|
break;
|
|
931
1023
|
}
|
|
932
1024
|
|
|
933
1025
|
throw "";
|
|
934
1026
|
|
|
935
1027
|
case 20:
|
|
936
|
-
|
|
1028
|
+
_context8.next = 27;
|
|
937
1029
|
break;
|
|
938
1030
|
|
|
939
1031
|
case 22:
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1032
|
+
_context8.prev = 22;
|
|
1033
|
+
_context8.t0 = _context8["catch"](14);
|
|
1034
|
+
_context8.next = 26;
|
|
943
1035
|
return this.client.DefaultKMSAddress();
|
|
944
1036
|
|
|
945
1037
|
case 26:
|
|
946
|
-
kmsAddress =
|
|
1038
|
+
kmsAddress = _context8.sent;
|
|
947
1039
|
|
|
948
1040
|
case 27:
|
|
949
|
-
|
|
950
|
-
|
|
1041
|
+
_context8.prev = 27;
|
|
1042
|
+
_context8.next = 30;
|
|
951
1043
|
return Utils.ResponseToFormat("text", this.MakeAuthServiceRequest({
|
|
952
1044
|
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
953
1045
|
method: "POST",
|
|
@@ -959,16 +1051,16 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
959
1051
|
}));
|
|
960
1052
|
|
|
961
1053
|
case 30:
|
|
962
|
-
token =
|
|
963
|
-
|
|
1054
|
+
token = _context8.sent;
|
|
1055
|
+
_context8.next = 40;
|
|
964
1056
|
break;
|
|
965
1057
|
|
|
966
1058
|
case 33:
|
|
967
|
-
|
|
968
|
-
|
|
1059
|
+
_context8.prev = 33;
|
|
1060
|
+
_context8.t1 = _context8["catch"](27);
|
|
969
1061
|
this.Log("/as token redemption failed:", true);
|
|
970
|
-
this.Log(
|
|
971
|
-
|
|
1062
|
+
this.Log(_context8.t1, true);
|
|
1063
|
+
_context8.next = 39;
|
|
972
1064
|
return Utils.ResponseToFormat("text", this.MakeKMSRequest({
|
|
973
1065
|
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
974
1066
|
method: "POST",
|
|
@@ -980,12 +1072,12 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
980
1072
|
}));
|
|
981
1073
|
|
|
982
1074
|
case 39:
|
|
983
|
-
token =
|
|
1075
|
+
token = _context8.sent;
|
|
984
1076
|
|
|
985
1077
|
case 40:
|
|
986
1078
|
// Pull target object from token so token can be cached
|
|
987
1079
|
objectId = JSON.parse(Utils.FromB64(token)).qid;
|
|
988
|
-
|
|
1080
|
+
_context8.next = 54;
|
|
989
1081
|
break;
|
|
990
1082
|
|
|
991
1083
|
case 43:
|
|
@@ -1000,7 +1092,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1000
1092
|
|
|
1001
1093
|
stateChannelApi = "elv_channelContentRequestContext";
|
|
1002
1094
|
additionalParams = [JSON.stringify(audienceData)];
|
|
1003
|
-
|
|
1095
|
+
_context8.next = 48;
|
|
1004
1096
|
return this.MakeKMSCall({
|
|
1005
1097
|
objectId: objectId,
|
|
1006
1098
|
methodName: stateChannelApi,
|
|
@@ -1010,12 +1102,12 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1010
1102
|
});
|
|
1011
1103
|
|
|
1012
1104
|
case 48:
|
|
1013
|
-
payload =
|
|
1014
|
-
|
|
1105
|
+
payload = _context8.sent;
|
|
1106
|
+
_context8.next = 51;
|
|
1015
1107
|
return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(payload)));
|
|
1016
1108
|
|
|
1017
1109
|
case 51:
|
|
1018
|
-
signature =
|
|
1110
|
+
signature = _context8.sent;
|
|
1019
1111
|
multiSig = Utils.FormatSignature(signature);
|
|
1020
1112
|
token = "".concat(payload, ".").concat(Utils.B64(multiSig));
|
|
1021
1113
|
|
|
@@ -1027,17 +1119,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1027
1119
|
};
|
|
1028
1120
|
}
|
|
1029
1121
|
|
|
1030
|
-
return
|
|
1122
|
+
return _context8.abrupt("return", token);
|
|
1031
1123
|
|
|
1032
1124
|
case 56:
|
|
1033
1125
|
case "end":
|
|
1034
|
-
return
|
|
1126
|
+
return _context8.stop();
|
|
1035
1127
|
}
|
|
1036
1128
|
}
|
|
1037
|
-
},
|
|
1129
|
+
}, _callee8, this, [[14, 22], [27, 33]]);
|
|
1038
1130
|
}));
|
|
1039
1131
|
|
|
1040
|
-
function GenerateChannelContentToken(
|
|
1132
|
+
function GenerateChannelContentToken(_x8) {
|
|
1041
1133
|
return _GenerateChannelContentToken.apply(this, arguments);
|
|
1042
1134
|
}
|
|
1043
1135
|
|
|
@@ -1046,16 +1138,16 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1046
1138
|
}, {
|
|
1047
1139
|
key: "ChannelContentFinalize",
|
|
1048
1140
|
value: function () {
|
|
1049
|
-
var _ChannelContentFinalize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1050
|
-
var objectId, versionHash,
|
|
1141
|
+
var _ChannelContentFinalize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref11) {
|
|
1142
|
+
var objectId, versionHash, _ref11$percent, percent, result;
|
|
1051
1143
|
|
|
1052
|
-
return _regeneratorRuntime.wrap(function
|
|
1144
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
1053
1145
|
while (1) {
|
|
1054
|
-
switch (
|
|
1146
|
+
switch (_context9.prev = _context9.next) {
|
|
1055
1147
|
case 0:
|
|
1056
|
-
objectId =
|
|
1148
|
+
objectId = _ref11.objectId, versionHash = _ref11.versionHash, _ref11$percent = _ref11.percent, percent = _ref11$percent === void 0 ? 0 : _ref11$percent;
|
|
1057
1149
|
this.Log("Making state channel finalize request: ".concat(objectId));
|
|
1058
|
-
|
|
1150
|
+
_context9.next = 4;
|
|
1059
1151
|
return this.MakeKMSCall({
|
|
1060
1152
|
objectId: objectId,
|
|
1061
1153
|
methodName: "elv_channelContentFinalizeContext",
|
|
@@ -1068,19 +1160,19 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1068
1160
|
});
|
|
1069
1161
|
|
|
1070
1162
|
case 4:
|
|
1071
|
-
result =
|
|
1163
|
+
result = _context9.sent;
|
|
1072
1164
|
this.channelContentTokens[objectId] = undefined;
|
|
1073
|
-
return
|
|
1165
|
+
return _context9.abrupt("return", result);
|
|
1074
1166
|
|
|
1075
1167
|
case 7:
|
|
1076
1168
|
case "end":
|
|
1077
|
-
return
|
|
1169
|
+
return _context9.stop();
|
|
1078
1170
|
}
|
|
1079
1171
|
}
|
|
1080
|
-
},
|
|
1172
|
+
}, _callee9, this);
|
|
1081
1173
|
}));
|
|
1082
1174
|
|
|
1083
|
-
function ChannelContentFinalize(
|
|
1175
|
+
function ChannelContentFinalize(_x9) {
|
|
1084
1176
|
return _ChannelContentFinalize.apply(this, arguments);
|
|
1085
1177
|
}
|
|
1086
1178
|
|
|
@@ -1089,36 +1181,36 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1089
1181
|
}, {
|
|
1090
1182
|
key: "GenerateOauthChannelToken",
|
|
1091
1183
|
value: function () {
|
|
1092
|
-
var _GenerateOauthChannelToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1184
|
+
var _GenerateOauthChannelToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref12) {
|
|
1093
1185
|
var objectId, versionHash, token, fabricToken;
|
|
1094
|
-
return _regeneratorRuntime.wrap(function
|
|
1186
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
1095
1187
|
while (1) {
|
|
1096
|
-
switch (
|
|
1188
|
+
switch (_context10.prev = _context10.next) {
|
|
1097
1189
|
case 0:
|
|
1098
|
-
objectId =
|
|
1190
|
+
objectId = _ref12.objectId, versionHash = _ref12.versionHash, token = _ref12.token;
|
|
1099
1191
|
|
|
1100
1192
|
if (versionHash) {
|
|
1101
1193
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1102
1194
|
}
|
|
1103
1195
|
|
|
1104
1196
|
if (!(!this.noCache && this.channelContentTokens[objectId])) {
|
|
1105
|
-
|
|
1197
|
+
_context10.next = 6;
|
|
1106
1198
|
break;
|
|
1107
1199
|
}
|
|
1108
1200
|
|
|
1109
1201
|
if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
1110
|
-
|
|
1202
|
+
_context10.next = 5;
|
|
1111
1203
|
break;
|
|
1112
1204
|
}
|
|
1113
1205
|
|
|
1114
|
-
return
|
|
1206
|
+
return _context10.abrupt("return", this.channelContentTokens[objectId].token);
|
|
1115
1207
|
|
|
1116
1208
|
case 5:
|
|
1117
1209
|
// Token expired
|
|
1118
1210
|
this.channelContentTokens[objectId] = undefined;
|
|
1119
1211
|
|
|
1120
1212
|
case 6:
|
|
1121
|
-
|
|
1213
|
+
_context10.next = 8;
|
|
1122
1214
|
return this.MakeKMSRequest({
|
|
1123
1215
|
objectId: objectId,
|
|
1124
1216
|
versionHash: versionHash,
|
|
@@ -1131,11 +1223,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1131
1223
|
});
|
|
1132
1224
|
|
|
1133
1225
|
case 8:
|
|
1134
|
-
|
|
1135
|
-
return
|
|
1226
|
+
_context10.next = 10;
|
|
1227
|
+
return _context10.sent.text();
|
|
1136
1228
|
|
|
1137
1229
|
case 10:
|
|
1138
|
-
fabricToken =
|
|
1230
|
+
fabricToken = _context10.sent;
|
|
1139
1231
|
|
|
1140
1232
|
if (!this.noCache) {
|
|
1141
1233
|
this.channelContentTokens[objectId] = {
|
|
@@ -1144,17 +1236,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1144
1236
|
};
|
|
1145
1237
|
}
|
|
1146
1238
|
|
|
1147
|
-
return
|
|
1239
|
+
return _context10.abrupt("return", fabricToken);
|
|
1148
1240
|
|
|
1149
1241
|
case 13:
|
|
1150
1242
|
case "end":
|
|
1151
|
-
return
|
|
1243
|
+
return _context10.stop();
|
|
1152
1244
|
}
|
|
1153
1245
|
}
|
|
1154
|
-
},
|
|
1246
|
+
}, _callee10, this);
|
|
1155
1247
|
}));
|
|
1156
1248
|
|
|
1157
|
-
function GenerateOauthChannelToken(
|
|
1249
|
+
function GenerateOauthChannelToken(_x10) {
|
|
1158
1250
|
return _GenerateOauthChannelToken.apply(this, arguments);
|
|
1159
1251
|
}
|
|
1160
1252
|
|
|
@@ -1163,27 +1255,27 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1163
1255
|
}, {
|
|
1164
1256
|
key: "IsV3",
|
|
1165
1257
|
value: function () {
|
|
1166
|
-
var _IsV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1258
|
+
var _IsV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref13) {
|
|
1167
1259
|
var id, contractName;
|
|
1168
|
-
return _regeneratorRuntime.wrap(function
|
|
1260
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1169
1261
|
while (1) {
|
|
1170
|
-
switch (
|
|
1262
|
+
switch (_context11.prev = _context11.next) {
|
|
1171
1263
|
case 0:
|
|
1172
|
-
id =
|
|
1264
|
+
id = _ref13.id;
|
|
1173
1265
|
|
|
1174
1266
|
if (!this.client.assumeV3) {
|
|
1175
|
-
|
|
1267
|
+
_context11.next = 3;
|
|
1176
1268
|
break;
|
|
1177
1269
|
}
|
|
1178
1270
|
|
|
1179
|
-
return
|
|
1271
|
+
return _context11.abrupt("return", true);
|
|
1180
1272
|
|
|
1181
1273
|
case 3:
|
|
1182
|
-
|
|
1274
|
+
_context11.next = 5;
|
|
1183
1275
|
return this.client.ethClient.ContractName(Utils.HashToAddress(id), true);
|
|
1184
1276
|
|
|
1185
1277
|
case 5:
|
|
1186
|
-
contractName =
|
|
1278
|
+
contractName = _context11.sent;
|
|
1187
1279
|
|
|
1188
1280
|
if (!this.accessVersions[contractName]) {
|
|
1189
1281
|
this.accessVersions[contractName] = this.ContractHasMethod({
|
|
@@ -1193,21 +1285,21 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1193
1285
|
});
|
|
1194
1286
|
}
|
|
1195
1287
|
|
|
1196
|
-
|
|
1288
|
+
_context11.next = 9;
|
|
1197
1289
|
return this.accessVersions[contractName];
|
|
1198
1290
|
|
|
1199
1291
|
case 9:
|
|
1200
|
-
return
|
|
1292
|
+
return _context11.abrupt("return", _context11.sent);
|
|
1201
1293
|
|
|
1202
1294
|
case 10:
|
|
1203
1295
|
case "end":
|
|
1204
|
-
return
|
|
1296
|
+
return _context11.stop();
|
|
1205
1297
|
}
|
|
1206
1298
|
}
|
|
1207
|
-
},
|
|
1299
|
+
}, _callee11, this);
|
|
1208
1300
|
}));
|
|
1209
1301
|
|
|
1210
|
-
function IsV3(
|
|
1302
|
+
function IsV3(_x11) {
|
|
1211
1303
|
return _IsV.apply(this, arguments);
|
|
1212
1304
|
}
|
|
1213
1305
|
|
|
@@ -1216,13 +1308,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1216
1308
|
}, {
|
|
1217
1309
|
key: "AccessInfo",
|
|
1218
1310
|
value: function () {
|
|
1219
|
-
var _AccessInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1311
|
+
var _AccessInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref14) {
|
|
1220
1312
|
var accessType, publicKey, args, isV3, checkAccessCharge;
|
|
1221
|
-
return _regeneratorRuntime.wrap(function
|
|
1313
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
1222
1314
|
while (1) {
|
|
1223
|
-
switch (
|
|
1315
|
+
switch (_context12.prev = _context12.next) {
|
|
1224
1316
|
case 0:
|
|
1225
|
-
accessType =
|
|
1317
|
+
accessType = _ref14.accessType, publicKey = _ref14.publicKey, args = _ref14.args, isV3 = _ref14.isV3;
|
|
1226
1318
|
checkAccessCharge = false;
|
|
1227
1319
|
|
|
1228
1320
|
if (accessType === ACCESS_TYPES.OBJECT) {
|
|
@@ -1250,20 +1342,20 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1250
1342
|
];
|
|
1251
1343
|
}
|
|
1252
1344
|
|
|
1253
|
-
return
|
|
1345
|
+
return _context12.abrupt("return", {
|
|
1254
1346
|
accessArgs: args,
|
|
1255
1347
|
checkAccessCharge: checkAccessCharge
|
|
1256
1348
|
});
|
|
1257
1349
|
|
|
1258
1350
|
case 5:
|
|
1259
1351
|
case "end":
|
|
1260
|
-
return
|
|
1352
|
+
return _context12.stop();
|
|
1261
1353
|
}
|
|
1262
1354
|
}
|
|
1263
|
-
},
|
|
1355
|
+
}, _callee12, this);
|
|
1264
1356
|
}));
|
|
1265
1357
|
|
|
1266
|
-
function AccessInfo(
|
|
1358
|
+
function AccessInfo(_x12) {
|
|
1267
1359
|
return _AccessInfo.apply(this, arguments);
|
|
1268
1360
|
}
|
|
1269
1361
|
|
|
@@ -1273,54 +1365,54 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1273
1365
|
}, {
|
|
1274
1366
|
key: "AccessType",
|
|
1275
1367
|
value: function () {
|
|
1276
|
-
var _AccessType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1368
|
+
var _AccessType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id) {
|
|
1277
1369
|
var contractName, accessType;
|
|
1278
|
-
return _regeneratorRuntime.wrap(function
|
|
1370
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1279
1371
|
while (1) {
|
|
1280
|
-
switch (
|
|
1372
|
+
switch (_context13.prev = _context13.next) {
|
|
1281
1373
|
case 0:
|
|
1282
|
-
|
|
1374
|
+
_context13.next = 2;
|
|
1283
1375
|
return this.client.ethClient.ContractName(Utils.HashToAddress(id));
|
|
1284
1376
|
|
|
1285
1377
|
case 2:
|
|
1286
|
-
contractName =
|
|
1378
|
+
contractName = _context13.sent;
|
|
1287
1379
|
|
|
1288
1380
|
if (this.accessTypes[id]) {
|
|
1289
|
-
|
|
1381
|
+
_context13.next = 23;
|
|
1290
1382
|
break;
|
|
1291
1383
|
}
|
|
1292
1384
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1385
|
+
_context13.t0 = contractName;
|
|
1386
|
+
_context13.next = _context13.t0 === "BaseContentSpace" ? 7 : _context13.t0 === "BaseLibrary" ? 9 : _context13.t0 === "BaseContentType" ? 11 : _context13.t0 === "BsAccessWallet" ? 13 : _context13.t0 === "BsAccessCtrlGrp" ? 15 : _context13.t0 === "BaseContent" ? 17 : _context13.t0 === "BaseTenantSpace" ? 19 : 21;
|
|
1295
1387
|
break;
|
|
1296
1388
|
|
|
1297
1389
|
case 7:
|
|
1298
1390
|
accessType = ACCESS_TYPES.SPACE;
|
|
1299
|
-
return
|
|
1391
|
+
return _context13.abrupt("break", 22);
|
|
1300
1392
|
|
|
1301
1393
|
case 9:
|
|
1302
1394
|
accessType = ACCESS_TYPES.LIBRARY;
|
|
1303
|
-
return
|
|
1395
|
+
return _context13.abrupt("break", 22);
|
|
1304
1396
|
|
|
1305
1397
|
case 11:
|
|
1306
1398
|
accessType = ACCESS_TYPES.TYPE;
|
|
1307
|
-
return
|
|
1399
|
+
return _context13.abrupt("break", 22);
|
|
1308
1400
|
|
|
1309
1401
|
case 13:
|
|
1310
1402
|
accessType = ACCESS_TYPES.WALLET;
|
|
1311
|
-
return
|
|
1403
|
+
return _context13.abrupt("break", 22);
|
|
1312
1404
|
|
|
1313
1405
|
case 15:
|
|
1314
1406
|
accessType = ACCESS_TYPES.GROUP;
|
|
1315
|
-
return
|
|
1407
|
+
return _context13.abrupt("break", 22);
|
|
1316
1408
|
|
|
1317
1409
|
case 17:
|
|
1318
1410
|
accessType = ACCESS_TYPES.OBJECT;
|
|
1319
|
-
return
|
|
1411
|
+
return _context13.abrupt("break", 22);
|
|
1320
1412
|
|
|
1321
1413
|
case 19:
|
|
1322
1414
|
accessType = ACCESS_TYPES.TENANT;
|
|
1323
|
-
return
|
|
1415
|
+
return _context13.abrupt("break", 22);
|
|
1324
1416
|
|
|
1325
1417
|
case 21:
|
|
1326
1418
|
accessType = ACCESS_TYPES.OTHER;
|
|
@@ -1329,17 +1421,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1329
1421
|
this.accessTypes[id] = accessType;
|
|
1330
1422
|
|
|
1331
1423
|
case 23:
|
|
1332
|
-
return
|
|
1424
|
+
return _context13.abrupt("return", this.accessTypes[id]);
|
|
1333
1425
|
|
|
1334
1426
|
case 24:
|
|
1335
1427
|
case "end":
|
|
1336
|
-
return
|
|
1428
|
+
return _context13.stop();
|
|
1337
1429
|
}
|
|
1338
1430
|
}
|
|
1339
|
-
},
|
|
1431
|
+
}, _callee13, this);
|
|
1340
1432
|
}));
|
|
1341
1433
|
|
|
1342
|
-
function AccessType(
|
|
1434
|
+
function AccessType(_x13) {
|
|
1343
1435
|
return _AccessType.apply(this, arguments);
|
|
1344
1436
|
}
|
|
1345
1437
|
|
|
@@ -1348,29 +1440,29 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1348
1440
|
}, {
|
|
1349
1441
|
key: "AccessComplete",
|
|
1350
1442
|
value: function () {
|
|
1351
|
-
var _AccessComplete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1443
|
+
var _AccessComplete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref15) {
|
|
1352
1444
|
var id, score, _yield$this$ContractI3, abi, isV3, address, requestId, event;
|
|
1353
1445
|
|
|
1354
|
-
return _regeneratorRuntime.wrap(function
|
|
1446
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
1355
1447
|
while (1) {
|
|
1356
|
-
switch (
|
|
1448
|
+
switch (_context14.prev = _context14.next) {
|
|
1357
1449
|
case 0:
|
|
1358
|
-
id =
|
|
1450
|
+
id = _ref15.id, score = _ref15.score;
|
|
1359
1451
|
this.Log("Calling access complete on ".concat(id, " with score ").concat(score));
|
|
1360
|
-
|
|
1452
|
+
_context14.next = 4;
|
|
1361
1453
|
return this.ContractInfo({
|
|
1362
1454
|
id: id
|
|
1363
1455
|
});
|
|
1364
1456
|
|
|
1365
1457
|
case 4:
|
|
1366
|
-
_yield$this$ContractI3 =
|
|
1458
|
+
_yield$this$ContractI3 = _context14.sent;
|
|
1367
1459
|
abi = _yield$this$ContractI3.abi;
|
|
1368
1460
|
isV3 = _yield$this$ContractI3.isV3;
|
|
1369
1461
|
address = Utils.HashToAddress(id);
|
|
1370
1462
|
requestId = this.requestIds[address];
|
|
1371
1463
|
|
|
1372
1464
|
if (requestId) {
|
|
1373
|
-
|
|
1465
|
+
_context14.next = 11;
|
|
1374
1466
|
break;
|
|
1375
1467
|
}
|
|
1376
1468
|
|
|
@@ -1378,11 +1470,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1378
1470
|
|
|
1379
1471
|
case 11:
|
|
1380
1472
|
if (!isV3) {
|
|
1381
|
-
|
|
1473
|
+
_context14.next = 17;
|
|
1382
1474
|
break;
|
|
1383
1475
|
}
|
|
1384
1476
|
|
|
1385
|
-
|
|
1477
|
+
_context14.next = 14;
|
|
1386
1478
|
return this.client.CallContractMethodAndWait({
|
|
1387
1479
|
contractAddress: address,
|
|
1388
1480
|
abi: abi,
|
|
@@ -1391,12 +1483,12 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1391
1483
|
});
|
|
1392
1484
|
|
|
1393
1485
|
case 14:
|
|
1394
|
-
event =
|
|
1395
|
-
|
|
1486
|
+
event = _context14.sent;
|
|
1487
|
+
_context14.next = 20;
|
|
1396
1488
|
break;
|
|
1397
1489
|
|
|
1398
1490
|
case 17:
|
|
1399
|
-
|
|
1491
|
+
_context14.next = 19;
|
|
1400
1492
|
return this.client.CallContractMethodAndWait({
|
|
1401
1493
|
contractAddress: address,
|
|
1402
1494
|
abi: abi,
|
|
@@ -1405,22 +1497,22 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1405
1497
|
});
|
|
1406
1498
|
|
|
1407
1499
|
case 19:
|
|
1408
|
-
event =
|
|
1500
|
+
event = _context14.sent;
|
|
1409
1501
|
|
|
1410
1502
|
case 20:
|
|
1411
1503
|
delete this.requestIds[address];
|
|
1412
1504
|
delete this.accessTransactions[address];
|
|
1413
|
-
return
|
|
1505
|
+
return _context14.abrupt("return", event);
|
|
1414
1506
|
|
|
1415
1507
|
case 23:
|
|
1416
1508
|
case "end":
|
|
1417
|
-
return
|
|
1509
|
+
return _context14.stop();
|
|
1418
1510
|
}
|
|
1419
1511
|
}
|
|
1420
|
-
},
|
|
1512
|
+
}, _callee14, this);
|
|
1421
1513
|
}));
|
|
1422
1514
|
|
|
1423
|
-
function AccessComplete(
|
|
1515
|
+
function AccessComplete(_x14) {
|
|
1424
1516
|
return _AccessComplete.apply(this, arguments);
|
|
1425
1517
|
}
|
|
1426
1518
|
|
|
@@ -1431,13 +1523,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1431
1523
|
}, {
|
|
1432
1524
|
key: "ContractInfo",
|
|
1433
1525
|
value: function () {
|
|
1434
|
-
var _ContractInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1526
|
+
var _ContractInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref16) {
|
|
1435
1527
|
var id, address, isV3, version, accessType;
|
|
1436
|
-
return _regeneratorRuntime.wrap(function
|
|
1528
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
1437
1529
|
while (1) {
|
|
1438
|
-
switch (
|
|
1530
|
+
switch (_context15.prev = _context15.next) {
|
|
1439
1531
|
case 0:
|
|
1440
|
-
id =
|
|
1532
|
+
id = _ref16.id, address = _ref16.address;
|
|
1441
1533
|
|
|
1442
1534
|
if (!address) {
|
|
1443
1535
|
address = Utils.HashToAddress(id);
|
|
@@ -1447,29 +1539,29 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1447
1539
|
id = Utils.AddressToObjectId(address);
|
|
1448
1540
|
}
|
|
1449
1541
|
|
|
1450
|
-
|
|
1542
|
+
_context15.next = 5;
|
|
1451
1543
|
return this.IsV3({
|
|
1452
1544
|
id: id
|
|
1453
1545
|
});
|
|
1454
1546
|
|
|
1455
1547
|
case 5:
|
|
1456
|
-
isV3 =
|
|
1548
|
+
isV3 = _context15.sent;
|
|
1457
1549
|
version = isV3 ? "v3" : "v2";
|
|
1458
|
-
|
|
1550
|
+
_context15.next = 9;
|
|
1459
1551
|
return this.AccessType(id);
|
|
1460
1552
|
|
|
1461
1553
|
case 9:
|
|
1462
|
-
accessType =
|
|
1554
|
+
accessType = _context15.sent;
|
|
1463
1555
|
|
|
1464
1556
|
if (!(accessType === this.ACCESS_TYPES.OTHER)) {
|
|
1465
|
-
|
|
1557
|
+
_context15.next = 12;
|
|
1466
1558
|
break;
|
|
1467
1559
|
}
|
|
1468
1560
|
|
|
1469
|
-
return
|
|
1561
|
+
return _context15.abrupt("return", {});
|
|
1470
1562
|
|
|
1471
1563
|
case 12:
|
|
1472
|
-
return
|
|
1564
|
+
return _context15.abrupt("return", {
|
|
1473
1565
|
isV3: isV3,
|
|
1474
1566
|
accessType: accessType,
|
|
1475
1567
|
abi: this.CONTRACTS[version][accessType].abi
|
|
@@ -1477,13 +1569,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1477
1569
|
|
|
1478
1570
|
case 13:
|
|
1479
1571
|
case "end":
|
|
1480
|
-
return
|
|
1572
|
+
return _context15.stop();
|
|
1481
1573
|
}
|
|
1482
1574
|
}
|
|
1483
|
-
},
|
|
1575
|
+
}, _callee15, this);
|
|
1484
1576
|
}));
|
|
1485
1577
|
|
|
1486
|
-
function ContractInfo(
|
|
1578
|
+
function ContractInfo(_x15) {
|
|
1487
1579
|
return _ContractInfo.apply(this, arguments);
|
|
1488
1580
|
}
|
|
1489
1581
|
|
|
@@ -1492,23 +1584,23 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1492
1584
|
}, {
|
|
1493
1585
|
key: "GetAccessCharge",
|
|
1494
1586
|
value: function () {
|
|
1495
|
-
var _GetAccessCharge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1587
|
+
var _GetAccessCharge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref17) {
|
|
1496
1588
|
var objectId, args, _yield$this$ContractI4, abi, info;
|
|
1497
1589
|
|
|
1498
|
-
return _regeneratorRuntime.wrap(function
|
|
1590
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1499
1591
|
while (1) {
|
|
1500
|
-
switch (
|
|
1592
|
+
switch (_context16.prev = _context16.next) {
|
|
1501
1593
|
case 0:
|
|
1502
|
-
objectId =
|
|
1503
|
-
|
|
1594
|
+
objectId = _ref17.objectId, args = _ref17.args;
|
|
1595
|
+
_context16.next = 3;
|
|
1504
1596
|
return this.ContractInfo({
|
|
1505
1597
|
id: objectId
|
|
1506
1598
|
});
|
|
1507
1599
|
|
|
1508
1600
|
case 3:
|
|
1509
|
-
_yield$this$ContractI4 =
|
|
1601
|
+
_yield$this$ContractI4 = _context16.sent;
|
|
1510
1602
|
abi = _yield$this$ContractI4.abi;
|
|
1511
|
-
|
|
1603
|
+
_context16.next = 7;
|
|
1512
1604
|
return this.client.CallContractMethod({
|
|
1513
1605
|
contractAddress: Utils.HashToAddress(objectId),
|
|
1514
1606
|
abi: abi,
|
|
@@ -1517,18 +1609,18 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1517
1609
|
});
|
|
1518
1610
|
|
|
1519
1611
|
case 7:
|
|
1520
|
-
info =
|
|
1521
|
-
return
|
|
1612
|
+
info = _context16.sent;
|
|
1613
|
+
return _context16.abrupt("return", info[1] === 0 ? 0 : info[2]);
|
|
1522
1614
|
|
|
1523
1615
|
case 9:
|
|
1524
1616
|
case "end":
|
|
1525
|
-
return
|
|
1617
|
+
return _context16.stop();
|
|
1526
1618
|
}
|
|
1527
1619
|
}
|
|
1528
|
-
},
|
|
1620
|
+
}, _callee16, this);
|
|
1529
1621
|
}));
|
|
1530
1622
|
|
|
1531
|
-
function GetAccessCharge(
|
|
1623
|
+
function GetAccessCharge(_x16) {
|
|
1532
1624
|
return _GetAccessCharge.apply(this, arguments);
|
|
1533
1625
|
}
|
|
1534
1626
|
|
|
@@ -1537,27 +1629,27 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1537
1629
|
}, {
|
|
1538
1630
|
key: "Owner",
|
|
1539
1631
|
value: function () {
|
|
1540
|
-
var _Owner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1632
|
+
var _Owner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref18) {
|
|
1541
1633
|
var id, address, ownerAddress;
|
|
1542
|
-
return _regeneratorRuntime.wrap(function
|
|
1634
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1543
1635
|
while (1) {
|
|
1544
|
-
switch (
|
|
1636
|
+
switch (_context17.prev = _context17.next) {
|
|
1545
1637
|
case 0:
|
|
1546
|
-
id =
|
|
1638
|
+
id = _ref18.id, address = _ref18.address;
|
|
1547
1639
|
|
|
1548
1640
|
if (this.client.signer) {
|
|
1549
|
-
|
|
1641
|
+
_context17.next = 3;
|
|
1550
1642
|
break;
|
|
1551
1643
|
}
|
|
1552
1644
|
|
|
1553
|
-
return
|
|
1645
|
+
return _context17.abrupt("return", false);
|
|
1554
1646
|
|
|
1555
1647
|
case 3:
|
|
1556
1648
|
if (id) {
|
|
1557
1649
|
address = Utils.HashToAddress(id);
|
|
1558
1650
|
}
|
|
1559
1651
|
|
|
1560
|
-
|
|
1652
|
+
_context17.next = 6;
|
|
1561
1653
|
return this.client.CallContractMethod({
|
|
1562
1654
|
contractAddress: address,
|
|
1563
1655
|
methodName: "owner",
|
|
@@ -1565,18 +1657,18 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1565
1657
|
});
|
|
1566
1658
|
|
|
1567
1659
|
case 6:
|
|
1568
|
-
ownerAddress =
|
|
1569
|
-
return
|
|
1660
|
+
ownerAddress = _context17.sent;
|
|
1661
|
+
return _context17.abrupt("return", Utils.FormatAddress(ownerAddress));
|
|
1570
1662
|
|
|
1571
1663
|
case 8:
|
|
1572
1664
|
case "end":
|
|
1573
|
-
return
|
|
1665
|
+
return _context17.stop();
|
|
1574
1666
|
}
|
|
1575
1667
|
}
|
|
1576
|
-
},
|
|
1668
|
+
}, _callee17, this);
|
|
1577
1669
|
}));
|
|
1578
1670
|
|
|
1579
|
-
function Owner(
|
|
1671
|
+
function Owner(_x17) {
|
|
1580
1672
|
return _Owner.apply(this, arguments);
|
|
1581
1673
|
}
|
|
1582
1674
|
|
|
@@ -1585,50 +1677,50 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1585
1677
|
}, {
|
|
1586
1678
|
key: "Sign",
|
|
1587
1679
|
value: function () {
|
|
1588
|
-
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1589
|
-
return _regeneratorRuntime.wrap(function
|
|
1680
|
+
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(message) {
|
|
1681
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1590
1682
|
while (1) {
|
|
1591
|
-
switch (
|
|
1683
|
+
switch (_context18.prev = _context18.next) {
|
|
1592
1684
|
case 0:
|
|
1593
|
-
|
|
1685
|
+
_context18.t0 = Ethers.utils;
|
|
1594
1686
|
|
|
1595
1687
|
if (!this.client.signer.signDigest) {
|
|
1596
|
-
|
|
1688
|
+
_context18.next = 7;
|
|
1597
1689
|
break;
|
|
1598
1690
|
}
|
|
1599
1691
|
|
|
1600
|
-
|
|
1692
|
+
_context18.next = 4;
|
|
1601
1693
|
return this.client.signer.signDigest(message);
|
|
1602
1694
|
|
|
1603
1695
|
case 4:
|
|
1604
|
-
|
|
1605
|
-
|
|
1696
|
+
_context18.t1 = _context18.sent;
|
|
1697
|
+
_context18.next = 10;
|
|
1606
1698
|
break;
|
|
1607
1699
|
|
|
1608
1700
|
case 7:
|
|
1609
|
-
|
|
1701
|
+
_context18.next = 9;
|
|
1610
1702
|
return this.client.signer.signingKey.signDigest(message);
|
|
1611
1703
|
|
|
1612
1704
|
case 9:
|
|
1613
|
-
|
|
1705
|
+
_context18.t1 = _context18.sent;
|
|
1614
1706
|
|
|
1615
1707
|
case 10:
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
return
|
|
1708
|
+
_context18.t2 = _context18.t1;
|
|
1709
|
+
_context18.next = 13;
|
|
1710
|
+
return _context18.t0.joinSignature.call(_context18.t0, _context18.t2);
|
|
1619
1711
|
|
|
1620
1712
|
case 13:
|
|
1621
|
-
return
|
|
1713
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1622
1714
|
|
|
1623
1715
|
case 14:
|
|
1624
1716
|
case "end":
|
|
1625
|
-
return
|
|
1717
|
+
return _context18.stop();
|
|
1626
1718
|
}
|
|
1627
1719
|
}
|
|
1628
|
-
},
|
|
1720
|
+
}, _callee18, this);
|
|
1629
1721
|
}));
|
|
1630
1722
|
|
|
1631
|
-
function Sign(
|
|
1723
|
+
function Sign(_x18) {
|
|
1632
1724
|
return _Sign.apply(this, arguments);
|
|
1633
1725
|
}
|
|
1634
1726
|
|
|
@@ -1637,37 +1729,37 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1637
1729
|
}, {
|
|
1638
1730
|
key: "KMSAddress",
|
|
1639
1731
|
value: function () {
|
|
1640
|
-
var _KMSAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1732
|
+
var _KMSAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref19) {
|
|
1641
1733
|
var objectId, versionHash, _yield$this$ContractI5, abi;
|
|
1642
1734
|
|
|
1643
|
-
return _regeneratorRuntime.wrap(function
|
|
1735
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1644
1736
|
while (1) {
|
|
1645
|
-
switch (
|
|
1737
|
+
switch (_context19.prev = _context19.next) {
|
|
1646
1738
|
case 0:
|
|
1647
|
-
objectId =
|
|
1739
|
+
objectId = _ref19.objectId, versionHash = _ref19.versionHash;
|
|
1648
1740
|
|
|
1649
1741
|
if (versionHash) {
|
|
1650
1742
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1651
1743
|
}
|
|
1652
1744
|
|
|
1653
|
-
|
|
1745
|
+
_context19.next = 4;
|
|
1654
1746
|
return this.ContractInfo({
|
|
1655
1747
|
id: objectId
|
|
1656
1748
|
});
|
|
1657
1749
|
|
|
1658
1750
|
case 4:
|
|
1659
|
-
_yield$this$ContractI5 =
|
|
1751
|
+
_yield$this$ContractI5 = _context19.sent;
|
|
1660
1752
|
abi = _yield$this$ContractI5.abi;
|
|
1661
1753
|
|
|
1662
1754
|
if (abi) {
|
|
1663
|
-
|
|
1755
|
+
_context19.next = 8;
|
|
1664
1756
|
break;
|
|
1665
1757
|
}
|
|
1666
1758
|
|
|
1667
1759
|
throw Error("Unable to determine contract info for ".concat(objectId, " - wrong network?"));
|
|
1668
1760
|
|
|
1669
1761
|
case 8:
|
|
1670
|
-
|
|
1762
|
+
_context19.next = 10;
|
|
1671
1763
|
return this.client.CallContractMethod({
|
|
1672
1764
|
contractAddress: Utils.HashToAddress(objectId),
|
|
1673
1765
|
abi: abi,
|
|
@@ -1675,17 +1767,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1675
1767
|
});
|
|
1676
1768
|
|
|
1677
1769
|
case 10:
|
|
1678
|
-
return
|
|
1770
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1679
1771
|
|
|
1680
1772
|
case 11:
|
|
1681
1773
|
case "end":
|
|
1682
|
-
return
|
|
1774
|
+
return _context19.stop();
|
|
1683
1775
|
}
|
|
1684
1776
|
}
|
|
1685
|
-
},
|
|
1777
|
+
}, _callee19, this);
|
|
1686
1778
|
}));
|
|
1687
1779
|
|
|
1688
|
-
function KMSAddress(
|
|
1780
|
+
function KMSAddress(_x19) {
|
|
1689
1781
|
return _KMSAddress.apply(this, arguments);
|
|
1690
1782
|
}
|
|
1691
1783
|
|
|
@@ -1694,29 +1786,29 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1694
1786
|
}, {
|
|
1695
1787
|
key: "KMSInfo",
|
|
1696
1788
|
value: function () {
|
|
1697
|
-
var _KMSInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1789
|
+
var _KMSInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref20) {
|
|
1698
1790
|
var objectId, versionHash, kmsId, KMSInfo, _yield$this$ContractI6, abi, _yield$this$ContractI7, _abi, publicKey;
|
|
1699
1791
|
|
|
1700
|
-
return _regeneratorRuntime.wrap(function
|
|
1792
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1701
1793
|
while (1) {
|
|
1702
|
-
switch (
|
|
1794
|
+
switch (_context20.prev = _context20.next) {
|
|
1703
1795
|
case 0:
|
|
1704
|
-
objectId =
|
|
1796
|
+
objectId = _ref20.objectId, versionHash = _ref20.versionHash, kmsId = _ref20.kmsId;
|
|
1705
1797
|
|
|
1706
1798
|
if (!kmsId) {
|
|
1707
|
-
|
|
1799
|
+
_context20.next = 11;
|
|
1708
1800
|
break;
|
|
1709
1801
|
}
|
|
1710
1802
|
|
|
1711
|
-
|
|
1803
|
+
_context20.next = 4;
|
|
1712
1804
|
return this.ContractInfo({
|
|
1713
1805
|
address: this.client.contentSpaceAddress
|
|
1714
1806
|
});
|
|
1715
1807
|
|
|
1716
1808
|
case 4:
|
|
1717
|
-
_yield$this$ContractI6 =
|
|
1809
|
+
_yield$this$ContractI6 = _context20.sent;
|
|
1718
1810
|
abi = _yield$this$ContractI6.abi;
|
|
1719
|
-
|
|
1811
|
+
_context20.next = 8;
|
|
1720
1812
|
return this.client.CallContractMethod({
|
|
1721
1813
|
contractAddress: this.client.contentSpaceAddress,
|
|
1722
1814
|
abi: abi,
|
|
@@ -1726,8 +1818,8 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1726
1818
|
});
|
|
1727
1819
|
|
|
1728
1820
|
case 8:
|
|
1729
|
-
KMSInfo =
|
|
1730
|
-
|
|
1821
|
+
KMSInfo = _context20.sent;
|
|
1822
|
+
_context20.next = 19;
|
|
1731
1823
|
break;
|
|
1732
1824
|
|
|
1733
1825
|
case 11:
|
|
@@ -1735,15 +1827,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1735
1827
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1736
1828
|
}
|
|
1737
1829
|
|
|
1738
|
-
|
|
1830
|
+
_context20.next = 14;
|
|
1739
1831
|
return this.ContractInfo({
|
|
1740
1832
|
id: objectId
|
|
1741
1833
|
});
|
|
1742
1834
|
|
|
1743
1835
|
case 14:
|
|
1744
|
-
_yield$this$ContractI7 =
|
|
1836
|
+
_yield$this$ContractI7 = _context20.sent;
|
|
1745
1837
|
_abi = _yield$this$ContractI7.abi;
|
|
1746
|
-
|
|
1838
|
+
_context20.next = 18;
|
|
1747
1839
|
return this.client.CallContractMethod({
|
|
1748
1840
|
contractAddress: Utils.HashToAddress(objectId),
|
|
1749
1841
|
abi: _abi,
|
|
@@ -1753,25 +1845,25 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1753
1845
|
});
|
|
1754
1846
|
|
|
1755
1847
|
case 18:
|
|
1756
|
-
KMSInfo =
|
|
1848
|
+
KMSInfo = _context20.sent;
|
|
1757
1849
|
|
|
1758
1850
|
case 19:
|
|
1759
1851
|
// Public key is compressed and hashed
|
|
1760
1852
|
publicKey = Ethers.utils.computePublicKey(Utils.HashToAddress(KMSInfo[1]), false);
|
|
1761
|
-
return
|
|
1853
|
+
return _context20.abrupt("return", {
|
|
1762
1854
|
urls: KMSInfo[0].split(","),
|
|
1763
1855
|
publicKey: publicKey
|
|
1764
1856
|
});
|
|
1765
1857
|
|
|
1766
1858
|
case 21:
|
|
1767
1859
|
case "end":
|
|
1768
|
-
return
|
|
1860
|
+
return _context20.stop();
|
|
1769
1861
|
}
|
|
1770
1862
|
}
|
|
1771
|
-
},
|
|
1863
|
+
}, _callee20, this);
|
|
1772
1864
|
}));
|
|
1773
1865
|
|
|
1774
|
-
function KMSInfo(
|
|
1866
|
+
function KMSInfo(_x20) {
|
|
1775
1867
|
return _KMSInfo.apply(this, arguments);
|
|
1776
1868
|
}
|
|
1777
1869
|
|
|
@@ -1781,37 +1873,37 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1781
1873
|
}, {
|
|
1782
1874
|
key: "RetrieveConk",
|
|
1783
1875
|
value: function () {
|
|
1784
|
-
var _RetrieveConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1876
|
+
var _RetrieveConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref21) {
|
|
1785
1877
|
var libraryId, objectId, kmsAddress, kmsCapId, kmsCap, cap;
|
|
1786
|
-
return _regeneratorRuntime.wrap(function
|
|
1878
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1787
1879
|
while (1) {
|
|
1788
|
-
switch (
|
|
1880
|
+
switch (_context21.prev = _context21.next) {
|
|
1789
1881
|
case 0:
|
|
1790
|
-
libraryId =
|
|
1882
|
+
libraryId = _ref21.libraryId, objectId = _ref21.objectId;
|
|
1791
1883
|
|
|
1792
1884
|
if (libraryId) {
|
|
1793
|
-
|
|
1885
|
+
_context21.next = 5;
|
|
1794
1886
|
break;
|
|
1795
1887
|
}
|
|
1796
1888
|
|
|
1797
|
-
|
|
1889
|
+
_context21.next = 4;
|
|
1798
1890
|
return this.client.ContentObjectLibraryId({
|
|
1799
1891
|
objectId: objectId
|
|
1800
1892
|
});
|
|
1801
1893
|
|
|
1802
1894
|
case 4:
|
|
1803
|
-
libraryId =
|
|
1895
|
+
libraryId = _context21.sent;
|
|
1804
1896
|
|
|
1805
1897
|
case 5:
|
|
1806
|
-
|
|
1898
|
+
_context21.next = 7;
|
|
1807
1899
|
return this.KMSAddress({
|
|
1808
1900
|
objectId: objectId
|
|
1809
1901
|
});
|
|
1810
1902
|
|
|
1811
1903
|
case 7:
|
|
1812
|
-
kmsAddress =
|
|
1904
|
+
kmsAddress = _context21.sent;
|
|
1813
1905
|
kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
|
|
1814
|
-
|
|
1906
|
+
_context21.next = 11;
|
|
1815
1907
|
return this.client.ContentObjectMetadata({
|
|
1816
1908
|
libraryId: libraryId,
|
|
1817
1909
|
objectId: objectId,
|
|
@@ -1819,17 +1911,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1819
1911
|
});
|
|
1820
1912
|
|
|
1821
1913
|
case 11:
|
|
1822
|
-
kmsCap =
|
|
1914
|
+
kmsCap = _context21.sent;
|
|
1823
1915
|
|
|
1824
1916
|
if (kmsCap) {
|
|
1825
|
-
|
|
1917
|
+
_context21.next = 14;
|
|
1826
1918
|
break;
|
|
1827
1919
|
}
|
|
1828
1920
|
|
|
1829
1921
|
throw Error("No KMS key set for this object");
|
|
1830
1922
|
|
|
1831
1923
|
case 14:
|
|
1832
|
-
|
|
1924
|
+
_context21.next = 16;
|
|
1833
1925
|
return this.MakeKMSCall({
|
|
1834
1926
|
objectId: objectId,
|
|
1835
1927
|
methodName: "elv_getEncryptionKey",
|
|
@@ -1838,18 +1930,18 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1838
1930
|
});
|
|
1839
1931
|
|
|
1840
1932
|
case 16:
|
|
1841
|
-
cap =
|
|
1842
|
-
return
|
|
1933
|
+
cap = _context21.sent;
|
|
1934
|
+
return _context21.abrupt("return", JSON.parse(Utils.FromB58(cap.replace(/^kp__/, "")).toString("utf-8")));
|
|
1843
1935
|
|
|
1844
1936
|
case 18:
|
|
1845
1937
|
case "end":
|
|
1846
|
-
return
|
|
1938
|
+
return _context21.stop();
|
|
1847
1939
|
}
|
|
1848
1940
|
}
|
|
1849
|
-
},
|
|
1941
|
+
}, _callee21, this);
|
|
1850
1942
|
}));
|
|
1851
1943
|
|
|
1852
|
-
function RetrieveConk(
|
|
1944
|
+
function RetrieveConk(_x21) {
|
|
1853
1945
|
return _RetrieveConk.apply(this, arguments);
|
|
1854
1946
|
}
|
|
1855
1947
|
|
|
@@ -1859,37 +1951,37 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1859
1951
|
}, {
|
|
1860
1952
|
key: "RetrieveReencryptionSymmetricKey",
|
|
1861
1953
|
value: function () {
|
|
1862
|
-
var _RetrieveReencryptionSymmetricKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1954
|
+
var _RetrieveReencryptionSymmetricKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref22) {
|
|
1863
1955
|
var libraryId, objectId, kmsAddress, kmsCapId, kmsCap;
|
|
1864
|
-
return _regeneratorRuntime.wrap(function
|
|
1956
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1865
1957
|
while (1) {
|
|
1866
|
-
switch (
|
|
1958
|
+
switch (_context22.prev = _context22.next) {
|
|
1867
1959
|
case 0:
|
|
1868
|
-
libraryId =
|
|
1960
|
+
libraryId = _ref22.libraryId, objectId = _ref22.objectId;
|
|
1869
1961
|
|
|
1870
1962
|
if (libraryId) {
|
|
1871
|
-
|
|
1963
|
+
_context22.next = 5;
|
|
1872
1964
|
break;
|
|
1873
1965
|
}
|
|
1874
1966
|
|
|
1875
|
-
|
|
1967
|
+
_context22.next = 4;
|
|
1876
1968
|
return this.client.ContentObjectLibraryId({
|
|
1877
1969
|
objectId: objectId
|
|
1878
1970
|
});
|
|
1879
1971
|
|
|
1880
1972
|
case 4:
|
|
1881
|
-
libraryId =
|
|
1973
|
+
libraryId = _context22.sent;
|
|
1882
1974
|
|
|
1883
1975
|
case 5:
|
|
1884
|
-
|
|
1976
|
+
_context22.next = 7;
|
|
1885
1977
|
return this.KMSAddress({
|
|
1886
1978
|
objectId: objectId
|
|
1887
1979
|
});
|
|
1888
1980
|
|
|
1889
1981
|
case 7:
|
|
1890
|
-
kmsAddress =
|
|
1982
|
+
kmsAddress = _context22.sent;
|
|
1891
1983
|
kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
|
|
1892
|
-
|
|
1984
|
+
_context22.next = 11;
|
|
1893
1985
|
return this.client.ContentObjectMetadata({
|
|
1894
1986
|
libraryId: libraryId,
|
|
1895
1987
|
objectId: objectId,
|
|
@@ -1897,17 +1989,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1897
1989
|
});
|
|
1898
1990
|
|
|
1899
1991
|
case 11:
|
|
1900
|
-
kmsCap =
|
|
1992
|
+
kmsCap = _context22.sent;
|
|
1901
1993
|
|
|
1902
1994
|
if (kmsCap) {
|
|
1903
|
-
|
|
1995
|
+
_context22.next = 14;
|
|
1904
1996
|
break;
|
|
1905
1997
|
}
|
|
1906
1998
|
|
|
1907
1999
|
throw Error("No KMS key set for this object");
|
|
1908
2000
|
|
|
1909
2001
|
case 14:
|
|
1910
|
-
|
|
2002
|
+
_context22.next = 16;
|
|
1911
2003
|
return this.MakeKMSCall({
|
|
1912
2004
|
objectId: objectId,
|
|
1913
2005
|
methodName: "elv_getSymmetricKeyAuth",
|
|
@@ -1916,17 +2008,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1916
2008
|
});
|
|
1917
2009
|
|
|
1918
2010
|
case 16:
|
|
1919
|
-
return
|
|
2011
|
+
return _context22.abrupt("return", _context22.sent);
|
|
1920
2012
|
|
|
1921
2013
|
case 17:
|
|
1922
2014
|
case "end":
|
|
1923
|
-
return
|
|
2015
|
+
return _context22.stop();
|
|
1924
2016
|
}
|
|
1925
2017
|
}
|
|
1926
|
-
},
|
|
2018
|
+
}, _callee22, this);
|
|
1927
2019
|
}));
|
|
1928
2020
|
|
|
1929
|
-
function RetrieveReencryptionSymmetricKey(
|
|
2021
|
+
function RetrieveReencryptionSymmetricKey(_x22) {
|
|
1930
2022
|
return _RetrieveReencryptionSymmetricKey.apply(this, arguments);
|
|
1931
2023
|
}
|
|
1932
2024
|
|
|
@@ -1936,55 +2028,55 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1936
2028
|
}, {
|
|
1937
2029
|
key: "MakeKMSCall",
|
|
1938
2030
|
value: function () {
|
|
1939
|
-
var _MakeKMSCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1940
|
-
var kmsId, tenantId, objectId, versionHash, methodName, params, paramTypes,
|
|
2031
|
+
var _MakeKMSCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref23) {
|
|
2032
|
+
var kmsId, tenantId, objectId, versionHash, methodName, params, paramTypes, _ref23$additionalPara, additionalParams, _ref23$signature, signature, packedHash, KMSUrls, i, kmsUrl;
|
|
1941
2033
|
|
|
1942
|
-
return _regeneratorRuntime.wrap(function
|
|
2034
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1943
2035
|
while (1) {
|
|
1944
|
-
switch (
|
|
2036
|
+
switch (_context23.prev = _context23.next) {
|
|
1945
2037
|
case 0:
|
|
1946
|
-
kmsId =
|
|
2038
|
+
kmsId = _ref23.kmsId, tenantId = _ref23.tenantId, objectId = _ref23.objectId, versionHash = _ref23.versionHash, methodName = _ref23.methodName, params = _ref23.params, paramTypes = _ref23.paramTypes, _ref23$additionalPara = _ref23.additionalParams, additionalParams = _ref23$additionalPara === void 0 ? [] : _ref23$additionalPara, _ref23$signature = _ref23.signature, signature = _ref23$signature === void 0 ? true : _ref23$signature;
|
|
1947
2039
|
|
|
1948
2040
|
if (versionHash) {
|
|
1949
2041
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1950
2042
|
}
|
|
1951
2043
|
|
|
1952
2044
|
if (objectId) {
|
|
1953
|
-
|
|
2045
|
+
_context23.next = 10;
|
|
1954
2046
|
break;
|
|
1955
2047
|
}
|
|
1956
2048
|
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2049
|
+
_context23.t0 = "ikms";
|
|
2050
|
+
_context23.t1 = Utils;
|
|
2051
|
+
_context23.next = 7;
|
|
1960
2052
|
return this.client.DefaultKMSAddress({
|
|
1961
2053
|
tenantId: tenantId
|
|
1962
2054
|
});
|
|
1963
2055
|
|
|
1964
2056
|
case 7:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
kmsId =
|
|
2057
|
+
_context23.t2 = _context23.sent;
|
|
2058
|
+
_context23.t3 = _context23.t1.AddressToHash.call(_context23.t1, _context23.t2);
|
|
2059
|
+
kmsId = _context23.t0.concat.call(_context23.t0, _context23.t3);
|
|
1968
2060
|
|
|
1969
2061
|
case 10:
|
|
1970
2062
|
if (!signature) {
|
|
1971
|
-
|
|
2063
|
+
_context23.next = 17;
|
|
1972
2064
|
break;
|
|
1973
2065
|
}
|
|
1974
2066
|
|
|
1975
2067
|
packedHash = Ethers.utils.solidityKeccak256(paramTypes, params);
|
|
1976
|
-
|
|
1977
|
-
|
|
2068
|
+
_context23.t4 = params;
|
|
2069
|
+
_context23.next = 15;
|
|
1978
2070
|
return this.Sign(packedHash);
|
|
1979
2071
|
|
|
1980
2072
|
case 15:
|
|
1981
|
-
|
|
2073
|
+
_context23.t5 = _context23.sent;
|
|
1982
2074
|
|
|
1983
|
-
|
|
2075
|
+
_context23.t4.push.call(_context23.t4, _context23.t5);
|
|
1984
2076
|
|
|
1985
2077
|
case 17:
|
|
1986
2078
|
params = params.concat(additionalParams);
|
|
1987
|
-
|
|
2079
|
+
_context23.next = 20;
|
|
1988
2080
|
return this.KMSInfo({
|
|
1989
2081
|
kmsId: kmsId,
|
|
1990
2082
|
objectId: objectId,
|
|
@@ -1992,16 +2084,16 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1992
2084
|
});
|
|
1993
2085
|
|
|
1994
2086
|
case 20:
|
|
1995
|
-
KMSUrls =
|
|
2087
|
+
KMSUrls = _context23.sent.urls;
|
|
1996
2088
|
i = 0;
|
|
1997
2089
|
|
|
1998
2090
|
case 22:
|
|
1999
2091
|
if (!(i < KMSUrls.length)) {
|
|
2000
|
-
|
|
2092
|
+
_context23.next = 40;
|
|
2001
2093
|
break;
|
|
2002
2094
|
}
|
|
2003
2095
|
|
|
2004
|
-
|
|
2096
|
+
_context23.prev = 23;
|
|
2005
2097
|
this.Log("Making KMS request:\n URL: ".concat(KMSUrls[i], "\n Method: ").concat(methodName, "\n Params: ").concat(params.join(", ")));
|
|
2006
2098
|
kmsUrl = KMSUrls[i];
|
|
2007
2099
|
|
|
@@ -2009,38 +2101,38 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2009
2101
|
this.providers[kmsUrl] = new Ethers.providers.JsonRpcProvider(kmsUrl, this.client.networkId);
|
|
2010
2102
|
}
|
|
2011
2103
|
|
|
2012
|
-
|
|
2104
|
+
_context23.next = 29;
|
|
2013
2105
|
return this.providers[kmsUrl].send(methodName, params);
|
|
2014
2106
|
|
|
2015
2107
|
case 29:
|
|
2016
|
-
return
|
|
2108
|
+
return _context23.abrupt("return", _context23.sent);
|
|
2017
2109
|
|
|
2018
2110
|
case 32:
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
this.Log("KMS Call Error: ".concat(
|
|
2111
|
+
_context23.prev = 32;
|
|
2112
|
+
_context23.t6 = _context23["catch"](23);
|
|
2113
|
+
this.Log("KMS Call Error: ".concat(_context23.t6), true); // If the request has been attempted on all KMS urls, throw the error
|
|
2022
2114
|
|
|
2023
2115
|
if (!(i === KMSUrls.length - 1)) {
|
|
2024
|
-
|
|
2116
|
+
_context23.next = 37;
|
|
2025
2117
|
break;
|
|
2026
2118
|
}
|
|
2027
2119
|
|
|
2028
|
-
throw
|
|
2120
|
+
throw _context23.t6;
|
|
2029
2121
|
|
|
2030
2122
|
case 37:
|
|
2031
2123
|
i++;
|
|
2032
|
-
|
|
2124
|
+
_context23.next = 22;
|
|
2033
2125
|
break;
|
|
2034
2126
|
|
|
2035
2127
|
case 40:
|
|
2036
2128
|
case "end":
|
|
2037
|
-
return
|
|
2129
|
+
return _context23.stop();
|
|
2038
2130
|
}
|
|
2039
2131
|
}
|
|
2040
|
-
},
|
|
2132
|
+
}, _callee23, this, [[23, 32]]);
|
|
2041
2133
|
}));
|
|
2042
2134
|
|
|
2043
|
-
function MakeKMSCall(
|
|
2135
|
+
function MakeKMSCall(_x23) {
|
|
2044
2136
|
return _MakeKMSCall.apply(this, arguments);
|
|
2045
2137
|
}
|
|
2046
2138
|
|
|
@@ -2050,21 +2142,21 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2050
2142
|
}, {
|
|
2051
2143
|
key: "MakeAuthServiceRequest",
|
|
2052
2144
|
value: function () {
|
|
2053
|
-
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2054
|
-
var kmsId, objectId, versionHash,
|
|
2145
|
+
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref24) {
|
|
2146
|
+
var kmsId, objectId, versionHash, _ref24$method, method, path, bodyType, _ref24$body, body, _ref24$queryParams, queryParams, headers;
|
|
2055
2147
|
|
|
2056
|
-
return _regeneratorRuntime.wrap(function
|
|
2148
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
2057
2149
|
while (1) {
|
|
2058
|
-
switch (
|
|
2150
|
+
switch (_context24.prev = _context24.next) {
|
|
2059
2151
|
case 0:
|
|
2060
|
-
kmsId =
|
|
2152
|
+
kmsId = _ref24.kmsId, objectId = _ref24.objectId, versionHash = _ref24.versionHash, _ref24$method = _ref24.method, method = _ref24$method === void 0 ? "GET" : _ref24$method, path = _ref24.path, bodyType = _ref24.bodyType, _ref24$body = _ref24.body, body = _ref24$body === void 0 ? {} : _ref24$body, _ref24$queryParams = _ref24.queryParams, queryParams = _ref24$queryParams === void 0 ? {} : _ref24$queryParams, headers = _ref24.headers;
|
|
2061
2153
|
|
|
2062
2154
|
if (!(this.client.authServiceURIs.length === 0)) {
|
|
2063
|
-
|
|
2155
|
+
_context24.next = 5;
|
|
2064
2156
|
break;
|
|
2065
2157
|
}
|
|
2066
2158
|
|
|
2067
|
-
|
|
2159
|
+
_context24.next = 4;
|
|
2068
2160
|
return this.MakeKMSRequest({
|
|
2069
2161
|
kmsId: kmsId,
|
|
2070
2162
|
objectId: objectId,
|
|
@@ -2078,10 +2170,10 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2078
2170
|
});
|
|
2079
2171
|
|
|
2080
2172
|
case 4:
|
|
2081
|
-
return
|
|
2173
|
+
return _context24.abrupt("return", _context24.sent);
|
|
2082
2174
|
|
|
2083
2175
|
case 5:
|
|
2084
|
-
|
|
2176
|
+
_context24.next = 7;
|
|
2085
2177
|
return this.client.AuthHttpClient.Request({
|
|
2086
2178
|
method: method,
|
|
2087
2179
|
path: path,
|
|
@@ -2092,17 +2184,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2092
2184
|
});
|
|
2093
2185
|
|
|
2094
2186
|
case 7:
|
|
2095
|
-
return
|
|
2187
|
+
return _context24.abrupt("return", _context24.sent);
|
|
2096
2188
|
|
|
2097
2189
|
case 8:
|
|
2098
2190
|
case "end":
|
|
2099
|
-
return
|
|
2191
|
+
return _context24.stop();
|
|
2100
2192
|
}
|
|
2101
2193
|
}
|
|
2102
|
-
},
|
|
2194
|
+
}, _callee24, this);
|
|
2103
2195
|
}));
|
|
2104
2196
|
|
|
2105
|
-
function MakeAuthServiceRequest(
|
|
2197
|
+
function MakeAuthServiceRequest(_x24) {
|
|
2106
2198
|
return _MakeAuthServiceRequest.apply(this, arguments);
|
|
2107
2199
|
}
|
|
2108
2200
|
|
|
@@ -2112,36 +2204,36 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2112
2204
|
}, {
|
|
2113
2205
|
key: "MakeKMSRequest",
|
|
2114
2206
|
value: function () {
|
|
2115
|
-
var _MakeKMSRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2116
|
-
var kmsId, objectId, versionHash,
|
|
2207
|
+
var _MakeKMSRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref25) {
|
|
2208
|
+
var kmsId, objectId, versionHash, _ref25$method, method, path, bodyType, _ref25$body, body, _ref25$queryParams, queryParams, headers, kmsUrls, kmsHttpClient;
|
|
2117
2209
|
|
|
2118
|
-
return _regeneratorRuntime.wrap(function
|
|
2210
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
2119
2211
|
while (1) {
|
|
2120
|
-
switch (
|
|
2212
|
+
switch (_context25.prev = _context25.next) {
|
|
2121
2213
|
case 0:
|
|
2122
|
-
kmsId =
|
|
2214
|
+
kmsId = _ref25.kmsId, objectId = _ref25.objectId, versionHash = _ref25.versionHash, _ref25$method = _ref25.method, method = _ref25$method === void 0 ? "GET" : _ref25$method, path = _ref25.path, bodyType = _ref25.bodyType, _ref25$body = _ref25.body, body = _ref25$body === void 0 ? {} : _ref25$body, _ref25$queryParams = _ref25.queryParams, queryParams = _ref25$queryParams === void 0 ? {} : _ref25$queryParams, headers = _ref25.headers;
|
|
2123
2215
|
|
|
2124
2216
|
if (versionHash) {
|
|
2125
2217
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
2126
2218
|
}
|
|
2127
2219
|
|
|
2128
2220
|
if (!(!objectId && !kmsId)) {
|
|
2129
|
-
|
|
2221
|
+
_context25.next = 10;
|
|
2130
2222
|
break;
|
|
2131
2223
|
}
|
|
2132
2224
|
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2225
|
+
_context25.t0 = "ikms";
|
|
2226
|
+
_context25.t1 = Utils;
|
|
2227
|
+
_context25.next = 7;
|
|
2136
2228
|
return this.client.DefaultKMSAddress();
|
|
2137
2229
|
|
|
2138
2230
|
case 7:
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
kmsId =
|
|
2231
|
+
_context25.t2 = _context25.sent;
|
|
2232
|
+
_context25.t3 = _context25.t1.AddressToHash.call(_context25.t1, _context25.t2);
|
|
2233
|
+
kmsId = _context25.t0.concat.call(_context25.t0, _context25.t3);
|
|
2142
2234
|
|
|
2143
2235
|
case 10:
|
|
2144
|
-
|
|
2236
|
+
_context25.next = 12;
|
|
2145
2237
|
return this.KMSInfo({
|
|
2146
2238
|
kmsId: kmsId,
|
|
2147
2239
|
objectId: objectId,
|
|
@@ -2149,10 +2241,10 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2149
2241
|
});
|
|
2150
2242
|
|
|
2151
2243
|
case 12:
|
|
2152
|
-
kmsUrls =
|
|
2244
|
+
kmsUrls = _context25.sent.urls;
|
|
2153
2245
|
|
|
2154
2246
|
if (!(!kmsUrls || !kmsUrls[0])) {
|
|
2155
|
-
|
|
2247
|
+
_context25.next = 15;
|
|
2156
2248
|
break;
|
|
2157
2249
|
}
|
|
2158
2250
|
|
|
@@ -2162,7 +2254,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2162
2254
|
kmsHttpClient = new HttpClient({
|
|
2163
2255
|
uris: kmsUrls
|
|
2164
2256
|
});
|
|
2165
|
-
|
|
2257
|
+
_context25.next = 18;
|
|
2166
2258
|
return kmsHttpClient.Request({
|
|
2167
2259
|
method: method,
|
|
2168
2260
|
path: path,
|
|
@@ -2173,17 +2265,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2173
2265
|
});
|
|
2174
2266
|
|
|
2175
2267
|
case 18:
|
|
2176
|
-
return
|
|
2268
|
+
return _context25.abrupt("return", _context25.sent);
|
|
2177
2269
|
|
|
2178
2270
|
case 19:
|
|
2179
2271
|
case "end":
|
|
2180
|
-
return
|
|
2272
|
+
return _context25.stop();
|
|
2181
2273
|
}
|
|
2182
2274
|
}
|
|
2183
|
-
},
|
|
2275
|
+
}, _callee25, this);
|
|
2184
2276
|
}));
|
|
2185
2277
|
|
|
2186
|
-
function MakeKMSRequest(
|
|
2278
|
+
function MakeKMSRequest(_x25) {
|
|
2187
2279
|
return _MakeKMSRequest.apply(this, arguments);
|
|
2188
2280
|
}
|
|
2189
2281
|
|
|
@@ -2192,39 +2284,39 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2192
2284
|
}, {
|
|
2193
2285
|
key: "ContractHasMethod",
|
|
2194
2286
|
value: function () {
|
|
2195
|
-
var _ContractHasMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2287
|
+
var _ContractHasMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref26) {
|
|
2196
2288
|
var contractAddress, abi, methodName, key, method, methodSignature, methodId;
|
|
2197
|
-
return _regeneratorRuntime.wrap(function
|
|
2289
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
2198
2290
|
while (1) {
|
|
2199
|
-
switch (
|
|
2291
|
+
switch (_context26.prev = _context26.next) {
|
|
2200
2292
|
case 0:
|
|
2201
|
-
contractAddress =
|
|
2293
|
+
contractAddress = _ref26.contractAddress, abi = _ref26.abi, methodName = _ref26.methodName;
|
|
2202
2294
|
contractAddress = Utils.FormatAddress(contractAddress);
|
|
2203
2295
|
key = "".concat(contractAddress, "-").concat(methodName);
|
|
2204
2296
|
|
|
2205
2297
|
if (!(this.methodAvailability[key] === undefined)) {
|
|
2206
|
-
|
|
2298
|
+
_context26.next = 19;
|
|
2207
2299
|
break;
|
|
2208
2300
|
}
|
|
2209
2301
|
|
|
2210
2302
|
this.Log("Checking method availability: ".concat(contractAddress, " ").concat(methodName));
|
|
2211
2303
|
|
|
2212
2304
|
if (abi) {
|
|
2213
|
-
|
|
2305
|
+
_context26.next = 9;
|
|
2214
2306
|
break;
|
|
2215
2307
|
}
|
|
2216
2308
|
|
|
2217
|
-
|
|
2309
|
+
_context26.next = 8;
|
|
2218
2310
|
return this.ContractInfo({
|
|
2219
2311
|
address: contractAddress
|
|
2220
2312
|
});
|
|
2221
2313
|
|
|
2222
2314
|
case 8:
|
|
2223
|
-
abi =
|
|
2315
|
+
abi = _context26.sent.abi;
|
|
2224
2316
|
|
|
2225
2317
|
case 9:
|
|
2226
2318
|
if (abi) {
|
|
2227
|
-
|
|
2319
|
+
_context26.next = 11;
|
|
2228
2320
|
break;
|
|
2229
2321
|
}
|
|
2230
2322
|
|
|
@@ -2236,38 +2328,38 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2236
2328
|
});
|
|
2237
2329
|
|
|
2238
2330
|
if (method) {
|
|
2239
|
-
|
|
2331
|
+
_context26.next = 14;
|
|
2240
2332
|
break;
|
|
2241
2333
|
}
|
|
2242
2334
|
|
|
2243
|
-
return
|
|
2335
|
+
return _context26.abrupt("return", false);
|
|
2244
2336
|
|
|
2245
2337
|
case 14:
|
|
2246
2338
|
methodSignature = "".concat(method.name, "(").concat(method.inputs.map(function (i) {
|
|
2247
2339
|
return i.type;
|
|
2248
2340
|
}).join(","), ")");
|
|
2249
2341
|
methodId = Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(methodSignature)).replace("0x", "").slice(0, 8);
|
|
2250
|
-
|
|
2342
|
+
_context26.next = 18;
|
|
2251
2343
|
return this.MakeElvMasterCall({
|
|
2252
2344
|
methodName: "elv_deployedContractHasMethod",
|
|
2253
2345
|
params: [contractAddress, methodId]
|
|
2254
2346
|
});
|
|
2255
2347
|
|
|
2256
2348
|
case 18:
|
|
2257
|
-
this.methodAvailability[key] =
|
|
2349
|
+
this.methodAvailability[key] = _context26.sent;
|
|
2258
2350
|
|
|
2259
2351
|
case 19:
|
|
2260
|
-
return
|
|
2352
|
+
return _context26.abrupt("return", this.methodAvailability[key]);
|
|
2261
2353
|
|
|
2262
2354
|
case 20:
|
|
2263
2355
|
case "end":
|
|
2264
|
-
return
|
|
2356
|
+
return _context26.stop();
|
|
2265
2357
|
}
|
|
2266
2358
|
}
|
|
2267
|
-
},
|
|
2359
|
+
}, _callee26, this);
|
|
2268
2360
|
}));
|
|
2269
2361
|
|
|
2270
|
-
function ContractHasMethod(
|
|
2362
|
+
function ContractHasMethod(_x26) {
|
|
2271
2363
|
return _ContractHasMethod.apply(this, arguments);
|
|
2272
2364
|
}
|
|
2273
2365
|
|
|
@@ -2276,31 +2368,31 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2276
2368
|
}, {
|
|
2277
2369
|
key: "MakeElvMasterCall",
|
|
2278
2370
|
value: function () {
|
|
2279
|
-
var _MakeElvMasterCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2371
|
+
var _MakeElvMasterCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref27) {
|
|
2280
2372
|
var methodName, params;
|
|
2281
|
-
return _regeneratorRuntime.wrap(function
|
|
2373
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
2282
2374
|
while (1) {
|
|
2283
|
-
switch (
|
|
2375
|
+
switch (_context27.prev = _context27.next) {
|
|
2284
2376
|
case 0:
|
|
2285
|
-
methodName =
|
|
2286
|
-
|
|
2377
|
+
methodName = _ref27.methodName, params = _ref27.params;
|
|
2378
|
+
_context27.next = 3;
|
|
2287
2379
|
return this.client.ethClient.MakeProviderCall({
|
|
2288
2380
|
methodName: "send",
|
|
2289
2381
|
args: [methodName, params]
|
|
2290
2382
|
});
|
|
2291
2383
|
|
|
2292
2384
|
case 3:
|
|
2293
|
-
return
|
|
2385
|
+
return _context27.abrupt("return", _context27.sent);
|
|
2294
2386
|
|
|
2295
2387
|
case 4:
|
|
2296
2388
|
case "end":
|
|
2297
|
-
return
|
|
2389
|
+
return _context27.stop();
|
|
2298
2390
|
}
|
|
2299
2391
|
}
|
|
2300
|
-
},
|
|
2392
|
+
}, _callee27, this);
|
|
2301
2393
|
}));
|
|
2302
2394
|
|
|
2303
|
-
function MakeElvMasterCall(
|
|
2395
|
+
function MakeElvMasterCall(_x27) {
|
|
2304
2396
|
return _MakeElvMasterCall.apply(this, arguments);
|
|
2305
2397
|
}
|
|
2306
2398
|
|
|
@@ -2309,50 +2401,50 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2309
2401
|
}, {
|
|
2310
2402
|
key: "ReEncryptionConk",
|
|
2311
2403
|
value: function () {
|
|
2312
|
-
var _ReEncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2404
|
+
var _ReEncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref28) {
|
|
2313
2405
|
var libraryId, objectId, versionHash, cap;
|
|
2314
|
-
return _regeneratorRuntime.wrap(function
|
|
2406
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
2315
2407
|
while (1) {
|
|
2316
|
-
switch (
|
|
2408
|
+
switch (_context28.prev = _context28.next) {
|
|
2317
2409
|
case 0:
|
|
2318
|
-
libraryId =
|
|
2410
|
+
libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash;
|
|
2319
2411
|
|
|
2320
2412
|
if (versionHash) {
|
|
2321
2413
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
2322
2414
|
}
|
|
2323
2415
|
|
|
2324
2416
|
if (this.reencryptionKeys[objectId]) {
|
|
2325
|
-
|
|
2417
|
+
_context28.next = 10;
|
|
2326
2418
|
break;
|
|
2327
2419
|
}
|
|
2328
2420
|
|
|
2329
|
-
|
|
2421
|
+
_context28.next = 5;
|
|
2330
2422
|
return this.client.Crypto.GenerateTargetConk();
|
|
2331
2423
|
|
|
2332
2424
|
case 5:
|
|
2333
|
-
cap =
|
|
2334
|
-
|
|
2425
|
+
cap = _context28.sent;
|
|
2426
|
+
_context28.next = 8;
|
|
2335
2427
|
return this.RetrieveReencryptionSymmetricKey({
|
|
2336
2428
|
libraryId: libraryId,
|
|
2337
2429
|
objectId: objectId
|
|
2338
2430
|
});
|
|
2339
2431
|
|
|
2340
2432
|
case 8:
|
|
2341
|
-
cap.symm_key =
|
|
2433
|
+
cap.symm_key = _context28.sent;
|
|
2342
2434
|
this.reencryptionKeys[objectId] = cap;
|
|
2343
2435
|
|
|
2344
2436
|
case 10:
|
|
2345
|
-
return
|
|
2437
|
+
return _context28.abrupt("return", this.reencryptionKeys[objectId]);
|
|
2346
2438
|
|
|
2347
2439
|
case 11:
|
|
2348
2440
|
case "end":
|
|
2349
|
-
return
|
|
2441
|
+
return _context28.stop();
|
|
2350
2442
|
}
|
|
2351
2443
|
}
|
|
2352
|
-
},
|
|
2444
|
+
}, _callee28, this);
|
|
2353
2445
|
}));
|
|
2354
2446
|
|
|
2355
|
-
function ReEncryptionConk(
|
|
2447
|
+
function ReEncryptionConk(_x28) {
|
|
2356
2448
|
return _ReEncryptionConk.apply(this, arguments);
|
|
2357
2449
|
}
|
|
2358
2450
|
|
|
@@ -2361,70 +2453,70 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2361
2453
|
}, {
|
|
2362
2454
|
key: "EncryptionConk",
|
|
2363
2455
|
value: function () {
|
|
2364
|
-
var _EncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2456
|
+
var _EncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref29) {
|
|
2365
2457
|
var libraryId, objectId, versionHash, conk, _yield$this$client$Cr, secret_key;
|
|
2366
2458
|
|
|
2367
|
-
return _regeneratorRuntime.wrap(function
|
|
2459
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
2368
2460
|
while (1) {
|
|
2369
|
-
switch (
|
|
2461
|
+
switch (_context29.prev = _context29.next) {
|
|
2370
2462
|
case 0:
|
|
2371
|
-
libraryId =
|
|
2463
|
+
libraryId = _ref29.libraryId, objectId = _ref29.objectId, versionHash = _ref29.versionHash;
|
|
2372
2464
|
|
|
2373
2465
|
if (versionHash) {
|
|
2374
2466
|
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
2375
2467
|
}
|
|
2376
2468
|
|
|
2377
2469
|
if (libraryId) {
|
|
2378
|
-
|
|
2470
|
+
_context29.next = 6;
|
|
2379
2471
|
break;
|
|
2380
2472
|
}
|
|
2381
2473
|
|
|
2382
|
-
|
|
2474
|
+
_context29.next = 5;
|
|
2383
2475
|
return this.client.ContentObjectLibraryId({
|
|
2384
2476
|
objectId: objectId
|
|
2385
2477
|
});
|
|
2386
2478
|
|
|
2387
2479
|
case 5:
|
|
2388
|
-
libraryId =
|
|
2480
|
+
libraryId = _context29.sent;
|
|
2389
2481
|
|
|
2390
2482
|
case 6:
|
|
2391
2483
|
if (this.encryptionKeys[objectId]) {
|
|
2392
|
-
|
|
2484
|
+
_context29.next = 16;
|
|
2393
2485
|
break;
|
|
2394
2486
|
}
|
|
2395
2487
|
|
|
2396
|
-
|
|
2488
|
+
_context29.next = 9;
|
|
2397
2489
|
return this.RetrieveConk({
|
|
2398
2490
|
libraryId: libraryId,
|
|
2399
2491
|
objectId: objectId
|
|
2400
2492
|
});
|
|
2401
2493
|
|
|
2402
2494
|
case 9:
|
|
2403
|
-
conk =
|
|
2404
|
-
|
|
2495
|
+
conk = _context29.sent;
|
|
2496
|
+
_context29.next = 12;
|
|
2405
2497
|
return this.client.Crypto.GeneratePrimaryConk({
|
|
2406
2498
|
objectId: objectId
|
|
2407
2499
|
});
|
|
2408
2500
|
|
|
2409
2501
|
case 12:
|
|
2410
|
-
_yield$this$client$Cr =
|
|
2502
|
+
_yield$this$client$Cr = _context29.sent;
|
|
2411
2503
|
secret_key = _yield$this$client$Cr.secret_key;
|
|
2412
2504
|
conk.secret_key = secret_key; // { secret_key, public_key, symm_key, block_size }
|
|
2413
2505
|
|
|
2414
2506
|
this.encryptionKeys[objectId] = conk;
|
|
2415
2507
|
|
|
2416
2508
|
case 16:
|
|
2417
|
-
return
|
|
2509
|
+
return _context29.abrupt("return", this.encryptionKeys[objectId]);
|
|
2418
2510
|
|
|
2419
2511
|
case 17:
|
|
2420
2512
|
case "end":
|
|
2421
|
-
return
|
|
2513
|
+
return _context29.stop();
|
|
2422
2514
|
}
|
|
2423
2515
|
}
|
|
2424
|
-
},
|
|
2516
|
+
}, _callee29, this);
|
|
2425
2517
|
}));
|
|
2426
2518
|
|
|
2427
|
-
function EncryptionConk(
|
|
2519
|
+
function EncryptionConk(_x29) {
|
|
2428
2520
|
return _EncryptionConk.apply(this, arguments);
|
|
2429
2521
|
}
|
|
2430
2522
|
|
|
@@ -2433,46 +2525,46 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2433
2525
|
}, {
|
|
2434
2526
|
key: "RecordTags",
|
|
2435
2527
|
value: function () {
|
|
2436
|
-
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2528
|
+
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref30) {
|
|
2437
2529
|
var accessType, libraryId, objectId, versionHash, _yield$this$ContractI8, abi, owner;
|
|
2438
2530
|
|
|
2439
|
-
return _regeneratorRuntime.wrap(function
|
|
2531
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
2440
2532
|
while (1) {
|
|
2441
|
-
switch (
|
|
2533
|
+
switch (_context30.prev = _context30.next) {
|
|
2442
2534
|
case 0:
|
|
2443
|
-
accessType =
|
|
2535
|
+
accessType = _ref30.accessType, libraryId = _ref30.libraryId, objectId = _ref30.objectId, versionHash = _ref30.versionHash;
|
|
2444
2536
|
|
|
2445
2537
|
if (!(accessType !== ACCESS_TYPES.OBJECT)) {
|
|
2446
|
-
|
|
2538
|
+
_context30.next = 3;
|
|
2447
2539
|
break;
|
|
2448
2540
|
}
|
|
2449
2541
|
|
|
2450
|
-
return
|
|
2542
|
+
return _context30.abrupt("return");
|
|
2451
2543
|
|
|
2452
2544
|
case 3:
|
|
2453
|
-
|
|
2545
|
+
_context30.next = 5;
|
|
2454
2546
|
return this.ContractInfo({
|
|
2455
2547
|
id: objectId
|
|
2456
2548
|
});
|
|
2457
2549
|
|
|
2458
2550
|
case 5:
|
|
2459
|
-
_yield$this$ContractI8 =
|
|
2551
|
+
_yield$this$ContractI8 = _context30.sent;
|
|
2460
2552
|
abi = _yield$this$ContractI8.abi;
|
|
2461
|
-
|
|
2553
|
+
_context30.next = 9;
|
|
2462
2554
|
return this.Owner({
|
|
2463
2555
|
id: objectId,
|
|
2464
2556
|
abi: abi
|
|
2465
2557
|
});
|
|
2466
2558
|
|
|
2467
2559
|
case 9:
|
|
2468
|
-
owner =
|
|
2560
|
+
owner = _context30.sent;
|
|
2469
2561
|
|
|
2470
2562
|
if (Utils.EqualAddress(owner, this.client.signer.address)) {
|
|
2471
|
-
|
|
2563
|
+
_context30.next = 13;
|
|
2472
2564
|
break;
|
|
2473
2565
|
}
|
|
2474
2566
|
|
|
2475
|
-
|
|
2567
|
+
_context30.next = 13;
|
|
2476
2568
|
return this.client.userProfileClient.RecordTags({
|
|
2477
2569
|
libraryId: libraryId,
|
|
2478
2570
|
objectId: objectId,
|
|
@@ -2481,13 +2573,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2481
2573
|
|
|
2482
2574
|
case 13:
|
|
2483
2575
|
case "end":
|
|
2484
|
-
return
|
|
2576
|
+
return _context30.stop();
|
|
2485
2577
|
}
|
|
2486
2578
|
}
|
|
2487
|
-
},
|
|
2579
|
+
}, _callee30, this);
|
|
2488
2580
|
}));
|
|
2489
2581
|
|
|
2490
|
-
function RecordTags(
|
|
2582
|
+
function RecordTags(_x30) {
|
|
2491
2583
|
return _RecordTags.apply(this, arguments);
|
|
2492
2584
|
}
|
|
2493
2585
|
|
|
@@ -2498,34 +2590,34 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2498
2590
|
}, {
|
|
2499
2591
|
key: "CreateAccessGroup",
|
|
2500
2592
|
value: function () {
|
|
2501
|
-
var _CreateAccessGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2593
|
+
var _CreateAccessGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
|
|
2502
2594
|
var _yield$this$client$et, contractAddress, transactionHash;
|
|
2503
2595
|
|
|
2504
|
-
return _regeneratorRuntime.wrap(function
|
|
2596
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
2505
2597
|
while (1) {
|
|
2506
|
-
switch (
|
|
2598
|
+
switch (_context31.prev = _context31.next) {
|
|
2507
2599
|
case 0:
|
|
2508
|
-
|
|
2600
|
+
_context31.next = 2;
|
|
2509
2601
|
return this.client.ethClient.DeployAccessGroupContract({
|
|
2510
2602
|
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2511
2603
|
signer: this.client.signer
|
|
2512
2604
|
});
|
|
2513
2605
|
|
|
2514
2606
|
case 2:
|
|
2515
|
-
_yield$this$client$et =
|
|
2607
|
+
_yield$this$client$et = _context31.sent;
|
|
2516
2608
|
contractAddress = _yield$this$client$et.contractAddress;
|
|
2517
2609
|
transactionHash = _yield$this$client$et.transactionHash;
|
|
2518
|
-
return
|
|
2610
|
+
return _context31.abrupt("return", {
|
|
2519
2611
|
contractAddress: contractAddress,
|
|
2520
2612
|
transactionHash: transactionHash
|
|
2521
2613
|
});
|
|
2522
2614
|
|
|
2523
2615
|
case 6:
|
|
2524
2616
|
case "end":
|
|
2525
|
-
return
|
|
2617
|
+
return _context31.stop();
|
|
2526
2618
|
}
|
|
2527
2619
|
}
|
|
2528
|
-
},
|
|
2620
|
+
}, _callee31, this);
|
|
2529
2621
|
}));
|
|
2530
2622
|
|
|
2531
2623
|
function CreateAccessGroup() {
|
|
@@ -2537,34 +2629,34 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2537
2629
|
}, {
|
|
2538
2630
|
key: "CreateContentType",
|
|
2539
2631
|
value: function () {
|
|
2540
|
-
var _CreateContentType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2632
|
+
var _CreateContentType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
|
|
2541
2633
|
var _yield$this$client$et2, contractAddress, transactionHash;
|
|
2542
2634
|
|
|
2543
|
-
return _regeneratorRuntime.wrap(function
|
|
2635
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
2544
2636
|
while (1) {
|
|
2545
|
-
switch (
|
|
2637
|
+
switch (_context32.prev = _context32.next) {
|
|
2546
2638
|
case 0:
|
|
2547
|
-
|
|
2639
|
+
_context32.next = 2;
|
|
2548
2640
|
return this.client.ethClient.DeployTypeContract({
|
|
2549
2641
|
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2550
2642
|
signer: this.client.signer
|
|
2551
2643
|
});
|
|
2552
2644
|
|
|
2553
2645
|
case 2:
|
|
2554
|
-
_yield$this$client$et2 =
|
|
2646
|
+
_yield$this$client$et2 = _context32.sent;
|
|
2555
2647
|
contractAddress = _yield$this$client$et2.contractAddress;
|
|
2556
2648
|
transactionHash = _yield$this$client$et2.transactionHash;
|
|
2557
|
-
return
|
|
2649
|
+
return _context32.abrupt("return", {
|
|
2558
2650
|
contractAddress: contractAddress,
|
|
2559
2651
|
transactionHash: transactionHash
|
|
2560
2652
|
});
|
|
2561
2653
|
|
|
2562
2654
|
case 6:
|
|
2563
2655
|
case "end":
|
|
2564
|
-
return
|
|
2656
|
+
return _context32.stop();
|
|
2565
2657
|
}
|
|
2566
2658
|
}
|
|
2567
|
-
},
|
|
2659
|
+
}, _callee32, this);
|
|
2568
2660
|
}));
|
|
2569
2661
|
|
|
2570
2662
|
function CreateContentType() {
|
|
@@ -2576,15 +2668,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2576
2668
|
}, {
|
|
2577
2669
|
key: "CreateContentLibrary",
|
|
2578
2670
|
value: function () {
|
|
2579
|
-
var _CreateContentLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2671
|
+
var _CreateContentLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref31) {
|
|
2580
2672
|
var kmsId, _yield$this$client$et3, contractAddress, transactionHash;
|
|
2581
2673
|
|
|
2582
|
-
return _regeneratorRuntime.wrap(function
|
|
2674
|
+
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
2583
2675
|
while (1) {
|
|
2584
|
-
switch (
|
|
2676
|
+
switch (_context33.prev = _context33.next) {
|
|
2585
2677
|
case 0:
|
|
2586
|
-
kmsId =
|
|
2587
|
-
|
|
2678
|
+
kmsId = _ref31.kmsId;
|
|
2679
|
+
_context33.next = 3;
|
|
2588
2680
|
return this.client.ethClient.DeployLibraryContract({
|
|
2589
2681
|
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2590
2682
|
kmsId: kmsId,
|
|
@@ -2592,23 +2684,23 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2592
2684
|
});
|
|
2593
2685
|
|
|
2594
2686
|
case 3:
|
|
2595
|
-
_yield$this$client$et3 =
|
|
2687
|
+
_yield$this$client$et3 = _context33.sent;
|
|
2596
2688
|
contractAddress = _yield$this$client$et3.contractAddress;
|
|
2597
2689
|
transactionHash = _yield$this$client$et3.transactionHash;
|
|
2598
|
-
return
|
|
2690
|
+
return _context33.abrupt("return", {
|
|
2599
2691
|
contractAddress: contractAddress,
|
|
2600
2692
|
transactionHash: transactionHash
|
|
2601
2693
|
});
|
|
2602
2694
|
|
|
2603
2695
|
case 7:
|
|
2604
2696
|
case "end":
|
|
2605
|
-
return
|
|
2697
|
+
return _context33.stop();
|
|
2606
2698
|
}
|
|
2607
2699
|
}
|
|
2608
|
-
},
|
|
2700
|
+
}, _callee33, this);
|
|
2609
2701
|
}));
|
|
2610
2702
|
|
|
2611
|
-
function CreateContentLibrary(
|
|
2703
|
+
function CreateContentLibrary(_x31) {
|
|
2612
2704
|
return _CreateContentLibrary.apply(this, arguments);
|
|
2613
2705
|
}
|
|
2614
2706
|
|
|
@@ -2617,15 +2709,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2617
2709
|
}, {
|
|
2618
2710
|
key: "CreateContentObject",
|
|
2619
2711
|
value: function () {
|
|
2620
|
-
var _CreateContentObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2712
|
+
var _CreateContentObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(_ref32) {
|
|
2621
2713
|
var libraryId, typeId, _yield$this$client$et4, contractAddress, transactionHash;
|
|
2622
2714
|
|
|
2623
|
-
return _regeneratorRuntime.wrap(function
|
|
2715
|
+
return _regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
2624
2716
|
while (1) {
|
|
2625
|
-
switch (
|
|
2717
|
+
switch (_context34.prev = _context34.next) {
|
|
2626
2718
|
case 0:
|
|
2627
|
-
libraryId =
|
|
2628
|
-
|
|
2719
|
+
libraryId = _ref32.libraryId, typeId = _ref32.typeId;
|
|
2720
|
+
_context34.next = 3;
|
|
2629
2721
|
return this.client.ethClient.DeployContentContract({
|
|
2630
2722
|
contentLibraryAddress: Utils.HashToAddress(libraryId),
|
|
2631
2723
|
typeAddress: typeId ? Utils.HashToAddress(typeId) : Utils.nullAddress,
|
|
@@ -2633,23 +2725,23 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2633
2725
|
});
|
|
2634
2726
|
|
|
2635
2727
|
case 3:
|
|
2636
|
-
_yield$this$client$et4 =
|
|
2728
|
+
_yield$this$client$et4 = _context34.sent;
|
|
2637
2729
|
contractAddress = _yield$this$client$et4.contractAddress;
|
|
2638
2730
|
transactionHash = _yield$this$client$et4.transactionHash;
|
|
2639
|
-
return
|
|
2731
|
+
return _context34.abrupt("return", {
|
|
2640
2732
|
contractAddress: contractAddress,
|
|
2641
2733
|
transactionHash: transactionHash
|
|
2642
2734
|
});
|
|
2643
2735
|
|
|
2644
2736
|
case 7:
|
|
2645
2737
|
case "end":
|
|
2646
|
-
return
|
|
2738
|
+
return _context34.stop();
|
|
2647
2739
|
}
|
|
2648
2740
|
}
|
|
2649
|
-
},
|
|
2741
|
+
}, _callee34, this);
|
|
2650
2742
|
}));
|
|
2651
2743
|
|
|
2652
|
-
function CreateContentObject(
|
|
2744
|
+
function CreateContentObject(_x32) {
|
|
2653
2745
|
return _CreateContentObject.apply(this, arguments);
|
|
2654
2746
|
}
|
|
2655
2747
|
|