@eluvio/elv-client-js 4.0.142 → 4.0.144

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.
@@ -24,7 +24,8 @@ var _require = require("./LogMessage"),
24
24
  LogMessage = _require.LogMessage;
25
25
  var Pako = require("pako");
26
26
  var _require2 = require("./Validation"),
27
- ValidatePresence = _require2.ValidatePresence;
27
+ ValidatePresence = _require2.ValidatePresence,
28
+ ValidateWriteToken = _require2.ValidateWriteToken;
28
29
  var UrlJoin = require("url-join");
29
30
  var networks = {
30
31
  "main": "https://main.net955305.contentfabric.io",
@@ -125,6 +126,10 @@ var ElvClient = /*#__PURE__*/function () {
125
126
  }
126
127
  this.service = service;
127
128
  this.debug = false;
129
+
130
+ // Use a default key when client is unauthed. This key should not be used for any other purpose.
131
+ // Break it up to avoid automatic private key detection warnings
132
+ this.defaultKey = "0x" + "5d52d808f10f64f0dffff8c73edff" + "3f7b467411216e2350940f869e6ac5a7db6";
128
133
  this.InitializeClients({
129
134
  staticToken: staticToken
130
135
  });
@@ -277,9 +282,10 @@ var ElvClient = /*#__PURE__*/function () {
277
282
  });
