@eluvio/elv-client-js 4.0.86 → 4.0.88

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");
@@ -18,8 +18,6 @@ var EthClient = require("./EthClient");
18
18
  var UserProfileClient = require("./UserProfileClient");
19
19
  var HttpClient = require("./HttpClient");
20
20
  var RemoteSigner = require("./RemoteSigner");
21
-
22
- // const ContentObjectVerification = require("./ContentObjectVerification");
23
21
  var Utils = require("./Utils");
24
22
  var Crypto = require("./Crypto");
25
23
  var _require = require("./LogMessage"),
@@ -27,11 +25,12 @@ var _require = require("./LogMessage"),
27
25
  var Pako = require("pako");
28
26
  var _require2 = require("./Validation"),
29
27
  ValidatePresence = _require2.ValidatePresence;
30
- var CBOR = require("cbor-x");
28
+ var UrlJoin = require("url-join");
31
29
  var networks = {
32
30
  "main": "https://main.net955305.contentfabric.io",
33
31
  "demo": "https://demov3.net955210.contentfabric.io",
34
32
  "demov3": "https://demov3.net955210.contentfabric.io",
33
+ "local": "http://127.0.0.1:8008/config?qspace=dev&self",
35
34
  "test": "https://test.net955203.contentfabric.io"
36
35
  };
37
36
  if (Utils.Platform() === Utils.PLATFORM_NODE) {
@@ -69,7 +68,7 @@ var ElvClient = /*#__PURE__*/function () {
69
68
  * @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
70
69
  * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
71
70
  * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
72
- * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
71
+ * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth. Also known as an anonymous token containing the space
73
72
  * @param {boolean=} noCache=false - If enabled, blockchain transactions will not be cached
74
73
  * @param {boolean=} noAuth=false - If enabled, blockchain authorization will not be performed
75
74
  * @param {boolean=} assumeV3=false - If enabled, V3 fabric will be assumed
@@ -100,6 +99,7 @@ var ElvClient = /*#__PURE__*/function () {
100
99
  _ref$service = _ref.service,
101
100
  service = _ref$service === void 0 ? "default" : _ref$service;
102
101
  _classCallCheck(this, ElvClient);
102
+ this.Configuration = ElvClient.Configuration;
103
103
  this.utils = Utils;
104
104
  this.contentSpaceId = contentSpaceId;
105
105
  this.contentSpaceAddress = this.utils.HashToAddress(contentSpaceId);
@@ -358,6 +358,7 @@ var ElvClient = /*#__PURE__*/function () {
358
358
  ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
359
359
  authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
360
360
  searchURIs = _yield$ElvClient$Conf.searchURIs;
361
+ this.region = region;
361
362
  this.authServiceURIs = authServiceURIs;
362
363
  this.fabricURIs = fabricURIs;
363
364
  this.ethereumURIs = ethereumURIs;
@@ -371,7 +372,7 @@ var ElvClient = /*#__PURE__*/function () {
371
372
  ethereumURIs: ethereumURIs,
372
373
  searchURIs: searchURIs
373
374
  });
374
- case 19:
375
+ case 20:
375
376
  case "end":
376
377
  return _context3.stop();
377
378
  }
@@ -526,123 +527,85 @@ var ElvClient = /*#__PURE__*/function () {
526
527
  * @param {string=} matchEndpoint - Return node(s) matching the specified endpoint
527
528
  * @param {string=} matchNodeId - Return node(s) matching the specified node ID
528
529
  *
529
- * @return {Array<Object>} - A list of nodes in the space matching the parameters
530
+ * @return {Promise<Array<Object>>} - A list of nodes in the space matching the parameters
530
531
  */
531
532
  }, {
532
533
  key: "SpaceNodes",
533
534
  value: function () {
534
- var _SpaceNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
535
+ var _SpaceNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
535
536
  var _this = this;
536
537
  var _ref7,
537
538
  matchEndpoint,
538
539
  matchNodeId,
539
- bign,
540
- n,
541
- _args7 = arguments;
542
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
543
- while (1) switch (_context7.prev = _context7.next) {
540
+ nodes,
541
+ _yield$this$utils$Res,
542
+ node,
543
+ _args6 = arguments;
544
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
545
+ while (1) switch (_context6.prev = _context6.next) {
544
546
  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, nodeId, locatorsHex, node, 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
- nodeId = _this.utils.AddressToNodeId(addr);
572
- if (!(matchNodeId && nodeId !== matchNodeId)) {
573
- _context6.next = 7;
574
- break;
575
- }
576
- return _context6.abrupt("return");
577
- case 7:
578
- _context6.next = 9;
579
- return _this.CallContractMethod({
580
- contractAddress: _this.contentSpaceAddress,
581
- methodName: "activeNodeLocators",
582
- methodArgs: [bigi]
583
- });
584
- case 9:
585
- locatorsHex = _context6.sent;
586
- node = {
587
- id: nodeId,
588
- endpoints: []
589
- }; // Parse locators CBOR
590
- locators = CBOR.decodeMultiple(Buffer.from(locatorsHex.slice(2, locatorsHex.length), "hex"));
591
- match = false;
592
- if (!(locators.length >= 5)) {
593
- _context6.next = 29;
594
- break;
595
- }
596
- fabArray = locators[4].fab;
597
- if (!fabArray) {
598
- _context6.next = 29;
599
- break;
600
- }
601
- i = 0;
602
- case 17:
603
- if (!(i < fabArray.length)) {
604
- _context6.next = 29;
605
- break;
606
- }
607
- host = fabArray[i].host;
608
- if (!(matchEndpoint && !matchEndpoint.includes(host))) {
609
- _context6.next = 21;
610
- break;
611
- }
612
- return _context6.abrupt("continue", 26);
613
- case 21:
614
- match = true;
615
- endpoint = fabArray[i].scheme + "://" + host;
616
- if (fabArray[i].port) {
617
- endpoint = endpoint + ":" + fabArray[i].port;
618
- }
619
- endpoint = endpoint + "/" + fabArray[i].path;
620
- node.endpoints.push(endpoint);
621
- case 26:
622
- i++;
623
- _context6.next = 17;
624
- break;
625
- case 29:
626
- return _context6.abrupt("return", match ? node : undefined);
627
- case 30:
628
- case "end":
629
- return _context6.stop();
630
- }
631
- }, _callee6);
632
- }));
633
- return function (_x3, _x4) {
634
- return _ref8.apply(this, arguments);
635
- };
636
- }());
637
- case 7:
638
- return _context7.abrupt("return", _context7.sent.filter(function (n) {
639
- return n;
547
+ _ref7 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId;
548
+ this.SetStaticToken();
549
+ if (!matchEndpoint) {
550
+ _context6.next = 12;
551
+ break;
552
+ }
553
+ _context6.next = 5;
554
+ return this.utils.ResponseToJson(this.HttpClient.Request({
555
+ path: UrlJoin("nodes"),
556
+ method: "GET",
557
+ headers: {
558
+ Authorization: "Bearer ".concat(this.staticToken)
559
+ }
640
560
  }));
641
- case 8:
561
+ case 5:
562
+ _yield$this$utils$Res = _context6.sent;
563
+ nodes = _yield$this$utils$Res.nodes;
564
+ if (!(!nodes || !Array.isArray(nodes) || nodes.length === 0)) {
565
+ _context6.next = 9;
566
+ break;
567
+ }
568
+ return _context6.abrupt("return", []);
569
+ case 9:
570
+ return _context6.abrupt("return", nodes.filter(function (node) {
571
+ var match = false;
572
+ if (node.services && node.services.fabric_api && node.services.fabric_api.urls) {
573
+ var results = (node.services.fabric_api.urls || []).find(function (url) {
574
+ return url.includes(matchEndpoint);
575
+ });
576
+ if (results) {
577
+ match = true;
578
+ }
579
+ }
580
+ if (matchNodeId && node.id === matchNodeId) {
581
+ match = true;
582
+ }
583
+ _this.ClearStaticToken();
584
+ return match;
585
+ }));
586
+ case 12:
587
+ if (!matchNodeId) {
588
+ _context6.next = 19;
589
+ break;
590
+ }
591
+ this.SetStaticToken();
592
+ _context6.next = 16;
593
+ return this.utils.ResponseToJson(this.HttpClient.Request({
594
+ path: UrlJoin("nodes", matchNodeId),
595
+ method: "GET",
596
+ headers: {
597
+ Authorization: "Bearer ".concat(this.staticToken)
598
+ }
599
+ }));
600
+ case 16:
601
+ node = _context6.sent;
602
+ this.ClearStaticToken();
603
+ return _context6.abrupt("return", [node]);
604
+ case 19:
642
605
  case "end":
643
- return _context7.stop();
606
+ return _context6.stop();
644
607
  }
645
- }, _callee7, this);
608
+ }, _callee6, this);
646
609
  }));
