@eluvio/elv-client-js 4.0.52 → 4.0.53

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.
@@ -1,6 +1,6 @@
1
+ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
1
2
  var _typeof = require("@babel/runtime/helpers/typeof");
2
3
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
- var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
4
4
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
5
5
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
6
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
@@ -27,7 +27,6 @@ var _require = require("./LogMessage"),
27
27
  var Pako = require("pako");
28
28
  var _require2 = require("./Validation"),
29
29
  ValidatePresence = _require2.ValidatePresence;
30
- var CBOR = require("cbor");
31
30
  var networks = {
32
31
  "main": "https://main.net955305.contentfabric.io",
33
32
  "demo": "https://demov3.net955210.contentfabric.io",
@@ -518,139 +517,6 @@ var ElvClient = /*#__PURE__*/function () {
518
517
  }
519
518
  }
520
519
 
521
- /**
522
- * Return a list of nodes in the content space, optionally filtered by node ID or endpoint.
523
- *
524
- * @methodGroup Nodes
525
- * @namedParams
526
- * @param {string=} matchEndpoint - Return node(s) matching the specified endpoint
527
- * @param {string=} matchNodeId - Return node(s) matching the specified node ID
528
- *
529
- * @return {Array<Object>} - A list of nodes in the space matching the parameters
530
- */
531
- }, {
532
- key: "SpaceNodes",
533
- value: function () {
534
- var _SpaceNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
535
- var _this = this;
536
- var _ref7,
537
- matchEndpoint,
538
- matchNodeId,
539
- bign,
540
- n,
541
- _args7 = arguments;
542
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
543
- while (1) switch (_context7.prev = _context7.next) {
544
- case 0:
545
- _ref7 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId;
546
- _context7.next = 3;
547
- return this.CallContractMethod({
548
- contractAddress: this.contentSpaceAddress,
549
- methodName: "numActiveNodes"
550
- });
551
- case 3:
552
- bign = _context7.sent;
553
- n = bign.toNumber();
554
- _context7.next = 7;
555
- return Utils.LimitedMap(5, _toConsumableArray(new Array(n)), /*#__PURE__*/function () {
556
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_, index) {
557
- var bigi, addr, locatorsHex, nodeId, node, buffer, hex, locators, match, fabArray, i, host, endpoint;
558
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
559
- while (1) switch (_context6.prev = _context6.next) {
560
- case 0:
561
- bigi = Ethers.BigNumber.from(index);
562
- _context6.next = 3;
563
- return _this.CallContractMethod({
564
- contractAddress: _this.contentSpaceAddress,
565
- methodName: "activeNodeAddresses",
566
- methodArgs: [bigi],
567
- formatArguments: true
568
- });
569
- case 3:
570
- addr = _context6.sent;
571
- _context6.next = 6;
572
- return _this.CallContractMethod({
573
- contractAddress: _this.contentSpaceAddress,
574
- methodName: "activeNodeLocators",
575
- methodArgs: [bigi]
576
- });
577
- case 6:
578
- locatorsHex = _context6.sent;
579
- nodeId = _this.utils.AddressToNodeId(addr);
580
- if (!(matchNodeId && nodeId !== matchNodeId)) {
581
- _context6.next = 10;
582
- break;
583
- }
584
- return _context6.abrupt("return");
585
- case 10:
586
- node = {
587
- id: nodeId,
588
- endpoints: []
589
- }; // Parse locators CBOR
590
- buffer = locatorsHex.slice(2, locatorsHex.length); // Skip "0x"
591
- hex = buffer.toString("hex");
592
- locators = CBOR.decodeAllSync(hex);
593
- match = false;
594
- if (!(locators.length >= 5)) {
595
- _context6.next = 31;
596
- break;
597
- }
598
- fabArray = locators[4].fab;
599
- if (!fabArray) {
600
- _context6.next = 31;
601
- break;
602
- }
603
- i = 0;
604
- case 19:
605
- if (!(i < fabArray.length)) {
606
- _context6.next = 31;
607
- break;
608
- }
609
- host = fabArray[i].host;
610
- if (!(matchEndpoint && !matchEndpoint.includes(host))) {
611
- _context6.next = 23;
612
- break;
613
- }
614
- return _context6.abrupt("continue", 28);
615
- case 23:
616
- match = true;
617
- endpoint = fabArray[i].scheme + "://" + host;
618
- if (fabArray[i].port) {
619
- endpoint = endpoint + ":" + fabArray[i].port;
620
- }
621
- endpoint = endpoint + "/" + fabArray[i].path;
622
- node.endpoints.push(endpoint);
623
- case 28:
624
- i++;
625
- _context6.next = 19;
626
- break;
627
- case 31:
628
- return _context6.abrupt("return", match ? node : undefined);
629
- case 32:
630
- case "end":
631
- return _context6.stop();
632
- }
633
- }, _callee6);
634
- }));
635
- return function (_x3, _x4) {
636
- return _ref8.apply(this, arguments);
637
- };
638
- }());
639
- case 7:
640
- return _context7.abrupt("return", _context7.sent.filter(function (n) {
641
- return n;
642
- }));
643
- case 8:
644
- case "end":
645
- return _context7.stop();
646
- }
647
- }, _callee7, this);
648
- }));
649
- function SpaceNodes() {
650
- return _SpaceNodes.apply(this, arguments);
651
- }
652
- return SpaceNodes;
653
- }()
654
520
  /**
655
521
  * Return information about how the client was connected to the network
656
522
  *
@@ -668,16 +534,16 @@ var ElvClient = /*#__PURE__*/function () {
668
534
  }