278
283
  if (!this.signer) {
279
284
  wallet = this.GenerateWallet();
280
- signer = wallet.AddAccountFromMnemonic({
281
- mnemonic: wallet.GenerateMnemonic()
285
+ signer = wallet.AddAccount({
286
+ privateKey: this.defaultKey
282
287
  });
288
+ signer.anonymous = true;
283
289
  this.SetSigner({
284
290
  signer: signer,
285
291
  reset: false
@@ -545,6 +551,7 @@ var ElvClient = /*#__PURE__*/function () {
545
551
  * @namedParams
546
552
  * @param {string=} matchEndpoint - Return node(s) matching the specified endpoint
547
553
  * @param {string=} matchNodeId - Return node(s) matching the specified node ID
554
+ * @param {string=} matchWriteToken - Return node(s) matching the specified write token
548
555
  *
549
556
  * @return {Promise<Array<Object>>} - A list of nodes in the space matching the parameters
550
557
  */
@@ -556,14 +563,17 @@ var ElvClient = /*#__PURE__*/function () {
556
563
  var _ref7,
557
564
  matchEndpoint,
558
565
  matchNodeId,
566
+ matchWriteToken,
559
567
  nodes,
560
568
  _yield$this$utils$Res,
561
569
  node,
570
+ _yield$this$utils$Res2,
571
+ _nodes,
562
572
  _args6 = arguments;
563
573
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
564
574
  while (1) switch (_context6.prev = _context6.next) {
565
575
  case 0:
566
- _ref7 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId;
576
+ _ref7 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId, matchWriteToken = _ref7.matchWriteToken;
567
577
  this.SetStaticToken();
568
578
  if (!matchEndpoint) {
569
579
  _context6.next = 12;
@@ -604,7 +614,7 @@ var ElvClient = /*#__PURE__*/function () {
604
614
  }));
605
615
  case 12:
606
616
  if (!matchNodeId) {
607
- _context6.next = 19;
617
+ _context6.next = 21;
608
618
  break;
609
619
  }
610
620
  this.SetStaticToken();
@@ -620,7 +630,29 @@ var ElvClient = /*#__PURE__*/function () {
620
630
  node = _context6.sent;
621
631
  this.ClearStaticToken();
622
632
  return _context6.abrupt("return", [node]);
623
- case 19:
633
+ case 21:
634
+ if (!matchWriteToken) {
635
+ _context6.next = 29;
636
+ break;
637
+ }
638
+ this.SetStaticToken();
639
+ _context6.next = 25;
640
+ return this.utils.ResponseToJson(this.HttpClient.Request({
641
+ path: UrlJoin("nodes"),
642
+ method: "GET",
643
+ headers: {
644
+ Authorization: "Bearer ".concat(this.staticToken)
645
+ },
646
+ queryParams: {
647
+ token: matchWriteToken
648
+ }
649
+ }));
650
+ case 25:
651
+ _yield$this$utils$Res2 = _context6.sent;
652
+ _nodes = _yield$this$utils$Res2.nodes;
653
+ this.ClearStaticToken();
654
+ return _context6.abrupt("return", _nodes);
655
+ case 29:
624
656
  case "end":
625
657
  return _context6.stop();
626
658
  }
@@ -646,18 +678,75 @@ var ElvClient = /*#__PURE__*/function () {
646
678
  configUrl: this.configUrl
647
679
  };
648
680
  }
681
+
682
+ /**
683
+ * Return node url for a given write token via a network call
684
+ *
685
+ * @methodGroup Nodes
686
+ * @namedParams
687
+ * @param {string} writeToken - The write token to match to a node
688
+ *
689
+ * @returns {Promise<string>} - The node url for a write token
690
+ */
691
+ }, {
692
+ key: "WriteTokenNodeUrlNetwork",
693
+ value: function () {
694
+ var _WriteTokenNodeUrlNetwork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
695
+ var writeToken, nodes, nodeUrl;
696
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
697
+ while (1) switch (_context7.prev = _context7.next) {
698
+ case 0:
699
+ writeToken = _ref8.writeToken;
700
+ ValidateWriteToken(writeToken);
701
+ _context7.next = 4;
702
+ return this.SpaceNodes({
703
+ matchWriteToken: writeToken
704
+ });
705
+ case 4:
706
+ nodes = _context7.sent;
707
+ nodeUrl = nodes && nodes[0] && nodes[0].services && nodes[0].services.fabric_api && nodes[0].services.fabric_api.urls && nodes[0].services.fabric_api.urls[0];
708
+ if (nodeUrl) {
709
+ _context7.next = 9;
710
+ break;
711
+ }
712
+ // eslint-disable-next-line no-console
713
+ console.error("No node url found for write token: ".concat(writeToken));
714
+ return _context7.abrupt("return", "");
715
+ case 9:
716
+ return _context7.abrupt("return", nodeUrl ? nodeUrl.toString() : undefined);
717
+ case 10:
718
+ case "end":
719
+ return _context7.stop();
720
+ }
721
+ }, _callee7, this);
722
+ }));
723
+ function WriteTokenNodeUrlNetwork(_x3) {
724
+ return _WriteTokenNodeUrlNetwork.apply(this, arguments);
725
+ }
726
+ return WriteTokenNodeUrlNetwork;
727
+ }()
728
+ /**
729
+ * Return node url for a given write token via local lookup
730
+ *
731
+ * @methodGroup Nodes
732
+ * @namedParams
733
+ * @param {string} writeToken - The write token to match to a node
734
+ *
735
+ * @returns {string} - The node url for a write token
736
+ */
649
737
  }, {
650
- key: "WriteTokenNodeUrl",
651
- value: function WriteTokenNodeUrl(_ref8) {
652
- var writeToken = _ref8.writeToken;
738
+ key: "WriteTokenNodeUrlLocal",
739
+ value: function WriteTokenNodeUrlLocal(_ref9) {
740
+ var writeToken = _ref9.writeToken;
741
+ ValidateWriteToken(writeToken);
653
742
  var nodeUrl = this.HttpClient.draftURIs[writeToken];
654
743
  return nodeUrl ? nodeUrl.toString() : undefined;
655
744
  }
656
745
  }, {
657
746
  key: "RecordWriteToken",
658
- value: function RecordWriteToken(_ref9) {
659
- var writeToken = _ref9.writeToken,
660
- fabricNodeUrl = _ref9.fabricNodeUrl;
747
+ value: function RecordWriteToken(_ref10) {
748
+ var writeToken = _ref10.writeToken,
749
+ fabricNodeUrl = _ref10.fabricNodeUrl;
661
750
  this.HttpClient.RecordWriteToken(writeToken, fabricNodeUrl);
662
751
  }
663
752
 
@@ -707,18 +796,14 @@ var ElvClient = /*#__PURE__*/function () {
707
796
  */
708
797
  }, {
709
798
  key: "SetSigner",
710
- value: function SetSigner(_ref10) {
711
- var _this2 = this;
712
- var signer = _ref10.signer,
713
- _ref10$reset = _ref10.reset,
714
- reset = _ref10$reset === void 0 ? true : _ref10$reset;
799
+ value: function SetSigner(_ref11) {
800
+ var signer = _ref11.signer,
801
+ _ref11$reset = _ref11.reset,
802
+ reset = _ref11$reset === void 0 ? true : _ref11$reset;
715
803
  this.staticToken = undefined;
716
804
  signer.connect(this.ethClient.Provider());
717
805
  signer.provider.pollingInterval = 500;
718
806
  this.signer = signer;
719
- this.CreateFabricToken({}).then(function (token) {
720
- return _this2.signedToken = token;
721
- });
722
807
  if (reset) {
723
808
  this.InitializeClients();
724
809
  }
@@ -739,34 +824,34 @@ var ElvClient = /*#__PURE__*/function () {
739
824
  }, {
740
825
  key: "SetRemoteSigner",
741
826
  value: function () {
742
- var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
827
+ var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
743
828
  var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
744
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
745
- while (1) switch (_context7.prev = _context7.next) {
829
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
830
+ while (1) switch (_context8.prev = _context8.next) {
746
831
  case 0:
747
- idToken = _ref11.idToken, authToken = _ref11.authToken, tenantId = _ref11.tenantId, extraData = _ref11.extraData, signerURIs = _ref11.signerURIs, unsignedPublicAuth = _ref11.unsignedPublicAuth;
748
- _context7.t0 = RemoteSigner;
749
- _context7.t1 = signerURIs || this.authServiceURIs;
750
- _context7.t2 = idToken;
751
- _context7.t3 = authToken;
752
- _context7.t4 = tenantId;
753
- _context7.next = 8;
832
+ idToken = _ref12.idToken, authToken = _ref12.authToken, tenantId = _ref12.tenantId, extraData = _ref12.extraData, signerURIs = _ref12.signerURIs, unsignedPublicAuth = _ref12.unsignedPublicAuth;
833
+ _context8.t0 = RemoteSigner;
834
+ _context8.t1 = signerURIs || this.authServiceURIs;
835
+ _context8.t2 = idToken;
836
+ _context8.t3 = authToken;
837
+ _context8.t4 = tenantId;
838
+ _context8.next = 8;
754
839
  return this.ethClient.Provider();
755
840
  case 8:
756
- _context7.t5 = _context7.sent;
757
- _context7.t6 = extraData;
758
- _context7.t7 = unsignedPublicAuth;
759
- _context7.t8 = {
760
- signerURIs: _context7.t1,
761
- idToken: _context7.t2,
762
- authToken: _context7.t3,
763
- tenantId: _context7.t4,
764
- provider: _context7.t5,
765
- extraData: _context7.t6,
766
- unsignedPublicAuth: _context7.t7
841
+ _context8.t5 = _context8.sent;
842
+ _context8.t6 = extraData;
843
+ _context8.t7 = unsignedPublicAuth;
844
+ _context8.t8 = {
845
+ signerURIs: _context8.t1,
846
+ idToken: _context8.t2,
847
+ authToken: _context8.t3,
848
+ tenantId: _context8.t4,
849
+ provider: _context8.t5,
850
+ extraData: _context8.t6,
851
+ unsignedPublicAuth: _context8.t7
767
852
  };
768
- signer = new _context7.t0(_context7.t8);
769
- _context7.next = 15;
853
+ signer = new _context8.t0(_context8.t8);
854
+ _context8.next = 15;
770
855
  return signer.Initialize();
771
856
  case 15:
772
857
  this.SetSigner({
@@ -774,11 +859,11 @@ var ElvClient = /*#__PURE__*/function () {
774
859
  });
775
860
  case 16:
776
861
  case "end":
777
- return _context7.stop();
862
+ return _context8.stop();
778
863
  }
779
- }, _callee7, this);
864
+ }, _callee8, this);
780
865
  }));
781
- function SetRemoteSigner(_x3) {
866
+ function SetRemoteSigner(_x4) {
782
867
  return _SetRemoteSigner.apply(this, arguments);
783
868
  }
784
869
  return SetRemoteSigner;
@@ -796,29 +881,29 @@ var ElvClient = /*#__PURE__*/function () {
796
881
  }, {
797
882
  key: "SetSignerFromWeb3Provider",
798
883
  value: function () {
799
- var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
884
+ var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
800
885
  var provider, ethProvider;
801
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
802
- while (1) switch (_context8.prev = _context8.next) {
886
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
887
+ while (1) switch (_context9.prev = _context9.next) {
803
888
  case 0:
804
- provider = _ref12.provider;
889
+ provider = _ref13.provider;
805
890
  this.staticToken = undefined;
806
891
  ethProvider = new Ethers.providers.Web3Provider(provider);
807
892
  ethProvider.pollingInterval = 250;
808
893
  this.signer = ethProvider.getSigner();
809
- _context8.next = 7;
894
+ _context9.next = 7;
810
895
  return this.signer.getAddress();
811
896
  case 7:
812
- this.signer.address = _context8.sent;
813
- _context8.next = 10;
897
+ this.signer.address = _context9.sent;
898
+ _context9.next = 10;
814
899
  return this.InitializeClients();
815
900
  case 10:
816
901
  case "end":
817
- return _context8.stop();
902
+ return _context9.stop();
818
903
  }
819
- }, _callee8, this);
904
+ }, _callee9, this);
820
905
  }));
821
- function SetSignerFromWeb3Provider(_x4) {
906
+ function SetSignerFromWeb3Provider(_x5) {
822
907
  return _SetSignerFromWeb3Provider.apply(this, arguments);
823
908
  }
824
909
  return SetSignerFromWeb3Provider;
@@ -841,12 +926,12 @@ var ElvClient = /*#__PURE__*/function () {
841
926
  }, {
842
927
  key: "CreateAccount",
843
928
  value: function () {
844
- var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
845
- var tenantId, fundingToken, _ref13$funds, funds, groupToken, wallet, signer;
846
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
847
- while (1) switch (_context9.prev = _context9.next) {
929
+ var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
930
+ var tenantId, fundingToken, _ref14$funds, funds, groupToken, wallet, signer;
931
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
932
+ while (1) switch (_context10.prev = _context10.next) {
848
933
  case 0:
849
- tenantId = _ref13.tenantId, fundingToken = _ref13.fundingToken, _ref13$funds = _ref13.funds, funds = _ref13$funds === void 0 ? 0.5 : _ref13$funds, groupToken = _ref13.groupToken;
934
+ tenantId = _ref14.tenantId, fundingToken = _ref14.fundingToken, _ref14$funds = _ref14.funds, funds = _ref14$funds === void 0 ? 0.5 : _ref14$funds, groupToken = _ref14.groupToken;
850
935
  if (!this.signer) {
851
936
  wallet = this.GenerateWallet();
852
937
  signer = wallet.AddAccountFromMnemonic({
@@ -856,7 +941,7 @@ var ElvClient = /*#__PURE__*/function () {
856
941
  signer: signer
857
942
  });
858
943
  }
859
- _context9.next = 4;
944
+ _context10.next = 4;
860
945
  return this.authClient.MakeKMSRequest({
861
946
  method: "POST",
862
947
  path: "/ks/otp/fnd/".concat(tenantId),
@@ -869,20 +954,20 @@ var ElvClient = /*#__PURE__*/function () {
869
954
  }
870
955
  });
871
956
  case 4:
872
- _context9.next = 6;
957
+ _context10.next = 6;
873
958
  return this.userProfileClient.CreateWallet();
874
959
  case 6:
875
- _context9.next = 8;
960
+ _context10.next = 8;
876
961
  return this.userProfileClient.ReplaceUserMetadata({
877
962
  metadataSubtree: "tenantContractId",
878
963
  metadata: tenantId
879
964
  });
880
965
  case 8:
881
966
  if (!groupToken) {
882
- _context9.next = 11;
967
+ _context10.next = 11;
883
968
  break;
884
969
  }
885
- _context9.next = 11;
970
+ _context10.next = 11;
886
971
  return this.authClient.MakeKMSRequest({
887
972
  method: "POST",
888
973
  path: "/ks/otp/grp/".concat(tenantId),
@@ -894,14 +979,14 @@ var ElvClient = /*#__PURE__*/function () {
894
979
  }
895
980
  });
896
981
  case 11:
897
- return _context9.abrupt("return", this.utils.FormatAddress(this.signer.address));
982
+ return _context10.abrupt("return", this.utils.FormatAddress(this.signer.address));
898
983
  case 12:
899
984
  case "end":
900
- return _context9.stop();
985
+ return _context10.stop();
901
986
  }
902
- }, _callee9, this);
987
+ }, _callee10, this);
903
988
  }));
