@eluvio/elv-client-js 4.0.121 → 4.0.123
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/README.md +1 -1
- package/dist/ElvClient-min.js +14 -15
- package/dist/ElvClient-node-min.js +13 -14
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +14 -15
- package/dist/ElvWalletClient-node-min.js +13 -14
- package/dist/src/AuthorizationClient.js +41 -32
- package/dist/src/ContentObjectAudit.js +3 -3
- package/dist/src/ContentObjectVerification.js +3 -3
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +52 -61
- package/dist/src/ElvWallet.js +5 -7
- package/dist/src/EthClient.js +9 -8
- package/dist/src/FrameClient.js +10 -9
- package/dist/src/HttpClient.js +2 -1
- package/dist/src/Id.js +2 -1
- package/dist/src/PermissionsClient.js +19 -31
- package/dist/src/RemoteSigner.js +8 -6
- package/dist/src/UserProfileClient.js +20 -35
- package/dist/src/Utils.js +3 -2
- package/dist/src/client/ABRPublishing.js +3 -3
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +10 -5
- package/dist/src/client/ContentManagement.js +3 -3
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +5 -3
- package/dist/src/client/LiveStream.js +2 -0
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/client/Shares.js +285 -0
- package/dist/src/walletClient/ClientMethods.js +2 -2
- package/dist/src/walletClient/Profile.js +2 -2
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +14 -17
- package/package.json +2 -2
- package/src/AuthorizationClient.js +2 -0
- package/src/ElvClient.js +13 -3
- package/src/FrameClient.js +5 -0
- package/src/client/ABRPublishing.js +1 -1
- package/src/client/ContentAccess.js +6 -3
- package/src/client/Shares.js +162 -0
- package/utilities/GenerateFabricToken.js +3 -2
- package/build/BuildDocs.js +0 -12
package/dist/src/ElvClient.js
CHANGED
|
@@ -5,8 +5,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
5
5
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
6
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
7
7
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
if (typeof globalThis.Buffer === "undefined") {
|
|
11
11
|
globalThis.Buffer = require("buffer/").Buffer;
|
|
12
12
|
}
|
|
@@ -142,7 +142,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
142
142
|
* @param {string=} clientIP - IP address to use in determining the region to use
|
|
143
143
|
* @return {Promise<Object>} - Object containing content space ID and fabric and ethereum URLs
|
|
144
144
|
*/
|
|
145
|
-
|
|
145
|
+
_createClass(ElvClient, [{
|
|
146
146
|
key: "Log",
|
|
147
147
|
value: function Log(message) {
|
|
148
148
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -341,7 +341,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
341
341
|
*/
|
|
342
342
|
}, {
|
|
343
343
|
key: "UseRegion",
|
|
344
|
-
value:
|
|
344
|
+
value: function () {
|
|
345
345
|
var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
346
346
|
var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs;
|
|
347
347
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -401,10 +401,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
401
401
|
*
|
|
402
402
|
* @return {Promise<Object>} - An object containing the updated fabric and ethereum URLs in order of preference
|
|
403
403
|
*/
|
|
404
|
-
)
|
|
405
404
|
}, {
|
|
406
405
|
key: "ResetRegion",
|
|
407
|
-
value:
|
|
406
|
+
value: function () {
|
|
408
407
|
var _ResetRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
409
408
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
410
409
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -444,10 +443,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
444
443
|
*
|
|
445
444
|
* @return {Promise<string>} - The node ID reported by the fabric
|
|
446
445
|
*/
|
|
447
|
-
)
|
|
448
446
|
}, {
|
|
449
447
|
key: "NodeId",
|
|
450
|
-
value:
|
|
448
|
+
value: function () {
|
|
451
449
|
var _NodeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
452
450
|
var region, _yield$ElvClient$Conf2, nodeId;
|
|
453
451
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
@@ -481,7 +479,6 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
481
479
|
*
|
|
482
480
|
* @return {Promise<Object>} - An object containing the lists of fabric, ethereum, auth service, and search urls in use by the client
|
|
483
481
|
*/
|
|
484
|
-
)
|
|
485
482
|
}, {
|
|
486
483
|
key: "Nodes",
|
|
487
484
|
value: function Nodes() {
|
|
@@ -553,7 +550,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
553
550
|
*/
|
|
554
551
|
}, {
|
|
555
552
|
key: "SpaceNodes",
|
|
556
|
-
value:
|
|
553
|
+
value: function () {
|
|
557
554
|
var _SpaceNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
558
555
|
var _this = this;
|
|
559
556
|
var _ref7,
|
|
@@ -640,7 +637,6 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
640
637
|
* @methodGroup Nodes
|
|
641
638
|
* @returns {Object} - The name, ID and configuration URL of the network
|
|
642
639
|
*/
|
|
643
|
-
)
|
|
644
640
|
}, {
|
|
645
641
|
key: "NetworkInfo",
|
|
646
642
|
value: function NetworkInfo() {
|
|
@@ -712,6 +708,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
712
708
|
}, {
|
|
713
709
|
key: "SetSigner",
|
|
714
710
|
value: function SetSigner(_ref10) {
|
|
711
|
+
var _this2 = this;
|
|
715
712
|
var signer = _ref10.signer,
|
|
716
713
|
_ref10$reset = _ref10.reset,
|
|
717
714
|
reset = _ref10$reset === void 0 ? true : _ref10$reset;
|
|
@@ -719,6 +716,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
719
716
|
signer.connect(this.ethClient.Provider());
|
|
720
717
|
signer.provider.pollingInterval = 500;
|
|
721
718
|
this.signer = signer;
|
|
719
|
+
this.CreateFabricToken({}).then(function (token) {
|
|
720
|
+
return _this2.signedToken = token;
|
|
721
|
+
});
|
|
722
722
|
if (reset) {
|
|
723
723
|
this.InitializeClients();
|
|
724
724
|
}
|
|
@@ -738,7 +738,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
738
738
|
*/
|
|
739
739
|
}, {
|
|
740
740
|
key: "SetRemoteSigner",
|
|
741
|
-
value:
|
|
741
|
+
value: function () {
|
|
742
742
|
var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
|
|
743
743
|
var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
|
|
744
744
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
@@ -793,10 +793,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
793
793
|
* @namedParams
|
|
794
794
|
* @param {object} provider - The web3 provider object
|
|
795
795
|
*/
|
|
796
|
-
)
|
|
797
796
|
}, {
|
|
798
797
|
key: "SetSignerFromWeb3Provider",
|
|
799
|
-
value:
|
|
798
|
+
value: function () {
|
|
800
799
|
var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
|
|
801
800
|
var provider, ethProvider;
|
|
802
801
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
@@ -839,10 +838,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
839
838
|
*
|
|
840
839
|
* @return {string} - The address of the user
|
|
841
840
|
*/
|
|
842
|
-
)
|
|
843
841
|
}, {
|
|
844
842
|
key: "CreateAccount",
|
|
845
|
-
value:
|
|
843
|
+
value: function () {
|
|
846
844
|
var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
|
|
847
845
|
var tenantId, fundingToken, _ref13$funds, funds, groupToken, wallet, signer;
|
|
848
846
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
@@ -917,12 +915,11 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
917
915
|
PAYLOAD 85b json-compressed
|
|
918
916
|
json 79b {"adr":"VVf4DQU357tDnZGYQeDrntRJ5rs=","spc":"ispc3ANoVSzNA3P6t7abLR69ho5YPPZU"}
|
|
919
917
|
*/
|
|
920
|
-
)
|
|
921
918
|
}, {
|
|
922
919
|
key: "PersonalSign",
|
|
923
|
-
value:
|
|
920
|
+
value: function () {
|
|
924
921
|
var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref14) {
|
|
925
|
-
var
|
|
922
|
+
var _this3 = this;
|
|
926
923
|
var message, addEthereumPrefix, Sign;
|
|
927
924
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
928
925
|
while (1) switch (_context11.prev = _context11.next) {
|
|
@@ -936,19 +933,19 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
936
933
|
while (1) switch (_context10.prev = _context10.next) {
|
|
937
934
|
case 0:
|
|
938
935
|
_context10.t0 = Ethers.utils;
|
|
939
|
-
if (!
|
|
936
|
+
if (!_this3.signer.signDigest) {
|
|
940
937
|
_context10.next = 7;
|
|
941
938
|
break;
|
|
942
939
|
}
|
|
943
940
|
_context10.next = 4;
|
|
944
|
-
return
|
|
941
|
+
return _this3.signer.signDigest(message);
|
|
945
942
|
case 4:
|
|
946
943
|
_context10.t1 = _context10.sent;
|
|
947
944
|
_context10.next = 10;
|
|
948
945
|
break;
|
|
949
946
|
case 7:
|
|
950
947
|
_context10.next = 9;
|
|
951
|
-
return
|
|
948
|
+
return _this3.signer._signingKey().signDigest(message);
|
|
952
949
|
case 9:
|
|
953
950
|
_context10.t1 = _context10.sent;
|
|
954
951
|
case 10:
|
|
@@ -994,10 +991,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
994
991
|
* @param {function=} Sign - If specified, this function will be used to produce the signature instead of the client's current signer
|
|
995
992
|
* @param {boolean=} addEthereumPrefix=true - If specified, the 'Ethereum Signed Message' prefixed hash format will be performed. Disable this if the provided Sign method already does this (e.g. Metamask)
|
|
996
993
|
*/
|
|
997
|
-
)
|
|
998
994
|
}, {
|
|
999
995
|
key: "CreateFabricToken",
|
|
1000
|
-
value:
|
|
996
|
+
value: function () {
|
|
1001
997
|
var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
1002
998
|
var _ref16,
|
|
1003
999
|
_ref16$duration,
|
|
@@ -1079,10 +1075,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1079
1075
|
* enabling the user of this token to download encrypted content from the specified object
|
|
1080
1076
|
* @param {Object=} context - Additional JSON context
|
|
1081
1077
|
*/
|
|
1082
|
-
)
|
|
1083
1078
|
}, {
|
|
1084
1079
|
key: "CreateSignedToken",
|
|
1085
|
-
value:
|
|
1080
|
+
value: function () {
|
|
1086
1081
|
var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
|
|
1087
1082
|
var libraryId, objectId, versionHash, policyId, subject, _ref17$grantType, grantType, _ref17$allowDecryptio, allowDecryption, duration, _ref17$context, context, token, cap, compressedToken, signature;
|
|
1088
1083
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
@@ -1195,10 +1190,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1195
1190
|
* @namedParams
|
|
1196
1191
|
* @param {string} messasge - A JSON object representing the message to sign
|
|
1197
1192
|
*/
|
|
1198
|
-
)
|
|
1199
1193
|
}, {
|
|
1200
1194
|
key: "CreateSignedMessageJSON",
|
|
1201
|
-
value:
|
|
1195
|
+
value: function () {
|
|
1202
1196
|
var _CreateSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
|
|
1203
1197
|
var message, type, msg, signature;
|
|
1204
1198
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
@@ -1235,10 +1229,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1235
1229
|
* @param {string} signedMessage - a signed message as created by CreateSignedMessageJSON
|
|
1236
1230
|
* @returns {Promise<Object>} - The decoded message, signer address, signature and signature type
|
|
1237
1231
|
*/
|
|
1238
|
-
)
|
|
1239
1232
|
}, {
|
|
1240
1233
|
key: "DecodeSignedMessageJSON",
|
|
1241
|
-
value:
|
|
1234
|
+
value: function () {
|
|
1242
1235
|
var _DecodeSignedMessageJSON = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
|
|
1243
1236
|
var signedMessage, type, msgBytes, signature, msg, obj, prefixedMsgHash, signerAddr;
|
|
1244
1237
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
@@ -1281,7 +1274,6 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1281
1274
|
* @methodGroup Signers
|
|
1282
1275
|
* @returns {string} - The address of the current signer
|
|
1283
1276
|
*/
|
|
1284
|
-
)
|
|
1285
1277
|
}, {
|
|
1286
1278
|
key: "CurrentAccountAddress",
|
|
1287
1279
|
value: function CurrentAccountAddress() {
|
|
@@ -1297,7 +1289,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1297
1289
|
*/
|
|
1298
1290
|
}, {
|
|
1299
1291
|
key: "SetOauthToken",
|
|
1300
|
-
value:
|
|
1292
|
+
value: function () {
|
|
1301
1293
|
var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
|
|
1302
1294
|
var token, wallet, signer;
|
|
1303
1295
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
@@ -1333,10 +1325,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1333
1325
|
* @namedParams
|
|
1334
1326
|
* @param {string} token - The OAuth ID
|
|
1335
1327
|
*/
|
|
1336
|
-
)
|
|
1337
1328
|
}, {
|
|
1338
1329
|
key: "SetSignerFromOauthToken",
|
|
1339
|
-
value:
|
|
1330
|
+
value: function () {
|
|
1340
1331
|
var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref21) {
|
|
1341
1332
|
var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
|
|
1342
1333
|
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
@@ -1440,7 +1431,6 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1440
1431
|
*
|
|
1441
1432
|
* @return {string} - The created static token
|
|
1442
1433
|
*/
|
|
1443
|
-
)
|
|
1444
1434
|
}, {
|
|
1445
1435
|
key: "CreateStaticToken",
|
|
1446
1436
|
value: function CreateStaticToken(_ref22) {
|
|
@@ -1460,12 +1450,15 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1460
1450
|
* @methodGroup Authorization
|
|
1461
1451
|
* @namedParams
|
|
1462
1452
|
* @param {string=} token - The static token to use. If not provided, the default static token will be set.
|
|
1453
|
+
* @param {boolean=} update=false - If specified, the static token will be used for update operations as well
|
|
1463
1454
|
*/
|
|
1464
1455
|
}, {
|
|
1465
1456
|
key: "SetStaticToken",
|
|
1466
1457
|
value: function SetStaticToken() {
|
|
1467
1458
|
var _ref23 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1468
|
-
token = _ref23.token
|
|
1459
|
+
token = _ref23.token,
|
|
1460
|
+
_ref23$update = _ref23.update,
|
|
1461
|
+
update = _ref23$update === void 0 ? false : _ref23$update;
|
|
1469
1462
|
if (token) {
|
|
1470
1463
|
this.staticToken = token;
|
|
1471
1464
|
} else {
|
|
@@ -1473,6 +1466,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1473
1466
|
qspace_id: this.contentSpaceId
|
|
1474
1467
|
}));
|
|
1475
1468
|
}
|
|
1469
|
+
this.staticUpdateToken = update ? this.staticToken : undefined;
|
|
1476
1470
|
}
|
|
1477
1471
|
|
|
1478
1472
|
/**
|
|
@@ -1495,7 +1489,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1495
1489
|
*/
|
|
1496
1490
|
}, {
|
|
1497
1491
|
key: "SetPolicyAuthorization",
|
|
1498
|
-
value:
|
|
1492
|
+
value: function () {
|
|
1499
1493
|
var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref24) {
|
|
1500
1494
|
var objectId;
|
|
1501
1495
|
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
@@ -1530,10 +1524,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1530
1524
|
* @param {string} string - The string to sign
|
|
1531
1525
|
* @return {Promise<string>} - The signed string
|
|
1532
1526
|
*/
|
|
1533
|
-
)
|
|
1534
1527
|
}, {
|
|
1535
1528
|
key: "Sign",
|
|
1536
|
-
value:
|
|
1529
|
+
value: function () {
|
|
1537
1530
|
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(string) {
|
|
1538
1531
|
var signature;
|
|
1539
1532
|
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
@@ -1564,10 +1557,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1564
1557
|
*
|
|
1565
1558
|
* @return {Promise<string>} - The encrypted message
|
|
1566
1559
|
*/
|
|
1567
|
-
)
|
|
1568
1560
|
}, {
|
|
1569
1561
|
key: "EncryptECIES",
|
|
1570
|
-
value:
|
|
1562
|
+
value: function () {
|
|
1571
1563
|
var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref25) {
|
|
1572
1564
|
var message, publicKey;
|
|
1573
1565
|
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
@@ -1604,10 +1596,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1604
1596
|
*
|
|
1605
1597
|
* @return {Promise<string | Object>} - The decrypted string or object
|
|
1606
1598
|
*/
|
|
1607
|
-
)
|
|
1608
1599
|
}, {
|
|
1609
1600
|
key: "DecryptECIES",
|
|
1610
|
-
value:
|
|
1601
|
+
value: function () {
|
|
1611
1602
|
var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref26) {
|
|
1612
1603
|
var message;
|
|
1613
1604
|
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
@@ -1647,10 +1638,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1647
1638
|
*
|
|
1648
1639
|
* @return {Promise<*>} - Response in the specified format
|
|
1649
1640
|
*/
|
|
1650
|
-
)
|
|
1651
1641
|
}, {
|
|
1652
1642
|
key: "Request",
|
|
1653
|
-
value:
|
|
1643
|
+
value: function () {
|
|
1654
1644
|
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref27) {
|
|
1655
1645
|
var url, _ref27$format, format, _ref27$method, method, _ref27$headers, headers, body;
|
|
1656
1646
|
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
@@ -1672,17 +1662,17 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1672
1662
|
return _Request.apply(this, arguments);
|
|
1673
1663
|
}
|
|
1674
1664
|
return Request;
|
|
1675
|
-
}()
|
|
1665
|
+
}()
|
|
1676
1666
|
}, {
|
|
1677
1667
|
key: "MakeAuthServiceRequest",
|
|
1678
1668
|
value: function () {
|
|
1679
1669
|
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref28) {
|
|
1680
|
-
var kmsId, objectId, versionHash, _ref28$method, method, path, bodyType, _ref28$body, body, _ref28$queryParams, queryParams, headers;
|
|
1670
|
+
var kmsId, objectId, versionHash, _ref28$method, method, path, bodyType, _ref28$body, body, _ref28$queryParams, queryParams, headers, format, response;
|
|
1681
1671
|
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1682
1672
|
while (1) switch (_context23.prev = _context23.next) {
|
|
1683
1673
|
case 0:
|
|
1684
|
-
kmsId = _ref28.kmsId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, _ref28$method = _ref28.method, method = _ref28$method === void 0 ? "GET" : _ref28$method, path = _ref28.path, bodyType = _ref28.bodyType, _ref28$body = _ref28.body, body = _ref28$body === void 0 ? {} : _ref28$body, _ref28$queryParams = _ref28.queryParams, queryParams = _ref28$queryParams === void 0 ? {} : _ref28$queryParams, headers = _ref28.headers;
|
|
1685
|
-
|
|
1674
|
+
kmsId = _ref28.kmsId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, _ref28$method = _ref28.method, method = _ref28$method === void 0 ? "GET" : _ref28$method, path = _ref28.path, bodyType = _ref28.bodyType, _ref28$body = _ref28.body, body = _ref28$body === void 0 ? {} : _ref28$body, _ref28$queryParams = _ref28.queryParams, queryParams = _ref28$queryParams === void 0 ? {} : _ref28$queryParams, headers = _ref28.headers, format = _ref28.format;
|
|
1675
|
+
response = this.authClient.MakeAuthServiceRequest({
|
|
1686
1676
|
kmsId: kmsId,
|
|
1687
1677
|
objectId: objectId,
|
|
1688
1678
|
versionHash: versionHash,
|
|
@@ -1692,8 +1682,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1692
1682
|
body: body,
|
|
1693
1683
|
queryParams: queryParams,
|
|
1694
1684
|
headers: headers
|
|
1695
|
-
})
|
|
1696
|
-
|
|
1685
|
+
});
|
|
1686
|
+
return _context23.abrupt("return", !format ? response : this.utils.ResponseToFormat(format, response));
|
|
1687
|
+
case 3:
|
|
1697
1688
|
case "end":
|
|
1698
1689
|
return _context23.stop();
|
|
1699
1690
|
}
|
|
@@ -1709,10 +1700,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1709
1700
|
}, {
|
|
1710
1701
|
key: "FrameAllowedMethods",
|
|
1711
1702
|
value: function FrameAllowedMethods() {
|
|
1712
|
-
var
|
|
1703
|
+
var _this4 = this;
|
|
1713
1704
|
var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
|
|
1714
1705
|
return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
|
|
1715
|
-
return typeof
|
|
1706
|
+
return typeof _this4[method] === "function" && !forbiddenMethods.includes(method);
|
|
1716
1707
|
});
|
|
1717
1708
|
}
|
|
1718
1709
|
|
|
@@ -1721,7 +1712,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1721
1712
|
key: "CallFromFrameMessage",
|
|
1722
1713
|
value: function () {
|
|
1723
1714
|
var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(message, Respond) {
|
|
1724
|
-
var
|
|
1715
|
+
var _this5 = this;
|
|
1725
1716
|
var callback, method, methodResults, responseError;
|
|
1726
1717
|
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
1727
1718
|
while (1) switch (_context24.prev = _context24.next) {
|
|
@@ -1734,7 +1725,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1734
1725
|
case 2:
|
|
1735
1726
|
if (message.callbackId) {
|
|
1736
1727
|
callback = function callback(result) {
|
|
1737
|
-
Respond(
|
|
1728
|
+
Respond(_this5.utils.MakeClonable({
|
|
1738
1729
|
type: "ElvFrameResponse",
|
|
1739
1730
|
requestId: message.callbackId,
|
|
1740
1731
|
response: result
|
|
@@ -1829,7 +1820,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1829
1820
|
}()
|
|
1830
1821
|
}], [{
|
|
1831
1822
|
key: "Configuration",
|
|
1832
|
-
value:
|
|
1823
|
+
value: function () {
|
|
1833
1824
|
var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref29) {
|
|
1834
1825
|
var configUrl, _ref29$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion;
|
|
1835
1826
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -1910,7 +1901,6 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1910
1901
|
*
|
|
1911
1902
|
* @return {Object} - An object using network names as keys and configuration URLs as values.
|
|
1912
1903
|
*/
|
|
1913
|
-
)
|
|
1914
1904
|
}, {
|
|
1915
1905
|
key: "Networks",
|
|
1916
1906
|
value: function Networks() {
|
|
@@ -1935,7 +1925,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1935
1925
|
*/
|
|
1936
1926
|
}, {
|
|
1937
1927
|
key: "FromNetworkName",
|
|
1938
|
-
value:
|
|
1928
|
+
value: function () {
|
|
1939
1929
|
var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref30) {
|
|
1940
1930
|
var networkName, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, assumeV3, configUrl;
|
|
1941
1931
|
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
@@ -1990,10 +1980,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1990
1980
|
*
|
|
1991
1981
|
* @return {Promise<ElvClient>} - New ElvClient connected to the specified content fabric and blockchain
|
|
1992
1982
|
*/
|
|
1993
|
-
)
|
|
1994
1983
|
}, {
|
|
1995
1984
|
key: "FromConfigurationUrl",
|
|
1996
|
-
value:
|
|
1985
|
+
value: function () {
|
|
1997
1986
|
var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref31) {
|
|
1998
1987
|
var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref31$ethereumContra, ethereumContractTimeout, _ref31$noCache, noCache, _ref31$noAuth, noAuth, _ref31$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, client;
|
|
1999
1988
|
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
@@ -2048,8 +2037,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2048
2037
|
return _FromConfigurationUrl.apply(this, arguments);
|
|
2049
2038
|
}
|
|
2050
2039
|
return FromConfigurationUrl;
|
|
2051
|
-
}()
|
|
2040
|
+
}()
|
|
2052
2041
|
}]);
|
|
2042
|
+
return ElvClient;
|
|
2053
2043
|
}();
|
|
2054
2044
|
Object.assign(ElvClient.prototype, require("./client/AccessGroups"));
|
|
2055
2045
|
Object.assign(ElvClient.prototype, require("./client/ContentAccess"));
|
|
@@ -2060,4 +2050,5 @@ Object.assign(ElvClient.prototype, require("./client/LiveStream"));
|
|
|
2060
2050
|
Object.assign(ElvClient.prototype, require("./client/ContentManagement"));
|
|
2061
2051
|
Object.assign(ElvClient.prototype, require("./client/NTP"));
|
|
2062
2052
|
Object.assign(ElvClient.prototype, require("./client/NFT"));
|
|
2053
|
+
Object.assign(ElvClient.prototype, require("./client/Shares"));
|
|
2063
2054
|
exports.ElvClient = ElvClient;
|
package/dist/src/ElvWallet.js
CHANGED
|
@@ -25,7 +25,7 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns {string} - Space-separated list of random words
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
_createClass(ElvWallet, [{
|
|
29
29
|
key: "GenerateMnemonic",
|
|
30
30
|
value: function GenerateMnemonic() {
|
|
31
31
|
return Ethers.Wallet.createRandom().mnemonic.phrase;
|
|
@@ -64,7 +64,7 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
64
64
|
*/
|
|
65
65
|
}, {
|
|
66
66
|
key: "AddAccountFromEncryptedPK",
|
|
67
|
-
value:
|
|
67
|
+
value: function () {
|
|
68
68
|
var _AddAccountFromEncryptedPK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
69
69
|
var accountName, encryptedPrivateKey, password, signer;
|
|
70
70
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -102,7 +102,6 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
102
102
|
*
|
|
103
103
|
* @returns {Signer} - Signer with the private key, connected to the provider
|
|
104
104
|
*/
|
|
105
|
-
)
|
|
106
105
|
}, {
|
|
107
106
|
key: "AddAccount",
|
|
108
107
|
value: function AddAccount(_ref3) {
|
|
@@ -134,7 +133,7 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
134
133
|
*/
|
|
135
134
|
}, {
|
|
136
135
|
key: "GetAccountBalance",
|
|
137
|
-
value:
|
|
136
|
+
value: function () {
|
|
138
137
|
var _GetAccountBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
|
|
139
138
|
var accountName, signer, accountSigner;
|
|
140
139
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -181,10 +180,9 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
181
180
|
*
|
|
182
181
|
* @returns {Promise<string>} - The encrypted private key (in Ethereum keystore format)
|
|
183
182
|
*/
|
|
184
|
-
)
|
|
185
183
|
}, {
|
|
186
184
|
key: "GenerateEncryptedPrivateKey",
|
|
187
|
-
value:
|
|
185
|
+
value: function () {
|
|
188
186
|
var _GenerateEncryptedPrivateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
189
187
|
var accountName, signer, password, options, accountSigner;
|
|
190
188
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -222,7 +220,6 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
222
220
|
* @param {string} accountName - Name of the account
|
|
223
221
|
* @returns {(Signer|undefined)} - Signer of the saved account, if it exists
|
|
224
222
|
*/
|
|
225
|
-
)
|
|
226
223
|
}, {
|
|
227
224
|
key: "GetAccount",
|
|
228
225
|
value: function GetAccount(_ref6) {
|
|
@@ -243,5 +240,6 @@ var ElvWallet = /*#__PURE__*/function () {
|
|
|
243
240
|
delete this.signers[accountName];
|
|
244
241
|
}
|
|
245
242
|
}]);
|
|
243
|
+
return ElvWallet;
|
|
246
244
|
}();
|
|
247
245
|
module.exports = ElvWallet;
|
package/dist/src/EthClient.js
CHANGED
|
@@ -5,11 +5,11 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
5
5
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
6
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
7
7
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
8
|
-
function _createForOfIteratorHelper(
|
|
9
|
-
function _unsupportedIterableToArray(
|
|
10
|
-
function _arrayLikeToArray(
|
|
11
|
-
function ownKeys(
|
|
12
|
-
function _objectSpread(
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
// NOTE: Querying Ethereum requires CORS enabled
|
|
14
14
|
// Use --rpccorsdomain "http[s]://hostname:port" or set up proxy
|
|
15
15
|
var Ethers = require("ethers");
|
|
@@ -57,7 +57,7 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
57
57
|
|
|
58
58
|
//Ethers.errors.setLogLevel("error");
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
_createClass(EthClient, [{
|
|
61
61
|
key: "Log",
|
|
62
62
|
value: function Log(message) {
|
|
63
63
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -701,7 +701,7 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
701
701
|
}() /* Specific contract management */
|
|
702
702
|
}, {
|
|
703
703
|
key: "DeployAccessGroupContract",
|
|
704
|
-
value:
|
|
704
|
+
value: function () {
|
|
705
705
|
var _DeployAccessGroupContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
|
|
706
706
|
var contentSpaceAddress;
|
|
707
707
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
@@ -725,7 +725,7 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
725
725
|
return _DeployAccessGroupContract.apply(this, arguments);
|
|
726
726
|
}
|
|
727
727
|
return DeployAccessGroupContract;
|
|
728
|
-
}()
|
|
728
|
+
}()
|
|
729
729
|
}, {
|
|
730
730
|
key: "DeployTypeContract",
|
|
731
731
|
value: function () {
|
|
@@ -1149,5 +1149,6 @@ var EthClient = /*#__PURE__*/function () {
|
|
|
1149
1149
|
return Events;
|
|
1150
1150
|
}()
|
|
1151
1151
|
}]);
|
|
1152
|
+
return EthClient;
|
|
1152
1153
|
}();
|
|
1153
1154
|
module.exports = EthClient;
|