@eluvio/elv-client-js 4.0.146 → 4.1.0
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 +2 -68
- package/dist/ElvClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvClient-node-min.js +2 -67
- package/dist/ElvClient-node-min.js.LICENSE.txt +72 -0
- package/dist/ElvFrameClient-min.js +2 -60
- package/dist/ElvFrameClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvPermissionsClient-min.js +2 -60
- package/dist/ElvPermissionsClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-min.js +2 -68
- package/dist/ElvWalletClient-min.js.LICENSE.txt +72 -0
- package/dist/ElvWalletClient-node-min.js +2 -67
- package/dist/ElvWalletClient-node-min.js.LICENSE.txt +72 -0
- package/dist/src/AuthorizationClient.js +704 -703
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/Crypto.js +85 -86
- package/dist/src/ElvClient.js +483 -471
- package/dist/src/ElvWallet.js +23 -23
- package/dist/src/EthClient.js +308 -307
- package/dist/src/FrameClient.js +62 -62
- package/dist/src/HttpClient.js +59 -58
- package/dist/src/PermissionsClient.js +470 -470
- package/dist/src/RemoteSigner.js +77 -76
- package/dist/src/UserProfileClient.js +357 -354
- package/dist/src/Utils.js +65 -64
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +237 -237
- package/dist/src/client/AccessGroups.js +477 -474
- package/dist/src/client/ContentAccess.js +1749 -1802
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +575 -578
- package/dist/src/client/Files.js +700 -684
- package/dist/src/client/LiveStream.js +659 -650
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +49 -49
- package/dist/src/walletClient/ClientMethods.js +977 -951
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +557 -550
- package/package.json +17 -16
- package/src/ElvClient.js +1 -0
- package/src/FrameClient.js +12 -0
- package/src/client/AccessGroups.js +1 -1
- package/src/client/ContentAccess.js +44 -71
- package/testScripts/Test.js +5 -1
- package/webpack.config.js +10 -13
- package/dist/src/ContentObjectVerification.js +0 -281
package/dist/src/ElvClient.js
CHANGED
|
@@ -190,28 +190,28 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
190
190
|
}).forEach(function (methodName) {
|
|
191
191
|
var originalMethod = klass[methodName].bind(klass);
|
|
192
192
|
if (originalMethod.constructor.name === "AsyncFunction") {
|
|
193
|
-
klass[methodName] = /*#__PURE__*/_asyncToGenerator(
|
|
193
|
+
klass[methodName] = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
194
194
|
var start,
|
|
195
195
|
_len,
|
|
196
196
|
args,
|
|
197
197
|
_key,
|
|
198
198
|
result,
|
|
199
199
|
_args = arguments;
|
|
200
|
-
return _regeneratorRuntime.wrap(function
|
|
200
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
201
201
|
while (1) switch (_context.prev = _context.next) {
|
|
202
202
|
case 0:
|
|
203
203
|
start = Date.now();
|
|
204
204
|
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
205
205
|
args[_key] = _args[_key];
|
|
206
206
|
}
|
|
207
|
-
_context.next =
|
|
207
|
+
_context.next = 1;
|
|
208
208
|
return originalMethod.apply(void 0, args);
|
|
209
|
-
case
|
|
209
|
+
case 1:
|
|
210
210
|
result = _context.sent;
|
|
211
211
|
// eslint-disable-next-line no-console
|
|
212
212
|
console.log(methodName, Date.now() - start, "ms", JSON.stringify(args));
|
|
213
213
|
return _context.abrupt("return", result);
|
|
214
|
-
case
|
|
214
|
+
case 2:
|
|
215
215
|
case "end":
|
|
216
216
|
return _context.stop();
|
|
217
217
|
}
|
|
@@ -236,14 +236,14 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
236
236
|
}, {
|
|
237
237
|
key: "InitializeClients",
|
|
238
238
|
value: function () {
|
|
239
|
-
var _InitializeClients = _asyncToGenerator(
|
|
239
|
+
var _InitializeClients = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
240
240
|
var _ref3,
|
|
241
241
|
staticToken,
|
|
242
242
|
uris,
|
|
243
243
|
wallet,
|
|
244
244
|
signer,
|
|
245
245
|
_args2 = arguments;
|
|
246
|
-
return _regeneratorRuntime.wrap(function
|
|
246
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
247
247
|
while (1) switch (_context2.prev = _context2.next) {
|
|
248
248
|
case 0:
|
|
249
249
|
_ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, staticToken = _ref3.staticToken;
|
|
@@ -251,6 +251,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
251
251
|
this.contentTypes = {};
|
|
252
252
|
this.encryptionConks = {};
|
|
253
253
|
this.stateChannelAccess = {};
|
|
254
|
+
this.objectInfo = {};
|
|
254
255
|
this.objectTenantIds = {};
|
|
255
256
|
this.objectLibraryIds = {};
|
|
256
257
|
this.objectImageUrls = {};
|
|
@@ -310,7 +311,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
310
311
|
// Initialize crypto wasm
|
|
311
312
|
this.Crypto = Crypto;
|
|
312
313
|
this.Crypto.ElvCrypto();
|
|
313
|
-
case
|
|
314
|
+
case 1:
|
|
314
315
|
case "end":
|
|
315
316
|
return _context2.stop();
|
|
316
317
|
}
|
|
@@ -348,24 +349,24 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
348
349
|
}, {
|
|
349
350
|
key: "UseRegion",
|
|
350
351
|
value: (function () {
|
|
351
|
-
var _UseRegion = _asyncToGenerator(
|
|
352
|
+
var _UseRegion = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
352
353
|
var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs;
|
|
353
|
-
return _regeneratorRuntime.wrap(function
|
|
354
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
354
355
|
while (1) switch (_context3.prev = _context3.next) {
|
|
355
356
|
case 0:
|
|
356
357
|
region = _ref4.region;
|
|
357
358
|
if (this.configUrl) {
|
|
358
|
-
_context3.next =
|
|
359
|
+
_context3.next = 1;
|
|
359
360
|
break;
|
|
360
361
|
}
|
|
361
362
|
throw Error("Unable to change region: Configuration URL not set");
|
|
362
|
-
case
|
|
363
|
-
_context3.next =
|
|
363
|
+
case 1:
|
|
364
|
+
_context3.next = 2;
|
|
364
365
|
return ElvClient.Configuration({
|
|
365
366
|
configUrl: this.configUrl,
|
|
366
367
|
region: region
|
|
367
368
|
});
|
|
368
|
-
case
|
|
369
|
+
case 2:
|
|
369
370
|
_yield$ElvClient$Conf = _context3.sent;
|
|
370
371
|
fabricURIs = _yield$ElvClient$Conf.fabricURIs;
|
|
371
372
|
ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
|
|
@@ -387,7 +388,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
387
388
|
authServiceURIs: authServiceURIs,
|
|
388
389
|
searchURIs: searchURIs
|
|
389
390
|
});
|
|
390
|
-
case
|
|
391
|
+
case 3:
|
|
391
392
|
case "end":
|
|
392
393
|
return _context3.stop();
|
|
393
394
|
}
|
|
@@ -411,23 +412,23 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
411
412
|
}, {
|
|
412
413
|
key: "ResetRegion",
|
|
413
414
|
value: (function () {
|
|
414
|
-
var _ResetRegion = _asyncToGenerator(
|
|
415
|
-
return _regeneratorRuntime.wrap(function
|
|
415
|
+
var _ResetRegion = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
416
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
416
417
|
while (1) switch (_context4.prev = _context4.next) {
|
|
417
418
|
case 0:
|
|
418
419
|
if (this.configUrl) {
|
|
419
|
-
_context4.next =
|
|
420
|
+
_context4.next = 1;
|
|
420
421
|
break;
|
|
421
422
|
}
|
|
422
423
|
throw Error("Unable to change region: Configuration URL not set");
|
|
423
|
-
case
|
|
424
|
-
_context4.next =
|
|
424
|
+
case 1:
|
|
425
|
+
_context4.next = 2;
|
|
425
426
|
return this.UseRegion({
|
|
426
427
|
region: ""
|
|
427
428
|
});
|
|
428
|
-
case
|
|
429
|
+
case 2:
|
|
429
430
|
return _context4.abrupt("return", _context4.sent);
|
|
430
|
-
case
|
|
431
|
+
case 3:
|
|
431
432
|
case "end":
|
|
432
433
|
return _context4.stop();
|
|
433
434
|
}
|
|
@@ -454,22 +455,22 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
454
455
|
}, {
|
|
455
456
|
key: "NodeId",
|
|
456
457
|
value: (function () {
|
|
457
|
-
var _NodeId = _asyncToGenerator(
|
|
458
|
+
var _NodeId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
458
459
|
var region, _yield$ElvClient$Conf2, nodeId;
|
|
459
|
-
return _regeneratorRuntime.wrap(function
|
|
460
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
460
461
|
while (1) switch (_context5.prev = _context5.next) {
|
|
461
462
|
case 0:
|
|
462
463
|
region = _ref5.region;
|
|
463
|
-
_context5.next =
|
|
464
|
+
_context5.next = 1;
|
|
464
465
|
return ElvClient.Configuration({
|
|
465
466
|
configUrl: this.configUrl,
|
|
466
467
|
region: region
|
|
467
468
|
});
|
|
468
|
-
case
|
|
469
|
+
case 1:
|
|
469
470
|
_yield$ElvClient$Conf2 = _context5.sent;
|
|
470
471
|
nodeId = _yield$ElvClient$Conf2.nodeId;
|
|
471
472
|
return _context5.abrupt("return", nodeId);
|
|
472
|
-
case
|
|
473
|
+
case 2:
|
|
473
474
|
case "end":
|
|
474
475
|
return _context5.stop();
|
|
475
476
|
}
|
|
@@ -561,7 +562,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
561
562
|
}, {
|
|
562
563
|
key: "SpaceNodes",
|
|
563
564
|
value: (function () {
|
|
564
|
-
var _SpaceNodes = _asyncToGenerator(
|
|
565
|
+
var _SpaceNodes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
565
566
|
var _this = this;
|
|
566
567
|
var _ref7,
|
|
567
568
|
matchEndpoint,
|
|
@@ -573,16 +574,16 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
573
574
|
_yield$this$utils$Res2,
|
|
574
575
|
_nodes,
|
|
575
576
|
_args6 = arguments;
|
|
576
|
-
return _regeneratorRuntime.wrap(function
|
|
577
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
577
578
|
while (1) switch (_context6.prev = _context6.next) {
|
|
578
579
|
case 0:
|
|
579
580
|
_ref7 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId, matchWriteToken = _ref7.matchWriteToken;
|
|
580
581
|
this.SetStaticToken();
|
|
581
582
|
if (!matchEndpoint) {
|
|
582
|
-
_context6.next =
|
|
583
|
+
_context6.next = 3;
|
|
583
584
|
break;
|
|
584
585
|
}
|
|
585
|
-
_context6.next =
|
|
586
|
+
_context6.next = 1;
|
|
586
587
|
return this.utils.ResponseToJson(this.HttpClient.Request({
|
|
587
588
|
path: UrlJoin("nodes"),
|
|
588
589
|
method: "GET",
|
|
@@ -590,15 +591,15 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
590
591
|
Authorization: "Bearer ".concat(this.staticToken)
|
|
591
592
|
}
|
|
592
593
|
}));
|
|
593
|
-
case
|
|
594
|
+
case 1:
|
|
594
595
|
_yield$this$utils$Res = _context6.sent;
|
|
595
596
|
nodes = _yield$this$utils$Res.nodes;
|
|
596
597
|
if (!(!nodes || !Array.isArray(nodes) || nodes.length === 0)) {
|
|
597
|
-
_context6.next =
|
|
598
|
+
_context6.next = 2;
|
|
598
599
|
break;
|
|
599
600
|
}
|
|
600
601
|
return _context6.abrupt("return", []);
|
|
601
|
-
case
|
|
602
|
+
case 2:
|
|
602
603
|
return _context6.abrupt("return", nodes.filter(function (node) {
|
|
603
604
|
var match = false;
|
|
604
605
|
if (node.services && node.services.fabric_api && node.services.fabric_api.urls) {
|
|
@@ -615,13 +616,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
615
616
|
_this.ClearStaticToken();
|
|
616
617
|
return match;
|
|
617
618
|
}));
|
|
618
|
-
case
|
|
619
|
+
case 3:
|
|
619
620
|
if (!matchNodeId) {
|
|
620
|
-
_context6.next =
|
|
621
|
+
_context6.next = 5;
|
|
621
622
|
break;
|
|
622
623
|
}
|
|
623
624
|
this.SetStaticToken();
|
|
624
|
-
_context6.next =
|
|
625
|
+
_context6.next = 4;
|
|
625
626
|
return this.utils.ResponseToJson(this.HttpClient.Request({
|
|
626
627
|
path: UrlJoin("nodes", matchNodeId),
|
|
627
628
|
method: "GET",
|
|
@@ -629,17 +630,17 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
629
630
|
Authorization: "Bearer ".concat(this.staticToken)
|
|
630
631
|
}
|
|
631
632
|
}));
|
|
632
|
-
case
|
|
633
|
+
case 4:
|
|
633
634
|
node = _context6.sent;
|
|
634
635
|
this.ClearStaticToken();
|
|
635
636
|
return _context6.abrupt("return", [node]);
|
|
636
|
-
case
|
|
637
|
+
case 5:
|
|
637
638
|
if (!matchWriteToken) {
|
|
638
|
-
_context6.next =
|
|
639
|
+
_context6.next = 7;
|
|
639
640
|
break;
|
|
640
641
|
}
|
|
641
642
|
this.SetStaticToken();
|
|
642
|
-
_context6.next =
|
|
643
|
+
_context6.next = 6;
|
|
643
644
|
return this.utils.ResponseToJson(this.HttpClient.Request({
|
|
644
645
|
path: UrlJoin("nodes"),
|
|
645
646
|
method: "GET",
|
|
@@ -650,12 +651,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
650
651
|
token: matchWriteToken
|
|
651
652
|
}
|
|
652
653
|
}));
|
|
653
|
-
case
|
|
654
|
+
case 6:
|
|
654
655
|
_yield$this$utils$Res2 = _context6.sent;
|
|
655
656
|
_nodes = _yield$this$utils$Res2.nodes;
|
|
656
657
|
this.ClearStaticToken();
|
|
657
658
|
return _context6.abrupt("return", _nodes);
|
|
658
|
-
case
|
|
659
|
+
case 7:
|
|
659
660
|
case "end":
|
|
660
661
|
return _context6.stop();
|
|
661
662
|
}
|
|
@@ -695,30 +696,30 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
695
696
|
}, {
|
|
696
697
|
key: "WriteTokenNodeUrlNetwork",
|
|
697
698
|
value: (function () {
|
|
698
|
-
var _WriteTokenNodeUrlNetwork = _asyncToGenerator(
|
|
699
|
+
var _WriteTokenNodeUrlNetwork = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
|
|
699
700
|
var writeToken, nodes, nodeUrl;
|
|
700
|
-
return _regeneratorRuntime.wrap(function
|
|
701
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
701
702
|
while (1) switch (_context7.prev = _context7.next) {
|
|
702
703
|
case 0:
|
|
703
704
|
writeToken = _ref8.writeToken;
|
|
704
705
|
ValidateWriteToken(writeToken);
|
|
705
|
-
_context7.next =
|
|
706
|
+
_context7.next = 1;
|
|
706
707
|
return this.SpaceNodes({
|
|
707
708
|
matchWriteToken: writeToken
|
|
708
709
|
});
|
|
709
|
-
case
|
|
710
|
+
case 1:
|
|
710
711
|
nodes = _context7.sent;
|
|
711
712
|
nodeUrl = nodes && nodes[0] && nodes[0].services && nodes[0].services.fabric_api && nodes[0].services.fabric_api.urls && nodes[0].services.fabric_api.urls[0];
|
|
712
713
|
if (nodeUrl) {
|
|
713
|
-
_context7.next =
|
|
714
|
+
_context7.next = 2;
|
|
714
715
|
break;
|
|
715
716
|
}
|
|
716
717
|
// eslint-disable-next-line no-console
|
|
717
718
|
console.error("No node url found for write token: ".concat(writeToken));
|
|
718
719
|
return _context7.abrupt("return", "");
|
|
719
|
-
case
|
|
720
|
+
case 2:
|
|
720
721
|
return _context7.abrupt("return", nodeUrl ? nodeUrl.toString() : undefined);
|
|
721
|
-
case
|
|
722
|
+
case 3:
|
|
722
723
|
case "end":
|
|
723
724
|
return _context7.stop();
|
|
724
725
|
}
|
|
@@ -749,9 +750,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
749
750
|
}
|
|
750
751
|
}, {
|
|
751
752
|
key: "RecordWriteToken",
|
|
752
|
-
value: function RecordWriteToken(
|
|
753
|
-
var writeToken =
|
|
754
|
-
fabricNodeUrl =
|
|
753
|
+
value: function RecordWriteToken(_ref0) {
|
|
754
|
+
var writeToken = _ref0.writeToken,
|
|
755
|
+
fabricNodeUrl = _ref0.fabricNodeUrl;
|
|
755
756
|
this.HttpClient.RecordWriteToken(writeToken, fabricNodeUrl);
|
|
756
757
|
}
|
|
757
758
|
|
|
@@ -801,10 +802,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
801
802
|
*/
|
|
802
803
|
}, {
|
|
803
804
|
key: "SetSigner",
|
|
804
|
-
value: function SetSigner(
|
|
805
|
-
var signer =
|
|
806
|
-
|
|
807
|
-
reset =
|
|
805
|
+
value: function SetSigner(_ref1) {
|
|
806
|
+
var signer = _ref1.signer,
|
|
807
|
+
_ref1$reset = _ref1.reset,
|
|
808
|
+
reset = _ref1$reset === void 0 ? true : _ref1$reset;
|
|
808
809
|
this.staticToken = undefined;
|
|
809
810
|
signer.connect(this.ethClient.Provider());
|
|
810
811
|
signer.provider.pollingInterval = 500;
|
|
@@ -829,40 +830,40 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
829
830
|
}, {
|
|
830
831
|
key: "SetRemoteSigner",
|
|
831
832
|
value: (function () {
|
|
832
|
-
var _SetRemoteSigner = _asyncToGenerator(
|
|
833
|
-
var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
|
|
834
|
-
return _regeneratorRuntime.wrap(function
|
|
833
|
+
var _SetRemoteSigner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
|
|
834
|
+
var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
835
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
835
836
|
while (1) switch (_context8.prev = _context8.next) {
|
|
836
837
|
case 0:
|
|
837
|
-
idToken =
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
_context8.next =
|
|
838
|
+
idToken = _ref10.idToken, authToken = _ref10.authToken, tenantId = _ref10.tenantId, extraData = _ref10.extraData, signerURIs = _ref10.signerURIs, unsignedPublicAuth = _ref10.unsignedPublicAuth;
|
|
839
|
+
_t = RemoteSigner;
|
|
840
|
+
_t2 = signerURIs || this.authServiceURIs;
|
|
841
|
+
_t3 = idToken;
|
|
842
|
+
_t4 = authToken;
|
|
843
|
+
_t5 = tenantId;
|
|
844
|
+
_context8.next = 1;
|
|
844
845
|
return this.ethClient.Provider();
|
|
845
|
-
case
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
signerURIs:
|
|
851
|
-
idToken:
|
|
852
|
-
authToken:
|
|
853
|
-
tenantId:
|
|
854
|
-
provider:
|
|
855
|
-
extraData:
|
|
856
|
-
unsignedPublicAuth:
|
|
846
|
+
case 1:
|
|
847
|
+
_t6 = _context8.sent;
|
|
848
|
+
_t7 = extraData;
|
|
849
|
+
_t8 = unsignedPublicAuth;
|
|
850
|
+
_t9 = {
|
|
851
|
+
signerURIs: _t2,
|
|
852
|
+
idToken: _t3,
|
|
853
|
+
authToken: _t4,
|
|
854
|
+
tenantId: _t5,
|
|
855
|
+
provider: _t6,
|
|
856
|
+
extraData: _t7,
|
|
857
|
+
unsignedPublicAuth: _t8
|
|
857
858
|
};
|
|
858
|
-
signer = new
|
|
859
|
-
_context8.next =
|
|
859
|
+
signer = new _t(_t9);
|
|
860
|
+
_context8.next = 2;
|
|
860
861
|
return signer.Initialize();
|
|
861
|
-
case
|
|
862
|
+
case 2:
|
|
862
863
|
this.SetSigner({
|
|
863
864
|
signer: signer
|
|
864
865
|
});
|
|
865
|
-
case
|
|
866
|
+
case 3:
|
|
866
867
|
case "end":
|
|
867
868
|
return _context8.stop();
|
|
868
869
|
}
|
|
@@ -887,23 +888,23 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
887
888
|
}, {
|
|
888
889
|
key: "SetSignerFromWeb3Provider",
|
|
889
890
|
value: (function () {
|
|
890
|
-
var _SetSignerFromWeb3Provider = _asyncToGenerator(
|
|
891
|
+
var _SetSignerFromWeb3Provider = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref11) {
|
|
891
892
|
var provider, ethProvider;
|
|
892
|
-
return _regeneratorRuntime.wrap(function
|
|
893
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
893
894
|
while (1) switch (_context9.prev = _context9.next) {
|
|
894
895
|
case 0:
|
|
895
|
-
provider =
|
|
896
|
+
provider = _ref11.provider;
|
|
896
897
|
this.staticToken = undefined;
|
|
897
898
|
ethProvider = new Ethers.providers.Web3Provider(provider);
|
|
898
899
|
ethProvider.pollingInterval = 250;
|
|
899
900
|
this.signer = ethProvider.getSigner();
|
|
900
|
-
_context9.next =
|
|
901
|
+
_context9.next = 1;
|
|
901
902
|
return this.signer.getAddress();
|
|
902
|
-
case
|
|
903
|
+
case 1:
|
|
903
904
|
this.signer.address = _context9.sent;
|
|
904
|
-
_context9.next =
|
|
905
|
+
_context9.next = 2;
|
|
905
906
|
return this.InitializeClients();
|
|
906
|
-
case
|
|
907
|
+
case 2:
|
|
907
908
|
case "end":
|
|
908
909
|
return _context9.stop();
|
|
909
910
|
}
|
|
@@ -933,12 +934,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
933
934
|
}, {
|
|
934
935
|
key: "CreateAccount",
|
|
935
936
|
value: (function () {
|
|
936
|
-
var _CreateAccount = _asyncToGenerator(
|
|
937
|
-
var tenantId, fundingToken,
|
|
938
|
-
return _regeneratorRuntime.wrap(function
|
|
939
|
-
while (1) switch (
|
|
937
|
+
var _CreateAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref12) {
|
|
938
|
+
var tenantId, fundingToken, _ref12$funds, funds, groupToken, wallet, signer;
|
|
939
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
940
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
940
941
|
case 0:
|
|
941
|
-
tenantId =
|
|
942
|
+
tenantId = _ref12.tenantId, fundingToken = _ref12.fundingToken, _ref12$funds = _ref12.funds, funds = _ref12$funds === void 0 ? 0.5 : _ref12$funds, groupToken = _ref12.groupToken;
|
|
942
943
|
if (!this.signer) {
|
|
943
944
|
wallet = this.GenerateWallet();
|
|
944
945
|
signer = wallet.AddAccountFromMnemonic({
|
|
@@ -948,7 +949,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
948
949
|
signer: signer
|
|
949
950
|
});
|
|
950
951
|
}
|
|
951
|
-
|
|
952
|
+
_context0.next = 1;
|
|
952
953
|
return this.authClient.MakeKMSRequest({
|
|
953
954
|
method: "POST",
|
|
954
955
|
path: "/ks/otp/fnd/".concat(tenantId),
|
|
@@ -960,21 +961,21 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
960
961
|
Authorization: "Bearer ".concat(fundingToken)
|
|
961
962
|
}
|
|
962
963
|
});
|
|
963
|
-
case
|
|
964
|
-
|
|
964
|
+
case 1:
|
|
965
|
+
_context0.next = 2;
|
|
965
966
|
return this.userProfileClient.CreateWallet();
|
|
966
|
-
case
|
|
967
|
-
|
|
967
|
+
case 2:
|
|
968
|
+
_context0.next = 3;
|
|
968
969
|
return this.userProfileClient.ReplaceUserMetadata({
|
|
969
970
|
metadataSubtree: "tenantContractId",
|
|
970
971
|
metadata: tenantId
|
|
971
972
|
});
|
|
972
|
-
case
|
|
973
|
+
case 3:
|
|
973
974
|
if (!groupToken) {
|
|
974
|
-
|
|
975
|
+
_context0.next = 4;
|
|
975
976
|
break;
|
|
976
977
|
}
|
|
977
|
-
|
|
978
|
+
_context0.next = 4;
|
|
978
979
|
return this.authClient.MakeKMSRequest({
|
|
979
980
|
method: "POST",
|
|
980
981
|
path: "/ks/otp/grp/".concat(tenantId),
|
|
@@ -985,13 +986,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
985
986
|
Authorization: "Bearer ".concat(groupToken)
|
|
986
987
|
}
|
|
987
988
|
});
|
|
988
|
-
case
|
|
989
|
-
return
|
|
990
|
-
case
|
|
989
|
+
case 4:
|
|
990
|
+
return _context0.abrupt("return", this.utils.FormatAddress(this.signer.address));
|
|
991
|
+
case 5:
|
|
991
992
|
case "end":
|
|
992
|
-
return
|
|
993
|
+
return _context0.stop();
|
|
993
994
|
}
|
|
994
|
-
},
|
|
995
|
+
}, _callee0, this);
|
|
995
996
|
}));
|
|
996
997
|
function CreateAccount(_x6) {
|
|
997
998
|
return _CreateAccount.apply(this, arguments);
|
|
@@ -1011,62 +1012,63 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1011
1012
|
}, {
|
|
1012
1013
|
key: "PersonalSign",
|
|
1013
1014
|
value: (function () {
|
|
1014
|
-
var _PersonalSign = _asyncToGenerator(
|
|
1015
|
+
var _PersonalSign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref13) {
|
|
1015
1016
|
var _this2 = this;
|
|
1016
1017
|
var message, addEthereumPrefix, Sign;
|
|
1017
|
-
return _regeneratorRuntime.wrap(function
|
|
1018
|
-
while (1) switch (
|
|
1018
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1019
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1019
1020
|
case 0:
|
|
1020
|
-
message =
|
|
1021
|
+
message = _ref13.message, addEthereumPrefix = _ref13.addEthereumPrefix, Sign = _ref13.Sign;
|
|
1021
1022
|
if (!Sign) {
|
|
1022
1023
|
// Same as authClient.Sign, but authClient may not yet be initialized
|
|
1023
1024
|
Sign = /*#__PURE__*/function () {
|
|
1024
|
-
var
|
|
1025
|
-
|
|
1026
|
-
|
|
1025
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(message) {
|
|
1026
|
+
var _t0, _t1, _t10;
|
|
1027
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1028
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1027
1029
|
case 0:
|
|
1028
|
-
|
|
1030
|
+
_t0 = Ethers.utils;
|
|
1029
1031
|
if (!_this2.signer.signDigest) {
|
|
1030
|
-
|
|
1032
|
+
_context1.next = 2;
|
|
1031
1033
|
break;
|
|
1032
1034
|
}
|
|
1033
|
-
|
|
1035
|
+
_context1.next = 1;
|
|
1034
1036
|
return _this2.signer.signDigest(message);
|
|
1035
|
-
case
|
|
1036
|
-
|
|
1037
|
-
|
|
1037
|
+
case 1:
|
|
1038
|
+
_t1 = _context1.sent;
|
|
1039
|
+
_context1.next = 4;
|
|
1038
1040
|
break;
|
|
1039
|
-
case
|
|
1040
|
-
|
|
1041
|
+
case 2:
|
|
1042
|
+
_context1.next = 3;
|
|
1041
1043
|
return _this2.signer._signingKey().signDigest(message);
|
|
1042
|
-
case
|
|
1043
|
-
|
|
1044
|
-
case
|
|
1045
|
-
|
|
1046
|
-
return
|
|
1047
|
-
case
|
|
1044
|
+
case 3:
|
|
1045
|
+
_t1 = _context1.sent;
|
|
1046
|
+
case 4:
|
|
1047
|
+
_t10 = _t1;
|
|
1048
|
+
return _context1.abrupt("return", _t0.joinSignature.call(_t0, _t10));
|
|
1049
|
+
case 5:
|
|
1048
1050
|
case "end":
|
|
1049
|
-
return
|
|
1051
|
+
return _context1.stop();
|
|
1050
1052
|
}
|
|
1051
|
-
},
|
|
1053
|
+
}, _callee1);
|
|
1052
1054
|
}));
|
|
1053
1055
|
return function Sign(_x8) {
|
|
1054
|
-
return
|
|
1056
|
+
return _ref14.apply(this, arguments);
|
|
1055
1057
|
};
|
|
1056
1058
|
}();
|
|
1057
1059
|
}
|
|
1058
1060
|
if (addEthereumPrefix) {
|
|
1059
1061
|
message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
|
|
1060
1062
|
}
|
|
1061
|
-
|
|
1063
|
+
_context10.next = 1;
|
|
1062
1064
|
return Sign(message);
|
|
1063
|
-
case
|
|
1064
|
-
return
|
|
1065
|
-
case
|
|
1065
|
+
case 1:
|
|
1066
|
+
return _context10.abrupt("return", _context10.sent);
|
|
1067
|
+
case 2:
|
|
1066
1068
|
case "end":
|
|
1067
|
-
return
|
|
1069
|
+
return _context10.stop();
|
|
1068
1070
|
}
|
|
1069
|
-
},
|
|
1071
|
+
}, _callee10);
|
|
1070
1072
|
}));
|
|
1071
1073
|
function PersonalSign(_x7) {
|
|
1072
1074
|
return _PersonalSign.apply(this, arguments);
|
|
@@ -1088,65 +1090,75 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1088
1090
|
}, {
|
|
1089
1091
|
key: "CreateFabricToken",
|
|
1090
1092
|
value: (function () {
|
|
1091
|
-
var _CreateFabricToken = _asyncToGenerator(
|
|
1092
|
-
var
|
|
1093
|
-
|
|
1093
|
+
var _CreateFabricToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
1094
|
+
var _ref15,
|
|
1095
|
+
_ref15$duration,
|
|
1094
1096
|
duration,
|
|
1095
|
-
|
|
1097
|
+
_ref15$spec,
|
|
1096
1098
|
spec,
|
|
1097
1099
|
address,
|
|
1098
1100
|
Sign,
|
|
1099
|
-
|
|
1101
|
+
_ref15$addEthereumPre,
|
|
1100
1102
|
addEthereumPrefix,
|
|
1101
|
-
|
|
1103
|
+
_ref15$context,
|
|
1102
1104
|
context,
|
|
1103
1105
|
token,
|
|
1104
1106
|
message,
|
|
1105
1107
|
signature,
|
|
1106
1108
|
compressedToken,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1109
|
+
_args11 = arguments,
|
|
1110
|
+
_t11,
|
|
1111
|
+
_t12,
|
|
1112
|
+
_t13,
|
|
1113
|
+
_t14,
|
|
1114
|
+
_t15,
|
|
1115
|
+
_t16,
|
|
1116
|
+
_t17,
|
|
1117
|
+
_t18,
|
|
1118
|
+
_t19,
|
|
1119
|
+
_t20;
|
|
1120
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1121
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1110
1122
|
case 0:
|
|
1111
|
-
|
|
1123
|
+
_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, _ref15$context = _ref15.context, context = _ref15$context === void 0 ? {} : _ref15$context;
|
|
1112
1124
|
address = address || this.CurrentAccountAddress();
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1125
|
+
_t11 = _objectSpread;
|
|
1126
|
+
_t12 = _objectSpread({}, spec);
|
|
1127
|
+
_t13 = {};
|
|
1128
|
+
_t14 = "iusr".concat(Utils.AddressToHash(address));
|
|
1129
|
+
_t15 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
|
|
1130
|
+
_context11.next = 1;
|
|
1119
1131
|
return this.ContentSpaceId();
|
|
1120
|
-
case
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
sub:
|
|
1127
|
-
adr:
|
|
1128
|
-
spc:
|
|
1129
|
-
iat:
|
|
1130
|
-
exp:
|
|
1131
|
-
ctx:
|
|
1132
|
+
case 1:
|
|
1133
|
+
_t16 = _context11.sent;
|
|
1134
|
+
_t17 = Date.now();
|
|
1135
|
+
_t18 = Date.now() + duration;
|
|
1136
|
+
_t19 = context;
|
|
1137
|
+
_t20 = {
|
|
1138
|
+
sub: _t14,
|
|
1139
|
+
adr: _t15,
|
|
1140
|
+
spc: _t16,
|
|
1141
|
+
iat: _t17,
|
|
1142
|
+
exp: _t18,
|
|
1143
|
+
ctx: _t19
|
|
1132
1144
|
};
|
|
1133
|
-
token = (
|
|
1145
|
+
token = _t11(_t12, _t13, _t20);
|
|
1134
1146
|
message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
|
|
1135
|
-
|
|
1147
|
+
_context11.next = 2;
|
|
1136
1148
|
return this.PersonalSign({
|
|
1137
1149
|
message: message,
|
|
1138
1150
|
addEthereumPrefix: addEthereumPrefix,
|
|
1139
1151
|
Sign: Sign
|
|
1140
1152
|
});
|
|
1141
|
-
case
|
|
1142
|
-
signature =
|
|
1153
|
+
case 2:
|
|
1154
|
+
signature = _context11.sent;
|
|
1143
1155
|
compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
|
|
1144
|
-
return
|
|
1145
|
-
case
|
|
1156
|
+
return _context11.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
|
|
1157
|
+
case 3:
|
|
1146
1158
|
case "end":
|
|
1147
|
-
return
|
|
1159
|
+
return _context11.stop();
|
|
1148
1160
|
}
|
|
1149
|
-
},
|
|
1161
|
+
}, _callee11, this);
|
|
1150
1162
|
}));
|
|
1151
1163
|
function CreateFabricToken() {
|
|
1152
1164
|
return _CreateFabricToken.apply(this, arguments);
|
|
@@ -1175,99 +1187,99 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1175
1187
|
}, {
|
|
1176
1188
|
key: "CreateSignedToken",
|
|
1177
1189
|
value: (function () {
|
|
1178
|
-
var _CreateSignedToken = _asyncToGenerator(
|
|
1179
|
-
var libraryId, objectId, versionHash, policyId, subject,
|
|
1180
|
-
return _regeneratorRuntime.wrap(function
|
|
1181
|
-
while (1) switch (
|
|
1190
|
+
var _CreateSignedToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref16) {
|
|
1191
|
+
var libraryId, objectId, versionHash, policyId, subject, _ref16$grantType, grantType, _ref16$allowDecryptio, allowDecryption, duration, _ref16$context, context, issueTime, expirationTime, issueDateTime, token, cap, compressedToken, signature, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33;
|
|
1192
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
1193
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1182
1194
|
case 0:
|
|
1183
|
-
libraryId =
|
|
1195
|
+
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, issueTime = _ref16.issueTime, expirationTime = _ref16.expirationTime;
|
|
1184
1196
|
if (subject) {
|
|
1185
|
-
|
|
1197
|
+
_context12.next = 2;
|
|
1186
1198
|
break;
|
|
1187
1199
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1200
|
+
_t21 = "iusr";
|
|
1201
|
+
_t22 = this.utils;
|
|
1202
|
+
_context12.next = 1;
|
|
1191
1203
|
return this.CurrentAccountAddress();
|
|
1192
|
-
case
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
subject =
|
|
1196
|
-
case
|
|
1204
|
+
case 1:
|
|
1205
|
+
_t23 = _context12.sent;
|
|
1206
|
+
_t24 = _t22.AddressToHash.call(_t22, _t23);
|
|
1207
|
+
subject = _t21.concat.call(_t21, _t24);
|
|
1208
|
+
case 2:
|
|
1197
1209
|
if (policyId) {
|
|
1198
1210
|
context["elv:delegation-id"] = policyId;
|
|
1199
1211
|
}
|
|
1200
1212
|
issueDateTime = issueTime || Date.now();
|
|
1201
|
-
|
|
1202
|
-
|
|
1213
|
+
_t25 = Buffer;
|
|
1214
|
+
_context12.next = 3;
|
|
1203
1215
|
return this.CurrentAccountAddress().replace(/^0x/, "");
|
|
1204
|
-
case
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1216
|
+
case 3:
|
|
1217
|
+
_t26 = _context12.sent;
|
|
1218
|
+
_t27 = _t25.from.call(_t25, _t26, "hex").toString("base64");
|
|
1219
|
+
_t28 = subject;
|
|
1220
|
+
_context12.next = 4;
|
|
1209
1221
|
return this.ContentSpaceId();
|
|
1210
|
-
case
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1222
|
+
case 4:
|
|
1223
|
+
_t29 = _context12.sent;
|
|
1224
|
+
_t30 = issueDateTime;
|
|
1225
|
+
_t31 = expirationTime || issueDateTime + duration;
|
|
1226
|
+
_t32 = grantType;
|
|
1227
|
+
_t33 = context;
|
|
1216
1228
|
token = {
|
|
1217
|
-
adr:
|
|
1218
|
-
sub:
|
|
1219
|
-
spc:
|
|
1220
|
-
iat:
|
|
1221
|
-
exp:
|
|
1222
|
-
gra:
|
|
1223
|
-
ctx:
|
|
1229
|
+
adr: _t27,
|
|
1230
|
+
sub: _t28,
|
|
1231
|
+
spc: _t29,
|
|
1232
|
+
iat: _t30,
|
|
1233
|
+
exp: _t31,
|
|
1234
|
+
gra: _t32,
|
|
1235
|
+
ctx: _t33
|
|
1224
1236
|
};
|
|
1225
1237
|
if (versionHash) {
|
|
1226
1238
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1227
1239
|
}
|
|
1228
1240
|
if (!objectId) {
|
|
1229
|
-
|
|
1241
|
+
_context12.next = 6;
|
|
1230
1242
|
break;
|
|
1231
1243
|
}
|
|
1232
1244
|
token.qid = objectId;
|
|
1233
1245
|
if (libraryId) {
|
|
1234
|
-
|
|
1246
|
+
_context12.next = 6;
|
|
1235
1247
|
break;
|
|
1236
1248
|
}
|
|
1237
|
-
|
|
1249
|
+
_context12.next = 5;
|
|
1238
1250
|
return this.ContentObjectLibraryId({
|
|
1239
1251
|
objectId: objectId
|
|
1240
1252
|
});
|
|
1241
|
-
case
|
|
1242
|
-
libraryId =
|
|
1243
|
-
case
|
|
1253
|
+
case 5:
|
|
1254
|
+
libraryId = _context12.sent;
|
|
1255
|
+
case 6:
|
|
1244
1256
|
if (libraryId) {
|
|
1245
1257
|
token.lib = libraryId;
|
|
1246
1258
|
}
|
|
1247
1259
|
if (!allowDecryption) {
|
|
1248
|
-
|
|
1260
|
+
_context12.next = 8;
|
|
1249
1261
|
break;
|
|
1250
1262
|
}
|
|
1251
|
-
|
|
1263
|
+
_context12.next = 7;
|
|
1252
1264
|
return this.authClient.ReEncryptionConk({
|
|
1253
1265
|
libraryId: libraryId,
|
|
1254
1266
|
objectId: objectId
|
|
1255
1267
|
});
|
|
1256
|
-
case
|
|
1257
|
-
cap =
|
|
1268
|
+
case 7:
|
|
1269
|
+
cap = _context12.sent;
|
|
1258
1270
|
token.apk = cap.public_key;
|
|
1259
|
-
case
|
|
1271
|
+
case 8:
|
|
1260
1272
|
compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
|
|
1261
|
-
|
|
1273
|
+
_context12.next = 9;
|
|
1262
1274
|
return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
|
|
1263
|
-
case
|
|
1264
|
-
signature =
|
|
1265
|
-
return
|
|
1266
|
-
case
|
|
1275
|
+
case 9:
|
|
1276
|
+
signature = _context12.sent;
|
|
1277
|
+
return _context12.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
|
|
1278
|
+
case 10:
|
|
1267
1279
|
case "end":
|
|
1268
|
-
return
|
|
1280
|
+
return _context12.stop();
|
|
1269
1281
|
}
|
|
1270
|
-
},
|
|
1282
|
+
}, _callee12, this);
|
|
1271
1283
|
}));
|
|
1272
1284
|
function CreateSignedToken(_x9) {
|
|
1273
1285
|
return _CreateSignedToken.apply(this, arguments);
|
|
@@ -1277,21 +1289,21 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1277
1289
|
}, {
|
|
1278
1290
|
key: "CreateAuthorizationToken",
|
|
1279
1291
|
value: function () {
|
|
1280
|
-
var _CreateAuthorizationToken = _asyncToGenerator(
|
|
1281
|
-
return _regeneratorRuntime.wrap(function
|
|
1282
|
-
while (1) switch (
|
|
1292
|
+
var _CreateAuthorizationToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(args) {
|
|
1293
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
1294
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1283
1295
|
case 0:
|
|
1284
|
-
|
|
1296
|
+
_context13.next = 1;
|
|
1285
1297
|
return this.authClient.AuthorizationToken(args);
|
|
1298
|
+
case 1:
|
|
1299
|
+
return _context13.abrupt("return", _context13.sent);
|
|
1286
1300
|
case 2:
|
|
1287
|
-
return _context15.abrupt("return", _context15.sent);
|
|
1288
|
-
case 3:
|
|
1289
1301
|
case "end":
|
|
1290
|
-
return
|
|
1302
|
+
return _context13.stop();
|
|
1291
1303
|
}
|
|
1292
|
-
},
|
|
1304
|
+
}, _callee13, this);
|
|
1293
1305
|
}));
|
|
1294
|
-
function CreateAuthorizationToken(
|
|
1306
|
+
function CreateAuthorizationToken(_x0) {
|
|
1295
1307
|
return _CreateAuthorizationToken.apply(this, arguments);
|
|
1296
1308
|
}
|
|
1297
1309
|
return CreateAuthorizationToken;
|
|
@@ -1313,30 +1325,30 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1313
1325
|
}, {
|
|
1314
1326
|
key: "CreateSignedMessageJSON",
|
|
1315
1327
|
value: (function () {
|
|
1316
|
-
var _CreateSignedMessageJSON = _asyncToGenerator(
|
|
1328
|
+
var _CreateSignedMessageJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref17) {
|
|
1317
1329
|
var message, type, msg, signature;
|
|
1318
|
-
return _regeneratorRuntime.wrap(function
|
|
1319
|
-
while (1) switch (
|
|
1330
|
+
return _regeneratorRuntime.wrap(function (_context14) {
|
|
1331
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1320
1332
|
case 0:
|
|
1321
|
-
message =
|
|
1333
|
+
message = _ref17.message;
|
|
1322
1334
|
// Only one kind of signature supported currently
|
|
1323
1335
|
type = "mje_"; // JSON message, EIP192 signature
|
|
1324
1336
|
msg = JSON.stringify(message);
|
|
1325
|
-
|
|
1337
|
+
_context14.next = 1;
|
|
1326
1338
|
return this.PersonalSign({
|
|
1327
1339
|
message: msg,
|
|
1328
1340
|
addEthereumPrefix: true
|
|
1329
1341
|
});
|
|
1330
|
-
case
|
|
1331
|
-
signature =
|
|
1332
|
-
return
|
|
1333
|
-
case
|
|
1342
|
+
case 1:
|
|
1343
|
+
signature = _context14.sent;
|
|
1344
|
+
return _context14.abrupt("return", "".concat(type).concat(Utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(msg)]))));
|
|
1345
|
+
case 2:
|
|
1334
1346
|
case "end":
|
|
1335
|
-
return
|
|
1347
|
+
return _context14.stop();
|
|
1336
1348
|
}
|
|
1337
|
-
},
|
|
1349
|
+
}, _callee14, this);
|
|
1338
1350
|
}));
|
|
1339
|
-
function CreateSignedMessageJSON(
|
|
1351
|
+
function CreateSignedMessageJSON(_x1) {
|
|
1340
1352
|
return _CreateSignedMessageJSON.apply(this, arguments);
|
|
1341
1353
|
}
|
|
1342
1354
|
return CreateSignedMessageJSON;
|
|
@@ -1353,38 +1365,38 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1353
1365
|
}, {
|
|
1354
1366
|
key: "DecodeSignedMessageJSON",
|
|
1355
1367
|
value: (function () {
|
|
1356
|
-
var _DecodeSignedMessageJSON = _asyncToGenerator(
|
|
1357
|
-
var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr;
|
|
1358
|
-
return _regeneratorRuntime.wrap(function
|
|
1359
|
-
while (1) switch (
|
|
1368
|
+
var _DecodeSignedMessageJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref18) {
|
|
1369
|
+
var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr, _t34;
|
|
1370
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
1371
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1360
1372
|
case 0:
|
|
1361
|
-
signedMessage =
|
|
1373
|
+
signedMessage = _ref18.signedMessage;
|
|
1362
1374
|
type = signedMessage.slice(0, 4);
|
|
1363
|
-
|
|
1364
|
-
|
|
1375
|
+
_t34 = type;
|
|
1376
|
+
_context15.next = _t34 === "mje_" ? 1 : 2;
|
|
1365
1377
|
break;
|
|
1366
|
-
case
|
|
1378
|
+
case 1:
|
|
1367
1379
|
msgBytes = Utils.FromB58(signedMessage.slice(4));
|
|
1368
1380
|
signature = msgBytes.slice(0, 65);
|
|
1369
1381
|
msg = msgBytes.slice(65);
|
|
1370
1382
|
obj = JSON.parse(msg);
|
|
1371
1383
|
prefixedMsgHash = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(msg.length).concat(msg), "utf-8"));
|
|
1372
1384
|
signerAddr = Ethers.utils.recoverAddress(prefixedMsgHash, signature);
|
|
1373
|
-
return
|
|
1385
|
+
return _context15.abrupt("return", {
|
|
1374
1386
|
type: type,
|
|
1375
1387
|
message: obj,
|
|
1376
1388
|
signerAddress: signerAddr,
|
|
1377
1389
|
signature: "0x" + signature.toString("hex")
|
|
1378
1390
|
});
|
|
1379
|
-
case
|
|
1391
|
+
case 2:
|
|
1380
1392
|
throw new Error("Bad message type: ".concat(type));
|
|
1381
|
-
case
|
|
1393
|
+
case 3:
|
|
1382
1394
|
case "end":
|
|
1383
|
-
return
|
|
1395
|
+
return _context15.stop();
|
|
1384
1396
|
}
|
|
1385
|
-
},
|
|
1397
|
+
}, _callee15);
|
|
1386
1398
|
}));
|
|
1387
|
-
function DecodeSignedMessageJSON(
|
|
1399
|
+
function DecodeSignedMessageJSON(_x10) {
|
|
1388
1400
|
return _DecodeSignedMessageJSON.apply(this, arguments);
|
|
1389
1401
|
}
|
|
1390
1402
|
return DecodeSignedMessageJSON;
|
|
@@ -1412,12 +1424,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1412
1424
|
}, {
|
|
1413
1425
|
key: "SetOauthToken",
|
|
1414
1426
|
value: (function () {
|
|
1415
|
-
var _SetOauthToken = _asyncToGenerator(
|
|
1427
|
+
var _SetOauthToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref19) {
|
|
1416
1428
|
var token, wallet, signer;
|
|
1417
|
-
return _regeneratorRuntime.wrap(function
|
|
1418
|
-
while (1) switch (
|
|
1429
|
+
return _regeneratorRuntime.wrap(function (_context16) {
|
|
1430
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1419
1431
|
case 0:
|
|
1420
|
-
token =
|
|
1432
|
+
token = _ref19.token;
|
|
1421
1433
|
this.oauthToken = token;
|
|
1422
1434
|
wallet = this.GenerateWallet();
|
|
1423
1435
|
signer = wallet.AddAccountFromMnemonic({
|
|
@@ -1426,13 +1438,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1426
1438
|
this.SetSigner({
|
|
1427
1439
|
signer: signer
|
|
1428
1440
|
});
|
|
1429
|
-
case
|
|
1441
|
+
case 1:
|
|
1430
1442
|
case "end":
|
|
1431
|
-
return
|
|
1443
|
+
return _context16.stop();
|
|
1432
1444
|
}
|
|
1433
|
-
},
|
|
1445
|
+
}, _callee16, this);
|
|
1434
1446
|
}));
|
|
1435
|
-
function SetOauthToken(
|
|
1447
|
+
function SetOauthToken(_x11) {
|
|
1436
1448
|
return _SetOauthToken.apply(this, arguments);
|
|
1437
1449
|
}
|
|
1438
1450
|
return SetOauthToken;
|
|
@@ -1451,57 +1463,57 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1451
1463
|
}, {
|
|
1452
1464
|
key: "SetSignerFromOauthToken",
|
|
1453
1465
|
value: (function () {
|
|
1454
|
-
var _SetSignerFromOauthToken = _asyncToGenerator(
|
|
1455
|
-
var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
|
|
1456
|
-
return _regeneratorRuntime.wrap(function
|
|
1457
|
-
while (1) switch (
|
|
1466
|
+
var _SetSignerFromOauthToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref20) {
|
|
1467
|
+
var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey, _t35;
|
|
1468
|
+
return _regeneratorRuntime.wrap(function (_context17) {
|
|
1469
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1458
1470
|
case 0:
|
|
1459
|
-
token =
|
|
1471
|
+
token = _ref20.token;
|
|
1460
1472
|
if (this.trustAuthorityId) {
|
|
1461
|
-
|
|
1473
|
+
_context17.next = 1;
|
|
1462
1474
|
break;
|
|
1463
1475
|
}
|
|
1464
1476
|
throw Error("Unable to authorize with OAuth token: No trust authority ID set");
|
|
1465
|
-
case
|
|
1477
|
+
case 1:
|
|
1466
1478
|
wallet = this.GenerateWallet();
|
|
1467
|
-
|
|
1479
|
+
_context17.prev = 2;
|
|
1468
1480
|
if (this.kmsURIs) {
|
|
1469
|
-
|
|
1481
|
+
_context17.next = 6;
|
|
1470
1482
|
break;
|
|
1471
1483
|
}
|
|
1472
|
-
|
|
1484
|
+
_context17.next = 3;
|
|
1473
1485
|
return ElvClient.FromConfigurationUrl({
|
|
1474
1486
|
configUrl: this.configUrl
|
|
1475
1487
|
});
|
|
1476
|
-
case
|
|
1477
|
-
client =
|
|
1488
|
+
case 3:
|
|
1489
|
+
client = _context17.sent;
|
|
1478
1490
|
client.SetSigner({
|
|
1479
1491
|
signer: wallet.AddAccount({
|
|
1480
1492
|
privateKey: this.defaultKey
|
|
1481
1493
|
})
|
|
1482
1494
|
});
|
|
1483
|
-
|
|
1495
|
+
_context17.next = 4;
|
|
1484
1496
|
return client.authClient.KMSInfo({
|
|
1485
1497
|
kmsId: this.trustAuthorityId
|
|
1486
1498
|
});
|
|
1487
|
-
case
|
|
1488
|
-
_yield$client$authCli =
|
|
1499
|
+
case 4:
|
|
1500
|
+
_yield$client$authCli = _context17.sent;
|
|
1489
1501
|
urls = _yield$client$authCli.urls;
|
|
1490
1502
|
if (!(!urls || urls.length === 0)) {
|
|
1491
|
-
|
|
1503
|
+
_context17.next = 5;
|
|
1492
1504
|
break;
|
|
1493
1505
|
}
|
|
1494
1506
|
throw Error("Unable to authorize with OAuth token: No KMS URLs set");
|
|
1495
|
-
case
|
|
1507
|
+
case 5:
|
|
1496
1508
|
this.kmsURIs = urls;
|
|
1497
|
-
case
|
|
1509
|
+
case 6:
|
|
1498
1510
|
this.oauthToken = token;
|
|
1499
1511
|
path = "/ks/jwt/wlt";
|
|
1500
1512
|
httpClient = new HttpClient({
|
|
1501
1513
|
uris: this.kmsURIs,
|
|
1502
1514
|
debug: this.debug
|
|
1503
1515
|
});
|
|
1504
|
-
|
|
1516
|
+
_context17.next = 7;
|
|
1505
1517
|
return this.utils.ResponseToJson(httpClient.Request({
|
|
1506
1518
|
headers: {
|
|
1507
1519
|
Authorization: "Bearer ".concat(token)
|
|
@@ -1510,8 +1522,8 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1510
1522
|
path: path,
|
|
1511
1523
|
forceFailover: true
|
|
1512
1524
|
}));
|
|
1513
|
-
case
|
|
1514
|
-
response =
|
|
1525
|
+
case 7:
|
|
1526
|
+
response = _context17.sent;
|
|
1515
1527
|
privateKey = response["UserSKHex"];
|
|
1516
1528
|
this.SetSigner({
|
|
1517
1529
|
signer: wallet.AddAccount({
|
|
@@ -1520,27 +1532,27 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1520
1532
|
});
|
|
1521
1533
|
|
|
1522
1534
|
// Ensure wallet is initialized
|
|
1523
|
-
|
|
1535
|
+
_context17.next = 8;
|
|
1524
1536
|
return this.userProfileClient.WalletAddress();
|
|
1525
|
-
case
|
|
1526
|
-
|
|
1537
|
+
case 8:
|
|
1538
|
+
_context17.next = 11;
|
|
1527
1539
|
break;
|
|
1528
|
-
case
|
|
1529
|
-
|
|
1530
|
-
|
|
1540
|
+
case 9:
|
|
1541
|
+
_context17.prev = 9;
|
|
1542
|
+
_t35 = _context17["catch"](2);
|
|
1531
1543
|
this.Log("Failed to set signer from OAuth token:", true);
|
|
1532
|
-
this.Log(
|
|
1533
|
-
|
|
1544
|
+
this.Log(_t35, true);
|
|
1545
|
+
_context17.next = 10;
|
|
1534
1546
|
return this.ClearSigner();
|
|
1535
|
-
case
|
|
1536
|
-
throw
|
|
1537
|
-
case
|
|
1547
|
+
case 10:
|
|
1548
|
+
throw _t35;
|
|
1549
|
+
case 11:
|
|
1538
1550
|
case "end":
|
|
1539
|
-
return
|
|
1551
|
+
return _context17.stop();
|
|
1540
1552
|
}
|
|
1541
|
-
},
|
|
1553
|
+
}, _callee17, this, [[2, 9]]);
|
|
1542
1554
|
}));
|
|
1543
|
-
function SetSignerFromOauthToken(
|
|
1555
|
+
function SetSignerFromOauthToken(_x12) {
|
|
1544
1556
|
return _SetSignerFromOauthToken.apply(this, arguments);
|
|
1545
1557
|
}
|
|
1546
1558
|
return SetSignerFromOauthToken;
|
|
@@ -1557,8 +1569,8 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1557
1569
|
)
|
|
1558
1570
|
}, {
|
|
1559
1571
|
key: "CreateStaticToken",
|
|
1560
|
-
value: function CreateStaticToken(
|
|
1561
|
-
var libraryId =
|
|
1572
|
+
value: function CreateStaticToken(_ref21) {
|
|
1573
|
+
var libraryId = _ref21.libraryId;
|
|
1562
1574
|
var token = {
|
|
1563
1575
|
qspace_id: this.client.contentSpaceId
|
|
1564
1576
|
};
|
|
@@ -1579,10 +1591,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1579
1591
|
}, {
|
|
1580
1592
|
key: "SetStaticToken",
|
|
1581
1593
|
value: function SetStaticToken() {
|
|
1582
|
-
var
|
|
1583
|
-
token =
|
|
1584
|
-
|
|
1585
|
-
update =
|
|
1594
|
+
var _ref22 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1595
|
+
token = _ref22.token,
|
|
1596
|
+
_ref22$update = _ref22.update,
|
|
1597
|
+
update = _ref22$update === void 0 ? false : _ref22$update;
|
|
1586
1598
|
if (token) {
|
|
1587
1599
|
this.staticToken = token;
|
|
1588
1600
|
} else {
|
|
@@ -1614,30 +1626,30 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1614
1626
|
}, {
|
|
1615
1627
|
key: "SetPolicyAuthorization",
|
|
1616
1628
|
value: (function () {
|
|
1617
|
-
var _SetPolicyAuthorization = _asyncToGenerator(
|
|
1618
|
-
var objectId;
|
|
1619
|
-
return _regeneratorRuntime.wrap(function
|
|
1620
|
-
while (1) switch (
|
|
1629
|
+
var _SetPolicyAuthorization = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref23) {
|
|
1630
|
+
var objectId, _t36, _t37, _t38;
|
|
1631
|
+
return _regeneratorRuntime.wrap(function (_context18) {
|
|
1632
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1621
1633
|
case 0:
|
|
1622
|
-
objectId =
|
|
1623
|
-
|
|
1624
|
-
|
|
1634
|
+
objectId = _ref23.objectId;
|
|
1635
|
+
_t36 = this;
|
|
1636
|
+
_context18.next = 1;
|
|
1625
1637
|
return this.GenerateStateChannelToken({
|
|
1626
1638
|
objectId: objectId
|
|
1627
1639
|
});
|
|
1628
|
-
case
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
token:
|
|
1640
|
+
case 1:
|
|
1641
|
+
_t37 = _context18.sent;
|
|
1642
|
+
_t38 = {
|
|
1643
|
+
token: _t37
|
|
1632
1644
|
};
|
|
1633
|
-
|
|
1634
|
-
case
|
|
1645
|
+
_t36.SetStaticToken.call(_t36, _t38);
|
|
1646
|
+
case 2:
|
|
1635
1647
|
case "end":
|
|
1636
|
-
return
|
|
1648
|
+
return _context18.stop();
|
|
1637
1649
|
}
|
|
1638
|
-
},
|
|
1650
|
+
}, _callee18, this);
|
|
1639
1651
|
}));
|
|
1640
|
-
function SetPolicyAuthorization(
|
|
1652
|
+
function SetPolicyAuthorization(_x13) {
|
|
1641
1653
|
return _SetPolicyAuthorization.apply(this, arguments);
|
|
1642
1654
|
}
|
|
1643
1655
|
return SetPolicyAuthorization;
|
|
@@ -1652,23 +1664,23 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1652
1664
|
}, {
|
|
1653
1665
|
key: "Sign",
|
|
1654
1666
|
value: (function () {
|
|
1655
|
-
var _Sign = _asyncToGenerator(
|
|
1667
|
+
var _Sign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(string) {
|
|
1656
1668
|
var signature;
|
|
1657
|
-
return _regeneratorRuntime.wrap(function
|
|
1658
|
-
while (1) switch (
|
|
1669
|
+
return _regeneratorRuntime.wrap(function (_context19) {
|
|
1670
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1659
1671
|
case 0:
|
|
1660
|
-
|
|
1672
|
+
_context19.next = 1;
|
|
1661
1673
|
return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
|
|
1674
|
+
case 1:
|
|
1675
|
+
signature = _context19.sent;
|
|
1676
|
+
return _context19.abrupt("return", this.utils.FormatSignature(signature));
|
|
1662
1677
|
case 2:
|
|
1663
|
-
signature = _context21.sent;
|
|
1664
|
-
return _context21.abrupt("return", this.utils.FormatSignature(signature));
|
|
1665
|
-
case 4:
|
|
1666
1678
|
case "end":
|
|
1667
|
-
return
|
|
1679
|
+
return _context19.stop();
|
|
1668
1680
|
}
|
|
1669
|
-
},
|
|
1681
|
+
}, _callee19, this);
|
|
1670
1682
|
}));
|
|
1671
|
-
function Sign(
|
|
1683
|
+
function Sign(_x14) {
|
|
1672
1684
|
return _Sign.apply(this, arguments);
|
|
1673
1685
|
}
|
|
1674
1686
|
return Sign;
|
|
@@ -1686,30 +1698,30 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1686
1698
|
}, {
|
|
1687
1699
|
key: "EncryptECIES",
|
|
1688
1700
|
value: (function () {
|
|
1689
|
-
var _EncryptECIES = _asyncToGenerator(
|
|
1701
|
+
var _EncryptECIES = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref24) {
|
|
1690
1702
|
var message, publicKey;
|
|
1691
|
-
return _regeneratorRuntime.wrap(function
|
|
1692
|
-
while (1) switch (
|
|
1703
|
+
return _regeneratorRuntime.wrap(function (_context20) {
|
|
1704
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1693
1705
|
case 0:
|
|
1694
|
-
message =
|
|
1706
|
+
message = _ref24.message, publicKey = _ref24.publicKey;
|
|
1695
1707
|
if (this.signer) {
|
|
1696
|
-
|
|
1708
|
+
_context20.next = 1;
|
|
1697
1709
|
break;
|
|
1698
1710
|
}
|
|
1699
1711
|
throw "Signer not set";
|
|
1700
|
-
case
|
|
1712
|
+
case 1:
|
|
1701
1713
|
ValidatePresence("message", message);
|
|
1702
|
-
|
|
1714
|
+
_context20.next = 2;
|
|
1703
1715
|
return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
|
|
1704
|
-
case
|
|
1705
|
-
return
|
|
1706
|
-
case
|
|
1716
|
+
case 2:
|
|
1717
|
+
return _context20.abrupt("return", _context20.sent);
|
|
1718
|
+
case 3:
|
|
1707
1719
|
case "end":
|
|
1708
|
-
return
|
|
1720
|
+
return _context20.stop();
|
|
1709
1721
|
}
|
|
1710
|
-
},
|
|
1722
|
+
}, _callee20, this);
|
|
1711
1723
|
}));
|
|
1712
|
-
function EncryptECIES(
|
|
1724
|
+
function EncryptECIES(_x15) {
|
|
1713
1725
|
return _EncryptECIES.apply(this, arguments);
|
|
1714
1726
|
}
|
|
1715
1727
|
return EncryptECIES;
|
|
@@ -1726,30 +1738,30 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1726
1738
|
}, {
|
|
1727
1739
|
key: "DecryptECIES",
|
|
1728
1740
|
value: (function () {
|
|
1729
|
-
var _DecryptECIES = _asyncToGenerator(
|
|
1741
|
+
var _DecryptECIES = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref25) {
|
|
1730
1742
|
var message;
|
|
1731
|
-
return _regeneratorRuntime.wrap(function
|
|
1732
|
-
while (1) switch (
|
|
1743
|
+
return _regeneratorRuntime.wrap(function (_context21) {
|
|
1744
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1733
1745
|
case 0:
|
|
1734
|
-
message =
|
|
1746
|
+
message = _ref25.message;
|
|
1735
1747
|
if (this.signer) {
|
|
1736
|
-
|
|
1748
|
+
_context21.next = 1;
|
|
1737
1749
|
break;
|
|
1738
1750
|
}
|
|
1739
1751
|
throw "Signer not set";
|
|
1740
|
-
case
|
|
1752
|
+
case 1:
|
|
1741
1753
|
ValidatePresence("message", message);
|
|
1742
|
-
|
|
1754
|
+
_context21.next = 2;
|
|
1743
1755
|
return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
|
|
1744
|
-
case
|
|
1745
|
-
return
|
|
1746
|
-
case
|
|
1756
|
+
case 2:
|
|
1757
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1758
|
+
case 3:
|
|
1747
1759
|
case "end":
|
|
1748
|
-
return
|
|
1760
|
+
return _context21.stop();
|
|
1749
1761
|
}
|
|
1750
|
-
},
|
|
1762
|
+
}, _callee21, this);
|
|
1751
1763
|
}));
|
|
1752
|
-
function DecryptECIES(
|
|
1764
|
+
function DecryptECIES(_x16) {
|
|
1753
1765
|
return _DecryptECIES.apply(this, arguments);
|
|
1754
1766
|
}
|
|
1755
1767
|
return DecryptECIES;
|
|
@@ -1769,24 +1781,24 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1769
1781
|
}, {
|
|
1770
1782
|
key: "Request",
|
|
1771
1783
|
value: (function () {
|
|
1772
|
-
var _Request = _asyncToGenerator(
|
|
1773
|
-
var url,
|
|
1774
|
-
return _regeneratorRuntime.wrap(function
|
|
1775
|
-
while (1) switch (
|
|
1784
|
+
var _Request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref26) {
|
|
1785
|
+
var url, _ref26$format, format, _ref26$method, method, _ref26$headers, headers, body;
|
|
1786
|
+
return _regeneratorRuntime.wrap(function (_context22) {
|
|
1787
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1776
1788
|
case 0:
|
|
1777
|
-
url =
|
|
1778
|
-
return
|
|
1789
|
+
url = _ref26.url, _ref26$format = _ref26.format, format = _ref26$format === void 0 ? "json" : _ref26$format, _ref26$method = _ref26.method, method = _ref26$method === void 0 ? "GET" : _ref26$method, _ref26$headers = _ref26.headers, headers = _ref26$headers === void 0 ? {} : _ref26$headers, body = _ref26.body;
|
|
1790
|
+
return _context22.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
|
|
1779
1791
|
method: method,
|
|
1780
1792
|
headers: headers,
|
|
1781
1793
|
body: body
|
|
1782
1794
|
})));
|
|
1783
|
-
case
|
|
1795
|
+
case 1:
|
|
1784
1796
|
case "end":
|
|
1785
|
-
return
|
|
1797
|
+
return _context22.stop();
|
|
1786
1798
|
}
|
|
1787
|
-
},
|
|
1799
|
+
}, _callee22, this);
|
|
1788
1800
|
}));
|
|
1789
|
-
function Request(
|
|
1801
|
+
function Request(_x17) {
|
|
1790
1802
|
return _Request.apply(this, arguments);
|
|
1791
1803
|
}
|
|
1792
1804
|
return Request;
|
|
@@ -1794,12 +1806,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1794
1806
|
}, {
|
|
1795
1807
|
key: "MakeAuthServiceRequest",
|
|
1796
1808
|
value: function () {
|
|
1797
|
-
var _MakeAuthServiceRequest = _asyncToGenerator(
|
|
1798
|
-
var kmsId, objectId, versionHash,
|
|
1799
|
-
return _regeneratorRuntime.wrap(function
|
|
1800
|
-
while (1) switch (
|
|
1809
|
+
var _MakeAuthServiceRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref27) {
|
|
1810
|
+
var kmsId, objectId, versionHash, _ref27$method, method, path, bodyType, _ref27$body, body, _ref27$queryParams, queryParams, headers, format, response;
|
|
1811
|
+
return _regeneratorRuntime.wrap(function (_context23) {
|
|
1812
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1801
1813
|
case 0:
|
|
1802
|
-
kmsId =
|
|
1814
|
+
kmsId = _ref27.kmsId, objectId = _ref27.objectId, versionHash = _ref27.versionHash, _ref27$method = _ref27.method, method = _ref27$method === void 0 ? "GET" : _ref27$method, path = _ref27.path, bodyType = _ref27.bodyType, _ref27$body = _ref27.body, body = _ref27$body === void 0 ? {} : _ref27$body, _ref27$queryParams = _ref27.queryParams, queryParams = _ref27$queryParams === void 0 ? {} : _ref27$queryParams, headers = _ref27.headers, format = _ref27.format;
|
|
1803
1815
|
response = this.authClient.MakeAuthServiceRequest({
|
|
1804
1816
|
kmsId: kmsId,
|
|
1805
1817
|
objectId: objectId,
|
|
@@ -1811,14 +1823,14 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1811
1823
|
queryParams: queryParams,
|
|
1812
1824
|
headers: headers
|
|
1813
1825
|
});
|
|
1814
|
-
return
|
|
1815
|
-
case
|
|
1826
|
+
return _context23.abrupt("return", !format ? response : this.utils.ResponseToFormat(format, response));
|
|
1827
|
+
case 1:
|
|
1816
1828
|
case "end":
|
|
1817
|
-
return
|
|
1829
|
+
return _context23.stop();
|
|
1818
1830
|
}
|
|
1819
|
-
},
|
|
1831
|
+
}, _callee23, this);
|
|
1820
1832
|
}));
|
|
1821
|
-
function MakeAuthServiceRequest(
|
|
1833
|
+
function MakeAuthServiceRequest(_x18) {
|
|
1822
1834
|
return _MakeAuthServiceRequest.apply(this, arguments);
|
|
1823
1835
|
}
|
|
1824
1836
|
return MakeAuthServiceRequest;
|
|
@@ -1839,18 +1851,18 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1839
1851
|
}, {
|
|
1840
1852
|
key: "CallFromFrameMessage",
|
|
1841
1853
|
value: function () {
|
|
1842
|
-
var _CallFromFrameMessage = _asyncToGenerator(
|
|
1854
|
+
var _CallFromFrameMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24(message, Respond) {
|
|
1843
1855
|
var _this4 = this;
|
|
1844
|
-
var callback, method, methodResults, responseError;
|
|
1845
|
-
return _regeneratorRuntime.wrap(function
|
|
1846
|
-
while (1) switch (
|
|
1856
|
+
var callback, method, methodResults, responseError, _t39;
|
|
1857
|
+
return _regeneratorRuntime.wrap(function (_context24) {
|
|
1858
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1847
1859
|
case 0:
|
|
1848
1860
|
if (!(message.type !== "ElvFrameRequest")) {
|
|
1849
|
-
|
|
1861
|
+
_context24.next = 1;
|
|
1850
1862
|
break;
|
|
1851
1863
|
}
|
|
1852
|
-
return
|
|
1853
|
-
case
|
|
1864
|
+
return _context24.abrupt("return");
|
|
1865
|
+
case 1:
|
|
1854
1866
|
if (message.callbackId) {
|
|
1855
1867
|
callback = function callback(result) {
|
|
1856
1868
|
Respond(_this4.utils.MakeClonable({
|
|
@@ -1861,89 +1873,89 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1861
1873
|
};
|
|
1862
1874
|
message.args.callback = callback;
|
|
1863
1875
|
}
|
|
1864
|
-
|
|
1876
|
+
_context24.prev = 2;
|
|
1865
1877
|
method = message.calledMethod;
|
|
1866
1878
|
if (!(message.module === "walletClient")) {
|
|
1867
|
-
|
|
1879
|
+
_context24.next = 6;
|
|
1868
1880
|
break;
|
|
1869
1881
|
}
|
|
1870
1882
|
if (this.walletClient) {
|
|
1871
|
-
|
|
1883
|
+
_context24.next = 3;
|
|
1872
1884
|
break;
|
|
1873
1885
|
}
|
|
1874
1886
|
throw Error("Wallet client not set");
|
|
1875
|
-
case
|
|
1887
|
+
case 3:
|
|
1876
1888
|
if (!this.walletClient.ForbiddenMethods().includes(method)) {
|
|
1877
|
-
|
|
1889
|
+
_context24.next = 4;
|
|
1878
1890
|
break;
|
|
1879
1891
|
}
|
|
1880
1892
|
throw Error("Invalid user profile method: " + method);
|
|
1881
|
-
case
|
|
1882
|
-
|
|
1893
|
+
case 4:
|
|
1894
|
+
_context24.next = 5;
|
|
1883
1895
|
return this.walletClient[method](message.args);
|
|
1884
|
-
case
|
|
1885
|
-
methodResults =
|
|
1886
|
-
|
|
1896
|
+
case 5:
|
|
1897
|
+
methodResults = _context24.sent;
|
|
1898
|
+
_context24.next = 12;
|
|
1887
1899
|
break;
|
|
1888
|
-
case
|
|
1900
|
+
case 6:
|
|
1889
1901
|
if (!(message.module === "userProfileClient")) {
|
|
1890
|
-
|
|
1902
|
+
_context24.next = 9;
|
|
1891
1903
|
break;
|
|
1892
1904
|
}
|
|
1893
1905
|
if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
|
|
1894
|
-
|
|
1906
|
+
_context24.next = 7;
|
|
1895
1907
|
break;
|
|
1896
1908
|
}
|
|
1897
1909
|
throw Error("Invalid user profile method: " + method);
|
|
1898
|
-
case
|
|
1899
|
-
|
|
1910
|
+
case 7:
|
|
1911
|
+
_context24.next = 8;
|
|
1900
1912
|
return this.userProfileClient[method](message.args);
|
|
1901
|
-
case
|
|
1902
|
-
methodResults =
|
|
1903
|
-
|
|
1913
|
+
case 8:
|
|
1914
|
+
methodResults = _context24.sent;
|
|
1915
|
+
_context24.next = 12;
|
|
1904
1916
|
break;
|
|
1905
|
-
case
|
|
1917
|
+
case 9:
|
|
1906
1918
|
if (this.FrameAllowedMethods().includes(method)) {
|
|
1907
|
-
|
|
1919
|
+
_context24.next = 10;
|
|
1908
1920
|
break;
|
|
1909
1921
|
}
|
|
1910
1922
|
throw Error("Invalid method: " + method);
|
|
1911
|
-
case
|
|
1912
|
-
|
|
1923
|
+
case 10:
|
|
1924
|
+
_context24.next = 11;
|
|
1913
1925
|
return this[method](message.args);
|
|
1914
|
-
case
|
|
1915
|
-
methodResults =
|
|
1916
|
-
case
|
|
1926
|
+
case 11:
|
|
1927
|
+
methodResults = _context24.sent;
|
|
1928
|
+
case 12:
|
|
1917
1929
|
Respond(this.utils.MakeClonable({
|
|
1918
1930
|
type: "ElvFrameResponse",
|
|
1919
1931
|
requestId: message.requestId,
|
|
1920
1932
|
response: methodResults
|
|
1921
1933
|
}));
|
|
1922
|
-
|
|
1934
|
+
_context24.next = 14;
|
|
1923
1935
|
break;
|
|
1924
|
-
case
|
|
1925
|
-
|
|
1926
|
-
|
|
1936
|
+
case 13:
|
|
1937
|
+
_context24.prev = 13;
|
|
1938
|
+
_t39 = _context24["catch"](2);
|
|
1927
1939
|
// eslint-disable-next-line no-console
|
|
1928
|
-
this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(
|
|
1940
|
+
this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_t39) === "object" ? JSON.stringify(_t39, null, 2) : _t39), true);
|
|
1929
1941
|
|
|
1930
1942
|
// eslint-disable-next-line no-console
|
|
1931
1943
|
console.error(message);
|
|
1932
1944
|
// eslint-disable-next-line no-console
|
|
1933
|
-
console.error(
|
|
1934
|
-
responseError =
|
|
1945
|
+
console.error(_t39);
|
|
1946
|
+
responseError = _t39 instanceof Error ? _t39.message : _t39;
|
|
1935
1947
|
Respond(this.utils.MakeClonable({
|
|
1936
1948
|
type: "ElvFrameResponse",
|
|
1937
1949
|
requestId: message.requestId,
|
|
1938
1950
|
error: responseError
|
|
1939
1951
|
}));
|
|
1940
|
-
case
|
|
1952
|
+
case 14:
|
|
1941
1953
|
case "end":
|
|
1942
|
-
return
|
|
1954
|
+
return _context24.stop();
|
|
1943
1955
|
}
|
|
1944
|
-
},
|
|
1956
|
+
}, _callee24, this, [[2, 13]]);
|
|
1945
1957
|
}));
|
|
1946
|
-
function CallFromFrameMessage(
|
|
1958
|
+
function CallFromFrameMessage(_x19, _x20) {
|
|
1947
1959
|
return _CallFromFrameMessage.apply(this, arguments);
|
|
1948
1960
|
}
|
|
1949
1961
|
return CallFromFrameMessage;
|
|
@@ -1951,13 +1963,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1951
1963
|
}], [{
|
|
1952
1964
|
key: "Configuration",
|
|
1953
1965
|
value: (function () {
|
|
1954
|
-
var _Configuration = _asyncToGenerator(
|
|
1955
|
-
var configUrl,
|
|
1956
|
-
return _regeneratorRuntime.wrap(function
|
|
1957
|
-
while (1) switch (
|
|
1966
|
+
var _Configuration = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref28) {
|
|
1967
|
+
var configUrl, _ref28$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, _t40;
|
|
1968
|
+
return _regeneratorRuntime.wrap(function (_context25) {
|
|
1969
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1958
1970
|
case 0:
|
|
1959
|
-
configUrl =
|
|
1960
|
-
|
|
1971
|
+
configUrl = _ref28.configUrl, _ref28$kmsUrls = _ref28.kmsUrls, kmsUrls = _ref28$kmsUrls === void 0 ? [] : _ref28$kmsUrls, region = _ref28.region, clientIP = _ref28.clientIP;
|
|
1972
|
+
_context25.prev = 1;
|
|
1961
1973
|
uri = new URI(configUrl);
|
|
1962
1974
|
uri.pathname("/config");
|
|
1963
1975
|
if (region) {
|
|
@@ -1966,10 +1978,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1966
1978
|
if (clientIP) {
|
|
1967
1979
|
uri.addSearch("client_ip", clientIP);
|
|
1968
1980
|
}
|
|
1969
|
-
|
|
1981
|
+
_context25.next = 2;
|
|
1970
1982
|
return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
|
|
1971
|
-
case
|
|
1972
|
-
fabricInfo =
|
|
1983
|
+
case 2:
|
|
1984
|
+
fabricInfo = _context25.sent;
|
|
1973
1985
|
// If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
|
|
1974
1986
|
filterHTTPS = function filterHTTPS(uri) {
|
|
1975
1987
|
return uri.toLowerCase().startsWith("https");
|
|
@@ -1992,7 +2004,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1992
2004
|
}
|
|
1993
2005
|
searchURIs = fabricInfo.network.services.search || [];
|
|
1994
2006
|
fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
|
|
1995
|
-
return
|
|
2007
|
+
return _context25.abrupt("return", {
|
|
1996
2008
|
nodeId: fabricInfo.node_id,
|
|
1997
2009
|
contentSpaceId: fabricInfo.qspace.id,
|
|
1998
2010
|
networkId: (fabricInfo.qspace.ethereum || {}).network_id,
|
|
@@ -2005,21 +2017,21 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2005
2017
|
searchURIs: searchURIs,
|
|
2006
2018
|
fabricVersion: fabricVersion
|
|
2007
2019
|
});
|
|
2008
|
-
case
|
|
2009
|
-
|
|
2010
|
-
|
|
2020
|
+
case 3:
|
|
2021
|
+
_context25.prev = 3;
|
|
2022
|
+
_t40 = _context25["catch"](1);
|
|
2011
2023
|
// eslint-disable-next-line no-console
|
|
2012
2024
|
console.error("Error retrieving fabric configuration:");
|
|
2013
2025
|
// eslint-disable-next-line no-console
|
|
2014
|
-
console.error(
|
|
2015
|
-
throw
|
|
2016
|
-
case
|
|
2026
|
+
console.error(_t40);
|
|
2027
|
+
throw _t40;
|
|
2028
|
+
case 4:
|
|
2017
2029
|
case "end":
|
|
2018
|
-
return
|
|
2030
|
+
return _context25.stop();
|
|
2019
2031
|
}
|
|
2020
|
-
},
|
|
2032
|
+
}, _callee25, null, [[1, 3]]);
|
|
2021
2033
|
}));
|
|
2022
|
-
function Configuration(
|
|
2034
|
+
function Configuration(_x21) {
|
|
2023
2035
|
return _Configuration.apply(this, arguments);
|
|
2024
2036
|
}
|
|
2025
2037
|
return Configuration;
|
|
@@ -2057,20 +2069,20 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2057
2069
|
}, {
|
|
2058
2070
|
key: "FromNetworkName",
|
|
2059
2071
|
value: (function () {
|
|
2060
|
-
var _FromNetworkName = _asyncToGenerator(
|
|
2061
|
-
var networkName, region, clientIP, trustAuthorityId, staticToken,
|
|
2062
|
-
return _regeneratorRuntime.wrap(function
|
|
2063
|
-
while (1) switch (
|
|
2072
|
+
var _FromNetworkName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref29) {
|
|
2073
|
+
var networkName, region, clientIP, trustAuthorityId, staticToken, _ref29$ethereumContra, ethereumContractTimeout, _ref29$noCache, noCache, _ref29$noAuth, noAuth, assumeV3, configUrl;
|
|
2074
|
+
return _regeneratorRuntime.wrap(function (_context26) {
|
|
2075
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2064
2076
|
case 0:
|
|
2065
|
-
networkName =
|
|
2077
|
+
networkName = _ref29.networkName, region = _ref29.region, clientIP = _ref29.clientIP, trustAuthorityId = _ref29.trustAuthorityId, staticToken = _ref29.staticToken, _ref29$ethereumContra = _ref29.ethereumContractTimeout, ethereumContractTimeout = _ref29$ethereumContra === void 0 ? 10 : _ref29$ethereumContra, _ref29$noCache = _ref29.noCache, noCache = _ref29$noCache === void 0 ? false : _ref29$noCache, _ref29$noAuth = _ref29.noAuth, noAuth = _ref29$noAuth === void 0 ? false : _ref29$noAuth, assumeV3 = _ref29.assumeV3;
|
|
2066
2078
|
configUrl = networks[networkName];
|
|
2067
2079
|
if (configUrl) {
|
|
2068
|
-
|
|
2080
|
+
_context26.next = 1;
|
|
2069
2081
|
break;
|
|
2070
2082
|
}
|
|
2071
2083
|
throw Error("Invalid network name: " + networkName);
|
|
2072
|
-
case
|
|
2073
|
-
|
|
2084
|
+
case 1:
|
|
2085
|
+
_context26.next = 2;
|
|
2074
2086
|
return this.FromConfigurationUrl({
|
|
2075
2087
|
configUrl: configUrl,
|
|
2076
2088
|
region: region,
|
|
@@ -2082,15 +2094,15 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2082
2094
|
noAuth: noAuth,
|
|
2083
2095
|
assumeV3: assumeV3
|
|
2084
2096
|
});
|
|
2085
|
-
case
|
|
2086
|
-
return
|
|
2087
|
-
case
|
|
2097
|
+
case 2:
|
|
2098
|
+
return _context26.abrupt("return", _context26.sent);
|
|
2099
|
+
case 3:
|
|
2088
2100
|
case "end":
|
|
2089
|
-
return
|
|
2101
|
+
return _context26.stop();
|
|
2090
2102
|
}
|
|
2091
|
-
},
|
|
2103
|
+
}, _callee26, this);
|
|
2092
2104
|
}));
|
|
2093
|
-
function FromNetworkName(
|
|
2105
|
+
function FromNetworkName(_x22) {
|
|
2094
2106
|
return _FromNetworkName.apply(this, arguments);
|
|
2095
2107
|
}
|
|
2096
2108
|
return FromNetworkName;
|
|
@@ -2115,20 +2127,20 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2115
2127
|
}, {
|
|
2116
2128
|
key: "FromConfigurationUrl",
|
|
2117
2129
|
value: (function () {
|
|
2118
|
-
var _FromConfigurationUrl = _asyncToGenerator(
|
|
2119
|
-
var configUrl, region, clientIP, trustAuthorityId, staticToken,
|
|
2120
|
-
return _regeneratorRuntime.wrap(function
|
|
2121
|
-
while (1) switch (
|
|
2130
|
+
var _FromConfigurationUrl = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref30) {
|
|
2131
|
+
var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, _ref30$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, client;
|
|
2132
|
+
return _regeneratorRuntime.wrap(function (_context27) {
|
|
2133
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2122
2134
|
case 0:
|
|
2123
|
-
configUrl =
|
|
2124
|
-
|
|
2135
|
+
configUrl = _ref30.configUrl, region = _ref30.region, clientIP = _ref30.clientIP, trustAuthorityId = _ref30.trustAuthorityId, staticToken = _ref30.staticToken, _ref30$ethereumContra = _ref30.ethereumContractTimeout, ethereumContractTimeout = _ref30$ethereumContra === void 0 ? 10 : _ref30$ethereumContra, _ref30$noCache = _ref30.noCache, noCache = _ref30$noCache === void 0 ? false : _ref30$noCache, _ref30$noAuth = _ref30.noAuth, noAuth = _ref30$noAuth === void 0 ? false : _ref30$noAuth, _ref30$assumeV = _ref30.assumeV3, assumeV3 = _ref30$assumeV === void 0 ? false : _ref30$assumeV;
|
|
2136
|
+
_context27.next = 1;
|
|
2125
2137
|
return ElvClient.Configuration({
|
|
2126
2138
|
configUrl: configUrl,
|
|
2127
2139
|
clientIP: clientIP,
|
|
2128
2140
|
region: region
|
|
2129
2141
|
});
|
|
2130
|
-
case
|
|
2131
|
-
_yield$ElvClient$Conf3 =
|
|
2142
|
+
case 1:
|
|
2143
|
+
_yield$ElvClient$Conf3 = _context27.sent;
|
|
2132
2144
|
contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
|
|
2133
2145
|
networkId = _yield$ElvClient$Conf3.networkId;
|
|
2134
2146
|
networkName = _yield$ElvClient$Conf3.networkName;
|
|
@@ -2158,14 +2170,14 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2158
2170
|
client.configUrl = configUrl;
|
|
2159
2171
|
client.region = region;
|
|
2160
2172
|
client.clientIP = clientIP;
|
|
2161
|
-
return
|
|
2162
|
-
case
|
|
2173
|
+
return _context27.abrupt("return", client);
|
|
2174
|
+
case 2:
|
|
2163
2175
|
case "end":
|
|
2164
|
-
return
|
|
2176
|
+
return _context27.stop();
|
|
2165
2177
|
}
|
|
2166
|
-
},
|
|
2178
|
+
}, _callee27);
|
|
2167
2179
|
}));
|
|
2168
|
-
function FromConfigurationUrl(
|
|
2180
|
+
function FromConfigurationUrl(_x23) {
|
|
2169
2181
|
return _FromConfigurationUrl.apply(this, arguments);
|
|
2170
2182
|
}
|
|
2171
2183
|
return FromConfigurationUrl;
|