904
- function CreateAccount(_x5) {
989
+ function CreateAccount(_x6) {
905
990
  return _CreateAccount.apply(this, arguments);
906
991
  }
907
992
  return CreateAccount;
@@ -918,64 +1003,64 @@ var ElvClient = /*#__PURE__*/function () {
918
1003
  }, {
919
1004
  key: "PersonalSign",
920
1005
  value: function () {
921
- var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref14) {
922
- var _this3 = this;
1006
+ var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref15) {
1007
+ var _this2 = this;
923
1008
  var message, addEthereumPrefix, Sign;
924
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
925
- while (1) switch (_context11.prev = _context11.next) {
1009
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1010
+ while (1) switch (_context12.prev = _context12.next) {
926
1011
  case 0:
927
- message = _ref14.message, addEthereumPrefix = _ref14.addEthereumPrefix, Sign = _ref14.Sign;
1012
+ message = _ref15.message, addEthereumPrefix = _ref15.addEthereumPrefix, Sign = _ref15.Sign;
928
1013
  if (!Sign) {
929
1014
  // Same as authClient.Sign, but authClient may not yet be initialized
930
1015
  Sign = /*#__PURE__*/function () {
931
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(message) {
932
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
933
- while (1) switch (_context10.prev = _context10.next) {
1016
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(message) {
1017
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1018
+ while (1) switch (_context11.prev = _context11.next) {
934
1019
  case 0:
935
- _context10.t0 = Ethers.utils;
936
- if (!_this3.signer.signDigest) {
937
- _context10.next = 7;
1020
+ _context11.t0 = Ethers.utils;
1021
+ if (!_this2.signer.signDigest) {
1022
+ _context11.next = 7;
938
1023
  break;
939
1024
  }
940
- _context10.next = 4;
941
- return _this3.signer.signDigest(message);
1025
+ _context11.next = 4;
1026
+ return _this2.signer.signDigest(message);
942
1027
  case 4:
943
- _context10.t1 = _context10.sent;
944
- _context10.next = 10;
1028
+ _context11.t1 = _context11.sent;
1029
+ _context11.next = 10;
945
1030
  break;
946
1031
  case 7:
947
- _context10.next = 9;
948
- return _this3.signer._signingKey().signDigest(message);
1032
+ _context11.next = 9;
1033
+ return _this2.signer._signingKey().signDigest(message);
949
1034
  case 9:
950
- _context10.t1 = _context10.sent;
1035
+ _context11.t1 = _context11.sent;
951
1036
  case 10:
952
- _context10.t2 = _context10.t1;
953
- return _context10.abrupt("return", _context10.t0.joinSignature.call(_context10.t0, _context10.t2));
1037
+ _context11.t2 = _context11.t1;
1038
+ return _context11.abrupt("return", _context11.t0.joinSignature.call(_context11.t0, _context11.t2));
954
1039
  case 12:
955
1040
  case "end":
956
- return _context10.stop();
1041
+ return _context11.stop();
957
1042
  }
958
- }, _callee10);
1043
+ }, _callee11);
959
1044
  }));
960
- return function Sign(_x7) {
961
- return _ref15.apply(this, arguments);
1045
+ return function Sign(_x8) {
1046
+ return _ref16.apply(this, arguments);
962
1047
  };
963
1048
  }();
964
1049
  }
965
1050
  if (addEthereumPrefix) {
966
1051
  message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
967
1052
  }
968
- _context11.next = 5;
1053
+ _context12.next = 5;
969
1054
  return Sign(message);
970
1055
  case 5:
971
- return _context11.abrupt("return", _context11.sent);
1056
+ return _context12.abrupt("return", _context12.sent);
972
1057
  case 6:
973
1058
  case "end":
974
- return _context11.stop();
1059
+ return _context12.stop();
975
1060
  }
976
- }, _callee11);
1061
+ }, _callee12);
977
1062
  }));
978
- function PersonalSign(_x6) {
1063
+ function PersonalSign(_x7) {
979
1064
  return _PersonalSign.apply(this, arguments);
980
1065
  }
981
1066
  return PersonalSign;
@@ -994,65 +1079,65 @@ var ElvClient = /*#__PURE__*/function () {
994
1079
  }, {
995
1080
  key: "CreateFabricToken",
996
1081
  value: function () {
997
- var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
998
- var _ref16,
999
- _ref16$duration,
1082
+ var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
1083
+ var _ref17,
1084
+ _ref17$duration,
1000
1085
  duration,
1001
- _ref16$spec,
1086
+ _ref17$spec,
1002
1087
  spec,
1003
1088
  address,
1004
1089
  Sign,
1005
- _ref16$addEthereumPre,
1090
+ _ref17$addEthereumPre,
1006
1091
  addEthereumPrefix,
1007
- _ref16$context,
1092
+ _ref17$context,
1008
1093
  context,
1009
1094
  token,
1010
1095
  message,
1011
1096
  signature,
1012
1097
  compressedToken,
1013
- _args12 = arguments;
1014
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1015
- while (1) switch (_context12.prev = _context12.next) {
1098
+ _args13 = arguments;
1099
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1100
+ while (1) switch (_context13.prev = _context13.next) {
1016
1101
  case 0:
1017
- _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;
1102
+ _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;
1018
1103
  address = address || this.CurrentAccountAddress();
1019
- _context12.t0 = _objectSpread;
1020
- _context12.t1 = _objectSpread({}, spec);
1021
- _context12.t2 = {};
1022
- _context12.t3 = "iusr".concat(Utils.AddressToHash(address));
1023
- _context12.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
1024
- _context12.next = 9;
1104
+ _context13.t0 = _objectSpread;
1105
+ _context13.t1 = _objectSpread({}, spec);
1106
+ _context13.t2 = {};
1107
+ _context13.t3 = "iusr".concat(Utils.AddressToHash(address));
1108
+ _context13.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
1109
+ _context13.next = 9;
1025
1110
  return this.ContentSpaceId();
1026
1111
  case 9:
1027
- _context12.t5 = _context12.sent;
1028
- _context12.t6 = Date.now();
1029
- _context12.t7 = Date.now() + duration;
1030
- _context12.t8 = context;
1031
- _context12.t9 = {
1032
- sub: _context12.t3,
1033
- adr: _context12.t4,
1034
- spc: _context12.t5,
1035
- iat: _context12.t6,
1036
- exp: _context12.t7,
1037
- ctx: _context12.t8
1112
+ _context13.t5 = _context13.sent;
1113
+ _context13.t6 = Date.now();
1114
+ _context13.t7 = Date.now() + duration;
1115
+ _context13.t8 = context;
1116
+ _context13.t9 = {
1117
+ sub: _context13.t3,
1118
+ adr: _context13.t4,
1119
+ spc: _context13.t5,
1120
+ iat: _context13.t6,
1121
+ exp: _context13.t7,
1122
+ ctx: _context13.t8
1038
1123
  };
1039
- token = (0, _context12.t0)(_context12.t1, _context12.t2, _context12.t9);
1124
+ token = (0, _context13.t0)(_context13.t1, _context13.t2, _context13.t9);
1040
1125
  message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
1041
- _context12.next = 18;
1126
+ _context13.next = 18;
1042
1127
  return this.PersonalSign({
1043
1128
  message: message,
1044
1129
  addEthereumPrefix: addEthereumPrefix,
1045
1130
  Sign: Sign
1046
1131
  });
1047
1132
  case 18:
1048
- signature = _context12.sent;
1133
+ signature = _context13.sent;
1049
1134
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1050
- return _context12.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1135
+ return _context13.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1051
1136
  case 21:
1052
1137
  case "end":
1053
- return _context12.stop();
1138
+ return _context13.stop();
1054
1139
  }
1055
- }, _callee12, this);
1140
+ }, _callee13, this);
1056
1141
  }));