647
610
  function SpaceNodes() {
648
611
  return _SpaceNodes.apply(this, arguments);
@@ -666,16 +629,16 @@ var ElvClient = /*#__PURE__*/function () {
666
629
  }
667
630
  }, {
668
631
  key: "WriteTokenNodeUrl",
669
- value: function WriteTokenNodeUrl(_ref9) {
670
- var writeToken = _ref9.writeToken;
632
+ value: function WriteTokenNodeUrl(_ref8) {
633
+ var writeToken = _ref8.writeToken;
671
634
  var nodeUrl = this.HttpClient.draftURIs[writeToken];
672
635
  return nodeUrl ? nodeUrl.toString() : undefined;
673
636
  }
674
637
  }, {
675
638
  key: "RecordWriteToken",
676
- value: function RecordWriteToken(_ref10) {
677
- var writeToken = _ref10.writeToken,
678
- fabricNodeUrl = _ref10.fabricNodeUrl;
639
+ value: function RecordWriteToken(_ref9) {
640
+ var writeToken = _ref9.writeToken,
641
+ fabricNodeUrl = _ref9.fabricNodeUrl;
679
642
  this.HttpClient.RecordWriteToken(writeToken, fabricNodeUrl);
680
643
  }
681
644
 
@@ -725,10 +688,10 @@ var ElvClient = /*#__PURE__*/function () {
725
688
  */
726
689
  }, {
727
690
  key: "SetSigner",
728
- value: function SetSigner(_ref11) {
729
- var signer = _ref11.signer,
730
- _ref11$reset = _ref11.reset,
731
- reset = _ref11$reset === void 0 ? true : _ref11$reset;
691
+ value: function SetSigner(_ref10) {
692
+ var signer = _ref10.signer,
693
+ _ref10$reset = _ref10.reset,
694
+ reset = _ref10$reset === void 0 ? true : _ref10$reset;
732
695
  this.staticToken = undefined;
733
696
  signer.connect(this.ethClient.Provider());
734
697
  signer.provider.pollingInterval = 500;
@@ -753,34 +716,34 @@ var ElvClient = /*#__PURE__*/function () {
753
716
  }, {
754
717
  key: "SetRemoteSigner",
755
718
  value: function () {
756
- var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
719
+ var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
757
720
  var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
758
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
759
- while (1) switch (_context8.prev = _context8.next) {
721
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
722
+ while (1) switch (_context7.prev = _context7.next) {
760
723
  case 0:
761
- idToken = _ref12.idToken, authToken = _ref12.authToken, tenantId = _ref12.tenantId, extraData = _ref12.extraData, signerURIs = _ref12.signerURIs, unsignedPublicAuth = _ref12.unsignedPublicAuth;
762
- _context8.t0 = RemoteSigner;
763
- _context8.t1 = signerURIs || this.authServiceURIs;
764
- _context8.t2 = idToken;
765
- _context8.t3 = authToken;
766
- _context8.t4 = tenantId;
767
- _context8.next = 8;
724
+ idToken = _ref11.idToken, authToken = _ref11.authToken, tenantId = _ref11.tenantId, extraData = _ref11.extraData, signerURIs = _ref11.signerURIs, unsignedPublicAuth = _ref11.unsignedPublicAuth;
725
+ _context7.t0 = RemoteSigner;
726
+ _context7.t1 = signerURIs || this.authServiceURIs;
727
+ _context7.t2 = idToken;
728
+ _context7.t3 = authToken;
729
+ _context7.t4 = tenantId;
730
+ _context7.next = 8;
768
731
  return this.ethClient.Provider();
769
732
  case 8:
770
- _context8.t5 = _context8.sent;
771
- _context8.t6 = extraData;
772
- _context8.t7 = unsignedPublicAuth;
773
- _context8.t8 = {
774
- signerURIs: _context8.t1,
775
- idToken: _context8.t2,
776
- authToken: _context8.t3,
777
- tenantId: _context8.t4,
778
- provider: _context8.t5,
779
- extraData: _context8.t6,
780
- unsignedPublicAuth: _context8.t7
733
+ _context7.t5 = _context7.sent;
734
+ _context7.t6 = extraData;
735
+ _context7.t7 = unsignedPublicAuth;
736
+ _context7.t8 = {
737
+ signerURIs: _context7.t1,
738
+ idToken: _context7.t2,
739
+ authToken: _context7.t3,
740
+ tenantId: _context7.t4,
741
+ provider: _context7.t5,
742
+ extraData: _context7.t6,
743
+ unsignedPublicAuth: _context7.t7
781
744
  };
782
- signer = new _context8.t0(_context8.t8);
783
- _context8.next = 15;
745
+ signer = new _context7.t0(_context7.t8);
746
+ _context7.next = 15;
784
747
  return signer.Initialize();
785
748
  case 15:
786
749
  this.SetSigner({
@@ -788,11 +751,11 @@ var ElvClient = /*#__PURE__*/function () {
788
751
  });
789
752
  case 16:
790
753
  case "end":
791
- return _context8.stop();
754
+ return _context7.stop();
792
755
  }
793
- }, _callee8, this);
756
+ }, _callee7, this);
794
757
  }));
795
- function SetRemoteSigner(_x5) {
758
+ function SetRemoteSigner(_x3) {
796
759
  return _SetRemoteSigner.apply(this, arguments);
797
760
  }
798
761
  return SetRemoteSigner;
@@ -810,29 +773,29 @@ var ElvClient = /*#__PURE__*/function () {
810
773
  }, {
811
774
  key: "SetSignerFromWeb3Provider",
812
775
  value: function () {
813
- var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
776
+ var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
814
777
  var provider, ethProvider;
815
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
816
- while (1) switch (_context9.prev = _context9.next) {
778
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
779
+ while (1) switch (_context8.prev = _context8.next) {
817
780
  case 0:
818
- provider = _ref13.provider;
781
+ provider = _ref12.provider;
819
782
  this.staticToken = undefined;
820
783
  ethProvider = new Ethers.providers.Web3Provider(provider);
821
784
  ethProvider.pollingInterval = 250;
822
785
  this.signer = ethProvider.getSigner();
823
- _context9.next = 7;
786
+ _context8.next = 7;
824
787
  return this.signer.getAddress();
825
788
  case 7:
826
- this.signer.address = _context9.sent;
827
- _context9.next = 10;
789
+ this.signer.address = _context8.sent;
790
+ _context8.next = 10;
828
791
  return this.InitializeClients();
829
792
  case 10:
830
793
  case "end":
831
- return _context9.stop();
794
+ return _context8.stop();
832
795
  }
833
- }, _callee9, this);
796
+ }, _callee8, this);
834
797
  }));
835
- function SetSignerFromWeb3Provider(_x6) {
798
+ function SetSignerFromWeb3Provider(_x4) {
836
799
  return _SetSignerFromWeb3Provider.apply(this, arguments);
837
800
  }
838
801
  return SetSignerFromWeb3Provider;
@@ -855,12 +818,12 @@ var ElvClient = /*#__PURE__*/function () {
855
818
  }, {
856
819
  key: "CreateAccount",
857
820
  value: function () {
858
- var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
859
- var tenantId, fundingToken, _ref14$funds, funds, groupToken, wallet, signer;
860
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
861
- while (1) switch (_context10.prev = _context10.next) {
821
+ var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
822
+ var tenantId, fundingToken, _ref13$funds, funds, groupToken, wallet, signer;
823
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
824
+ while (1) switch (_context9.prev = _context9.next) {
862
825
  case 0:
863
- tenantId = _ref14.tenantId, fundingToken = _ref14.fundingToken, _ref14$funds = _ref14.funds, funds = _ref14$funds === void 0 ? 0.5 : _ref14$funds, groupToken = _ref14.groupToken;
826
+ tenantId = _ref13.tenantId, fundingToken = _ref13.fundingToken, _ref13$funds = _ref13.funds, funds = _ref13$funds === void 0 ? 0.5 : _ref13$funds, groupToken = _ref13.groupToken;
864
827
  if (!this.signer) {
865
828
  wallet = this.GenerateWallet();
866
829
  signer = wallet.AddAccountFromMnemonic({
@@ -870,7 +833,7 @@ var ElvClient = /*#__PURE__*/function () {
870
833
  signer: signer
871
834
  });
872
835
  }
873
- _context10.next = 4;
836
+ _context9.next = 4;
874
837
  return this.authClient.MakeKMSRequest({
875
838
  method: "POST",
876
839
  path: "/ks/otp/fnd/".concat(tenantId),
@@ -883,20 +846,20 @@ var ElvClient = /*#__PURE__*/function () {
883
846
  }
884
847
  });
885
848
  case 4:
886
- _context10.next = 6;
849
+ _context9.next = 6;
887
850
  return this.userProfileClient.CreateWallet();
888
851
  case 6:
889
- _context10.next = 8;
852
+ _context9.next = 8;
890
853
  return this.userProfileClient.ReplaceUserMetadata({
891
854
  metadataSubtree: "tenantContractId",
892
855
  metadata: tenantId
893
856
  });
894
857
  case 8:
895
858
  if (!groupToken) {
896
- _context10.next = 11;
859
+ _context9.next = 11;
897
860
  break;
898
861
  }
899
- _context10.next = 11;
862
+ _context9.next = 11;
900
863
  return this.authClient.MakeKMSRequest({
901
864
  method: "POST",
902
865
  path: "/ks/otp/grp/".concat(tenantId),
@@ -908,14 +871,14 @@ var ElvClient = /*#__PURE__*/function () {
908
871
  }
909
872
  });
910
873
  case 11:
911
- return _context10.abrupt("return", this.utils.FormatAddress(this.signer.address));
874
+ return _context9.abrupt("return", this.utils.FormatAddress(this.signer.address));
912
875
  case 12:
913
876
  case "end":
914
- return _context10.stop();
877
+ return _context9.stop();
915
878
  }
916
- }, _callee10, this);
879
+ }, _callee9, this);
917
880
  }));