669
535
  }, {
670
536
  key: "WriteTokenNodeUrl",
671
- value: function WriteTokenNodeUrl(_ref9) {
672
- var writeToken = _ref9.writeToken;
537
+ value: function WriteTokenNodeUrl(_ref7) {
538
+ var writeToken = _ref7.writeToken;
673
539
  var nodeUrl = this.HttpClient.draftURIs[writeToken];
674
540
  return nodeUrl ? nodeUrl.toString() : undefined;
675
541
  }
676
542
  }, {
677
543
  key: "RecordWriteToken",
678
- value: function RecordWriteToken(_ref10) {
679
- var writeToken = _ref10.writeToken,
680
- fabricNodeUrl = _ref10.fabricNodeUrl;
544
+ value: function RecordWriteToken(_ref8) {
545
+ var writeToken = _ref8.writeToken,
546
+ fabricNodeUrl = _ref8.fabricNodeUrl;
681
547
  this.HttpClient.RecordWriteToken(writeToken, fabricNodeUrl);
682
548
  }
683
549
 
@@ -727,10 +593,10 @@ var ElvClient = /*#__PURE__*/function () {
727
593
  */
728
594
  }, {
729
595
  key: "SetSigner",
730
- value: function SetSigner(_ref11) {
731
- var signer = _ref11.signer,
732
- _ref11$reset = _ref11.reset,
733
- reset = _ref11$reset === void 0 ? true : _ref11$reset;
596
+ value: function SetSigner(_ref9) {
597
+ var signer = _ref9.signer,
598
+ _ref9$reset = _ref9.reset,
599
+ reset = _ref9$reset === void 0 ? true : _ref9$reset;
734
600
  this.staticToken = undefined;
735
601
  signer.connect(this.ethClient.Provider());
736
602
  signer.provider.pollingInterval = 500;
@@ -755,34 +621,34 @@ var ElvClient = /*#__PURE__*/function () {
755
621
  }, {
756
622
  key: "SetRemoteSigner",
757
623
  value: function () {
758
- var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
624
+ var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
759
625
  var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
760
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
761
- while (1) switch (_context8.prev = _context8.next) {
626
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
627
+ while (1) switch (_context6.prev = _context6.next) {
762
628
  case 0:
763
- idToken = _ref12.idToken, authToken = _ref12.authToken, tenantId = _ref12.tenantId, extraData = _ref12.extraData, signerURIs = _ref12.signerURIs, unsignedPublicAuth = _ref12.unsignedPublicAuth;
764
- _context8.t0 = RemoteSigner;
765
- _context8.t1 = signerURIs || this.authServiceURIs;
766
- _context8.t2 = idToken;
767
- _context8.t3 = authToken;
768
- _context8.t4 = tenantId;
769
- _context8.next = 8;
629
+ idToken = _ref10.idToken, authToken = _ref10.authToken, tenantId = _ref10.tenantId, extraData = _ref10.extraData, signerURIs = _ref10.signerURIs, unsignedPublicAuth = _ref10.unsignedPublicAuth;
630
+ _context6.t0 = RemoteSigner;
631
+ _context6.t1 = signerURIs || this.authServiceURIs;
632
+ _context6.t2 = idToken;
633
+ _context6.t3 = authToken;
634
+ _context6.t4 = tenantId;
635
+ _context6.next = 8;
770
636
  return this.ethClient.Provider();
771
637
  case 8:
772
- _context8.t5 = _context8.sent;
773
- _context8.t6 = extraData;
774
- _context8.t7 = unsignedPublicAuth;
775
- _context8.t8 = {
776
- signerURIs: _context8.t1,
777
- idToken: _context8.t2,
778
- authToken: _context8.t3,
779
- tenantId: _context8.t4,
780
- provider: _context8.t5,
781
- extraData: _context8.t6,
782
- unsignedPublicAuth: _context8.t7
638
+ _context6.t5 = _context6.sent;
639
+ _context6.t6 = extraData;
640
+ _context6.t7 = unsignedPublicAuth;
641
+ _context6.t8 = {
642
+ signerURIs: _context6.t1,
643
+ idToken: _context6.t2,
644
+ authToken: _context6.t3,
645
+ tenantId: _context6.t4,
646
+ provider: _context6.t5,
647
+ extraData: _context6.t6,
648
+ unsignedPublicAuth: _context6.t7
783
649
  };
784
- signer = new _context8.t0(_context8.t8);
785
- _context8.next = 15;
650
+ signer = new _context6.t0(_context6.t8);
651
+ _context6.next = 15;
786
652
  return signer.Initialize();
787
653
  case 15:
788
654
  this.SetSigner({
@@ -790,11 +656,11 @@ var ElvClient = /*#__PURE__*/function () {
790
656
  });
791
657
  case 16:
792
658
  case "end":
793
- return _context8.stop();
659
+ return _context6.stop();
794
660
  }
795
- }, _callee8, this);
661
+ }, _callee6, this);
796
662
  }));
797
- function SetRemoteSigner(_x5) {
663
+ function SetRemoteSigner(_x3) {
798
664
  return _SetRemoteSigner.apply(this, arguments);
799
665
  }
800
666
  return SetRemoteSigner;
@@ -812,29 +678,29 @@ var ElvClient = /*#__PURE__*/function () {
812
678
  }, {
813
679
  key: "SetSignerFromWeb3Provider",
814
680
  value: function () {
815
- var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
681
+ var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
816
682
  var provider, ethProvider;
817
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
818
- while (1) switch (_context9.prev = _context9.next) {
683
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
684
+ while (1) switch (_context7.prev = _context7.next) {
819
685
  case 0:
820
- provider = _ref13.provider;
686
+ provider = _ref11.provider;
821
687
  this.staticToken = undefined;
822
688
  ethProvider = new Ethers.providers.Web3Provider(provider);
823
689
  ethProvider.pollingInterval = 250;
824
690
  this.signer = ethProvider.getSigner();
825
- _context9.next = 7;
691
+ _context7.next = 7;
826
692
  return this.signer.getAddress();
827
693
  case 7:
828
- this.signer.address = _context9.sent;
829
- _context9.next = 10;
694
+ this.signer.address = _context7.sent;
695
+ _context7.next = 10;
830
696
  return this.InitializeClients();
831
697
  case 10:
832
698
  case "end":
833
- return _context9.stop();
699
+ return _context7.stop();
834
700
  }
835
- }, _callee9, this);
701
+ }, _callee7, this);
836
702
  }));
837
- function SetSignerFromWeb3Provider(_x6) {
703
+ function SetSignerFromWeb3Provider(_x4) {
838
704
  return _SetSignerFromWeb3Provider.apply(this, arguments);
839
705
  }
840
706
  return SetSignerFromWeb3Provider;
@@ -857,12 +723,12 @@ var ElvClient = /*#__PURE__*/function () {
857
723
  }, {
858
724
  key: "CreateAccount",
859
725
  value: function () {
860
- var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
861
- var tenantId, fundingToken, _ref14$funds, funds, groupToken, wallet, signer;
862
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
863
- while (1) switch (_context10.prev = _context10.next) {
726
+ var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
727
+ var tenantId, fundingToken, _ref12$funds, funds, groupToken, wallet, signer;
728
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
729
+ while (1) switch (_context8.prev = _context8.next) {
864
730
  case 0:
865
- tenantId = _ref14.tenantId, fundingToken = _ref14.fundingToken, _ref14$funds = _ref14.funds, funds = _ref14$funds === void 0 ? 0.5 : _ref14$funds, groupToken = _ref14.groupToken;
731
+ tenantId = _ref12.tenantId, fundingToken = _ref12.fundingToken, _ref12$funds = _ref12.funds, funds = _ref12$funds === void 0 ? 0.5 : _ref12$funds, groupToken = _ref12.groupToken;
866
732
  if (!this.signer) {
867
733
  wallet = this.GenerateWallet();
868
734
  signer = wallet.AddAccountFromMnemonic({
@@ -872,7 +738,7 @@ var ElvClient = /*#__PURE__*/function () {
872
738
  signer: signer
873
739
  });
874
740
  }
875
- _context10.next = 4;
741
+ _context8.next = 4;
876
742
  return this.authClient.MakeKMSRequest({
877
743
  method: "POST",
878
744
  path: "/ks/otp/fnd/".concat(tenantId),
@@ -885,20 +751,20 @@ var ElvClient = /*#__PURE__*/function () {
885
751
  }
886
752
  });
887
753
  case 4:
888
- _context10.next = 6;
754
+ _context8.next = 6;
889
755
  return this.userProfileClient.CreateWallet();
890
756
  case 6:
891
- _context10.next = 8;
757
+ _context8.next = 8;
892
758
  return this.userProfileClient.ReplaceUserMetadata({
893
759
  metadataSubtree: "tenantContractId",
894
760
  metadata: tenantId
895
761
  });
896
762
  case 8:
897
763
  if (!groupToken) {
898
- _context10.next = 11;
764
+ _context8.next = 11;
899
765
  break;
900
766
  }
901
- _context10.next = 11;
767
+ _context8.next = 11;
902
768
  return this.authClient.MakeKMSRequest({
903
769
  method: "POST",
904
770
  path: "/ks/otp/grp/".concat(tenantId),
@@ -910,14 +776,14 @@ var ElvClient = /*#__PURE__*/function () {
910
776
  }
911
777
  });
912
778
  case 11:
913
- return _context10.abrupt("return", this.utils.FormatAddress(this.signer.address));
779
+ return _context8.abrupt("return", this.utils.FormatAddress(this.signer.address));
914
780
  case 12:
915
781
  case "end":
916
- return _context10.stop();
782
+ return _context8.stop();
917
783
  }
918
- }, _callee10, this);
784
+ }, _callee8, this);
919
785
  }));
