@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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/ElvClient-min.js +14 -15
  3. package/dist/ElvClient-node-min.js +13 -14
  4. package/dist/ElvFrameClient-min.js +10 -10
  5. package/dist/ElvPermissionsClient-min.js +9 -9
  6. package/dist/ElvWalletClient-min.js +14 -15
  7. package/dist/ElvWalletClient-node-min.js +13 -14
  8. package/dist/src/AuthorizationClient.js +41 -32
  9. package/dist/src/ContentObjectAudit.js +3 -3
  10. package/dist/src/ContentObjectVerification.js +3 -3
  11. package/dist/src/Crypto.js +2 -2
  12. package/dist/src/ElvClient.js +52 -61
  13. package/dist/src/ElvWallet.js +5 -7
  14. package/dist/src/EthClient.js +9 -8
  15. package/dist/src/FrameClient.js +10 -9
  16. package/dist/src/HttpClient.js +2 -1
  17. package/dist/src/Id.js +2 -1
  18. package/dist/src/PermissionsClient.js +19 -31
  19. package/dist/src/RemoteSigner.js +8 -6
  20. package/dist/src/UserProfileClient.js +20 -35
  21. package/dist/src/Utils.js +3 -2
  22. package/dist/src/client/ABRPublishing.js +3 -3
  23. package/dist/src/client/AccessGroups.js +2 -2
  24. package/dist/src/client/ContentAccess.js +10 -5
  25. package/dist/src/client/ContentManagement.js +3 -3
  26. package/dist/src/client/Contracts.js +2 -2
  27. package/dist/src/client/Files.js +2 -2
  28. package/dist/src/client/LiveConf.js +5 -3
  29. package/dist/src/client/LiveStream.js +2 -0
  30. package/dist/src/client/NFT.js +2 -2
  31. package/dist/src/client/Shares.js +285 -0
  32. package/dist/src/walletClient/ClientMethods.js +2 -2
  33. package/dist/src/walletClient/Profile.js +2 -2
  34. package/dist/src/walletClient/Utils.js +2 -2
  35. package/dist/src/walletClient/index.js +14 -17
  36. package/package.json +2 -2
  37. package/src/AuthorizationClient.js +2 -0
  38. package/src/ElvClient.js +13 -3
  39. package/src/FrameClient.js +5 -0
  40. package/src/client/ABRPublishing.js +1 -1
  41. package/src/client/ContentAccess.js +6 -3
  42. package/src/client/Shares.js +162 -0
  43. package/utilities/GenerateFabricToken.js +3 -2
  44. package/build/BuildDocs.js +0 -12
@@ -7,8 +7,8 @@ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
7
7
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
8
8
  var _createClass = require("@babel/runtime/helpers/createClass");
9
9
  var _excluded = ["code", "address", "type", "authToken", "expiresAt"];
10
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ 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; }
11
+ 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; }
12
12
  var _require = require("../ElvClient"),
13
13
  ElvClient = _require.ElvClient;
14
14
  var Configuration = require("./Configuration");
@@ -79,7 +79,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
79
79
  this.utils = client.utils;
80
80
  this.ForbiddenMethods = ElvWalletClient.ForbiddenMethods;
81
81
  }