918
- function CreateAccount(_x7) {
881
+ function CreateAccount(_x5) {
919
882
  return _CreateAccount.apply(this, arguments);
920
883
  }
921
884
  return CreateAccount;
@@ -932,45 +895,45 @@ var ElvClient = /*#__PURE__*/function () {
932
895
  }, {
933
896
  key: "PersonalSign",
934
897
  value: function () {
935
- var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref15) {
898
+ var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref14) {
936
899
  var _this2 = this;
937
900
  var message, addEthereumPrefix, Sign;
938
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
939
- while (1) switch (_context12.prev = _context12.next) {
901
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
902
+ while (1) switch (_context11.prev = _context11.next) {
940
903
  case 0:
941
- message = _ref15.message, addEthereumPrefix = _ref15.addEthereumPrefix, Sign = _ref15.Sign;
904
+ message = _ref14.message, addEthereumPrefix = _ref14.addEthereumPrefix, Sign = _ref14.Sign;
942
905
  if (!Sign) {
943
906
  Sign = /*#__PURE__*/function () {
944
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(message) {
945
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
946
- while (1) switch (_context11.prev = _context11.next) {
907
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(message) {
908
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
909
+ while (1) switch (_context10.prev = _context10.next) {
947
910
  case 0:
948
- return _context11.abrupt("return", _this2.authClient.Sign(message));
911
+ return _context10.abrupt("return", _this2.authClient.Sign(message));
949
912
  case 1:
950
913
  case "end":
951
- return _context11.stop();
914
+ return _context10.stop();
952
915
  }
953
- }, _callee11);
916
+ }, _callee10);
954
917
  }));
955
- return function Sign(_x9) {
956
- return _ref16.apply(this, arguments);
918
+ return function Sign(_x7) {
919
+ return _ref15.apply(this, arguments);
957
920
  };
958
921
  }();
959
922
  }
960
923
  if (addEthereumPrefix) {
961
924
  message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
962
925
  }
963
- _context12.next = 5;
926
+ _context11.next = 5;
964
927
  return Sign(message);
965
928
  case 5:
966
- return _context12.abrupt("return", _context12.sent);
929
+ return _context11.abrupt("return", _context11.sent);
967
930
  case 6:
968
931
  case "end":
969
- return _context12.stop();
932
+ return _context11.stop();
970
933
  }
971
- }, _callee12);
934
+ }, _callee11);
972
935
  }));
973
- function PersonalSign(_x8) {
936
+ function PersonalSign(_x6) {
974
937
  return _PersonalSign.apply(this, arguments);
975
938
  }
976
939
  return PersonalSign;
@@ -989,65 +952,65 @@ var ElvClient = /*#__PURE__*/function () {
989
952
  }, {
990
953
  key: "CreateFabricToken",
991
954
  value: function () {
992
- var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
993
- var _ref17,
994
- _ref17$duration,
955
+ var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
956
+ var _ref16,
957
+ _ref16$duration,
995
958
  duration,
996
- _ref17$spec,
959
+ _ref16$spec,
997
960
  spec,
998
961
  address,
999
962
  Sign,
1000
- _ref17$addEthereumPre,
963
+ _ref16$addEthereumPre,
1001
964
  addEthereumPrefix,
1002
- _ref17$context,
965
+ _ref16$context,
1003
966
  context,
1004
967
  token,
1005
968
  message,
1006
969
  signature,
1007
970
  compressedToken,
1008
- _args13 = arguments;
1009
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1010
- while (1) switch (_context13.prev = _context13.next) {
971
+ _args12 = arguments;
972
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
973
+ while (1) switch (_context12.prev = _context12.next) {
1011
974
  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, _ref17$context = _ref17.context, context = _ref17$context === void 0 ? {} : _ref17$context;
975
+ _ref16 = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {}, _ref16$duration = _ref16.duration, duration = _ref16$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref16$duration, _ref16$spec = _ref16.spec, spec = _ref16$spec === void 0 ? {} : _ref16$spec, address = _ref16.address, Sign = _ref16.Sign, _ref16$addEthereumPre = _ref16.addEthereumPrefix, addEthereumPrefix = _ref16$addEthereumPre === void 0 ? true : _ref16$addEthereumPre, _ref16$context = _ref16.context, context = _ref16$context === void 0 ? {} : _ref16$context;
1013
976
  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;
977
+ _context12.t0 = _objectSpread;
978
+ _context12.t1 = _objectSpread({}, spec);
979
+ _context12.t2 = {};
980
+ _context12.t3 = "iusr".concat(Utils.AddressToHash(address));
981
+ _context12.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
982
+ _context12.next = 9;
1020
983
  return this.ContentSpaceId();
1021
984
  case 9:
1022
- _context13.t5 = _context13.sent;
1023
- _context13.t6 = Date.now();
1024
- _context13.t7 = Date.now() + duration;
1025
- _context13.t8 = context;
1026
- _context13.t9 = {
1027
- sub: _context13.t3,
1028
- adr: _context13.t4,
1029
- spc: _context13.t5,
1030
- iat: _context13.t6,
1031
- exp: _context13.t7,
1032
- ctx: _context13.t8
985
+ _context12.t5 = _context12.sent;
986
+ _context12.t6 = Date.now();
987
+ _context12.t7 = Date.now() + duration;
988
+ _context12.t8 = context;
989
+ _context12.t9 = {
990
+ sub: _context12.t3,
991
+ adr: _context12.t4,
992
+ spc: _context12.t5,
993
+ iat: _context12.t6,
994
+ exp: _context12.t7,
995
+ ctx: _context12.t8
1033
996
  };
1034
- token = (0, _context13.t0)(_context13.t1, _context13.t2, _context13.t9);
997
+ token = (0, _context12.t0)(_context12.t1, _context12.t2, _context12.t9);
1035
998
  message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
1036
- _context13.next = 18;
999
+ _context12.next = 18;
1037
1000
  return this.PersonalSign({
1038
1001
  message: message,
1039
1002
  addEthereumPrefix: addEthereumPrefix,
1040
1003
  Sign: Sign
1041
1004
  });
1042
1005
  case 18:
1043
- signature = _context13.sent;
1006
+ signature = _context12.sent;
1044
1007
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1045
- return _context13.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1008
+ return _context12.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1046
1009
  case 21:
1047
1010
  case "end":
1048
- return _context13.stop();
1011
+ return _context12.stop();
1049
1012
  }
1050
- }, _callee13, this);
1013
+ }, _callee12, this);
1051
1014
  }));