920
- function CreateAccount(_x7) {
786
+ function CreateAccount(_x5) {
921
787
  return _CreateAccount.apply(this, arguments);
922
788
  }
923
789
  return CreateAccount;
@@ -934,45 +800,45 @@ var ElvClient = /*#__PURE__*/function () {
934
800
  }, {
935
801
  key: "PersonalSign",
936
802
  value: function () {
937
- var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref15) {
938
- var _this2 = this;
803
+ var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref13) {
804
+ var _this = this;
939
805
  var message, addEthereumPrefix, Sign;
940
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
941
- while (1) switch (_context12.prev = _context12.next) {
806
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
807
+ while (1) switch (_context10.prev = _context10.next) {
942
808
  case 0:
943
- message = _ref15.message, addEthereumPrefix = _ref15.addEthereumPrefix, Sign = _ref15.Sign;
809
+ message = _ref13.message, addEthereumPrefix = _ref13.addEthereumPrefix, Sign = _ref13.Sign;
944
810
  if (!Sign) {
945
811
  Sign = /*#__PURE__*/function () {
946
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(message) {
947
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
948
- while (1) switch (_context11.prev = _context11.next) {
812
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(message) {
813
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
814
+ while (1) switch (_context9.prev = _context9.next) {
949
815
  case 0:
950
- return _context11.abrupt("return", _this2.authClient.Sign(message));
816
+ return _context9.abrupt("return", _this.authClient.Sign(message));
951
817
  case 1:
952
818
  case "end":
953
- return _context11.stop();
819
+ return _context9.stop();
954
820
  }
955
- }, _callee11);
821
+ }, _callee9);
956
822
  }));
957
- return function Sign(_x9) {
958
- return _ref16.apply(this, arguments);
823
+ return function Sign(_x7) {
824
+ return _ref14.apply(this, arguments);
959
825
  };
960
826
  }();
961
827
  }
962
828
  if (addEthereumPrefix) {
963
829
  message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
964
830
  }
965
- _context12.next = 5;
831
+ _context10.next = 5;
966
832
  return Sign(message);
967
833
  case 5:
968
- return _context12.abrupt("return", _context12.sent);
834
+ return _context10.abrupt("return", _context10.sent);
969
835
  case 6:
970
836
  case "end":
971
- return _context12.stop();
837
+ return _context10.stop();
972
838
  }
973
- }, _callee12);
839
+ }, _callee10);
974
840
  }));
975
- function PersonalSign(_x8) {
841
+ function PersonalSign(_x6) {
976
842
  return _PersonalSign.apply(this, arguments);
977
843
  }
978
844
  return PersonalSign;
@@ -991,61 +857,61 @@ var ElvClient = /*#__PURE__*/function () {
991
857
  }, {
992
858
  key: "CreateFabricToken",
993
859
  value: function () {
994
- var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
995
- var _ref17,
996
- _ref17$duration,
860
+ var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
861
+ var _ref15,
862
+ _ref15$duration,
997
863
  duration,
998
- _ref17$spec,
864
+ _ref15$spec,
999
865
  spec,
1000
866
  address,
1001
867
  Sign,
1002
- _ref17$addEthereumPre,
868
+ _ref15$addEthereumPre,
1003
869
  addEthereumPrefix,
1004
870
  token,
1005
871
  message,
1006
872
  signature,
1007
873
  compressedToken,
1008
- _args13 = arguments;
1009
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1010
- while (1) switch (_context13.prev = _context13.next) {
874
+ _args11 = arguments;
875
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
876
+ while (1) switch (_context11.prev = _context11.next) {
1011
877
  case 0:
1012
- _ref17 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, _ref17$duration = _ref17.duration, duration = _ref17$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref17$duration, _ref17$spec = _ref17.spec, spec = _ref17$spec === void 0 ? {} : _ref17$spec, address = _ref17.address, Sign = _ref17.Sign, _ref17$addEthereumPre = _ref17.addEthereumPrefix, addEthereumPrefix = _ref17$addEthereumPre === void 0 ? true : _ref17$addEthereumPre;
878
+ _ref15 = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {}, _ref15$duration = _ref15.duration, duration = _ref15$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref15$duration, _ref15$spec = _ref15.spec, spec = _ref15$spec === void 0 ? {} : _ref15$spec, address = _ref15.address, Sign = _ref15.Sign, _ref15$addEthereumPre = _ref15.addEthereumPrefix, addEthereumPrefix = _ref15$addEthereumPre === void 0 ? true : _ref15$addEthereumPre;
1013
879
  address = address || this.CurrentAccountAddress();
1014
- _context13.t0 = _objectSpread;
1015
- _context13.t1 = _objectSpread({}, spec);
1016
- _context13.t2 = {};
1017
- _context13.t3 = "iusr".concat(Utils.AddressToHash(address));
1018
- _context13.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
1019
- _context13.next = 9;
880
+ _context11.t0 = _objectSpread;
881
+ _context11.t1 = _objectSpread({}, spec);
882
+ _context11.t2 = {};
883
+ _context11.t3 = "iusr".concat(Utils.AddressToHash(address));
884
+ _context11.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
885
+ _context11.next = 9;
1020
886
  return this.ContentSpaceId();
1021
887
  case 9:
1022
- _context13.t5 = _context13.sent;
1023
- _context13.t6 = Date.now();
1024
- _context13.t7 = Date.now() + duration;
1025
- _context13.t8 = {
1026
- sub: _context13.t3,
1027
- adr: _context13.t4,
1028
- spc: _context13.t5,
1029
- iat: _context13.t6,
1030
- exp: _context13.t7
888
+ _context11.t5 = _context11.sent;
889
+ _context11.t6 = Date.now();
890
+ _context11.t7 = Date.now() + duration;
891
+ _context11.t8 = {
892
+ sub: _context11.t3,
893
+ adr: _context11.t4,
894
+ spc: _context11.t5,
895
+ iat: _context11.t6,
896
+ exp: _context11.t7
1031
897
  };
1032
- token = (0, _context13.t0)(_context13.t1, _context13.t2, _context13.t8);
898
+ token = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t8);
1033
899
  message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
1034
- _context13.next = 17;
900
+ _context11.next = 17;
1035
901
  return this.PersonalSign({
1036
902
  message: message,
1037
903
  addEthereumPrefix: addEthereumPrefix,
1038
904
  Sign: Sign
1039
905
  });
1040
906
  case 17:
1041
- signature = _context13.sent;
907
+ signature = _context11.sent;
1042
908
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1043
- return _context13.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
909
+ return _context11.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1044
910
  case 20:
1045
911
  case "end":
1046
- return _context13.stop();
912
+ return _context11.stop();
1047
913
  }
1048
- }, _callee13, this);
914
+ }, _callee11, this);
1049
915
  }));