1057
1142
  function CreateFabricToken() {
1058
1143
  return _CreateFabricToken.apply(this, arguments);
@@ -1074,108 +1159,133 @@ var ElvClient = /*#__PURE__*/function () {
1074
1159
  * @param {boolean} allowDecryption=false - If specified, the re-encryption key will be included in the token,
1075
1160
  * enabling the user of this token to download encrypted content from the specified object
1076
1161
  * @param {Object=} context - Additional JSON context
1162
+ * @param {number=} issueTime - Issue Time in milliseconds
1163
+ * @param {number=} expirationTime - Expiration Time in milliseconds
1077
1164
  */
1078
1165
  }, {
1079
1166
  key: "CreateSignedToken",
1080
1167
  value: function () {
1081
- var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
1082
- var libraryId, objectId, versionHash, policyId, subject, _ref17$grantType, grantType, _ref17$allowDecryptio, allowDecryption, duration, _ref17$context, context, token, cap, compressedToken, signature;
1083
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1084
- while (1) switch (_context13.prev = _context13.next) {
1168
+ var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1169
+ var libraryId, objectId, versionHash, policyId, subject, _ref18$grantType, grantType, _ref18$allowDecryptio, allowDecryption, duration, _ref18$context, context, issueTime, expirationTime, issueDateTime, token, cap, compressedToken, signature;
1170
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1171
+ while (1) switch (_context14.prev = _context14.next) {
1085
1172
  case 0:
1086
- 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;
1173
+ 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, issueTime = _ref18.issueTime, expirationTime = _ref18.expirationTime;
1087
1174
  if (subject) {
1088
- _context13.next = 9;
1175
+ _context14.next = 9;
1089
1176
  break;
1090
1177
  }
1091
- _context13.t0 = "iusr";
1092
- _context13.t1 = this.utils;
1093
- _context13.next = 6;
1178
+ _context14.t0 = "iusr";
1179
+ _context14.t1 = this.utils;
1180
+ _context14.next = 6;
1094
1181
  return this.CurrentAccountAddress();
1095
1182
  case 6:
1096
- _context13.t2 = _context13.sent;
1097
- _context13.t3 = _context13.t1.AddressToHash.call(_context13.t1, _context13.t2);
1098
- subject = _context13.t0.concat.call(_context13.t0, _context13.t3);
1183
+ _context14.t2 = _context14.sent;
1184
+ _context14.t3 = _context14.t1.AddressToHash.call(_context14.t1, _context14.t2);
1185
+ subject = _context14.t0.concat.call(_context14.t0, _context14.t3);
1099
1186
  case 9:
1100
1187
  if (policyId) {
1101
1188
  context["elv:delegation-id"] = policyId;
1102
1189
  }
1103
- _context13.t4 = Buffer;
1104
- _context13.next = 13;
1190
+ issueDateTime = issueTime || Date.now();
1191
+ _context14.t4 = Buffer;
1192
+ _context14.next = 14;
1105
1193
  return this.CurrentAccountAddress().replace(/^0x/, "");
1106
- case 13:
1107
- _context13.t5 = _context13.sent;
1108
- _context13.t6 = _context13.t4.from.call(_context13.t4, _context13.t5, "hex").toString("base64");
1109
- _context13.t7 = subject;
1110
- _context13.next = 18;
1194
+ case 14:
1195
+ _context14.t5 = _context14.sent;
1196
+ _context14.t6 = _context14.t4.from.call(_context14.t4, _context14.t5, "hex").toString("base64");
1197
+ _context14.t7 = subject;
1198
+ _context14.next = 19;
1111
1199
  return this.ContentSpaceId();
1112
- case 18:
1113
- _context13.t8 = _context13.sent;
1114
- _context13.t9 = Date.now();
1115
- _context13.t10 = Date.now() + duration;
1116
- _context13.t11 = grantType;
1117
- _context13.t12 = context;
1200
+ case 19:
1201
+ _context14.t8 = _context14.sent;
1202
+ _context14.t9 = issueDateTime;
1203
+ _context14.t10 = expirationTime || issueDateTime + duration;
1204
+ _context14.t11 = grantType;
1205
+ _context14.t12 = context;
1118
1206
  token = {
1119
- adr: _context13.t6,
1120
- sub: _context13.t7,
1121
- spc: _context13.t8,
1122
- iat: _context13.t9,
1123
- exp: _context13.t10,
1124
- gra: _context13.t11,
1125
- ctx: _context13.t12
1207
+ adr: _context14.t6,
1208
+ sub: _context14.t7,
1209
+ spc: _context14.t8,
1210
+ iat: _context14.t9,
1211
+ exp: _context14.t10,
1212
+ gra: _context14.t11,
1213
+ ctx: _context14.t12
1126
1214
  };
1127
1215
  if (versionHash) {
1128
1216
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1129
1217
  }
1130
1218
  if (!objectId) {
1131
- _context13.next = 31;
1219
+ _context14.next = 32;
1132
1220
  break;
1133
1221
  }
1134
1222
  token.qid = objectId;
1135
1223
  if (libraryId) {
1136
- _context13.next = 31;
1224
+ _context14.next = 32;
1137
1225
  break;
1138
1226
  }
1139
- _context13.next = 30;
1227
+ _context14.next = 31;
1140
1228
  return this.ContentObjectLibraryId({
1141
1229
  objectId: objectId
1142
1230
  });
1143
- case 30:
1144
- libraryId = _context13.sent;
1145
1231
  case 31:
1232
+ libraryId = _context14.sent;
1233
+ case 32:
1146
1234
  if (libraryId) {
1147
1235
  token.lib = libraryId;
1148
1236
  }
1149
1237
  if (!allowDecryption) {
1150
- _context13.next = 37;
1238
+ _context14.next = 38;
1151
1239
  break;
1152
1240
  }
1153
- _context13.next = 35;
1241
+ _context14.next = 36;
1154
1242
  return this.authClient.ReEncryptionConk({
1155
1243
  libraryId: libraryId,
1156
1244
  objectId: objectId
1157
1245
  });
1158
- case 35:
1159
- cap = _context13.sent;
1246
+ case 36:
1247
+ cap = _context14.sent;
1160
1248
  token.apk = cap.public_key;
1161
- case 37:
1249
+ case 38:
1162
1250
  compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1163
- _context13.next = 40;
1251
+ _context14.next = 41;
1164
1252
  return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1165
- case 40:
1166
- signature = _context13.sent;
1167
- return _context13.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1168
- case 42:
1253
+ case 41:
1254
+ signature = _context14.sent;
1255
+ return _context14.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1256
+ case 43:
1169
1257
  case "end":
1170
- return _context13.stop();
1258
+ return _context14.stop();
1171
1259
  }
1172
- }, _callee13, this);
1260
+ }, _callee14, this);
1173
1261
  }));
1174
- function CreateSignedToken(_x8) {
1262
+ function CreateSignedToken(_x9) {
1175
1263
  return _CreateSignedToken.apply(this, arguments);
1176
1264
  }
1177
1265
  return CreateSignedToken;
1178
1266
  }()
1267
+ }, {
1268
+ key: "CreateAuthorizationToken",
1269
+ value: function () {
1270
+ var _CreateAuthorizationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(args) {
1271
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1272
+ while (1) switch (_context15.prev = _context15.next) {
1273
+ case 0:
1274
+ _context15.next = 2;
1275
+ return this.authClient.AuthorizationToken(args);
1276
+ case 2:
1277
+ return _context15.abrupt("return", _context15.sent);
1278
+ case 3:
1279
+ case "end":
1280
+ return _context15.stop();
1281
+ }
1282
+ }, _callee15, this);
1283
+ }));
1284
+ function CreateAuthorizationToken(_x10) {
1285
+ return _CreateAuthorizationToken.apply(this, arguments);
1286
+ }
1287
+ return CreateAuthorizationToken;
1288
+ }()
1179
1289
  /**
1180
1290
  * Build a signed message (JSON) using the current signer.
1181
1291
  * Signed messages have a similar format to signed access tokens and they include the message itself
@@ -1193,30 +1303,30 @@ var ElvClient = /*#__PURE__*/function () {
1193
1303
  }, {
1194
1304
  key: "CreateSignedMessageJSON",
1195
1305
  value: function () {
1196
- var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
1306
+ var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref19) {
1197
1307
  var message, type, msg, signature;
1198
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1199
- while (1) switch (_context14.prev = _context14.next) {
1308
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1309
+ while (1) switch (_context16.prev = _context16.next) {
1200
1310
  case 0:
1201
- message = _ref18.message;
1311
+ message = _ref19.message;
1202
1312
  // Only one kind of signature supported currently
1203
1313
  type = "mje_"; // JSON message, EIP192 signature
1204
1314
  msg = JSON.stringify(message);
1205
- _context14.next = 5;
1315
+ _context16.next = 5;
1206
1316
  return this.PersonalSign({
1207
1317
  message: msg,
1208
1318
  addEthereumPrefix: true
1209
1319
  });
1210
1320
  case 5:
1211
- signature = _context14.sent;
1212
- return _context14.abrupt("return", "".concat(type).concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(msg)]))));
1321
+ signature = _context16.sent;
1322
+ return _context16.abrupt("return", "".concat(type).concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(msg)]))));
1213
1323
  case 7:
1214
1324
  case "end":
1215
- return _context14.stop();
1325
+ return _context16.stop();
1216
1326
  }
1217
- }, _callee14, this);
1327
+ }, _callee16, this);
1218
1328
  }));