1052
1015
  function CreateFabricToken() {
1053
1016
  return _CreateFabricToken.apply(this, arguments);
@@ -1073,100 +1036,100 @@ var ElvClient = /*#__PURE__*/function () {
1073
1036
  }, {
1074
1037
  key: "CreateSignedToken",
1075
1038
  value: function () {
1076
- var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1077
- var libraryId, objectId, versionHash, policyId, subject, _ref18$grantType, grantType, _ref18$allowDecryptio, allowDecryption, duration, _ref18$context, context, token, cap, compressedToken, signature;
1078
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1079
- while (1) switch (_context14.prev = _context14.next) {
1039
+ var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
1040
+ var libraryId, objectId, versionHash, policyId, subject, _ref17$grantType, grantType, _ref17$allowDecryptio, allowDecryption, duration, _ref17$context, context, token, cap, compressedToken, signature;
1041
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1042
+ while (1) switch (_context13.prev = _context13.next) {
1080
1043
  case 0:
1081
- 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;
1044
+ libraryId = _ref17.libraryId, objectId = _ref17.objectId, versionHash = _ref17.versionHash, policyId = _ref17.policyId, subject = _ref17.subject, _ref17$grantType = _ref17.grantType, grantType = _ref17$grantType === void 0 ? "read" : _ref17$grantType, _ref17$allowDecryptio = _ref17.allowDecryption, allowDecryption = _ref17$allowDecryptio === void 0 ? false : _ref17$allowDecryptio, duration = _ref17.duration, _ref17$context = _ref17.context, context = _ref17$context === void 0 ? {} : _ref17$context;
1082
1045
  if (subject) {
1083
- _context14.next = 9;
1046
+ _context13.next = 9;
1084
1047
  break;
1085
1048
  }
1086
- _context14.t0 = "iusr";
1087
- _context14.t1 = this.utils;
1088
- _context14.next = 6;
1049
+ _context13.t0 = "iusr";
1050
+ _context13.t1 = this.utils;
1051
+ _context13.next = 6;
1089
1052
  return this.CurrentAccountAddress();
1090
1053
  case 6:
1091
- _context14.t2 = _context14.sent;
1092
- _context14.t3 = _context14.t1.AddressToHash.call(_context14.t1, _context14.t2);
1093
- subject = _context14.t0.concat.call(_context14.t0, _context14.t3);
1054
+ _context13.t2 = _context13.sent;
1055
+ _context13.t3 = _context13.t1.AddressToHash.call(_context13.t1, _context13.t2);
1056
+ subject = _context13.t0.concat.call(_context13.t0, _context13.t3);
1094
1057
  case 9:
1095
1058
  if (policyId) {
1096
1059
  context["elv:delegation-id"] = policyId;
1097
1060
  }
1098
- _context14.t4 = Buffer;
1099
- _context14.next = 13;
1061
+ _context13.t4 = Buffer;
1062
+ _context13.next = 13;
1100
1063
  return this.CurrentAccountAddress().replace(/^0x/, "");
1101
1064
  case 13:
1102
- _context14.t5 = _context14.sent;
1103
- _context14.t6 = _context14.t4.from.call(_context14.t4, _context14.t5, "hex").toString("base64");
1104
- _context14.t7 = subject;
1105
- _context14.next = 18;
1065
+ _context13.t5 = _context13.sent;
1066
+ _context13.t6 = _context13.t4.from.call(_context13.t4, _context13.t5, "hex").toString("base64");
1067
+ _context13.t7 = subject;
1068
+ _context13.next = 18;
1106
1069
  return this.ContentSpaceId();
1107
1070
  case 18:
1108
- _context14.t8 = _context14.sent;
1109
- _context14.t9 = Date.now();
1110
- _context14.t10 = Date.now() + duration;
1111
- _context14.t11 = grantType;
1112
- _context14.t12 = context;
1071
+ _context13.t8 = _context13.sent;
1072
+ _context13.t9 = Date.now();
1073
+ _context13.t10 = Date.now() + duration;
1074
+ _context13.t11 = grantType;
1075
+ _context13.t12 = context;
1113
1076
  token = {
1114
- adr: _context14.t6,
1115
- sub: _context14.t7,
1116
- spc: _context14.t8,
1117
- iat: _context14.t9,
1118
- exp: _context14.t10,
1119
- gra: _context14.t11,
1120
- ctx: _context14.t12
1077
+ adr: _context13.t6,
1078
+ sub: _context13.t7,
1079
+ spc: _context13.t8,
1080
+ iat: _context13.t9,
1081
+ exp: _context13.t10,
1082
+ gra: _context13.t11,
1083
+ ctx: _context13.t12
1121
1084
  };
1122
1085
  if (versionHash) {
1123
1086
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1124
1087
  }
1125
1088
  if (!objectId) {
1126
- _context14.next = 31;
1089
+ _context13.next = 31;
1127
1090
  break;
1128
1091
  }
1129
1092
  token.qid = objectId;
1130
1093
  if (libraryId) {
1131
- _context14.next = 31;
1094
+ _context13.next = 31;
1132
1095
  break;
1133
1096
  }
1134
- _context14.next = 30;
1097
+ _context13.next = 30;
1135
1098
  return this.ContentObjectLibraryId({
1136
1099
  objectId: objectId
1137
1100
  });
1138
1101
  case 30:
1139
- libraryId = _context14.sent;
1102
+ libraryId = _context13.sent;
1140
1103
  case 31:
1141
1104
  if (libraryId) {
1142
1105
  token.lib = libraryId;
1143
1106
  }
1144
1107
  if (!allowDecryption) {
1145
- _context14.next = 37;
1108
+ _context13.next = 37;
1146
1109
  break;
1147
1110
  }
1148
- _context14.next = 35;
1111
+ _context13.next = 35;
1149
1112
  return this.authClient.ReEncryptionConk({
1150
1113
  libraryId: libraryId,
1151
1114
  objectId: objectId
1152
1115
  });
1153
1116
  case 35:
1154
- cap = _context14.sent;
1117
+ cap = _context13.sent;
1155
1118
  token.apk = cap.public_key;
1156
1119
  case 37:
1157
1120
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1158
- _context14.next = 40;
1121
+ _context13.next = 40;
1159
1122
  return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1160
1123
  case 40:
1161
- signature = _context14.sent;
1162
- return _context14.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1124
+ signature = _context13.sent;
1125
+ return _context13.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1163
1126
  case 42:
1164
1127
  case "end":
1165
- return _context14.stop();
1128
+ return _context13.stop();
1166
1129
  }
1167
- }, _callee14, this);
1130
+ }, _callee13, this);
1168
1131
  }));
1169
- function CreateSignedToken(_x10) {
1132
+ function CreateSignedToken(_x8) {
1170
1133
  return _CreateSignedToken.apply(this, arguments);
1171
1134
  }
1172
1135
  return CreateSignedToken;
@@ -1188,30 +1151,30 @@ var ElvClient = /*#__PURE__*/function () {
1188
1151
  }, {
1189
1152
  key: "CreateSignedMessageJSON",
1190
1153
  value: function () {
1191
- var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1154
+ var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1192
1155
  var message, type, msg, signature;
1193
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1194
- while (1) switch (_context15.prev = _context15.next) {
1156
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1157
+ while (1) switch (_context14.prev = _context14.next) {
1195
1158
  case 0:
1196
- message = _ref19.message;
1159
+ message = _ref18.message;
1197
1160
  // Only one kind of signature supported currently
1198
1161
  type = "mje_"; // JSON message, EIP192 signature
1199
1162
  msg = JSON.stringify(message);
1200
- _context15.next = 5;
1163
+ _context14.next = 5;
1201
1164
  return this.PersonalSign({
1202
1165
  message: msg,
1203
1166
  addEthereumPrefix: true
1204
1167
  });
1205
1168
  case 5:
1206
- signature = _context15.sent;
1207
- return _context15.abrupt("return", "".concat(type).concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(msg)]))));
1169
+ signature = _context14.sent;
1170
+ return _context14.abrupt("return", "".concat(type).concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(msg)]))));
1208
1171
  case 7:
1209
1172
  case "end":
1210
- return _context15.stop();
1173
+ return _context14.stop();
1211
1174
  }
1212
- }, _callee15, this);
1175
+ }, _callee14, this);
1213
1176
  }));