82
- return _createClass(ElvWalletClient, [{
82
+ _createClass(ElvWalletClient, [{
83
83
  key: "Log",
84
84
  value: function Log(message) {
85
85
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -136,7 +136,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
136
136
  */
137
137
  }, {
138
138
  key: "PersonalSign",
139
- value: (function () {
139
+ value: function () {
140
140
  var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
141
141
  var message, parameters, url;
142
142
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -265,7 +265,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
265
265
  return _PersonalSign.apply(this, arguments);
266
266
  }
267
267
  return PersonalSign;
268
- }())
268
+ }()
269
269
  }, {
270
270
  key: "LogInURL",
271
271
  value: function () {
@@ -344,7 +344,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
344
344
  */
345
345
  }, {
346
346
  key: "LogIn",
347
- value: (function () {
347
+ value: function () {
348
348
  var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref5) {
349
349
  var _this = this;
350
350
  var _ref5$method, method, provider, _ref5$mode, mode, callbackUrl, marketplaceParams, _ref5$clearLogin, clearLogin, callback, loginUrl;
@@ -463,10 +463,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
463
463
  *
464
464
  * @methodGroup Login
465
465
  */
466
- )
467
466
  }, {
468
467
  key: "LogOut",
469
- value: (function () {
468
+ value: function () {
470
469
  var _LogOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
471
470
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
472
471
  while (1) switch (_context8.prev = _context8.next) {
@@ -509,7 +508,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
509
508
  return _LogOut.apply(this, arguments);
510
509
  }
511
510
  return LogOut;
512
- }())
511
+ }()
513
512
  }, {
514
513
  key: "TokenStatus",
515
514
  value: function () {
@@ -549,7 +548,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
549
548
  */
550
549
  }, {
551
550
  key: "Authenticate",
552
- value: (function () {
551
+ value: function () {
553
552
  var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref7) {
554
553
  var token, decodedToken;
555
554
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
@@ -615,10 +614,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
615
614
  * - signingToken - Identical to `authToken`, but also includes the ability to perform arbitrary signatures with the custodial wallet. This token should be protected and should not be
616
615
  * shared with third parties.
617
616
  */
618
- )
619
617
  }, {
620
618
  key: "AuthenticateOAuth",
621
- value: (function () {
619
+ value: function () {
622
620
  var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref8) {
623
621
  var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force, tokenDuration, fabricToken, expiresAt, tokenResponse, address, decodedToken;
624
622
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
@@ -746,10 +744,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
746
744
  * @returns {Promise<string>} - Returns an authorization token that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
747
745
  * Save this token to avoid having to reauthenticate. This token expires after 24 hours.
748
746
  */
749
- )
750
747
  }, {
751
748
  key: "AuthenticateExternalWallet",
752
- value: (function () {
749
+ value: function () {
753
750
  var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref9) {
754
751
  var _this2 = this;
755
752
  var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
@@ -818,7 +815,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
818
815
  *
819
816
  * @returns {string} - The client auth token
820
817
  */
821
- )
822
818
  }, {
823
819
  key: "ClientAuthToken",
824
820
  value: function ClientAuthToken() {
@@ -1882,7 +1878,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1882
1878
  */
1883
1879
  }, {
1884
1880
  key: "Initialize",
1885
- value: (function () {
1881
+ value: function () {
1886
1882
  var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
1887
1883
  var client, _ref24$appId, appId, _ref24$network, network, _ref24$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref24$storeAuthToken, storeAuthToken, _ref24$skipMarketplac, skipMarketplaceLoad, _ref25, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
1888
1884
  return _regeneratorRuntime.wrap(function _callee25$(_context25) {
@@ -2009,8 +2005,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
2009
2005
  return _Initialize.apply(this, arguments);
2010
2006
  }
2011
2007
  return Initialize;
2012
- }())
2008
+ }()
2013
2009
  }]);
2010
+ return ElvWalletClient;
2014
2011
  }();
2015
2012
  Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));
2016
2013
  Object.assign(ElvWalletClient.prototype, require("./Profile"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.121",
3
+ "version": "4.0.123",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "bump-version": "npm --git-tag-version --no-commit-hooks version patch",
11
11
  "build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-wallet-client-web && npm run build-wallet-client-node && npm run build-prod",
12
- "build-docs": "node build/BuildDocs.js && npm run build-client-docs && npm run build-wallet-client-docs",
12
+ "build-docs": "npm run build-client-docs && npm run build-wallet-client-docs",
13
13
  "build-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
14
14
  "build-wallet-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc-mc.json --readme ./src/walletClient/README.md",
15
15
  "build-dist": "node ./node_modules/@babel/cli/bin/babel.js --source-type=unambiguous --presets=@babel/preset-env --plugins @babel/plugin-transform-runtime src --out-dir dist/src",
@@ -130,6 +130,8 @@ class AuthorizationClient {
130
130
  // User wallet requests can't use static token
131
131
  if(this.client.staticToken && !isWalletRequest && !update) {
132
132
  return this.client.staticToken;
133
+ } else if(this.client.staticUpdateToken && !isWalletRequest) {
134
+ return this.client.staticUpdateToken;
133
135
  }
134
136
 
135
137
  const initialNoCache = this.noCache;
package/src/ElvClient.js CHANGED
@@ -750,6 +750,9 @@ class ElvClient {
750
750
  signer.provider.pollingInterval = 500;
751
751
  this.signer = signer;
752
752
 
753
+ this.CreateFabricToken({})
754
+ .then(token => this.signedToken = token);
755
+
753
756
  if(reset) {
754
757
  this.InitializeClients();
755
758
  }
@@ -1195,13 +1198,16 @@ class ElvClient {
1195
1198
  * @methodGroup Authorization
1196
1199
  * @namedParams
1197
1200
  * @param {string=} token - The static token to use. If not provided, the default static token will be set.
1201
+ * @param {boolean=} update=false - If specified, the static token will be used for update operations as well
1198
1202
  */
1199
- SetStaticToken({token}={}) {
1203
+ SetStaticToken({token, update=false}={}) {
1200
1204
  if(token) {
1201
1205
  this.staticToken = token;
1202
1206
  } else {
1203
1207
  this.staticToken = this.utils.B64(JSON.stringify({qspace_id: this.contentSpaceId}));
1204
1208
  }
1209
+
1210
+ this.staticUpdateToken = update ? this.staticToken : undefined;
1205
1211
  }
1206
1212
 
1207
1213
  /**
@@ -1299,8 +1305,11 @@ class ElvClient {
1299
1305
  );
1300
1306
  }
1301
1307
 
1302
- async MakeAuthServiceRequest({kmsId, objectId, versionHash, method="GET", path, bodyType, body={}, queryParams={}, headers}) {
1303
- return this.authClient.MakeAuthServiceRequest({kmsId, objectId, versionHash, method, path, bodyType, body, queryParams, headers});
1308
+ async MakeAuthServiceRequest({kmsId, objectId, versionHash, method="GET", path, bodyType, body={}, queryParams={}, headers, format}) {
1309
+ const response = this.authClient.MakeAuthServiceRequest({kmsId, objectId, versionHash, method, path, bodyType, body, queryParams, headers});
1310
+
1311
+ return !format ? response :
1312
+ this.utils.ResponseToFormat(format, response);
1304
1313
  }
1305
1314
 
1306
1315
  /* FrameClient related */
@@ -1416,5 +1425,6 @@ Object.assign(ElvClient.prototype, require("./client/LiveStream"));
1416
1425
  Object.assign(ElvClient.prototype, require("./client/ContentManagement"));
1417
1426
  Object.assign(ElvClient.prototype, require("./client/NTP"));
1418
1427
  Object.assign(ElvClient.prototype, require("./client/NFT"));
1428
+ Object.assign(ElvClient.prototype, require("./client/Shares"));
1419
1429
 
1420
1430
  exports.ElvClient = ElvClient;
@@ -375,6 +375,7 @@ class FrameClient {
375
375
  "CreateNonOwnerCap",
376
376
  "CreatePart",
377
377
  "CreateProductionMaster",
378
+ "CreateShare",
378
379
  "CreateSignedToken",
379
380
  "CreateStaticToken",
380
381
  "CurrentAccountAddress",
@@ -452,6 +453,7 @@ class FrameClient {
452
453
  "QParts",
453
454
  "RecordWriteToken",
454
455
  "RedeemCode",
456
+ "RedeemShareToken",
455
457
  "RemoveAccessGroupManager",
456
458
  "RemoveAccessGroupMember",
457
459
  "RemoveContentObjectGroupPermission",
@@ -462,6 +464,7 @@ class FrameClient {
462
464
  "ReplaceMetadata",
463
465
  "Request",
464
466
  "ResetRegion",
467
+ "RevokeShare",
465
468
  "SendFunds",
466
469
  "SetAccessCharge",
467
470
  "SetAuth",
@@ -478,6 +481,7 @@ class FrameClient {
478
481
  "SetStaticToken",
479
482
  "SetVisibility",
480
483
  "SetPermission",
484
+ "Shares",
481
485
  "SpaceNodes",
482
486
  "StartABRMezzanineJobs",
483
487
  "StreamAddWatermark",
@@ -495,6 +499,7 @@ class FrameClient {
495
499
  "UnlinkAccessGroupFromOauth",
496
500
  "UpdateContentObjectGraph",
497
501
  "UpdateNTPInstance",
502
+ "UpdateShare",
498
503
  "UploadFileData",
499
504
  "UploadFilesFromS3",
500
505
  "UploadJobStatus",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Methods for ABR video creation and management
3
3
  *
4
- * For more information on how to publish ABR content see <a href="./abr/index.html">this detailed guide</a>
4
+ * For more information on how to publish ABR content see <a href="https://docs.eluv.io/docs/guides/media-ingest/">this detailed guide</a>
5
5
  *
6
6
  * @module ElvClient/ABRPublishing
7
7
  */
@@ -1454,7 +1454,7 @@ exports.PlayoutOptions = async function({
1454
1454
 
1455
1455
  try {
1456
1456
  // If public/asset_metadata/sources/<offering> exists, use that instead of directly calling on object
1457
- if(!linkPath) {
1457
+ if(!linkPath && handler === "playout") {
1458
1458
  const offeringPath = UrlJoin("public", "asset_metadata", "sources", offering);
1459
1459
  const link = await this.ContentObjectMetadata({
1460
1460
  libraryId,
@@ -1573,6 +1573,7 @@ exports.PlayoutOptions = async function({
1573
1573
  signedLink ?
1574
1574
  await this.LinkUrl({
1575
1575
  versionHash,
1576
+ writeToken,
1576
1577
  linkPath: UrlJoin(linkPath, offering, playoutPath),
1577
1578
  queryParams,
1578
1579
  noAuth: true
@@ -1581,6 +1582,7 @@ exports.PlayoutOptions = async function({
1581
1582
  libraryId: linkTarget.libraryId || libraryId,
1582
1583
  objectId: linkTarget.objectId || objectId,
1583
1584
  versionHash: linkTarget.versionHash || versionHash,
1585
+ writeToken,
1584
1586
  rep: UrlJoin(handler, offering, playoutPath),
1585
1587
  noAuth: true,
1586
1588
  queryParams
@@ -2051,6 +2053,7 @@ exports.CallBitcodeMethod = async function({
2051
2053
  * @namedParams
2052
2054
  * @param {string=} libraryId - ID of the library
2053
2055
  * @param {string=} objectId - ID of the object
2056
+ * @param {string=} writeToken - A write token for a draft of the object (requires libraryId)
2054
2057
  * @param {string=} versionHash - Hash of the object version - if not specified, latest version will be used
2055
2058
  * @param {string} rep - Representation to use
2056
2059
  * @param {Object=} queryParams - Query params to add to the URL
@@ -2066,11 +2069,11 @@ exports.CallBitcodeMethod = async function({
2066
2069
  *
2067
2070
  * @returns {Promise<string>} - URL to the specified rep endpoint with authorization token
2068
2071
  */
2069
- exports.Rep = async function({libraryId, objectId, versionHash, rep, queryParams={}, service="fabric", makeAccessRequest=false, channelAuth=false, noAuth=false, noCache=false}) {
2072
+ exports.Rep = async function({libraryId, objectId, versionHash, writeToken, rep, queryParams={}, service="fabric", makeAccessRequest=false, channelAuth=false, noAuth=false, noCache=false}) {
2070
2073
  ValidateParameters({libraryId, objectId, versionHash});
2071
2074
  if(!rep) { throw "Rep not specified"; }
2072
2075
 
2073
- return this.FabricUrl({libraryId, objectId, versionHash, rep, queryParams, service, makeAccessRequest, channelAuth, noAuth, noCache});
2076
+ return this.FabricUrl({libraryId, objectId, versionHash, writeToken, rep, queryParams, service, makeAccessRequest, channelAuth, noAuth, noCache});
2074
2077
  };
2075
2078
 
2076
2079
  /**
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Methods for creating and managing shared authorization tokens
3
+ *
4
+ * @module ElvClient/Shares
5
+ */
6
+
7
+ const UrlJoin = require("url-join");
8
+
9
+ /**
10
+ * Create a share
11
+ *
12
+ * @namedParams
13
+ * @param {string} objectId - The object to create a share for
14
+ * @param {Date} expiresAt - The expiration time of the share
15
+ * @param {Object=} params - Additional parameters
16
+ *
17
+ * @returns {Promise<Object>} - Info about the created share
18
+ */
19
+ exports.CreateShare = async function({objectId, expiresAt, params={}}) {
20
+ const tenantId = await this.userProfileClient.TenantContractId();
21
+
22
+ params.object_id = objectId;
23
+
24
+ if(expiresAt) {
25
+ params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
26
+ }
27
+
28
+ return await this.MakeAuthServiceRequest({
29
+ path: UrlJoin("as", "sharing", tenantId, "share"),
30
+ method: "POST",
31
+ format: "JSON",
32
+ body: params,
33
+ headers: {
34
+ Authorization: `Bearer ${this.signedToken}`
35
+ }
36
+ });
37
+ };
38
+
39
+ /**
40
+ * List shares associated with your tenancy
41
+ *
42
+ * @namedParams
43
+ * @param {string=} objectId - If specified, the results will be limited shares for the specified object
44
+ * @param {number=} limit=100 - Maximum number of results to return
45
+ * @param {number=} offset=0 - Offset from which to return results
46
+ *
47
+ * @returns {Promise<Array<Object>>} - Info about the shares
48
+ */
49
+ exports.Shares = async function({objectId, limit=100, offset=0}={}) {
50
+ const tenantId = await this.userProfileClient.TenantContractId();
51
+
52
+ const response = await this.MakeAuthServiceRequest({
53
+ path: UrlJoin("as", "sharing", tenantId, "shares"),
54
+ method: objectId ? "POST" : "GET",
55
+ queryParams: { limit, offset },
56
+ body: objectId ? {object_id: objectId} : undefined,
57
+ format: "JSON",
58
+ headers: {
59
+ Authorization: `Bearer ${this.signedToken}`
60
+ }
61
+ });
62
+
63
+ // Convert dates from seconds to date strings
64
+ if(response && response.shares) {
65
+ response.shares = response.shares.map(share => ({
66
+ ...share,
67
+ start_time: share.start_time ? new Date(share.start_time * 1000).toISOString() : null,
68
+ end_time: share.end_time ? new Date(share.end_time * 1000).toISOString() : null,
69
+ }));
70
+ }
71
+
72
+ return response;
73
+ };
74
+
75
+ /**
76
+ * Update the specified share
77
+ *
78
+ * @namedParams
79
+ * @param {string} shareId - The ID of the share to modify
80
+ * @param {Date=} expiresAt - The new expiration time of the share
81
+ * @param {Object=} params - Additional parameters
82
+ *
83
+ * @returns {Promise<Object>} - Info about the updated share
84
+ */
85
+ exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
86
+ const tenantId = await this.userProfileClient.TenantContractId();
87
+
88
+ if(expiresAt) {
89
+ params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
90
+ }
91
+
92
+ return await this.MakeAuthServiceRequest({
93
+ path: UrlJoin("as", "sharing", tenantId, "share", shareId),
94
+ method: "PUT",
95
+ format: "JSON",
96
+ body: params,
97
+ headers: {
98
+ Authorization: `Bearer ${this.signedToken}`
99
+ }
100
+ });
101
+ };
102
+
103
+ /**
104
+ * Revoke the specified share
105
+ *
106
+ * @namedParams
107
+ * @param {string} shareId - The ID of the share to modify
108
+ */
109
+ exports.RevokeShare = async function({shareId}) {
110
+ const tenantId = await this.userProfileClient.TenantContractId();
111
+
112
+ return await this.MakeAuthServiceRequest({
113
+ path: UrlJoin("as", "sharing", tenantId, "share", shareId, "revoke"),
114
+ method: "PUT",
115
+ format: "JSON",
116
+ headers: {
117
+ Authorization: `Bearer ${this.signedToken}`
118
+ }
119
+ });
120
+ };
121
+
122
+ /**
123
+ * Retrieve info about the specified share
124
+ *
125
+ * @namedParams
126
+ * @param {string} shareId - The ID of the share
127
+ *
128
+ * @returns {Promise<Object>} - Info about the share
129
+ */
130
+ exports.ShareInfo = async function({shareId}) {
131
+ const {share} = await this.MakeAuthServiceRequest({
132
+ path: UrlJoin("as", "sharing", "share", shareId, "info"),
133
+ method: "GET",
134
+ format: "JSON"
135
+ });
136
+
137
+ if(share.start_time) {
138
+ share.start_time = new Date(share.start_time * 1000).toISOString();
139
+ }
140
+
141
+ if(share.end_time) {
142
+ share.end_time = new Date(share.end_time * 1000).toISOString();
143
+ }
144
+
145
+ return share;
146
+ };
147
+
148
+ /**
149
+ * Retrieve the authorization token for the specified share
150
+ *
151
+ * @namedParams
152
+ * @param {string} shareId - The ID of the share
153
+ *
154
+ * @returns {Promise<Object>} - The authorization token for the share
155
+ */
156
+ exports.RedeemShareToken = async function({shareId}) {
157
+ return (await this.MakeAuthServiceRequest({
158
+ path: UrlJoin("as", "sharing", "share", shareId, "token"),
159
+ method: "GET",
160
+ format: "JSON"
161
+ })).token;
162
+ };
@@ -2,7 +2,7 @@ const { ElvClient } = require("../src/ElvClient");
2
2
 
3
3
  const GenerateFabricToken = async () => {
4
4
  try {
5
- const client = await ElvClient.FromNetworkName({networkName: "main"});
5
+ const client = await ElvClient.FromNetworkName({networkName: process.env.ENV ?? "main"});
6
6
 
7
7
  const wallet = client.GenerateWallet();
8
8
  const signer = wallet.AddAccount({
@@ -12,7 +12,8 @@ const GenerateFabricToken = async () => {
12
12
  client.SetSigner({signer});
13
13
 
14
14
  console.log(await client.CreateFabricToken({
15
- duration: parseInt(process.env.DURATION),
15
+ duration: parseInt(process.env.DURATION ?? 24 * 60 * 60 * 1000),
16
+ context: JSON.parse(process.env.ELV_TOK_CTX ?? "{}")
16
17
  //context: {email:"xyz@eluv.io"}
17
18
  }));
18
19
  } catch(error) {
@@ -1,12 +0,0 @@
1
- const Showdown = require("showdown");
2
- const fs = require("fs");
3
- const Path = require("path");
4
-
5
- Showdown.setFlavor("vanilla");
6
-
7
- const markdownConverter = new Showdown.Converter();
8
-
9
- const md = fs.readFileSync(Path.join(__dirname, "..", "docs", "abr", "index.md")).toString("utf-8");
10
- const html = markdownConverter.makeHtml(md);
11
-
12
- fs.writeFileSync(Path.join(__dirname, "..", "docs", "abr", "index.html"), html);