1219
- function CreateSignedMessageJSON(_x9) {
1329
+ function CreateSignedMessageJSON(_x11) {
1220
1330
  return _CreateSignedMessageJSON.apply(this, arguments);
1221
1331
  }
1222
1332
  return CreateSignedMessageJSON;
@@ -1232,15 +1342,15 @@ var ElvClient = /*#__PURE__*/function () {
1232
1342
  }, {
1233
1343
  key: "DecodeSignedMessageJSON",
1234
1344
  value: function () {
1235
- var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1345
+ var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref20) {
1236
1346
  var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr;
1237
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1238
- while (1) switch (_context15.prev = _context15.next) {
1347
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1348
+ while (1) switch (_context17.prev = _context17.next) {
1239
1349
  case 0:
1240
- signedMessage = _ref19.signedMessage;
1350
+ signedMessage = _ref20.signedMessage;
1241
1351
  type = signedMessage.slice(0, 4);
1242
- _context15.t0 = type;
1243
- _context15.next = _context15.t0 === "mje_" ? 5 : 12;
1352
+ _context17.t0 = type;
1353
+ _context17.next = _context17.t0 === "mje_" ? 5 : 12;
1244
1354
  break;
1245
1355
  case 5:
1246
1356
  msgBytes = Utils.FromB58(signedMessage.slice(4));
@@ -1249,7 +1359,7 @@ var ElvClient = /*#__PURE__*/function () {
1249
1359
  obj = JSON.parse(msg);
1250
1360
  prefixedMsgHash = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(msg.length).concat(msg), "utf-8"));
1251
1361
  signerAddr = Ethers.utils.recoverAddress(prefixedMsgHash, signature);
1252
- return _context15.abrupt("return", {
1362
+ return _context17.abrupt("return", {
1253
1363
  type: type,
1254
1364
  message: obj,
1255
1365
  signerAddress: signerAddr,
@@ -1259,11 +1369,11 @@ var ElvClient = /*#__PURE__*/function () {
1259
1369
  throw new Error("Bad message type: ".concat(type));
1260
1370
  case 13:
1261
1371
  case "end":
1262
- return _context15.stop();
1372
+ return _context17.stop();
1263
1373
  }
1264
- }, _callee15);
1374
+ }, _callee17);
1265
1375
  }));
1266
- function DecodeSignedMessageJSON(_x10) {
1376
+ function DecodeSignedMessageJSON(_x12) {
1267
1377
  return _DecodeSignedMessageJSON.apply(this, arguments);
1268
1378
  }
1269
1379
  return DecodeSignedMessageJSON;
@@ -1290,12 +1400,12 @@ var ElvClient = /*#__PURE__*/function () {
1290
1400
  }, {
1291
1401
  key: "SetOauthToken",
1292
1402
  value: function () {
1293
- var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1403
+ var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref21) {
1294
1404
  var token, wallet, signer;
1295
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1296
- while (1) switch (_context16.prev = _context16.next) {
1405
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1406
+ while (1) switch (_context18.prev = _context18.next) {
1297
1407
  case 0:
1298
- token = _ref20.token;
1408
+ token = _ref21.token;
1299
1409
  this.oauthToken = token;
1300
1410
  wallet = this.GenerateWallet();
1301
1411
  signer = wallet.AddAccountFromMnemonic({
@@ -1306,11 +1416,11 @@ var ElvClient = /*#__PURE__*/function () {
1306
1416
  });
1307
1417
  case 5:
1308
1418
  case "end":
1309
- return _context16.stop();
1419
+ return _context18.stop();
1310
1420
  }
1311
- }, _callee16, this);
1421
+ }, _callee18, this);
1312
1422
  }));