1214
- function CreateSignedMessageJSON(_x11) {
1177
+ function CreateSignedMessageJSON(_x9) {
1215
1178
  return _CreateSignedMessageJSON.apply(this, arguments);
1216
1179
  }
1217
1180
  return CreateSignedMessageJSON;
@@ -1227,15 +1190,15 @@ var ElvClient = /*#__PURE__*/function () {
1227
1190
  }, {
1228
1191
  key: "DecodeSignedMessageJSON",
1229
1192
  value: function () {
1230
- var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1193
+ var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1231
1194
  var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr;
1232
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1233
- while (1) switch (_context16.prev = _context16.next) {
1195
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1196
+ while (1) switch (_context15.prev = _context15.next) {
1234
1197
  case 0:
1235
- signedMessage = _ref20.signedMessage;
1198
+ signedMessage = _ref19.signedMessage;
1236
1199
  type = signedMessage.slice(0, 4);
1237
- _context16.t0 = type;
1238
- _context16.next = _context16.t0 === "mje_" ? 5 : 12;
1200
+ _context15.t0 = type;
1201
+ _context15.next = _context15.t0 === "mje_" ? 5 : 12;
1239
1202
  break;
1240
1203
  case 5:
1241
1204
  msgBytes = Utils.FromB58(signedMessage.slice(4));
@@ -1244,7 +1207,7 @@ var ElvClient = /*#__PURE__*/function () {
1244
1207
  obj = JSON.parse(msg);
1245
1208
  prefixedMsgHash = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(msg.length).concat(msg), "utf-8"));
1246
1209
  signerAddr = Ethers.utils.recoverAddress(prefixedMsgHash, signature);
1247
- return _context16.abrupt("return", {
1210
+ return _context15.abrupt("return", {
1248
1211
  type: type,
1249
1212
  message: obj,
1250
1213
  signerAddress: signerAddr,
@@ -1254,11 +1217,11 @@ var ElvClient = /*#__PURE__*/function () {
1254
1217
  throw new Error("Bad message type: ".concat(type));
1255
1218
  case 13:
1256
1219
  case "end":
1257
- return _context16.stop();
1220
+ return _context15.stop();
1258
1221
  }
1259
- }, _callee16);
1222
+ }, _callee15);
1260
1223
  }));
1261
- function DecodeSignedMessageJSON(_x12) {
1224
+ function DecodeSignedMessageJSON(_x10) {
1262
1225
  return _DecodeSignedMessageJSON.apply(this, arguments);
1263
1226
  }
1264
1227
  return DecodeSignedMessageJSON;
@@ -1285,12 +1248,12 @@ var ElvClient = /*#__PURE__*/function () {
1285
1248
  }, {
1286
1249
  key: "SetOauthToken",
1287
1250
  value: function () {
1288
- var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
1251
+ var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1289
1252
  var token, wallet, signer;
1290
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1291
- while (1) switch (_context17.prev = _context17.next) {
1253
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1254
+ while (1) switch (_context16.prev = _context16.next) {
1292
1255
  case 0:
1293
- token = _ref21.token;
1256
+ token = _ref20.token;
1294
1257
  this.oauthToken = token;
1295
1258
  wallet = this.GenerateWallet();
1296
1259
  signer = wallet.AddAccountFromMnemonic({
@@ -1301,11 +1264,11 @@ var ElvClient = /*#__PURE__*/function () {
1301
1264
  });
1302
1265
  case 5:
1303
1266
  case "end":
1304
- return _context17.stop();
1267
+ return _context16.stop();
1305
1268
  }
1306
- }, _callee17, this);
1269
+ }, _callee16, this);
1307
1270
  }));
1308
- function SetOauthToken(_x13) {
1271
+ function SetOauthToken(_x11) {
1309
1272
  return _SetOauthToken.apply(this, arguments);
1310
1273
  }
1311
1274
  return SetOauthToken;
@@ -1323,44 +1286,44 @@ var ElvClient = /*#__PURE__*/function () {
1323
1286
  }, {
1324
1287
  key: "SetSignerFromOauthToken",
1325
1288
  value: function () {
1326
- var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref22) {
1289
+ var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
1327
1290
  var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1328
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1329
- while (1) switch (_context18.prev = _context18.next) {
1291
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1292
+ while (1) switch (_context17.prev = _context17.next) {
1330
1293
  case 0:
1331
- token = _ref22.token;
1294
+ token = _ref21.token;
1332
1295
  if (this.trustAuthorityId) {
1333
- _context18.next = 3;
1296
+ _context17.next = 3;
1334
1297
  break;
1335
1298
  }
1336
1299
  throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1337
1300
  case 3:
1338
1301
  wallet = this.GenerateWallet();
1339
- _context18.prev = 4;
1302
+ _context17.prev = 4;
1340
1303
  if (this.kmsURIs) {
1341
- _context18.next = 17;
1304
+ _context17.next = 17;
1342
1305
  break;
1343
1306
  }
1344
- _context18.next = 8;
1307
+ _context17.next = 8;
1345
1308
  return ElvClient.FromConfigurationUrl({
1346
1309
  configUrl: this.configUrl
1347
1310
  });
1348
1311
  case 8:
1349
- client = _context18.sent;
1312
+ client = _context17.sent;
1350
1313
  client.SetSigner({
1351
1314
  signer: wallet.AddAccountFromMnemonic({
1352
1315
  mnemonic: wallet.GenerateMnemonic()
1353
1316
  })
1354
1317
  });
1355
- _context18.next = 12;
1318
+ _context17.next = 12;
1356
1319
  return client.authClient.KMSInfo({
1357
1320
  kmsId: this.trustAuthorityId
1358
1321
  });
1359
1322
  case 12:
1360
- _yield$client$authCli = _context18.sent;
1323
+ _yield$client$authCli = _context17.sent;
1361
1324
  urls = _yield$client$authCli.urls;
1362
1325
  if (!(!urls || urls.length === 0)) {
1363
- _context18.next = 16;
1326
+ _context17.next = 16;
1364
1327
  break;
1365
1328
  }
1366
1329
  throw Error("Unable to authorize with OAuth token: No KMS URLs set");
@@ -1373,7 +1336,7 @@ var ElvClient = /*#__PURE__*/function () {
1373
1336
  uris: this.kmsURIs,
1374
1337
  debug: this.debug
1375
1338
  });
1376
- _context18.next = 22;
1339
+ _context17.next = 22;
1377
1340
  return this.utils.ResponseToJson(httpClient.Request({
1378
1341
  headers: {
1379
1342
  Authorization: "Bearer ".concat(token)
@@ -1383,7 +1346,7 @@ var ElvClient = /*#__PURE__*/function () {
1383
1346
  forceFailover: true
1384
1347
  }));
1385
1348
  case 22:
1386
- response = _context18.sent;
1349
+ response = _context17.sent;
1387
1350
  privateKey = response["UserSKHex"];
1388
1351
  this.SetSigner({
1389
1352
  signer: wallet.AddAccount({
@@ -1392,27 +1355,27 @@ var ElvClient = /*#__PURE__*/function () {
1392
1355
  });
1393
1356
 
1394
1357
  // Ensure wallet is initialized
1395
- _context18.next = 27;
1358
+ _context17.next = 27;
1396
1359
  return this.userProfileClient.WalletAddress();
1397
1360
  case 27:
1398
- _context18.next = 36;
1361
+ _context17.next = 36;
1399
1362
  break;
1400
1363
  case 29:
1401
- _context18.prev = 29;
1402
- _context18.t0 = _context18["catch"](4);
1364
+ _context17.prev = 29;
1365
+ _context17.t0 = _context17["catch"](4);
1403
1366
  this.Log("Failed to set signer from OAuth token:", true);
1404
- this.Log(_context18.t0, true);
1405
- _context18.next = 35;
1367
+ this.Log(_context17.t0, true);
1368
+ _context17.next = 35;
1406
1369
  return this.ClearSigner();
1407
1370
  case 35:
1408
- throw _context18.t0;
1371
+ throw _context17.t0;
1409
1372
  case 36:
1410
1373
  case "end":
1411
- return _context18.stop();
1374
+ return _context17.stop();
1412
1375
  }
1413
- }, _callee18, this, [[4, 29]]);
1376
+ }, _callee17, this, [[4, 29]]);
1414
1377
  }));
1415
- function SetSignerFromOauthToken(_x14) {
1378
+ function SetSignerFromOauthToken(_x12) {
1416
1379
  return _SetSignerFromOauthToken.apply(this, arguments);
1417
1380
  }
1418
1381
  return SetSignerFromOauthToken;
@@ -1427,8 +1390,8 @@ var ElvClient = /*#__PURE__*/function () {
1427
1390
  }, {
1428
1391
  key: "SetStaticToken",
1429
1392
  value: function SetStaticToken() {
1430
- var _ref23 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1431
- token = _ref23.token;
1393
+ var _ref22 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1394
+ token = _ref22.token;
1432
1395
  if (!token) {
1433
1396
  token = this.utils.B64(JSON.stringify({
1434
1397
  qspace_id: this.contentSpaceId
@@ -1458,30 +1421,30 @@ var ElvClient = /*#__PURE__*/function () {
1458
1421
  }, {
1459
1422
  key: "SetPolicyAuthorization",
1460
1423
  value: function () {
1461
- var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref24) {
1424
+ var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref23) {
1462
1425
  var objectId;
1463
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1464
- while (1) switch (_context19.prev = _context19.next) {
1426
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1427
+ while (1) switch (_context18.prev = _context18.next) {
1465
1428
  case 0:
1466
- objectId = _ref24.objectId;
1467
- _context19.t0 = this;
1468
- _context19.next = 4;
1429
+ objectId = _ref23.objectId;
1430
+ _context18.t0 = this;
1431
+ _context18.next = 4;
1469
1432
  return this.GenerateStateChannelToken({
1470
1433
  objectId: objectId
1471
1434
  });
1472
1435
  case 4:
1473
- _context19.t1 = _context19.sent;
1474
- _context19.t2 = {
1475
- token: _context19.t1
1436
+ _context18.t1 = _context18.sent;
1437
+ _context18.t2 = {
1438
+ token: _context18.t1
1476
1439
  };
1477
- _context19.t0.SetStaticToken.call(_context19.t0, _context19.t2);
1440
+ _context18.t0.SetStaticToken.call(_context18.t0, _context18.t2);
1478
1441
  case 7:
1479
1442
  case "end":
1480
- return _context19.stop();
1443
+ return _context18.stop();
1481
1444
  }
1482
- }, _callee19, this);
1445
+ }, _callee18, this);
1483
1446
  }));
1484
- function SetPolicyAuthorization(_x15) {
1447
+ function SetPolicyAuthorization(_x13) {
1485
1448
  return _SetPolicyAuthorization.apply(this, arguments);
1486
1449
  }
1487
1450
  return SetPolicyAuthorization;
@@ -1495,23 +1458,23 @@ var ElvClient = /*#__PURE__*/function () {
1495
1458
  }, {
1496
1459
  key: "Sign",
1497
1460
  value: function () {
1498
- var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(string) {
1461
+ var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(string) {
1499
1462
  var signature;
1500
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1501
- while (1) switch (_context20.prev = _context20.next) {
1463
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1464
+ while (1) switch (_context19.prev = _context19.next) {
1502
1465
  case 0:
1503
- _context20.next = 2;
1466
+ _context19.next = 2;
1504
1467
  return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1505
1468
  case 2:
1506
- signature = _context20.sent;
1507
- return _context20.abrupt("return", this.utils.FormatSignature(signature));
1469
+ signature = _context19.sent;
1470
+ return _context19.abrupt("return", this.utils.FormatSignature(signature));
1508
1471
  case 4:
1509
1472
  case "end":
1510
- return _context20.stop();
1473
+ return _context19.stop();
1511
1474
  }
1512
- }, _callee20, this);
1475
+ }, _callee19, this);
1513
1476
  }));
1514
- function Sign(_x16) {
1477
+ function Sign(_x14) {
1515
1478
  return _Sign.apply(this, arguments);
1516
1479
  }
1517
1480
  return Sign;
@@ -1528,30 +1491,30 @@ var ElvClient = /*#__PURE__*/function () {
1528
1491
  }, {
1529
1492
  key: "EncryptECIES",
1530
1493
  value: function () {
1531
- var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref25) {
1494
+ var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref24) {
1532
1495
  var message, publicKey;
1533
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1534
- while (1) switch (_context21.prev = _context21.next) {
1496
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1497
+ while (1) switch (_context20.prev = _context20.next) {
1535
1498
  case 0:
1536
- message = _ref25.message, publicKey = _ref25.publicKey;
1499
+ message = _ref24.message, publicKey = _ref24.publicKey;
1537
1500
  if (this.signer) {
1538
- _context21.next = 3;
1501
+ _context20.next = 3;
1539
1502
  break;
1540
1503
  }
1541
1504
  throw "Signer not set";
1542
1505
  case 3:
1543
1506
  ValidatePresence("message", message);
1544
- _context21.next = 6;
1507
+ _context20.next = 6;
1545
1508
  return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1546
1509
  case 6:
1547
- return _context21.abrupt("return", _context21.sent);
1510
+ return _context20.abrupt("return", _context20.sent);
1548
1511
  case 7:
1549
1512
  case "end":
1550
- return _context21.stop();
1513
+ return _context20.stop();
1551
1514
  }
1552
- }, _callee21, this);
1515
+ }, _callee20, this);
1553
1516
  }));
1554
- function EncryptECIES(_x17) {
1517
+ function EncryptECIES(_x15) {
1555
1518
  return _EncryptECIES.apply(this, arguments);
1556
1519
  }
1557
1520
  return EncryptECIES;
@@ -1567,30 +1530,30 @@ var ElvClient = /*#__PURE__*/function () {
1567
1530
  }, {
1568
1531
  key: "DecryptECIES",
1569
1532
  value: function () {
1570
- var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref26) {
1533
+ var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref25) {
1571
1534
  var message;
1572
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1573
- while (1) switch (_context22.prev = _context22.next) {
1535
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1536
+ while (1) switch (_context21.prev = _context21.next) {
1574
1537
  case 0:
1575
- message = _ref26.message;
1538
+ message = _ref25.message;
1576
1539
  if (this.signer) {
1577
- _context22.next = 3;
1540
+ _context21.next = 3;
1578
1541
  break;
1579
1542
  }
1580
1543
  throw "Signer not set";
1581
1544
  case 3:
1582
1545
  ValidatePresence("message", message);
1583
- _context22.next = 6;
1546
+ _context21.next = 6;
1584
1547
  return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1585
1548
  case 6:
1586
- return _context22.abrupt("return", _context22.sent);
1549
+ return _context21.abrupt("return", _context21.sent);
1587
1550
  case 7:
1588
1551
  case "end":
1589
- return _context22.stop();
1552
+ return _context21.stop();
1590
1553
  }
1591
- }, _callee22, this);
1554
+ }, _callee21, this);
1592
1555
  }));