1050
916
  function CreateFabricToken() {
1051
917
  return _CreateFabricToken.apply(this, arguments);
@@ -1071,100 +937,100 @@ var ElvClient = /*#__PURE__*/function () {
1071
937
  }, {
1072
938
  key: "CreateSignedToken",
1073
939
  value: function () {
1074
- var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1075
- var libraryId, objectId, versionHash, policyId, subject, _ref18$grantType, grantType, _ref18$allowDecryptio, allowDecryption, duration, _ref18$context, context, token, cap, compressedToken, signature;
1076
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1077
- while (1) switch (_context14.prev = _context14.next) {
940
+ var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref16) {
941
+ var libraryId, objectId, versionHash, policyId, subject, _ref16$grantType, grantType, _ref16$allowDecryptio, allowDecryption, duration, _ref16$context, context, token, cap, compressedToken, signature;
942
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
943
+ while (1) switch (_context12.prev = _context12.next) {
1078
944
  case 0:
1079
- libraryId = _ref18.libraryId, objectId = _ref18.objectId, versionHash = _ref18.versionHash, policyId = _ref18.policyId, subject = _ref18.subject, _ref18$grantType = _ref18.grantType, grantType = _ref18$grantType === void 0 ? "read" : _ref18$grantType, _ref18$allowDecryptio = _ref18.allowDecryption, allowDecryption = _ref18$allowDecryptio === void 0 ? false : _ref18$allowDecryptio, duration = _ref18.duration, _ref18$context = _ref18.context, context = _ref18$context === void 0 ? {} : _ref18$context;
945
+ libraryId = _ref16.libraryId, objectId = _ref16.objectId, versionHash = _ref16.versionHash, policyId = _ref16.policyId, subject = _ref16.subject, _ref16$grantType = _ref16.grantType, grantType = _ref16$grantType === void 0 ? "read" : _ref16$grantType, _ref16$allowDecryptio = _ref16.allowDecryption, allowDecryption = _ref16$allowDecryptio === void 0 ? false : _ref16$allowDecryptio, duration = _ref16.duration, _ref16$context = _ref16.context, context = _ref16$context === void 0 ? {} : _ref16$context;
1080
946
  if (subject) {
1081
- _context14.next = 9;
947
+ _context12.next = 9;
1082
948
  break;
1083
949
  }
1084
- _context14.t0 = "iusr";
1085
- _context14.t1 = this.utils;
1086
- _context14.next = 6;
950
+ _context12.t0 = "iusr";
951
+ _context12.t1 = this.utils;
952
+ _context12.next = 6;
1087
953
  return this.CurrentAccountAddress();
1088
954
  case 6:
1089
- _context14.t2 = _context14.sent;
1090
- _context14.t3 = _context14.t1.AddressToHash.call(_context14.t1, _context14.t2);
1091
- subject = _context14.t0.concat.call(_context14.t0, _context14.t3);
955
+ _context12.t2 = _context12.sent;
956
+ _context12.t3 = _context12.t1.AddressToHash.call(_context12.t1, _context12.t2);
957
+ subject = _context12.t0.concat.call(_context12.t0, _context12.t3);
1092
958
  case 9:
1093
959
  if (policyId) {
1094
960
  context["elv:delegation-id"] = policyId;
1095
961
  }
1096
- _context14.t4 = Buffer;
1097
- _context14.next = 13;
962
+ _context12.t4 = Buffer;
963
+ _context12.next = 13;
1098
964
  return this.CurrentAccountAddress().replace(/^0x/, "");
1099
965
  case 13:
1100
- _context14.t5 = _context14.sent;
1101
- _context14.t6 = _context14.t4.from.call(_context14.t4, _context14.t5, "hex").toString("base64");
1102
- _context14.t7 = subject;
1103
- _context14.next = 18;
966
+ _context12.t5 = _context12.sent;
967
+ _context12.t6 = _context12.t4.from.call(_context12.t4, _context12.t5, "hex").toString("base64");
968
+ _context12.t7 = subject;
969
+ _context12.next = 18;
1104
970
  return this.ContentSpaceId();
1105
971
  case 18:
1106
- _context14.t8 = _context14.sent;
1107
- _context14.t9 = Date.now();
1108
- _context14.t10 = Date.now() + duration;
1109
- _context14.t11 = grantType;
1110
- _context14.t12 = context;
972
+ _context12.t8 = _context12.sent;
973
+ _context12.t9 = Date.now();
974
+ _context12.t10 = Date.now() + duration;
975
+ _context12.t11 = grantType;
976
+ _context12.t12 = context;
1111
977
  token = {
1112
- adr: _context14.t6,
1113
- sub: _context14.t7,
1114
- spc: _context14.t8,
1115
- iat: _context14.t9,
1116
- exp: _context14.t10,
1117
- gra: _context14.t11,
1118
- ctx: _context14.t12
978
+ adr: _context12.t6,
979
+ sub: _context12.t7,
980
+ spc: _context12.t8,
981
+ iat: _context12.t9,
982
+ exp: _context12.t10,
983
+ gra: _context12.t11,
984
+ ctx: _context12.t12
1119
985
  };
1120
986
  if (versionHash) {
1121
987
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1122
988
  }
1123
989
  if (!objectId) {
1124
- _context14.next = 31;
990
+ _context12.next = 31;
1125
991
  break;
1126
992
  }
1127
993
  token.qid = objectId;
1128
994
  if (libraryId) {
1129
- _context14.next = 31;
995
+ _context12.next = 31;
1130
996
  break;
1131
997
  }
1132
- _context14.next = 30;
998
+ _context12.next = 30;
1133
999
  return this.ContentObjectLibraryId({
1134
1000
  objectId: objectId
1135
1001
  });
1136
1002
  case 30:
1137
- libraryId = _context14.sent;
1003
+ libraryId = _context12.sent;
1138
1004
  case 31:
1139
1005
  if (libraryId) {
1140
1006
  token.lib = libraryId;
1141
1007
  }
1142
1008
  if (!allowDecryption) {
1143
- _context14.next = 37;
1009
+ _context12.next = 37;
1144
1010
  break;
1145
1011
  }
1146
- _context14.next = 35;
1012
+ _context12.next = 35;
1147
1013
  return this.authClient.ReEncryptionConk({
1148
1014
  libraryId: libraryId,
1149
1015
  objectId: objectId
1150
1016
  });
1151
1017
  case 35:
1152
- cap = _context14.sent;
1018
+ cap = _context12.sent;
1153
1019
  token.apk = cap.public_key;
1154
1020
  case 37:
1155
1021
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1156
- _context14.next = 40;
1022
+ _context12.next = 40;
1157
1023
  return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1158
1024
  case 40:
1159
- signature = _context14.sent;
1160
- return _context14.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1025
+ signature = _context12.sent;
1026
+ return _context12.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1161
1027
  case 42:
1162
1028
  case "end":
1163
- return _context14.stop();
1029
+ return _context12.stop();
1164
1030
  }
1165
- }, _callee14, this);
1031
+ }, _callee12, this);
1166
1032
  }));
1167
- function CreateSignedToken(_x10) {
1033
+ function CreateSignedToken(_x8) {
1168
1034
  return _CreateSignedToken.apply(this, arguments);
1169
1035
  }
1170
1036
  return CreateSignedToken;
@@ -1191,12 +1057,12 @@ var ElvClient = /*#__PURE__*/function () {
1191
1057
  }, {
1192
1058
  key: "SetOauthToken",
1193
1059
  value: function () {
1194
- var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1060
+ var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
1195
1061
  var token, wallet, signer;
1196
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1197
- while (1) switch (_context15.prev = _context15.next) {
1062
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1063
+ while (1) switch (_context13.prev = _context13.next) {
1198
1064
  case 0:
1199
- token = _ref19.token;
1065
+ token = _ref17.token;
1200
1066
  this.oauthToken = token;
1201
1067
  wallet = this.GenerateWallet();
1202
1068
  signer = wallet.AddAccountFromMnemonic({
@@ -1207,11 +1073,11 @@ var ElvClient = /*#__PURE__*/function () {
1207
1073
  });
1208
1074
  case 5:
1209
1075
  case "end":
1210
- return _context15.stop();
1076
+ return _context13.stop();
1211
1077
  }
1212
- }, _callee15, this);
1078
+ }, _callee13, this);
1213
1079
  }));
