@eluvio/elv-client-js 4.0.136 → 4.0.137

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