1313
- function SetOauthToken(_x11) {
1423
+ function SetOauthToken(_x13) {
1314
1424
  return _SetOauthToken.apply(this, arguments);
1315
1425
  }
1316
1426
  return SetOauthToken;
@@ -1328,44 +1438,44 @@ var ElvClient = /*#__PURE__*/function () {
1328
1438
  }, {
1329
1439
  key: "SetSignerFromOauthToken",
1330
1440
  value: function () {
1331
- var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
1441
+ var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref22) {
1332
1442
  var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1333
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1334
- while (1) switch (_context17.prev = _context17.next) {
1443
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1444
+ while (1) switch (_context19.prev = _context19.next) {
1335
1445
  case 0:
1336
- token = _ref21.token;
1446
+ token = _ref22.token;
1337
1447
  if (this.trustAuthorityId) {
1338
- _context17.next = 3;
1448
+ _context19.next = 3;
1339
1449
  break;
1340
1450
  }
1341
1451
  throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1342
1452
  case 3:
1343
1453
  wallet = this.GenerateWallet();
1344
- _context17.prev = 4;
1454
+ _context19.prev = 4;
1345
1455
  if (this.kmsURIs) {
1346
- _context17.next = 17;
1456
+ _context19.next = 17;
1347
1457
  break;
1348
1458
  }
1349
- _context17.next = 8;
1459
+ _context19.next = 8;
1350
1460
  return ElvClient.FromConfigurationUrl({
1351
1461
  configUrl: this.configUrl
1352
1462
  });
1353
1463
  case 8:
1354
- client = _context17.sent;
1464
+ client = _context19.sent;
1355
1465
  client.SetSigner({
1356
- signer: wallet.AddAccountFromMnemonic({
1357
- mnemonic: wallet.GenerateMnemonic()
1466
+ signer: wallet.AddAccount({
1467
+ privateKey: this.defaultKey
1358
1468
  })
1359
1469
  });
1360
- _context17.next = 12;
1470
+ _context19.next = 12;
1361
1471
  return client.authClient.KMSInfo({
1362
1472
  kmsId: this.trustAuthorityId
1363
1473
  });
1364
1474
  case 12:
1365
- _yield$client$authCli = _context17.sent;
1475
+ _yield$client$authCli = _context19.sent;
1366
1476
  urls = _yield$client$authCli.urls;
1367
1477
  if (!(!urls || urls.length === 0)) {
1368
- _context17.next = 16;
1478
+ _context19.next = 16;
1369
1479
  break;
1370
1480
  }
1371
1481
  throw Error("Unable to authorize with OAuth token: No KMS URLs set");
@@ -1378,7 +1488,7 @@ var ElvClient = /*#__PURE__*/function () {
1378
1488
  uris: this.kmsURIs,
1379
1489
  debug: this.debug
1380
1490
  });
1381
- _context17.next = 22;
1491
+ _context19.next = 22;
1382
1492
  return this.utils.ResponseToJson(httpClient.Request({
1383
1493
  headers: {
1384
1494
  Authorization: "Bearer ".concat(token)
@@ -1388,7 +1498,7 @@ var ElvClient = /*#__PURE__*/function () {
1388
1498
  forceFailover: true
1389
1499
  }));
1390
1500
  case 22:
1391
- response = _context17.sent;
1501
+ response = _context19.sent;
1392
1502
  privateKey = response["UserSKHex"];
1393
1503
  this.SetSigner({
1394
1504
  signer: wallet.AddAccount({
@@ -1397,27 +1507,27 @@ var ElvClient = /*#__PURE__*/function () {
1397
1507
  });
1398
1508
 
1399
1509
  // Ensure wallet is initialized
1400
- _context17.next = 27;
1510
+ _context19.next = 27;
1401
1511
  return this.userProfileClient.WalletAddress();
1402
1512
  case 27:
1403
- _context17.next = 36;
1513
+ _context19.next = 36;
1404
1514
  break;
1405
1515
  case 29:
1406
- _context17.prev = 29;
1407
- _context17.t0 = _context17["catch"](4);
1516
+ _context19.prev = 29;
1517
+ _context19.t0 = _context19["catch"](4);
1408
1518
  this.Log("Failed to set signer from OAuth token:", true);
1409
- this.Log(_context17.t0, true);
1410
- _context17.next = 35;
1519
+ this.Log(_context19.t0, true);
1520
+ _context19.next = 35;
1411
1521
  return this.ClearSigner();
1412
1522
  case 35:
1413
- throw _context17.t0;
1523
+ throw _context19.t0;
1414
1524
  case 36:
1415
1525
  case "end":
1416
- return _context17.stop();
1526
+ return _context19.stop();
1417
1527
  }
1418
- }, _callee17, this, [[4, 29]]);
1528
+ }, _callee19, this, [[4, 29]]);
1419
1529
  }));
1420
- function SetSignerFromOauthToken(_x12) {
1530
+ function SetSignerFromOauthToken(_x14) {
1421
1531
  return _SetSignerFromOauthToken.apply(this, arguments);
1422
1532
  }
1423
1533
  return SetSignerFromOauthToken;
@@ -1433,8 +1543,8 @@ var ElvClient = /*#__PURE__*/function () {
1433
1543
  */
1434
1544
  }, {
1435
1545
  key: "CreateStaticToken",
1436
- value: function CreateStaticToken(_ref22) {
1437
- var libraryId = _ref22.libraryId;
1546
+ value: function CreateStaticToken(_ref23) {
1547
+ var libraryId = _ref23.libraryId;
1438
1548
  var token = {
1439
1549
  qspace_id: this.client.contentSpaceId
1440
1550
  };
@@ -1455,10 +1565,10 @@ var ElvClient = /*#__PURE__*/function () {
1455
1565
  }, {
1456
1566
  key: "SetStaticToken",
1457
1567
  value: function SetStaticToken() {
1458
- var _ref23 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1459
- token = _ref23.token,
1460
- _ref23$update = _ref23.update,
1461
- update = _ref23$update === void 0 ? false : _ref23$update;
1568
+ var _ref24 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1569
+ token = _ref24.token,
1570
+ _ref24$update = _ref24.update,
1571
+ update = _ref24$update === void 0 ? false : _ref24$update;
1462
1572
  if (token) {
1463
1573
  this.staticToken = token;
1464
1574
  } else {
@@ -1490,30 +1600,30 @@ var ElvClient = /*#__PURE__*/function () {
1490
1600
  }, {
1491
1601
  key: "SetPolicyAuthorization",
1492
1602
  value: function () {
1493
- var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref24) {
1603
+ var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref25) {
1494
1604
  var objectId;
1495
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1496
- while (1) switch (_context18.prev = _context18.next) {
1605
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1606
+ while (1) switch (_context20.prev = _context20.next) {
1497
1607
  case 0:
1498
- objectId = _ref24.objectId;
1499
- _context18.t0 = this;
1500
- _context18.next = 4;
1608
+ objectId = _ref25.objectId;
1609
+ _context20.t0 = this;
1610
+ _context20.next = 4;
1501
1611
  return this.GenerateStateChannelToken({
1502
1612
  objectId: objectId
1503
1613
  });
1504
1614
  case 4:
1505
- _context18.t1 = _context18.sent;
1506
- _context18.t2 = {
1507
- token: _context18.t1
1615
+ _context20.t1 = _context20.sent;
1616
+ _context20.t2 = {
1617
+ token: _context20.t1
1508
1618
  };
1509
- _context18.t0.SetStaticToken.call(_context18.t0, _context18.t2);
1619
+ _context20.t0.SetStaticToken.call(_context20.t0, _context20.t2);
1510
1620
  case 7:
1511
1621
  case "end":
1512
- return _context18.stop();
1622
+ return _context20.stop();
1513
1623
  }
1514
- }, _callee18, this);
1624
+ }, _callee20, this);
1515
1625
  }));
1516
- function SetPolicyAuthorization(_x13) {
1626
+ function SetPolicyAuthorization(_x15) {
1517
1627
  return _SetPolicyAuthorization.apply(this, arguments);
1518
1628
  }
1519
1629
  return SetPolicyAuthorization;
@@ -1527,23 +1637,23 @@ var ElvClient = /*#__PURE__*/function () {
1527
1637
  }, {
1528
1638
  key: "Sign",
1529
1639
  value: function () {
1530
- var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(string) {
1640
+ var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(string) {
1531
1641
  var signature;
1532
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1533
- while (1) switch (_context19.prev = _context19.next) {
1642
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1643
+ while (1) switch (_context21.prev = _context21.next) {
1534
1644
  case 0:
1535
- _context19.next = 2;
1645
+ _context21.next = 2;
1536
1646
  return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1537
1647
  case 2:
1538
- signature = _context19.sent;
1539
- return _context19.abrupt("return", this.utils.FormatSignature(signature));
1648
+ signature = _context21.sent;
1649
+ return _context21.abrupt("return", this.utils.FormatSignature(signature));
1540
1650
  case 4:
1541
1651
  case "end":
1542
- return _context19.stop();
1652
+ return _context21.stop();
1543
1653
  }
1544
- }, _callee19, this);
1654
+ }, _callee21, this);
1545
1655
  }));
1546
- function Sign(_x14) {
1656
+ function Sign(_x16) {
1547
1657
  return _Sign.apply(this, arguments);
1548
1658
  }
1549
1659
  return Sign;
@@ -1560,30 +1670,30 @@ var ElvClient = /*#__PURE__*/function () {
1560
1670
  }, {
1561
1671
  key: "EncryptECIES",
1562
1672
  value: function () {
1563
- var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref25) {
1673
+ var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref26) {
1564
1674
  var message, publicKey;
1565
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1566
- while (1) switch (_context20.prev = _context20.next) {
1675
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1676
+ while (1) switch (_context22.prev = _context22.next) {
1567
1677
  case 0:
1568
- message = _ref25.message, publicKey = _ref25.publicKey;
1678
+ message = _ref26.message, publicKey = _ref26.publicKey;
1569
1679
  if (this.signer) {
1570
- _context20.next = 3;
1680
+ _context22.next = 3;
1571
1681
  break;
1572
1682
  }
1573
1683
  throw "Signer not set";
1574
1684
  case 3:
1575
1685
  ValidatePresence("message", message);
1576
- _context20.next = 6;
1686
+ _context22.next = 6;
1577
1687
  return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1578
1688
  case 6:
1579
- return _context20.abrupt("return", _context20.sent);
1689
+ return _context22.abrupt("return", _context22.sent);
1580
1690
  case 7:
1581
1691
  case "end":
1582
- return _context20.stop();
1692
+ return _context22.stop();
1583
1693
  }
1584
- }, _callee20, this);
1694
+ }, _callee22, this);
1585
1695
  }));
1586
- function EncryptECIES(_x15) {
1696
+ function EncryptECIES(_x17) {
1587
1697
  return _EncryptECIES.apply(this, arguments);
1588
1698
  }
1589
1699
  return EncryptECIES;
@@ -1599,30 +1709,30 @@ var ElvClient = /*#__PURE__*/function () {
1599
1709
  }, {
1600
1710
  key: "DecryptECIES",
1601
1711
  value: function () {
1602
- var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref26) {
1712
+ var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref27) {
1603
1713
  var message;
1604
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1605
- while (1) switch (_context21.prev = _context21.next) {
1714
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1715
+ while (1) switch (_context23.prev = _context23.next) {
1606
1716
  case 0:
1607
- message = _ref26.message;
1717
+ message = _ref27.message;
1608
1718
  if (this.signer) {
1609
- _context21.next = 3;
1719
+ _context23.next = 3;
1610
1720
  break;
1611
1721
  }
1612
1722
  throw "Signer not set";
1613
1723
  case 3:
1614
1724
  ValidatePresence("message", message);
1615
- _context21.next = 6;
1725
+ _context23.next = 6;
1616
1726
  return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1617
1727
  case 6:
1618
- return _context21.abrupt("return", _context21.sent);
1728
+ return _context23.abrupt("return", _context23.sent);
1619
1729
  case 7:
1620
1730
  case "end":
1621
- return _context21.stop();
1731
+ return _context23.stop();
1622
1732
  }
1623
- }, _callee21, this);
1733
+ }, _callee23, this);
1624
1734
  }));
1625
- function DecryptECIES(_x16) {
1735
+ function DecryptECIES(_x18) {
1626
1736
  return _DecryptECIES.apply(this, arguments);
1627
1737
  }
1628
1738
  return DecryptECIES;
@@ -1641,24 +1751,24 @@ var ElvClient = /*#__PURE__*/function () {
1641
1751
  }, {
1642
1752
  key: "Request",
1643
1753
  value: function () {
1644
- var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref27) {
1645
- var url, _ref27$format, format, _ref27$method, method, _ref27$headers, headers, body;
1646
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1647
- while (1) switch (_context22.prev = _context22.next) {
1754
+ var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref28) {
1755
+ var url, _ref28$format, format, _ref28$method, method, _ref28$headers, headers, body;
1756
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1757
+ while (1) switch (_context24.prev = _context24.next) {
1648
1758
  case 0:
1649
- 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;
1650
- return _context22.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1759
+ url = _ref28.url, _ref28$format = _ref28.format, format = _ref28$format === void 0 ? "json" : _ref28$format, _ref28$method = _ref28.method, method = _ref28$method === void 0 ? "GET" : _ref28$method, _ref28$headers = _ref28.headers, headers = _ref28$headers === void 0 ? {} : _ref28$headers, body = _ref28.body;
1760
+ return _context24.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1651
1761
  method: method,
1652
1762
  headers: headers,
1653
1763
  body: body
1654
1764
  })));
1655
1765
  case 2:
1656
1766
  case "end":
1657
- return _context22.stop();
1767
+ return _context24.stop();
1658
1768
  }
1659
- }, _callee22, this);
1769
+ }, _callee24, this);
1660
1770
  }));