1214
- function SetOauthToken(_x11) {
1080
+ function SetOauthToken(_x9) {
1215
1081
  return _SetOauthToken.apply(this, arguments);
1216
1082
  }
1217
1083
  return SetOauthToken;
@@ -1229,44 +1095,44 @@ var ElvClient = /*#__PURE__*/function () {
1229
1095
  }, {
1230
1096
  key: "SetSignerFromOauthToken",
1231
1097
  value: function () {
1232
- var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1098
+ var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1233
1099
  var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1234
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1235
- while (1) switch (_context16.prev = _context16.next) {
1100
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1101
+ while (1) switch (_context14.prev = _context14.next) {
1236
1102
  case 0:
1237
- token = _ref20.token;
1103
+ token = _ref18.token;
1238
1104
  if (this.trustAuthorityId) {
1239
- _context16.next = 3;
1105
+ _context14.next = 3;
1240
1106
  break;
1241
1107
  }
1242
1108
  throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1243
1109
  case 3:
1244
1110
  wallet = this.GenerateWallet();
1245
- _context16.prev = 4;
1111
+ _context14.prev = 4;
1246
1112
  if (this.kmsURIs) {
1247
- _context16.next = 17;
1113
+ _context14.next = 17;
1248
1114
  break;
1249
1115
  }
1250
- _context16.next = 8;
1116
+ _context14.next = 8;
1251
1117
  return ElvClient.FromConfigurationUrl({
1252
1118
  configUrl: this.configUrl
1253
1119
  });
1254
1120
  case 8:
1255
- client = _context16.sent;
1121
+ client = _context14.sent;
1256
1122
  client.SetSigner({
1257
1123
  signer: wallet.AddAccountFromMnemonic({
1258
1124
  mnemonic: wallet.GenerateMnemonic()
1259
1125
  })
1260
1126
  });
1261
- _context16.next = 12;
1127
+ _context14.next = 12;
1262
1128
  return client.authClient.KMSInfo({
1263
1129
  kmsId: this.trustAuthorityId
1264
1130
  });
1265
1131
  case 12:
1266
- _yield$client$authCli = _context16.sent;
1132
+ _yield$client$authCli = _context14.sent;
1267
1133
  urls = _yield$client$authCli.urls;
1268
1134
  if (!(!urls || urls.length === 0)) {
1269
- _context16.next = 16;
1135
+ _context14.next = 16;
1270
1136
  break;
1271
1137
  }
1272
1138
  throw Error("Unable to authorize with OAuth token: No KMS URLs set");
@@ -1279,7 +1145,7 @@ var ElvClient = /*#__PURE__*/function () {
1279
1145
  uris: this.kmsURIs,
1280
1146
  debug: this.debug
1281
1147
  });
1282
- _context16.next = 22;
1148
+ _context14.next = 22;
1283
1149
  return this.utils.ResponseToJson(httpClient.Request({
1284
1150
  headers: {
1285
1151
  Authorization: "Bearer ".concat(token)
@@ -1289,7 +1155,7 @@ var ElvClient = /*#__PURE__*/function () {
1289
1155
  forceFailover: true
1290
1156
  }));
1291
1157
  case 22:
1292
- response = _context16.sent;
1158
+ response = _context14.sent;
1293
1159
  privateKey = response["UserSKHex"];
1294
1160
  this.SetSigner({
1295
1161
  signer: wallet.AddAccount({
@@ -1298,27 +1164,27 @@ var ElvClient = /*#__PURE__*/function () {
1298
1164
  });
1299
1165
 
1300
1166
  // Ensure wallet is initialized
1301
- _context16.next = 27;
1167
+ _context14.next = 27;
1302
1168
  return this.userProfileClient.WalletAddress();
1303
1169
  case 27:
1304
- _context16.next = 36;
1170
+ _context14.next = 36;
1305
1171
  break;
1306
1172
  case 29:
1307
- _context16.prev = 29;
1308
- _context16.t0 = _context16["catch"](4);
1173
+ _context14.prev = 29;
1174
+ _context14.t0 = _context14["catch"](4);
1309
1175
  this.Log("Failed to set signer from OAuth token:", true);
1310
- this.Log(_context16.t0, true);
1311
- _context16.next = 35;
1176
+ this.Log(_context14.t0, true);
1177
+ _context14.next = 35;
1312
1178
  return this.ClearSigner();
1313
1179
  case 35:
1314
- throw _context16.t0;
1180
+ throw _context14.t0;
1315
1181
  case 36:
1316
1182
  case "end":
1317
- return _context16.stop();
1183
+ return _context14.stop();
1318
1184
  }
1319
- }, _callee16, this, [[4, 29]]);
1185
+ }, _callee14, this, [[4, 29]]);
1320
1186
  }));
1321
- function SetSignerFromOauthToken(_x12) {
1187
+ function SetSignerFromOauthToken(_x10) {
1322
1188
  return _SetSignerFromOauthToken.apply(this, arguments);
1323
1189
  }
1324
1190
  return SetSignerFromOauthToken;
@@ -1333,8 +1199,8 @@ var ElvClient = /*#__PURE__*/function () {
1333
1199
  }, {
1334
1200
  key: "SetStaticToken",
1335
1201
  value: function SetStaticToken() {
1336
- var _ref21 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1337
- token = _ref21.token;
1202
+ var _ref19 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1203
+ token = _ref19.token;
1338
1204
  if (!token) {
1339
1205
  token = this.utils.B64(JSON.stringify({
1340
1206
  qspace_id: this.contentSpaceId
@@ -1364,30 +1230,30 @@ var ElvClient = /*#__PURE__*/function () {
1364
1230
  }, {
1365
1231
  key: "SetPolicyAuthorization",
1366
1232
  value: function () {
1367
- var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref22) {
1233
+ var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref20) {
1368
1234
  var objectId;
1369
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1370
- while (1) switch (_context17.prev = _context17.next) {
1235
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1236
+ while (1) switch (_context15.prev = _context15.next) {
1371
1237
  case 0:
1372
- objectId = _ref22.objectId;
1373
- _context17.t0 = this;
1374
- _context17.next = 4;
1238
+ objectId = _ref20.objectId;
1239
+ _context15.t0 = this;
1240
+ _context15.next = 4;
1375
1241
  return this.GenerateStateChannelToken({
1376
1242
  objectId: objectId
1377
1243
  });
1378
1244
  case 4:
1379
- _context17.t1 = _context17.sent;
1380
- _context17.t2 = {
1381
- token: _context17.t1
1245
+ _context15.t1 = _context15.sent;
1246
+ _context15.t2 = {
1247
+ token: _context15.t1
1382
1248
  };
1383
- _context17.t0.SetStaticToken.call(_context17.t0, _context17.t2);
1249
+ _context15.t0.SetStaticToken.call(_context15.t0, _context15.t2);
1384
1250
  case 7:
1385
1251
  case "end":
1386
- return _context17.stop();
1252
+ return _context15.stop();
1387
1253
  }
1388
- }, _callee17, this);
1254
+ }, _callee15, this);
1389
1255
  }));
1390
- function SetPolicyAuthorization(_x13) {
1256
+ function SetPolicyAuthorization(_x11) {
1391
1257
  return _SetPolicyAuthorization.apply(this, arguments);
1392
1258
  }
1393
1259
  return SetPolicyAuthorization;
@@ -1401,23 +1267,23 @@ var ElvClient = /*#__PURE__*/function () {
1401
1267
  }, {
1402
1268
  key: "Sign",
1403
1269
  value: function () {
1404
- var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(string) {
1270
+ var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(string) {
1405
1271
  var signature;
1406
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1407
- while (1) switch (_context18.prev = _context18.next) {
1272
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1273
+ while (1) switch (_context16.prev = _context16.next) {
1408
1274
  case 0:
1409
- _context18.next = 2;
1275
+ _context16.next = 2;
1410
1276
  return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1411
1277
  case 2:
1412
- signature = _context18.sent;
1413
- return _context18.abrupt("return", this.utils.FormatSignature(signature));
1278
+ signature = _context16.sent;
1279
+ return _context16.abrupt("return", this.utils.FormatSignature(signature));
1414
1280
  case 4:
1415
1281
  case "end":
1416
- return _context18.stop();
1282
+ return _context16.stop();
1417
1283
  }
1418
- }, _callee18, this);
1284
+ }, _callee16, this);
1419
1285
  }));
1420
- function Sign(_x14) {
1286
+ function Sign(_x12) {
1421
1287
  return _Sign.apply(this, arguments);
1422
1288
  }
1423
1289
  return Sign;
@@ -1434,30 +1300,30 @@ var ElvClient = /*#__PURE__*/function () {
1434
1300
  }, {
1435
1301
  key: "EncryptECIES",
1436
1302
  value: function () {
1437
- var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref23) {
1303
+ var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
1438
1304
  var message, publicKey;
1439
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1440
- while (1) switch (_context19.prev = _context19.next) {
1305
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1306
+ while (1) switch (_context17.prev = _context17.next) {
1441
1307
  case 0:
1442
- message = _ref23.message, publicKey = _ref23.publicKey;
1308
+ message = _ref21.message, publicKey = _ref21.publicKey;
1443
1309
  if (this.signer) {
1444
- _context19.next = 3;
1310
+ _context17.next = 3;
1445
1311
  break;
1446
1312
  }
1447
1313
  throw "Signer not set";
1448
1314
  case 3:
1449
1315
  ValidatePresence("message", message);
1450
- _context19.next = 6;
1316
+ _context17.next = 6;
1451
1317
  return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1452
1318
  case 6:
1453
- return _context19.abrupt("return", _context19.sent);
1319
+ return _context17.abrupt("return", _context17.sent);
1454
1320
  case 7:
1455
1321
  case "end":
1456
- return _context19.stop();
1322
+ return _context17.stop();
1457
1323
  }
1458
- }, _callee19, this);
1324
+ }, _callee17, this);
1459
1325
  }));
1460
- function EncryptECIES(_x15) {
1326
+ function EncryptECIES(_x13) {
1461
1327
  return _EncryptECIES.apply(this, arguments);
1462
1328
  }
1463
1329
  return EncryptECIES;
@@ -1473,30 +1339,30 @@ var ElvClient = /*#__PURE__*/function () {
1473
1339
  }, {
1474
1340
  key: "DecryptECIES",
1475
1341
  value: function () {
1476
- var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref24) {
1342
+ var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref22) {
1477
1343
  var message;
1478
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1479
- while (1) switch (_context20.prev = _context20.next) {
1344
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1345
+ while (1) switch (_context18.prev = _context18.next) {
1480
1346
  case 0:
1481
- message = _ref24.message;
1347
+ message = _ref22.message;
1482
1348
  if (this.signer) {
1483
- _context20.next = 3;
1349
+ _context18.next = 3;
1484
1350
  break;
1485
1351
  }
1486
1352
  throw "Signer not set";
1487
1353
  case 3:
1488
1354
  ValidatePresence("message", message);
1489
- _context20.next = 6;
1355
+ _context18.next = 6;
1490
1356
  return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1491
1357
  case 6:
1492
- return _context20.abrupt("return", _context20.sent);
1358
+ return _context18.abrupt("return", _context18.sent);
1493
1359
  case 7:
1494
1360
  case "end":
1495
- return _context20.stop();
1361
+ return _context18.stop();
1496
1362
  }
1497
- }, _callee20, this);
1363
+ }, _callee18, this);
1498
1364
  }));
