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