1593
- function DecryptECIES(_x18) {
1556
+ function DecryptECIES(_x16) {
1594
1557
  return _DecryptECIES.apply(this, arguments);
1595
1558
  }
1596
1559
  return DecryptECIES;
@@ -1609,24 +1572,24 @@ var ElvClient = /*#__PURE__*/function () {
1609
1572
  }, {
1610
1573
  key: "Request",
1611
1574
  value: function () {
1612
- var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref27) {
1613
- var url, _ref27$format, format, _ref27$method, method, _ref27$headers, headers, body;
1614
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1615
- while (1) switch (_context23.prev = _context23.next) {
1575
+ var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref26) {
1576
+ var url, _ref26$format, format, _ref26$method, method, _ref26$headers, headers, body;
1577
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1578
+ while (1) switch (_context22.prev = _context22.next) {
1616
1579
  case 0:
1617
- url = _ref27.url, _ref27$format = _ref27.format, format = _ref27$format === void 0 ? "json" : _ref27$format, _ref27$method = _ref27.method, method = _ref27$method === void 0 ? "GET" : _ref27$method, _ref27$headers = _ref27.headers, headers = _ref27$headers === void 0 ? {} : _ref27$headers, body = _ref27.body;
1618
- return _context23.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1580
+ url = _ref26.url, _ref26$format = _ref26.format, format = _ref26$format === void 0 ? "json" : _ref26$format, _ref26$method = _ref26.method, method = _ref26$method === void 0 ? "GET" : _ref26$method, _ref26$headers = _ref26.headers, headers = _ref26$headers === void 0 ? {} : _ref26$headers, body = _ref26.body;
1581
+ return _context22.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1619
1582
  method: method,
1620
1583
  headers: headers,
1621
1584
  body: body
1622
1585
  })));
1623
1586
  case 2:
1624
1587
  case "end":
1625
- return _context23.stop();
1588
+ return _context22.stop();
1626
1589
  }
1627
- }, _callee23, this);
1590
+ }, _callee22, this);
1628
1591
  }));