1661
- function Request(_x17) {
1771
+ function Request(_x19) {
1662
1772
  return _Request.apply(this, arguments);
1663
1773
  }
1664
1774
  return Request;
@@ -1666,12 +1776,12 @@ var ElvClient = /*#__PURE__*/function () {
1666
1776
  }, {
1667
1777
  key: "MakeAuthServiceRequest",
1668
1778
  value: function () {
1669
- var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref28) {
1670
- var kmsId, objectId, versionHash, _ref28$method, method, path, bodyType, _ref28$body, body, _ref28$queryParams, queryParams, headers, format, response;
1671
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1672
- while (1) switch (_context23.prev = _context23.next) {
1779
+ var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref29) {
1780
+ var kmsId, objectId, versionHash, _ref29$method, method, path, bodyType, _ref29$body, body, _ref29$queryParams, queryParams, headers, format, response;
1781
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1782
+ while (1) switch (_context25.prev = _context25.next) {
1673
1783
  case 0:
1674
- 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, format = _ref28.format;
1784
+ kmsId = _ref29.kmsId, objectId = _ref29.objectId, versionHash = _ref29.versionHash, _ref29$method = _ref29.method, method = _ref29$method === void 0 ? "GET" : _ref29$method, path = _ref29.path, bodyType = _ref29.bodyType, _ref29$body = _ref29.body, body = _ref29$body === void 0 ? {} : _ref29$body, _ref29$queryParams = _ref29.queryParams, queryParams = _ref29$queryParams === void 0 ? {} : _ref29$queryParams, headers = _ref29.headers, format = _ref29.format;
1675
1785
  response = this.authClient.MakeAuthServiceRequest({
1676
1786
  kmsId: kmsId,
1677
1787
  objectId: objectId,
@@ -1683,14 +1793,14 @@ var ElvClient = /*#__PURE__*/function () {
1683
1793
  queryParams: queryParams,
1684
1794
  headers: headers
1685
1795
  });
1686
- return _context23.abrupt("return", !format ? response : this.utils.ResponseToFormat(format, response));
1796
+ return _context25.abrupt("return", !format ? response : this.utils.ResponseToFormat(format, response));
1687
1797
  case 3:
1688
1798
  case "end":
1689
- return _context23.stop();
1799
+ return _context25.stop();
1690
1800
  }
1691
- }, _callee23, this);
1801
+ }, _callee25, this);
1692
1802
  }));
1693
- function MakeAuthServiceRequest(_x18) {
1803
+ function MakeAuthServiceRequest(_x20) {
1694
1804
  return _MakeAuthServiceRequest.apply(this, arguments);
1695
1805
  }
1696
1806
  return MakeAuthServiceRequest;
@@ -1700,10 +1810,10 @@ var ElvClient = /*#__PURE__*/function () {
1700
1810
  }, {
1701
1811
  key: "FrameAllowedMethods",
1702
1812
  value: function FrameAllowedMethods() {
1703
- var _this4 = this;
1813
+ var _this3 = this;
1704
1814
  var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1705
1815
  return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
1706
- return typeof _this4[method] === "function" && !forbiddenMethods.includes(method);
1816
+ return typeof _this3[method] === "function" && !forbiddenMethods.includes(method);
1707
1817
  });
1708
1818
  }
1709
1819
 
@@ -1711,21 +1821,21 @@ var ElvClient = /*#__PURE__*/function () {
1711
1821
  }, {
1712
1822
  key: "CallFromFrameMessage",
1713
1823
  value: function () {
1714
- var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(message, Respond) {
1715
- var _this5 = this;
1824
+ var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(message, Respond) {
1825
+ var _this4 = this;
1716
1826
  var callback, method, methodResults, responseError;
1717
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1718
- while (1) switch (_context24.prev = _context24.next) {
1827
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1828
+ while (1) switch (_context26.prev = _context26.next) {
1719
1829
  case 0:
1720
1830
  if (!(message.type !== "ElvFrameRequest")) {
1721
- _context24.next = 2;
1831
+ _context26.next = 2;
1722
1832
  break;
1723
1833
  }
1724
- return _context24.abrupt("return");
1834
+ return _context26.abrupt("return");
1725
1835
  case 2:
1726
1836
  if (message.callbackId) {
1727
1837
  callback = function callback(result) {
1728
- Respond(_this5.utils.MakeClonable({
1838
+ Respond(_this4.utils.MakeClonable({
1729
1839
  type: "ElvFrameResponse",
1730
1840
  requestId: message.callbackId,
1731
1841
  response: result
@@ -1733,87 +1843,89 @@ var ElvClient = /*#__PURE__*/function () {
1733
1843
  };
1734
1844
  message.args.callback = callback;
1735
1845
  }
1736
- _context24.prev = 3;
1846
+ _context26.prev = 3;
1737
1847
  method = message.calledMethod;
1738
1848
  if (!(message.module === "walletClient")) {
1739
- _context24.next = 15;
1849
+ _context26.next = 15;
1740
1850
  break;
1741
1851
  }
1742
1852
  if (this.walletClient) {
1743
- _context24.next = 8;
1853
+ _context26.next = 8;
1744
1854
  break;
1745
1855
  }
1746
1856
  throw Error("Wallet client not set");
1747
1857
  case 8:
1748
1858
  if (!this.walletClient.ForbiddenMethods().includes(method)) {
1749
- _context24.next = 10;
1859
+ _context26.next = 10;
1750
1860
  break;
1751
1861
  }
1752
1862
  throw Error("Invalid user profile method: " + method);
1753
1863
  case 10:
1754
- _context24.next = 12;
1864
+ _context26.next = 12;
1755
1865
  return this.walletClient[method](message.args);
1756
1866
  case 12:
1757
- methodResults = _context24.sent;
1758
- _context24.next = 28;
1867
+ methodResults = _context26.sent;
1868
+ _context26.next = 28;
1759
1869
  break;
1760
1870
  case 15:
1761
1871
  if (!(message.module === "userProfileClient")) {
1762
- _context24.next = 23;
1872
+ _context26.next = 23;
1763
1873
  break;
1764
1874
  }
1765
1875
  if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1766
- _context24.next = 18;
1876
+ _context26.next = 18;
1767
1877
  break;
1768
1878
  }
1769
1879
  throw Error("Invalid user profile method: " + method);
1770
1880
  case 18:
1771
- _context24.next = 20;
1881
+ _context26.next = 20;
1772
1882
  return this.userProfileClient[method](message.args);
1773
1883
  case 20:
1774
- methodResults = _context24.sent;
1775
- _context24.next = 28;
1884
+ methodResults = _context26.sent;
1885
+ _context26.next = 28;
1776
1886
  break;
1777
1887
  case 23:
1778
1888
  if (this.FrameAllowedMethods().includes(method)) {
1779
- _context24.next = 25;
1889
+ _context26.next = 25;
1780
1890
  break;
1781
1891
  }
1782
1892
  throw Error("Invalid method: " + method);
1783
1893
  case 25:
1784
- _context24.next = 27;
1894
+ _context26.next = 27;
1785
1895
  return this[method](message.args);
1786
1896
  case 27:
1787
- methodResults = _context24.sent;
1897
+ methodResults = _context26.sent;
1788
1898
  case 28:
1789
1899
  Respond(this.utils.MakeClonable({
1790
1900
  type: "ElvFrameResponse",
1791
1901
  requestId: message.requestId,
1792
1902
  response: methodResults
1793
1903
  }));
1794
- _context24.next = 37;
1904
+ _context26.next = 38;
1795
1905
  break;
1796
1906
  case 31:
1797
- _context24.prev = 31;
1798
- _context24.t0 = _context24["catch"](3);
1907
+ _context26.prev = 31;
1908
+ _context26.t0 = _context26["catch"](3);
1799
1909
  // eslint-disable-next-line no-console
1800
- 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);
1910
+ this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context26.t0) === "object" ? JSON.stringify(_context26.t0, null, 2) : _context26.t0), true);
1801
1911
 
1802
1912
  // eslint-disable-next-line no-console
1803
- console.error(_context24.t0);
1804
- responseError = _context24.t0 instanceof Error ? _context24.t0.message : _context24.t0;
1913
+ console.error(message);
1914
+ // eslint-disable-next-line no-console
1915
+ console.error(_context26.t0);
1916
+ responseError = _context26.t0 instanceof Error ? _context26.t0.message : _context26.t0;
1805
1917
  Respond(this.utils.MakeClonable({
1806
1918
  type: "ElvFrameResponse",
1807
1919
  requestId: message.requestId,
1808
1920
  error: responseError
1809
1921
  }));
1810
- case 37:
1922
+ case 38:
1811
1923
  case "end":
1812
- return _context24.stop();
1924
+ return _context26.stop();
1813
1925
  }
1814
- }, _callee24, this, [[3, 31]]);
1926
+ }, _callee26, this, [[3, 31]]);
1815
1927
  }));