1499
- function DecryptECIES(_x16) {
1365
+ function DecryptECIES(_x14) {
1500
1366
  return _DecryptECIES.apply(this, arguments);
1501
1367
  }
1502
1368
  return DecryptECIES;
@@ -1515,24 +1381,24 @@ var ElvClient = /*#__PURE__*/function () {
1515
1381
  }, {
1516
1382
  key: "Request",
1517
1383
  value: function () {
1518
- var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref25) {
1519
- var url, _ref25$format, format, _ref25$method, method, _ref25$headers, headers, body;
1520
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1521
- while (1) switch (_context21.prev = _context21.next) {
1384
+ var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref23) {
1385
+ var url, _ref23$format, format, _ref23$method, method, _ref23$headers, headers, body;
1386
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1387
+ while (1) switch (_context19.prev = _context19.next) {
1522
1388
  case 0:
1523
- url = _ref25.url, _ref25$format = _ref25.format, format = _ref25$format === void 0 ? "json" : _ref25$format, _ref25$method = _ref25.method, method = _ref25$method === void 0 ? "GET" : _ref25$method, _ref25$headers = _ref25.headers, headers = _ref25$headers === void 0 ? {} : _ref25$headers, body = _ref25.body;
1524
- return _context21.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1389
+ url = _ref23.url, _ref23$format = _ref23.format, format = _ref23$format === void 0 ? "json" : _ref23$format, _ref23$method = _ref23.method, method = _ref23$method === void 0 ? "GET" : _ref23$method, _ref23$headers = _ref23.headers, headers = _ref23$headers === void 0 ? {} : _ref23$headers, body = _ref23.body;
1390
+ return _context19.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1525
1391
  method: method,
1526
1392
  headers: headers,
1527
1393
  body: body
1528
1394
  })));
1529
1395
  case 2:
1530
1396
  case "end":
1531
- return _context21.stop();
1397
+ return _context19.stop();
1532
1398
  }
1533
- }, _callee21, this);
1399
+ }, _callee19, this);
1534
1400
  }));
1535
- function Request(_x17) {
1401
+ function Request(_x15) {
1536
1402
  return _Request.apply(this, arguments);
1537
1403
  }
1538
1404
  return Request;
@@ -1542,10 +1408,10 @@ var ElvClient = /*#__PURE__*/function () {
1542
1408
  }, {
1543
1409
  key: "FrameAllowedMethods",
1544
1410
  value: function FrameAllowedMethods() {
1545
- var _this3 = this;
1411
+ var _this2 = this;
1546
1412
  var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1547
1413
  return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
1548
- return typeof _this3[method] === "function" && !forbiddenMethods.includes(method);
1414
+ return typeof _this2[method] === "function" && !forbiddenMethods.includes(method);
1549
1415
  });
1550
1416
  }
1551
1417
 