1629
- function Request(_x19) {
1592
+ function Request(_x17) {
1630
1593
  return _Request.apply(this, arguments);
1631
1594
  }
1632
1595
  return Request;
@@ -1634,13 +1597,13 @@ var ElvClient = /*#__PURE__*/function () {
1634
1597
  }, {
1635
1598
  key: "MakeAuthServiceRequest",
1636
1599
  value: function () {
1637
- var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref28) {
1638
- var kmsId, objectId, versionHash, _ref28$method, method, path, bodyType, _ref28$body, body, _ref28$queryParams, queryParams, headers;
1639
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1640
- while (1) switch (_context24.prev = _context24.next) {
1600
+ var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref27) {
1601
+ var kmsId, objectId, versionHash, _ref27$method, method, path, bodyType, _ref27$body, body, _ref27$queryParams, queryParams, headers;
1602
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1603
+ while (1) switch (_context23.prev = _context23.next) {
1641
1604
  case 0:
1642
- kmsId = _ref28.kmsId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, _ref28$method = _ref28.method, method = _ref28$method === void 0 ? "GET" : _ref28$method, path = _ref28.path, bodyType = _ref28.bodyType, _ref28$body = _ref28.body, body = _ref28$body === void 0 ? {} : _ref28$body, _ref28$queryParams = _ref28.queryParams, queryParams = _ref28$queryParams === void 0 ? {} : _ref28$queryParams, headers = _ref28.headers;
1643
- return _context24.abrupt("return", this.authClient.MakeAuthServiceRequest({
1605
+ kmsId = _ref27.kmsId, objectId = _ref27.objectId, versionHash = _ref27.versionHash, _ref27$method = _ref27.method, method = _ref27$method === void 0 ? "GET" : _ref27$method, path = _ref27.path, bodyType = _ref27.bodyType, _ref27$body = _ref27.body, body = _ref27$body === void 0 ? {} : _ref27$body, _ref27$queryParams = _ref27.queryParams, queryParams = _ref27$queryParams === void 0 ? {} : _ref27$queryParams, headers = _ref27.headers;
1606
+ return _context23.abrupt("return", this.authClient.MakeAuthServiceRequest({
1644
1607
  kmsId: kmsId,
1645
1608
  objectId: objectId,
1646
1609
  versionHash: versionHash,
@@ -1653,11 +1616,11 @@ var ElvClient = /*#__PURE__*/function () {
1653
1616
  }));
1654
1617
  case 2:
1655
1618
  case "end":
1656
- return _context24.stop();
1619
+ return _context23.stop();
1657
1620
  }
1658
- }, _callee24, this);
1621
+ }, _callee23, this);
1659
1622
  }));
1660
- function MakeAuthServiceRequest(_x20) {
1623
+ function MakeAuthServiceRequest(_x18) {
1661
1624
  return _MakeAuthServiceRequest.apply(this, arguments);
1662
1625
  }
1663
1626
  return MakeAuthServiceRequest;
@@ -1678,17 +1641,17 @@ var ElvClient = /*#__PURE__*/function () {
1678
1641
  }, {
1679
1642
  key: "CallFromFrameMessage",
1680
1643
  value: function () {
1681
- var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(message, Respond) {
1644
+ var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(message, Respond) {
1682
1645
  var _this4 = this;
1683
1646
  var callback, method, methodResults, responseError;
1684
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1685
- while (1) switch (_context25.prev = _context25.next) {
1647
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1648
+ while (1) switch (_context24.prev = _context24.next) {
1686
1649
  case 0:
1687
1650
  if (!(message.type !== "ElvFrameRequest")) {
1688
- _context25.next = 2;
1651
+ _context24.next = 2;
1689
1652
  break;
1690
1653
  }
1691
- return _context25.abrupt("return");
1654
+ return _context24.abrupt("return");
1692
1655
  case 2:
1693
1656
  if (message.callbackId) {
1694
1657
  callback = function callback(result) {
@@ -1700,75 +1663,75 @@ var ElvClient = /*#__PURE__*/function () {
1700
1663
  };
1701
1664
  message.args.callback = callback;
1702
1665
  }
1703
- _context25.prev = 3;
1666
+ _context24.prev = 3;
1704
1667
  method = message.calledMethod;
1705
1668
  if (!(message.module === "walletClient")) {
1706
- _context25.next = 15;
1669
+ _context24.next = 15;
1707
1670
  break;
1708
1671
  }
1709
1672
  if (this.walletClient) {
1710
- _context25.next = 8;
1673
+ _context24.next = 8;
1711
1674
  break;
1712
1675
  }
1713
1676
  throw Error("Wallet client not set");
1714
1677
  case 8:
1715
1678
  if (!this.walletClient.ForbiddenMethods().includes(method)) {
1716
- _context25.next = 10;
1679
+ _context24.next = 10;
1717
1680
  break;
1718
1681
  }
1719
1682
  throw Error("Invalid user profile method: " + method);
1720
1683
  case 10:
1721
- _context25.next = 12;
1684
+ _context24.next = 12;
1722
1685
  return this.walletClient[method](message.args);
1723
1686
  case 12:
1724
- methodResults = _context25.sent;
1725
- _context25.next = 28;
1687
+ methodResults = _context24.sent;
1688
+ _context24.next = 28;
1726
1689
  break;
1727
1690
  case 15:
1728
1691
  if (!(message.module === "userProfileClient")) {
1729
- _context25.next = 23;
1692
+ _context24.next = 23;
1730
1693
  break;
1731
1694
  }
1732
1695
  if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1733
- _context25.next = 18;
1696
+ _context24.next = 18;
1734
1697
  break;
1735
1698
  }
1736
1699
  throw Error("Invalid user profile method: " + method);
1737
1700
  case 18:
1738
- _context25.next = 20;
1701
+ _context24.next = 20;
1739
1702
  return this.userProfileClient[method](message.args);
1740
1703
  case 20:
1741
- methodResults = _context25.sent;
1742
- _context25.next = 28;
1704
+ methodResults = _context24.sent;
1705
+ _context24.next = 28;
1743
1706
  break;
1744
1707
  case 23:
1745
1708
  if (this.FrameAllowedMethods().includes(method)) {
1746
- _context25.next = 25;
1709
+ _context24.next = 25;
1747
1710
  break;
1748
1711
  }
1749
1712
  throw Error("Invalid method: " + method);
1750
1713
  case 25:
1751
- _context25.next = 27;
1714
+ _context24.next = 27;
1752
1715
  return this[method](message.args);
1753
1716
  case 27:
1754
- methodResults = _context25.sent;
1717
+ methodResults = _context24.sent;
1755
1718
  case 28:
1756
1719
  Respond(this.utils.MakeClonable({
1757
1720
  type: "ElvFrameResponse",
1758
1721
  requestId: message.requestId,
1759
1722
  response: methodResults
1760
1723
  }));
1761
- _context25.next = 37;
1724
+ _context24.next = 37;
1762
1725
  break;
1763
1726
  case 31:
1764
- _context25.prev = 31;
1765
- _context25.t0 = _context25["catch"](3);
1727
+ _context24.prev = 31;
1728
+ _context24.t0 = _context24["catch"](3);
1766
1729
  // eslint-disable-next-line no-console
1767
- this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context25.t0) === "object" ? JSON.stringify(_context25.t0, null, 2) : _context25.t0), true);
1730
+ this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context24.t0) === "object" ? JSON.stringify(_context24.t0, null, 2) : _context24.t0), true);
1768
1731
 
1769
1732
  // eslint-disable-next-line no-console
1770
- console.error(_context25.t0);
1771
- responseError = _context25.t0 instanceof Error ? _context25.t0.message : _context25.t0;
1733
+ console.error(_context24.t0);
1734
+ responseError = _context24.t0 instanceof Error ? _context24.t0.message : _context24.t0;
1772
1735
  Respond(this.utils.MakeClonable({
1773
1736
  type: "ElvFrameResponse",
1774
1737
  requestId: message.requestId,
@@ -1776,11 +1739,11 @@ var ElvClient = /*#__PURE__*/function () {
1776
1739
  }));
1777
1740
  case 37:
1778
1741
  case "end":
1779
- return _context25.stop();
1742
+ return _context24.stop();
1780
1743
  }
1781
- }, _callee25, this, [[3, 31]]);
1744
+ }, _callee24, this, [[3, 31]]);
1782
1745
  }));