1816
- function CallFromFrameMessage(_x19, _x20) {
1928
+ function CallFromFrameMessage(_x21, _x22) {
1817
1929
  return _CallFromFrameMessage.apply(this, arguments);
1818
1930
  }
1819
1931
  return CallFromFrameMessage;
@@ -1821,13 +1933,13 @@ var ElvClient = /*#__PURE__*/function () {
1821
1933
  }], [{
1822
1934
  key: "Configuration",
1823
1935
  value: function () {
1824
- var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref29) {
1825
- var configUrl, _ref29$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion;
1826
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1827
- while (1) switch (_context25.prev = _context25.next) {
1936
+ var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref30) {
1937
+ var configUrl, _ref30$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion;
1938
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1939
+ while (1) switch (_context27.prev = _context27.next) {
1828
1940
  case 0:
1829
- configUrl = _ref29.configUrl, _ref29$kmsUrls = _ref29.kmsUrls, kmsUrls = _ref29$kmsUrls === void 0 ? [] : _ref29$kmsUrls, region = _ref29.region, clientIP = _ref29.clientIP;
1830
- _context25.prev = 1;
1941
+ configUrl = _ref30.configUrl, _ref30$kmsUrls = _ref30.kmsUrls, kmsUrls = _ref30$kmsUrls === void 0 ? [] : _ref30$kmsUrls, region = _ref30.region, clientIP = _ref30.clientIP;
1942
+ _context27.prev = 1;
1831
1943
  uri = new URI(configUrl);
1832
1944
  uri.pathname("/config");
1833
1945
  if (region) {
@@ -1836,10 +1948,10 @@ var ElvClient = /*#__PURE__*/function () {
1836
1948
  if (clientIP) {
1837
1949
  uri.addSearch("client_ip", clientIP);
1838
1950
  }
1839
- _context25.next = 8;
1951
+ _context27.next = 8;
1840
1952
  return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1841
1953
  case 8:
1842
- fabricInfo = _context25.sent;
1954
+ fabricInfo = _context27.sent;
1843
1955
  // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1844
1956
  filterHTTPS = function filterHTTPS(uri) {
1845
1957
  return uri.toLowerCase().startsWith("https");
@@ -1862,7 +1974,7 @@ var ElvClient = /*#__PURE__*/function () {
1862
1974
  }
1863
1975
  searchURIs = fabricInfo.network.services.search || [];
1864
1976
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1865
- return _context25.abrupt("return", {
1977
+ return _context27.abrupt("return", {
1866
1978
  nodeId: fabricInfo.node_id,
1867
1979
  contentSpaceId: fabricInfo.qspace.id,
1868
1980
  networkId: (fabricInfo.qspace.ethereum || {}).network_id,
@@ -1876,20 +1988,20 @@ var ElvClient = /*#__PURE__*/function () {
1876
1988
  fabricVersion: fabricVersion
1877
1989
  });
1878
1990
  case 23:
1879
- _context25.prev = 23;
1880
- _context25.t0 = _context25["catch"](1);
1991
+ _context27.prev = 23;
1992
+ _context27.t0 = _context27["catch"](1);
1881
1993
  // eslint-disable-next-line no-console
1882
1994
  console.error("Error retrieving fabric configuration:");
1883
1995
  // eslint-disable-next-line no-console
1884
- console.error(_context25.t0);
1885
- throw _context25.t0;
1996
+ console.error(_context27.t0);
1997
+ throw _context27.t0;
1886
1998
  case 28:
1887
1999
  case "end":
1888
- return _context25.stop();
2000
+ return _context27.stop();
1889
2001
  }
1890
- }, _callee25, null, [[1, 23]]);
2002
+ }, _callee27, null, [[1, 23]]);
1891
2003
  }));
1892
- function Configuration(_x21) {
2004
+ function Configuration(_x23) {
1893
2005
  return _Configuration.apply(this, arguments);
1894
2006
  }
1895
2007
  return Configuration;
@@ -1926,20 +2038,20 @@ var ElvClient = /*#__PURE__*/function () {
1926
2038
  }, {
1927
2039
  key: "FromNetworkName",
1928
2040
  value: function () {
1929
- var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref30) {
1930
- var networkName, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, assumeV3, configUrl;
1931
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1932
- while (1) switch (_context26.prev = _context26.next) {
2041
+ var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref31) {
2042
+ var networkName, region, clientIP, trustAuthorityId, staticToken, _ref31$ethereumContra, ethereumContractTimeout, _ref31$noCache, noCache, _ref31$noAuth, noAuth, assumeV3, configUrl;
2043
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
2044
+ while (1) switch (_context28.prev = _context28.next) {
1933
2045
  case 0:
1934
- 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;
2046
+ networkName = _ref31.networkName, 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, assumeV3 = _ref31.assumeV3;
1935
2047
  configUrl = networks[networkName];
1936
2048
  if (configUrl) {
1937
- _context26.next = 4;
2049
+ _context28.next = 4;
1938
2050
  break;
1939
2051
  }
1940
2052
  throw Error("Invalid network name: " + networkName);
1941
2053
  case 4:
1942
- _context26.next = 6;
2054
+ _context28.next = 6;
1943
2055
  return this.FromConfigurationUrl({
1944
2056
  configUrl: configUrl,
1945
2057
  region: region,
@@ -1952,14 +2064,14 @@ var ElvClient = /*#__PURE__*/function () {
1952
2064
  assumeV3: assumeV3
1953
2065
  });
1954
2066
  case 6:
1955
- return _context26.abrupt("return", _context26.sent);
2067
+ return _context28.abrupt("return", _context28.sent);
1956
2068
  case 7:
1957
2069
  case "end":
1958
- return _context26.stop();
2070
+ return _context28.stop();
1959
2071
  }
1960
- }, _callee26, this);
2072
+ }, _callee28, this);
1961
2073
  }));
1962
- function FromNetworkName(_x22) {
2074
+ function FromNetworkName(_x24) {
1963
2075
  return _FromNetworkName.apply(this, arguments);
1964
2076
  }
1965
2077
  return FromNetworkName;
@@ -1983,20 +2095,20 @@ var ElvClient = /*#__PURE__*/function () {
1983
2095
  }, {
1984
2096
  key: "FromConfigurationUrl",
1985
2097
  value: function () {
1986
- var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref31) {
1987
- 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, fileServiceURIs, searchURIs, fabricVersion, client;
1988
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1989
- while (1) switch (_context27.prev = _context27.next) {
2098
+ var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref32) {
2099
+ var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref32$ethereumContra, ethereumContractTimeout, _ref32$noCache, noCache, _ref32$noAuth, noAuth, _ref32$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, client;
2100
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
2101
+ while (1) switch (_context29.prev = _context29.next) {
1990
2102
  case 0:
1991
- 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;
1992
- _context27.next = 3;
2103
+ configUrl = _ref32.configUrl, region = _ref32.region, clientIP = _ref32.clientIP, trustAuthorityId = _ref32.trustAuthorityId, staticToken = _ref32.staticToken, _ref32$ethereumContra = _ref32.ethereumContractTimeout, ethereumContractTimeout = _ref32$ethereumContra === void 0 ? 10 : _ref32$ethereumContra, _ref32$noCache = _ref32.noCache, noCache = _ref32$noCache === void 0 ? false : _ref32$noCache, _ref32$noAuth = _ref32.noAuth, noAuth = _ref32$noAuth === void 0 ? false : _ref32$noAuth, _ref32$assumeV = _ref32.assumeV3, assumeV3 = _ref32$assumeV === void 0 ? false : _ref32$assumeV;
2104
+ _context29.next = 3;
1993
2105
  return ElvClient.Configuration({
1994
2106
  configUrl: configUrl,
1995
2107
  clientIP: clientIP,
1996
2108
  region: region
1997
2109
  });
1998
2110
  case 3:
1999
- _yield$ElvClient$Conf3 = _context27.sent;
2111
+ _yield$ElvClient$Conf3 = _context29.sent;
2000
2112
  contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
2001
2113
  networkId = _yield$ElvClient$Conf3.networkId;
2002
2114
  networkName = _yield$ElvClient$Conf3.networkName;
@@ -2026,14 +2138,14 @@ var ElvClient = /*#__PURE__*/function () {
2026
2138
  client.configUrl = configUrl;
2027
2139
  client.region = region;
2028
2140
  client.clientIP = clientIP;
2029
- return _context27.abrupt("return", client);
2141
+ return _context29.abrupt("return", client);
2030
2142
  case 18:
2031
2143
  case "end":
2032
- return _context27.stop();
2144
+ return _context29.stop();
2033
2145
  }
2034
- }, _callee27);
2146
+ }, _callee29);
2035
2147
  }));
2036
- function FromConfigurationUrl(_x23) {
2148
+ function FromConfigurationUrl(_x25) {
2037
2149
  return _FromConfigurationUrl.apply(this, arguments);
2038
2150
  }
2039
2151
  return FromConfigurationUrl;