@@ -1553,21 +1419,21 @@ var ElvClient = /*#__PURE__*/function () {
1553
1419
  }, {
1554
1420
  key: "CallFromFrameMessage",
1555
1421
  value: function () {
1556
- var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(message, Respond) {
1557
- var _this4 = this;
1422
+ var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(message, Respond) {
1423
+ var _this3 = this;
1558
1424
  var callback, method, methodResults, responseError;
1559
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1560
- while (1) switch (_context22.prev = _context22.next) {
1425
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1426
+ while (1) switch (_context20.prev = _context20.next) {
1561
1427
  case 0:
1562
1428
  if (!(message.type !== "ElvFrameRequest")) {
1563
- _context22.next = 2;
1429
+ _context20.next = 2;
1564
1430
  break;
1565
1431
  }
1566
- return _context22.abrupt("return");
1432
+ return _context20.abrupt("return");
1567
1433
  case 2:
1568
1434
  if (message.callbackId) {
1569
1435
  callback = function callback(result) {
1570
- Respond(_this4.utils.MakeClonable({
1436
+ Respond(_this3.utils.MakeClonable({
1571
1437
  type: "ElvFrameResponse",
1572
1438
  requestId: message.callbackId,
1573
1439
  response: result
@@ -1575,75 +1441,75 @@ var ElvClient = /*#__PURE__*/function () {
1575
1441
  };
1576
1442
  message.args.callback = callback;
1577
1443
  }
1578
- _context22.prev = 3;
1444
+ _context20.prev = 3;
1579
1445
  method = message.calledMethod;
1580
1446
  if (!(message.module === "walletClient")) {
1581
- _context22.next = 15;
1447
+ _context20.next = 15;
1582
1448
  break;
1583
1449
  }
1584
1450
  if (this.walletClient) {
1585
- _context22.next = 8;
1451
+ _context20.next = 8;
1586
1452
  break;
1587
1453
  }
1588
1454
  throw Error("Wallet client not set");
1589
1455
  case 8:
1590
1456
  if (!this.walletClient.ForbiddenMethods().includes(method)) {
1591
- _context22.next = 10;
1457
+ _context20.next = 10;
1592
1458
  break;
1593
1459
  }
1594
1460
  throw Error("Invalid user profile method: " + method);
1595
1461
  case 10:
1596
- _context22.next = 12;
1462
+ _context20.next = 12;
1597
1463
  return this.walletClient[method](message.args);
1598
1464
  case 12:
1599
- methodResults = _context22.sent;
1600
- _context22.next = 28;
1465
+ methodResults = _context20.sent;
1466
+ _context20.next = 28;
1601
1467
  break;
1602
1468
  case 15:
1603
1469
  if (!(message.module === "userProfileClient")) {
1604
- _context22.next = 23;
1470
+ _context20.next = 23;
1605
1471
  break;
1606
1472
  }
1607
1473
  if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1608
- _context22.next = 18;
1474
+ _context20.next = 18;
1609
1475
  break;
1610
1476
  }
1611
1477
  throw Error("Invalid user profile method: " + method);
1612
1478
  case 18:
1613
- _context22.next = 20;
1479
+ _context20.next = 20;
1614
1480
  return this.userProfileClient[method](message.args);
1615
1481
  case 20:
1616
- methodResults = _context22.sent;
1617
- _context22.next = 28;
1482
+ methodResults = _context20.sent;
1483
+ _context20.next = 28;
1618
1484
  break;
1619
1485
  case 23:
1620
1486
  if (this.FrameAllowedMethods().includes(method)) {
1621
- _context22.next = 25;
1487
+ _context20.next = 25;
1622
1488
  break;
1623
1489
  }
1624
1490
  throw Error("Invalid method: " + method);
1625
1491
  case 25:
1626
- _context22.next = 27;
1492
+ _context20.next = 27;
1627
1493
  return this[method](message.args);
1628
1494
  case 27:
1629
- methodResults = _context22.sent;
1495
+ methodResults = _context20.sent;
1630
1496
  case 28:
1631
1497
  Respond(this.utils.MakeClonable({
1632
1498
  type: "ElvFrameResponse",
1633
1499
  requestId: message.requestId,
1634
1500
  response: methodResults
1635
1501
  }));
1636
- _context22.next = 37;
1502
+ _context20.next = 37;
1637
1503
  break;
1638
1504
  case 31:
1639
- _context22.prev = 31;
1640
- _context22.t0 = _context22["catch"](3);
1505
+ _context20.prev = 31;
1506
+ _context20.t0 = _context20["catch"](3);
1641
1507
  // eslint-disable-next-line no-console
1642
- this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context22.t0) === "object" ? JSON.stringify(_context22.t0, null, 2) : _context22.t0), true);
1508
+ this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context20.t0) === "object" ? JSON.stringify(_context20.t0, null, 2) : _context20.t0), true);
1643
1509
 
1644
1510
  // eslint-disable-next-line no-console
1645
- console.error(_context22.t0);
1646
- responseError = _context22.t0 instanceof Error ? _context22.t0.message : _context22.t0;
1511
+ console.error(_context20.t0);
1512
+ responseError = _context20.t0 instanceof Error ? _context20.t0.message : _context20.t0;
1647
1513
  Respond(this.utils.MakeClonable({
1648
1514
  type: "ElvFrameResponse",
1649
1515
  requestId: message.requestId,
@@ -1651,11 +1517,11 @@ var ElvClient = /*#__PURE__*/function () {
1651
1517
  }));
1652
1518
  case 37:
1653
1519
  case "end":
1654
- return _context22.stop();
1520
+ return _context20.stop();
1655
1521
  }
1656
- }, _callee22, this, [[3, 31]]);
1522
+ }, _callee20, this, [[3, 31]]);
1657
1523
  }));
