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