1783
- function CallFromFrameMessage(_x21, _x22) {
1746
+ function CallFromFrameMessage(_x19, _x20) {
1784
1747
  return _CallFromFrameMessage.apply(this, arguments);
1785
1748
  }
1786
1749
  return CallFromFrameMessage;
@@ -1788,13 +1751,13 @@ var ElvClient = /*#__PURE__*/function () {
1788
1751
  }], [{
1789
1752
  key: "Configuration",
1790
1753
  value: function () {
1791
- var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref29) {
1792
- var configUrl, _ref29$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1793
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1794
- while (1) switch (_context26.prev = _context26.next) {
1754
+ var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref28) {
1755
+ var configUrl, _ref28$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1756
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1757
+ while (1) switch (_context25.prev = _context25.next) {
1795
1758
  case 0:
1796
- configUrl = _ref29.configUrl, _ref29$kmsUrls = _ref29.kmsUrls, kmsUrls = _ref29$kmsUrls === void 0 ? [] : _ref29$kmsUrls, region = _ref29.region, clientIP = _ref29.clientIP;
1797
- _context26.prev = 1;
1759
+ configUrl = _ref28.configUrl, _ref28$kmsUrls = _ref28.kmsUrls, kmsUrls = _ref28$kmsUrls === void 0 ? [] : _ref28$kmsUrls, region = _ref28.region, clientIP = _ref28.clientIP;
1760
+ _context25.prev = 1;
1798
1761
  uri = new URI(configUrl);
1799
1762
  uri.pathname("/config");
1800
1763
  if (region) {
@@ -1803,10 +1766,10 @@ var ElvClient = /*#__PURE__*/function () {
1803
1766
  if (clientIP) {
1804
1767
  uri.addSearch("client_ip", clientIP);
1805
1768
  }
1806
- _context26.next = 8;
1769
+ _context25.next = 8;
1807
1770
  return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1808
1771
  case 8:
1809
- fabricInfo = _context26.sent;
1772
+ fabricInfo = _context25.sent;
1810
1773
  // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1811
1774
  filterHTTPS = function filterHTTPS(uri) {
1812
1775
  return uri.toLowerCase().startsWith("https");
@@ -1825,7 +1788,7 @@ var ElvClient = /*#__PURE__*/function () {
1825
1788
  }
1826
1789
  searchURIs = fabricInfo.network.services.search || [];
1827
1790
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1828
- return _context26.abrupt("return", {
1791
+ return _context25.abrupt("return", {
1829
1792
  nodeId: fabricInfo.node_id,
1830
1793
  contentSpaceId: fabricInfo.qspace.id,
1831
1794
  networkId: (fabricInfo.qspace.ethereum || {}).network_id,
@@ -1838,24 +1801,37 @@ var ElvClient = /*#__PURE__*/function () {
1838
1801
  fabricVersion: fabricVersion
1839
1802
  });
1840
1803
  case 21:
1841
- _context26.prev = 21;
1842
- _context26.t0 = _context26["catch"](1);
1804
+ _context25.prev = 21;
1805
+ _context25.t0 = _context25["catch"](1);
1843
1806
  // eslint-disable-next-line no-console
1844
1807
  console.error("Error retrieving fabric configuration:");
1845
1808
  // eslint-disable-next-line no-console
1846
- console.error(_context26.t0);
1847
- throw _context26.t0;
1809
+ console.error(_context25.t0);
1810
+ throw _context25.t0;
1848
1811
  case 26:
1849
1812
  case "end":
1850
- return _context26.stop();
1813
+ return _context25.stop();
1851
1814
  }
1852
- }, _callee26, null, [[1, 21]]);
1815
+ }, _callee25, null, [[1, 21]]);
1853
1816
  }));
1854
- function Configuration(_x23) {
1817
+ function Configuration(_x21) {
1855
1818
  return _Configuration.apply(this, arguments);
1856
1819
  }
1857
1820
  return Configuration;
1858
1821
  }()
1822
+ /**
1823
+ * Return a list of valid Eluvio Content Fabric network names and their associated configuration URLs
1824
+ *
1825
+ * @methodGroup Miscellaneous
1826
+ *
1827
+ * @return {Object} - An object using network names as keys and configuration URLs as values.
1828
+ */
1829
+ }, {
1830
+ key: "Networks",
1831
+ value: function Networks() {
1832
+ return Object.assign({}, networks);
1833
+ }
1834
+
1859
1835
  /**
1860
1836
  * Create a new ElvClient for the specified network
1861
1837
  *
@@ -1875,20 +1851,20 @@ var ElvClient = /*#__PURE__*/function () {
1875
1851
  }, {
1876
1852
  key: "FromNetworkName",
1877
1853
  value: function () {
1878
- var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref30) {
1879
- var networkName, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, assumeV3, configUrl;
1880
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1881
- while (1) switch (_context27.prev = _context27.next) {
1854
+ var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref29) {
1855
+ var networkName, region, clientIP, trustAuthorityId, staticToken, _ref29$ethereumContra, ethereumContractTimeout, _ref29$noCache, noCache, _ref29$noAuth, noAuth, assumeV3, configUrl;
1856
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1857
+ while (1) switch (_context26.prev = _context26.next) {
1882
1858
  case 0:
1883
- networkName = _ref30.networkName, region = _ref30.region, clientIP = _ref30.clientIP, trustAuthorityId = _ref30.trustAuthorityId, staticToken = _ref30.staticToken, _ref30$ethereumContra = _ref30.ethereumContractTimeout, ethereumContractTimeout = _ref30$ethereumContra === void 0 ? 10 : _ref30$ethereumContra, _ref30$noCache = _ref30.noCache, noCache = _ref30$noCache === void 0 ? false : _ref30$noCache, _ref30$noAuth = _ref30.noAuth, noAuth = _ref30$noAuth === void 0 ? false : _ref30$noAuth, assumeV3 = _ref30.assumeV3;
1859
+ networkName = _ref29.networkName, region = _ref29.region, clientIP = _ref29.clientIP, trustAuthorityId = _ref29.trustAuthorityId, staticToken = _ref29.staticToken, _ref29$ethereumContra = _ref29.ethereumContractTimeout, ethereumContractTimeout = _ref29$ethereumContra === void 0 ? 10 : _ref29$ethereumContra, _ref29$noCache = _ref29.noCache, noCache = _ref29$noCache === void 0 ? false : _ref29$noCache, _ref29$noAuth = _ref29.noAuth, noAuth = _ref29$noAuth === void 0 ? false : _ref29$noAuth, assumeV3 = _ref29.assumeV3;
1884
1860
  configUrl = networks[networkName];
1885
1861
  if (configUrl) {
1886
- _context27.next = 4;
1862
+ _context26.next = 4;
1887
1863
  break;
1888
1864
  }
1889
1865
  throw Error("Invalid network name: " + networkName);
1890
1866
  case 4:
1891
- _context27.next = 6;
1867
+ _context26.next = 6;
1892
1868
  return this.FromConfigurationUrl({
1893
1869
  configUrl: configUrl,
1894
1870
  region: region,
@@ -1901,14 +1877,14 @@ var ElvClient = /*#__PURE__*/function () {
1901
1877
  assumeV3: assumeV3
1902
1878
  });
1903
1879
  case 6:
1904
- return _context27.abrupt("return", _context27.sent);
1880
+ return _context26.abrupt("return", _context26.sent);
1905
1881
  case 7:
1906
1882
  case "end":
1907
- return _context27.stop();
1883
+ return _context26.stop();
1908
1884
  }
1909
- }, _callee27, this);
1885
+ }, _callee26, this);
1910
1886
  }));
1911
- function FromNetworkName(_x24) {
1887
+ function FromNetworkName(_x22) {
1912
1888
  return _FromNetworkName.apply(this, arguments);
1913
1889
  }
1914
1890
  return FromNetworkName;
@@ -1932,20 +1908,20 @@ var ElvClient = /*#__PURE__*/function () {
1932
1908
  }, {
1933
1909
  key: "FromConfigurationUrl",
1934
1910
  value: function () {
1935
- var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref31) {
1936
- var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref31$ethereumContra, ethereumContractTimeout, _ref31$noCache, noCache, _ref31$noAuth, noAuth, _ref31$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1937
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
1938
- while (1) switch (_context28.prev = _context28.next) {
1911
+ var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref30) {
1912
+ var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, _ref30$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1913
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1914
+ while (1) switch (_context27.prev = _context27.next) {
1939
1915
  case 0:
1940
- configUrl = _ref31.configUrl, region = _ref31.region, clientIP = _ref31.clientIP, trustAuthorityId = _ref31.trustAuthorityId, staticToken = _ref31.staticToken, _ref31$ethereumContra = _ref31.ethereumContractTimeout, ethereumContractTimeout = _ref31$ethereumContra === void 0 ? 10 : _ref31$ethereumContra, _ref31$noCache = _ref31.noCache, noCache = _ref31$noCache === void 0 ? false : _ref31$noCache, _ref31$noAuth = _ref31.noAuth, noAuth = _ref31$noAuth === void 0 ? false : _ref31$noAuth, _ref31$assumeV = _ref31.assumeV3, assumeV3 = _ref31$assumeV === void 0 ? false : _ref31$assumeV;
1941
- _context28.next = 3;
1916
+ configUrl = _ref30.configUrl, region = _ref30.region, clientIP = _ref30.clientIP, trustAuthorityId = _ref30.trustAuthorityId, staticToken = _ref30.staticToken, _ref30$ethereumContra = _ref30.ethereumContractTimeout, ethereumContractTimeout = _ref30$ethereumContra === void 0 ? 10 : _ref30$ethereumContra, _ref30$noCache = _ref30.noCache, noCache = _ref30$noCache === void 0 ? false : _ref30$noCache, _ref30$noAuth = _ref30.noAuth, noAuth = _ref30$noAuth === void 0 ? false : _ref30$noAuth, _ref30$assumeV = _ref30.assumeV3, assumeV3 = _ref30$assumeV === void 0 ? false : _ref30$assumeV;
1917
+ _context27.next = 3;
1942
1918
  return ElvClient.Configuration({
1943
1919
  configUrl: configUrl,
1944
1920
  clientIP: clientIP,
1945
1921
  region: region
1946
1922
  });
1947
1923
  case 3:
1948
- _yield$ElvClient$Conf3 = _context28.sent;
1924
+ _yield$ElvClient$Conf3 = _context27.sent;
1949
1925
  contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
1950
1926
  networkId = _yield$ElvClient$Conf3.networkId;
1951
1927
  networkName = _yield$ElvClient$Conf3.networkName;
@@ -1971,14 +1947,16 @@ var ElvClient = /*#__PURE__*/function () {
1971
1947
  assumeV3: assumeV3
1972
1948
  });
1973
1949
  client.configUrl = configUrl;
1974
- return _context28.abrupt("return", client);
1975
- case 15:
1950
+ client.region = region;
1951
+ client.clientIP = clientIP;
1952
+ return _context27.abrupt("return", client);
1953
+ case 17:
1976
1954
  case "end":
1977
- return _context28.stop();
1955
+ return _context27.stop();
1978
1956
  }
1979
- }, _callee28);
1957
+ }, _callee27);
1980
1958
  }));
1981
- function FromConfigurationUrl(_x25) {
1959
+ function FromConfigurationUrl(_x23) {
1982
1960
  return _FromConfigurationUrl.apply(this, arguments);
1983
1961
  }
1984
1962
  return FromConfigurationUrl;