1658
- function CallFromFrameMessage(_x18, _x19) {
1524
+ function CallFromFrameMessage(_x16, _x17) {
1659
1525
  return _CallFromFrameMessage.apply(this, arguments);
1660
1526
  }
1661
1527
  return CallFromFrameMessage;
@@ -1663,13 +1529,13 @@ var ElvClient = /*#__PURE__*/function () {
1663
1529
  }], [{
1664
1530
  key: "Configuration",
1665
1531
  value: function () {
1666
- var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref26) {
1667
- var configUrl, _ref26$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1668
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1669
- while (1) switch (_context23.prev = _context23.next) {
1532
+ var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref24) {
1533
+ var configUrl, _ref24$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1534
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1535
+ while (1) switch (_context21.prev = _context21.next) {
1670
1536
  case 0:
1671
- configUrl = _ref26.configUrl, _ref26$kmsUrls = _ref26.kmsUrls, kmsUrls = _ref26$kmsUrls === void 0 ? [] : _ref26$kmsUrls, region = _ref26.region, clientIP = _ref26.clientIP;
1672
- _context23.prev = 1;
1537
+ configUrl = _ref24.configUrl, _ref24$kmsUrls = _ref24.kmsUrls, kmsUrls = _ref24$kmsUrls === void 0 ? [] : _ref24$kmsUrls, region = _ref24.region, clientIP = _ref24.clientIP;
1538
+ _context21.prev = 1;
1673
1539
  uri = new URI(configUrl);
1674
1540
  uri.pathname("/config");
1675
1541
  if (region) {
@@ -1678,10 +1544,10 @@ var ElvClient = /*#__PURE__*/function () {
1678
1544
  if (clientIP) {
1679
1545
  uri.addSearch("client_ip", clientIP);
1680
1546
  }
1681
- _context23.next = 8;
1547
+ _context21.next = 8;
1682
1548
  return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1683
1549
  case 8:
1684
- fabricInfo = _context23.sent;
1550
+ fabricInfo = _context21.sent;
1685
1551
  // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1686
1552
  filterHTTPS = function filterHTTPS(uri) {
1687
1553
  return uri.toLowerCase().startsWith("https");
@@ -1700,7 +1566,7 @@ var ElvClient = /*#__PURE__*/function () {
1700
1566
  }
1701
1567
  searchURIs = fabricInfo.network.services.search || [];
1702
1568
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1703
- return _context23.abrupt("return", {
1569
+ return _context21.abrupt("return", {
1704
1570
  nodeId: fabricInfo.node_id,
1705
1571
  contentSpaceId: fabricInfo.qspace.id,
1706
1572
  networkId: (fabricInfo.qspace.ethereum || {}).network_id,
@@ -1713,20 +1579,20 @@ var ElvClient = /*#__PURE__*/function () {
1713
1579
  fabricVersion: fabricVersion
1714
1580
  });
1715
1581
  case 21:
1716
- _context23.prev = 21;
1717
- _context23.t0 = _context23["catch"](1);
1582
+ _context21.prev = 21;
1583
+ _context21.t0 = _context21["catch"](1);
1718
1584
  // eslint-disable-next-line no-console
1719
1585
  console.error("Error retrieving fabric configuration:");
1720
1586
  // eslint-disable-next-line no-console
1721
- console.error(_context23.t0);
1722
- throw _context23.t0;
1587
+ console.error(_context21.t0);
1588
+ throw _context21.t0;
1723
1589
  case 26:
1724
1590
  case "end":
1725
- return _context23.stop();
1591
+ return _context21.stop();
1726
1592
  }
1727
- }, _callee23, null, [[1, 21]]);
1593
+ }, _callee21, null, [[1, 21]]);
1728
1594
  }));
1729
- function Configuration(_x20) {
1595
+ function Configuration(_x18) {
1730
1596
  return _Configuration.apply(this, arguments);
1731
1597
  }
1732
1598
  return Configuration;
@@ -1750,20 +1616,20 @@ var ElvClient = /*#__PURE__*/function () {
1750
1616
  }, {
1751
1617
  key: "FromNetworkName",
1752
1618
  value: function () {
1753
- var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref27) {
1754
- var networkName, region, clientIP, trustAuthorityId, staticToken, _ref27$ethereumContra, ethereumContractTimeout, _ref27$noCache, noCache, _ref27$noAuth, noAuth, assumeV3, configUrl;
1755
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1756
- while (1) switch (_context24.prev = _context24.next) {
1619
+ var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref25) {
1620
+ var networkName, region, clientIP, trustAuthorityId, staticToken, _ref25$ethereumContra, ethereumContractTimeout, _ref25$noCache, noCache, _ref25$noAuth, noAuth, assumeV3, configUrl;
1621
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1622
+ while (1) switch (_context22.prev = _context22.next) {
1757
1623
  case 0:
1758
- networkName = _ref27.networkName, region = _ref27.region, clientIP = _ref27.clientIP, trustAuthorityId = _ref27.trustAuthorityId, staticToken = _ref27.staticToken, _ref27$ethereumContra = _ref27.ethereumContractTimeout, ethereumContractTimeout = _ref27$ethereumContra === void 0 ? 10 : _ref27$ethereumContra, _ref27$noCache = _ref27.noCache, noCache = _ref27$noCache === void 0 ? false : _ref27$noCache, _ref27$noAuth = _ref27.noAuth, noAuth = _ref27$noAuth === void 0 ? false : _ref27$noAuth, assumeV3 = _ref27.assumeV3;
1624
+ networkName = _ref25.networkName, region = _ref25.region, clientIP = _ref25.clientIP, trustAuthorityId = _ref25.trustAuthorityId, staticToken = _ref25.staticToken, _ref25$ethereumContra = _ref25.ethereumContractTimeout, ethereumContractTimeout = _ref25$ethereumContra === void 0 ? 10 : _ref25$ethereumContra, _ref25$noCache = _ref25.noCache, noCache = _ref25$noCache === void 0 ? false : _ref25$noCache, _ref25$noAuth = _ref25.noAuth, noAuth = _ref25$noAuth === void 0 ? false : _ref25$noAuth, assumeV3 = _ref25.assumeV3;
1759
1625
  configUrl = networks[networkName];
1760
1626
  if (configUrl) {
1761
- _context24.next = 4;
1627
+ _context22.next = 4;
1762
1628
  break;
1763
1629
  }
1764
1630
  throw Error("Invalid network name: " + networkName);
1765
1631
  case 4:
1766
- _context24.next = 6;
1632
+ _context22.next = 6;
1767
1633
  return this.FromConfigurationUrl({
1768
1634
  configUrl: configUrl,
1769
1635
  region: region,
@@ -1776,14 +1642,14 @@ var ElvClient = /*#__PURE__*/function () {
1776
1642
  assumeV3: assumeV3
1777
1643
  });
1778
1644
  case 6:
1779
- return _context24.abrupt("return", _context24.sent);
1645
+ return _context22.abrupt("return", _context22.sent);
1780
1646
  case 7:
1781
1647
  case "end":
1782
- return _context24.stop();
1648
+ return _context22.stop();
1783
1649
  }
1784
- }, _callee24, this);
1650
+ }, _callee22, this);
1785
1651
  }));
1786
- function FromNetworkName(_x21) {
1652
+ function FromNetworkName(_x19) {
1787
1653
  return _FromNetworkName.apply(this, arguments);
1788
1654
  }
1789
1655
  return FromNetworkName;
@@ -1807,20 +1673,20 @@ var ElvClient = /*#__PURE__*/function () {
1807
1673
  }, {
1808
1674
  key: "FromConfigurationUrl",
1809
1675
  value: function () {
1810
- var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref28) {
1811
- var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref28$ethereumContra, ethereumContractTimeout, _ref28$noCache, noCache, _ref28$noAuth, noAuth, _ref28$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1812
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1813
- while (1) switch (_context25.prev = _context25.next) {
1676
+ var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref26) {
1677
+ var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref26$ethereumContra, ethereumContractTimeout, _ref26$noCache, noCache, _ref26$noAuth, noAuth, _ref26$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1678
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1679
+ while (1) switch (_context23.prev = _context23.next) {
1814
1680
  case 0:
1815
- configUrl = _ref28.configUrl, region = _ref28.region, clientIP = _ref28.clientIP, trustAuthorityId = _ref28.trustAuthorityId, staticToken = _ref28.staticToken, _ref28$ethereumContra = _ref28.ethereumContractTimeout, ethereumContractTimeout = _ref28$ethereumContra === void 0 ? 10 : _ref28$ethereumContra, _ref28$noCache = _ref28.noCache, noCache = _ref28$noCache === void 0 ? false : _ref28$noCache, _ref28$noAuth = _ref28.noAuth, noAuth = _ref28$noAuth === void 0 ? false : _ref28$noAuth, _ref28$assumeV = _ref28.assumeV3, assumeV3 = _ref28$assumeV === void 0 ? false : _ref28$assumeV;
1816
- _context25.next = 3;
1681
+ configUrl = _ref26.configUrl, region = _ref26.region, clientIP = _ref26.clientIP, trustAuthorityId = _ref26.trustAuthorityId, staticToken = _ref26.staticToken, _ref26$ethereumContra = _ref26.ethereumContractTimeout, ethereumContractTimeout = _ref26$ethereumContra === void 0 ? 10 : _ref26$ethereumContra, _ref26$noCache = _ref26.noCache, noCache = _ref26$noCache === void 0 ? false : _ref26$noCache, _ref26$noAuth = _ref26.noAuth, noAuth = _ref26$noAuth === void 0 ? false : _ref26$noAuth, _ref26$assumeV = _ref26.assumeV3, assumeV3 = _ref26$assumeV === void 0 ? false : _ref26$assumeV;
1682
+ _context23.next = 3;
1817
1683
  return ElvClient.Configuration({
1818
1684
  configUrl: configUrl,
1819
1685
  clientIP: clientIP,
1820
1686
  region: region
1821
1687
  });
1822
1688
  case 3:
1823
- _yield$ElvClient$Conf3 = _context25.sent;
1689
+ _yield$ElvClient$Conf3 = _context23.sent;
1824
1690
  contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
1825
1691
  networkId = _yield$ElvClient$Conf3.networkId;
1826
1692
  networkName = _yield$ElvClient$Conf3.networkName;
@@ -1846,14 +1712,14 @@ var ElvClient = /*#__PURE__*/function () {
1846
1712
  assumeV3: assumeV3
1847
1713
  });
1848
1714
  client.configUrl = configUrl;
1849
- return _context25.abrupt("return", client);
1715
+ return _context23.abrupt("return", client);
1850
1716
  case 15:
1851
1717
  case "end":
1852
- return _context25.stop();
1718
+ return _context23.stop();
1853
1719
  }
1854
- }, _callee25);
1720
+ }, _callee23);
1855
1721
  }));
1856
- function FromConfigurationUrl(_x22) {
1722
+ function FromConfigurationUrl(_x20) {
1857
1723
  return _FromConfigurationUrl.apply(this, arguments);
1858
1724
  }
1859
1725
  return FromConfigurationUrl;
@@ -1866,7 +1732,6 @@ Object.assign(ElvClient.prototype, require("./client/ContentAccess"));
1866
1732
  Object.assign(ElvClient.prototype, require("./client/Contracts"));
1867
1733
  Object.assign(ElvClient.prototype, require("./client/Files"));
1868
1734
  Object.assign(ElvClient.prototype, require("./client/ABRPublishing"));
1869
- Object.assign(ElvClient.prototype, require("./client/LiveStream"));
1870
1735
  Object.assign(ElvClient.prototype, require("./client/ContentManagement"));
1871
1736
  Object.assign(ElvClient.prototype, require("./client/NTP"));
1872
1737
  Object.assign(ElvClient.prototype, require("./client/NFT"));