@eluvio/elv-client-js 4.0.127 → 4.0.129
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 +15 -14
- package/dist/ElvClient-node-min.js +14 -13
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +15 -14
- package/dist/ElvWalletClient-node-min.js +14 -13
- package/dist/src/AuthorizationClient.js +9 -12
- 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 +263 -222
- package/dist/src/ElvWallet.js +7 -5
- package/dist/src/EthClient.js +8 -9
- package/dist/src/FrameClient.js +9 -10
- package/dist/src/HttpClient.js +1 -2
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +31 -19
- package/dist/src/RemoteSigner.js +6 -8
- package/dist/src/UserProfileClient.js +35 -20
- package/dist/src/Utils.js +2 -3
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +8 -12
- package/dist/src/client/ContentManagement.js +82 -72
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +9 -5
- package/dist/src/client/LiveStream.js +0 -2
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/client/Shares.js +47 -24
- 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 +35 -21
- package/package.json +1 -1
- package/src/ElvClient.js +9 -6
- package/src/client/ContentAccess.js +2 -2
- package/src/client/ContentManagement.js +47 -27
- package/src/client/LiveConf.js +8 -0
- package/src/client/Shares.js +14 -5
|
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
2
2
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
3
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var UrlJoin = require("url-join");
|
|
9
9
|
var StateStorePath = function StateStorePath(_ref) {
|
|
@@ -2,8 +2,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
2
2
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
3
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
4
4
|
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var RarityToPercentage = function RarityToPercentage(rarity) {
|
|
9
9
|
if (!rarity) {
|
|
@@ -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(
|
|
11
|
-
function _objectSpread(
|
|
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; }
|
|
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
|
-
_createClass(ElvWalletClient, [{
|
|
82
|
+
return _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,9 +463,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
463
463
|
*
|
|
464
464
|
* @methodGroup Login
|
|
465
465
|
*/
|
|
466
|
+
)
|
|
466
467
|
}, {
|
|
467
468
|
key: "LogOut",
|
|
468
|
-
value: function () {
|
|
469
|
+
value: (function () {
|
|
469
470
|
var _LogOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
470
471
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
471
472
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -508,7 +509,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
508
509
|
return _LogOut.apply(this, arguments);
|
|
509
510
|
}
|
|
510
511
|
return LogOut;
|
|
511
|
-
}()
|
|
512
|
+
}())
|
|
512
513
|
}, {
|
|
513
514
|
key: "TokenStatus",
|
|
514
515
|
value: function () {
|
|
@@ -548,7 +549,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
548
549
|
*/
|
|
549
550
|
}, {
|
|
550
551
|
key: "Authenticate",
|
|
551
|
-
value: function () {
|
|
552
|
+
value: (function () {
|
|
552
553
|
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref7) {
|
|
553
554
|
var token, decodedToken;
|
|
554
555
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
@@ -614,9 +615,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
614
615
|
* - 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
|
|
615
616
|
* shared with third parties.
|
|
616
617
|
*/
|
|
618
|
+
)
|
|
617
619
|
}, {
|
|
618
620
|
key: "AuthenticateOAuth",
|
|
619
|
-
value: function () {
|
|
621
|
+
value: (function () {
|
|
620
622
|
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref8) {
|
|
621
623
|
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force, tokenDuration, fabricToken, expiresAt, tokenResponse, address, decodedToken;
|
|
622
624
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
@@ -744,9 +746,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
744
746
|
* @returns {Promise<string>} - Returns an authorization token that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
745
747
|
* Save this token to avoid having to reauthenticate. This token expires after 24 hours.
|
|
746
748
|
*/
|
|
749
|
+
)
|
|
747
750
|
}, {
|
|
748
751
|
key: "AuthenticateExternalWallet",
|
|
749
|
-
value: function () {
|
|
752
|
+
value: (function () {
|
|
750
753
|
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref9) {
|
|
751
754
|
var _this2 = this;
|
|
752
755
|
var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
@@ -815,6 +818,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
815
818
|
*
|
|
816
819
|
* @returns {string} - The client auth token
|
|
817
820
|
*/
|
|
821
|
+
)
|
|
818
822
|
}, {
|
|
819
823
|
key: "ClientAuthToken",
|
|
820
824
|
value: function ClientAuthToken() {
|
|
@@ -1878,7 +1882,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1878
1882
|
*/
|
|
1879
1883
|
}, {
|
|
1880
1884
|
key: "Initialize",
|
|
1881
|
-
value: function () {
|
|
1885
|
+
value: (function () {
|
|
1882
1886
|
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
|
|
1883
1887
|
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;
|
|
1884
1888
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -1978,36 +1982,46 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1978
1982
|
_context25.prev = 35;
|
|
1979
1983
|
_context25.t0 = _context25["catch"](28);
|
|
1980
1984
|
case 37:
|
|
1981
|
-
_context25.
|
|
1985
|
+
_context25.prev = 37;
|
|
1986
|
+
_context25.next = 40;
|
|
1982
1987
|
return client.utils.ResponseToJson(client.MakeAuthServiceRequest({
|
|
1983
1988
|
path: "/as/mw/toplevel",
|
|
1984
1989
|
queryParams: {
|
|
1985
1990
|
env: mode
|
|
1986
1991
|
}
|
|
1987
1992
|
}));
|
|
1988
|
-
case
|
|
1993
|
+
case 40:
|
|
1989
1994
|
walletClient.topLevelInfo = _context25.sent;
|
|
1995
|
+
_context25.next = 47;
|
|
1996
|
+
break;
|
|
1997
|
+
case 43:
|
|
1998
|
+
_context25.prev = 43;
|
|
1999
|
+
_context25.t1 = _context25["catch"](37);
|
|
2000
|
+
// eslint-disable-next-line no-console
|
|
2001
|
+
console.error("Unable to load top level info:");
|
|
2002
|
+
// eslint-disable-next-line no-console
|
|
2003
|
+
console.error(_context25.t1);
|
|
2004
|
+
case 47:
|
|
1990
2005
|
if (skipMarketplaceLoad) {
|
|
1991
|
-
_context25.next =
|
|
2006
|
+
_context25.next = 50;
|
|
1992
2007
|
break;
|
|
1993
2008
|
}
|
|
1994
|
-
_context25.next =
|
|
2009
|
+
_context25.next = 50;
|
|
1995
2010
|
return walletClient.LoadAvailableMarketplaces();
|
|
1996
|
-
case
|
|
2011
|
+
case 50:
|
|
1997
2012
|
return _context25.abrupt("return", walletClient);
|
|
1998
|
-
case
|
|
2013
|
+
case 51:
|
|
1999
2014
|
case "end":
|
|
2000
2015
|
return _context25.stop();
|
|
2001
2016
|
}
|
|
2002
|
-
}, _callee25, null, [[28, 35]]);
|
|
2017
|
+
}, _callee25, null, [[28, 35], [37, 43]]);
|
|
2003
2018
|
}));
|
|
2004
2019
|
function Initialize(_x25) {
|
|
2005
2020
|
return _Initialize.apply(this, arguments);
|
|
2006
2021
|
}
|
|
2007
2022
|
return Initialize;
|
|
2008
|
-
}()
|
|
2023
|
+
}())
|
|
2009
2024
|
}]);
|
|
2010
|
-
return ElvWalletClient;
|
|
2011
2025
|
}();
|
|
2012
2026
|
Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));
|
|
2013
2027
|
Object.assign(ElvWalletClient.prototype, require("./Profile"));
|
package/package.json
CHANGED
package/src/ElvClient.js
CHANGED
|
@@ -750,9 +750,6 @@ 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
|
-
|
|
756
753
|
if(reset) {
|
|
757
754
|
this.InitializeClients();
|
|
758
755
|
}
|
|
@@ -956,6 +953,8 @@ class ElvClient {
|
|
|
956
953
|
* @param {boolean} allowDecryption=false - If specified, the re-encryption key will be included in the token,
|
|
957
954
|
* enabling the user of this token to download encrypted content from the specified object
|
|
958
955
|
* @param {Object=} context - Additional JSON context
|
|
956
|
+
* @param {number=} issueTime - Issue Time in milliseconds
|
|
957
|
+
* @param {number=} expirationTime - Expiration Time in milliseconds
|
|
959
958
|
*/
|
|
960
959
|
async CreateSignedToken({
|
|
961
960
|
libraryId,
|
|
@@ -966,7 +965,9 @@ class ElvClient {
|
|
|
966
965
|
grantType="read",
|
|
967
966
|
allowDecryption=false,
|
|
968
967
|
duration,
|
|
969
|
-
context={}
|
|
968
|
+
context={},
|
|
969
|
+
issueTime,
|
|
970
|
+
expirationTime
|
|
970
971
|
}) {
|
|
971
972
|
if(!subject) {
|
|
972
973
|
subject = `iusr${this.utils.AddressToHash(await this.CurrentAccountAddress())}`;
|
|
@@ -976,12 +977,14 @@ class ElvClient {
|
|
|
976
977
|
context["elv:delegation-id"] = policyId;
|
|
977
978
|
}
|
|
978
979
|
|
|
980
|
+
const issueDateTime = issueTime || Date.now();
|
|
981
|
+
|
|
979
982
|
let token = {
|
|
980
983
|
adr: Buffer.from(await this.CurrentAccountAddress().replace(/^0x/, ""), "hex").toString("base64"),
|
|
981
984
|
sub: subject,
|
|
982
985
|
spc: await this.ContentSpaceId(),
|
|
983
|
-
iat:
|
|
984
|
-
exp:
|
|
986
|
+
iat: issueDateTime,
|
|
987
|
+
exp: expirationTime || (issueDateTime + duration),
|
|
985
988
|
gra: grantType,
|
|
986
989
|
ctx: context
|
|
987
990
|
};
|
|
@@ -934,8 +934,8 @@ exports.ContentObjectMetadata = async function({
|
|
|
934
934
|
// For a 404 error, check if error was due to write token not found
|
|
935
935
|
const errQwtoken = objectPath.get(error.body, "errors.0.cause.cause.cause.qwtoken");
|
|
936
936
|
if(errQwtoken) {
|
|
937
|
-
// if so,
|
|
938
|
-
throw
|
|
937
|
+
// if so, throw more specific/informative error rather than the generic 'Not found' error
|
|
938
|
+
throw new Error(`Write token ${errQwtoken} not found`);
|
|
939
939
|
} else {
|
|
940
940
|
// For all other 404 errors (not just 'subtree not found'), suppress error and
|
|
941
941
|
// return an empty value. (there are function call chains that depend on this behavior,
|
|
@@ -251,11 +251,11 @@ exports.CreateContentType = async function({name, metadata={}, bitcode}) {
|
|
|
251
251
|
* @param {string} name - Library name
|
|
252
252
|
* @param {string=} description - Library description
|
|
253
253
|
* @param {blob=} image - Image associated with the library
|
|
254
|
-
* @param {string=}
|
|
254
|
+
* @param {string=} imageName - Name of the image associated with the library (required if image specified)
|
|
255
255
|
* @param {Object=} metadata - Metadata of library object
|
|
256
256
|
* @param {string=} kmsId - ID of the KMS to use for content in this library. If not specified,
|
|
257
257
|
* the default KMS will be used.
|
|
258
|
-
* @param {string=}
|
|
258
|
+
* @param {string=} tenantContractId - ID of the tenant to use for this library
|
|
259
259
|
*
|
|
260
260
|
* @returns {Promise<string>} - Library ID of created library
|
|
261
261
|
*/
|
|
@@ -420,26 +420,25 @@ exports.SetContentObjectImage = async function({libraryId, objectId, writeToken,
|
|
|
420
420
|
* @param {string} libraryId - ID of the library to delete
|
|
421
421
|
*/
|
|
422
422
|
exports.DeleteContentLibrary = async function({libraryId}) {
|
|
423
|
-
throw Error(
|
|
424
|
-
|
|
425
|
-
//
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
});
|
|
423
|
+
throw Error(`Delete library not supported. (${libraryId})`);
|
|
424
|
+
|
|
425
|
+
// ValidateLibrary(libraryId);
|
|
426
|
+
//
|
|
427
|
+
// let path = UrlJoin("qlibs", libraryId);
|
|
428
|
+
//
|
|
429
|
+
// const authorizationHeader = await this.authClient.AuthorizationHeader({libraryId, update: true});
|
|
430
|
+
//
|
|
431
|
+
// await this.CallContractMethodAndWait({
|
|
432
|
+
// contractAddress: this.utils.HashToAddress(libraryId),
|
|
433
|
+
// methodName: "kill",
|
|
434
|
+
// methodArgs: []
|
|
435
|
+
// });
|
|
436
|
+
//
|
|
437
|
+
// await this.HttpClient.Request({
|
|
438
|
+
// headers: authorizationHeader,
|
|
439
|
+
// method: "DELETE",
|
|
440
|
+
// path: path
|
|
441
|
+
// });
|
|
443
442
|
};
|
|
444
443
|
|
|
445
444
|
/* Library Content Type Management */
|
|
@@ -542,7 +541,11 @@ exports.RemoveLibraryContentType = async function({libraryId, typeId, typeName,
|
|
|
542
541
|
*
|
|
543
542
|
* meta: Metadata to use for the new object
|
|
544
543
|
*
|
|
545
|
-
*
|
|
544
|
+
* noEncryptionConk: Set to true to prevent creation of an encryption conk for the object
|
|
545
|
+
*
|
|
546
|
+
* createKMSConk: Set to true to create a KMS conk for object (usually for sharing a playable object) (incompatible with noEncryptionConk: true)
|
|
547
|
+
*
|
|
548
|
+
* @returns {Promise<Object>} - Response containing the object ID and write token of the draft, as well as the url of the node that created the write token.
|
|
546
549
|
*/
|
|
547
550
|
exports.CreateContentObject = async function({libraryId, objectId, options={}}) {
|
|
548
551
|
ValidateLibrary(libraryId);
|
|
@@ -550,6 +553,8 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
550
553
|
|
|
551
554
|
this.Log(`Creating content object: ${libraryId} ${objectId || ""}`);
|
|
552
555
|
|
|
556
|
+
if(options.noEncryptionConk && options.createKMSConk) throw new Error("Incompatible options: noEncryptionConk and createKMSConk both set to true");
|
|
557
|
+
|
|
553
558
|
// Look up content type, if specified
|
|
554
559
|
let typeId;
|
|
555
560
|
if(options.type) {
|
|
@@ -605,10 +610,15 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
605
610
|
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
|
|
606
611
|
method: "POST",
|
|
607
612
|
path: path,
|
|
608
|
-
body: options
|
|
613
|
+
body: { // filter out options not recognized by server (noEncryptionConk, createKMSConk)
|
|
614
|
+
type: options.type,
|
|
615
|
+
meta: options.meta
|
|
616
|
+
}
|
|
609
617
|
});
|
|
618
|
+
|
|
610
619
|
// extract the url for the node that handled the request
|
|
611
|
-
//
|
|
620
|
+
// (not strictly needed now that we can quickly look up node URL for a write token,
|
|
621
|
+
// but still convenient)
|
|
612
622
|
const nodeUrl = (new URL(rawCreateResponse.url)).origin;
|
|
613
623
|
const createResponse = await this.utils.ResponseToJson(
|
|
614
624
|
rawCreateResponse,
|
|
@@ -616,6 +626,16 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
616
626
|
this.HttpClient.Log.bind(this.HttpClient)
|
|
617
627
|
);
|
|
618
628
|
|
|
629
|
+
// create EncryptionConk and possibly KMSConk depending on options
|
|
630
|
+
if(!options.noEncryptionConk) await this.CreateEncryptionConk(
|
|
631
|
+
{
|
|
632
|
+
libraryId,
|
|
633
|
+
objectId,
|
|
634
|
+
writeToken: createResponse.write_token,
|
|
635
|
+
createKMSConk: options.createKMSConk
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
|
|
619
639
|
// Record the node used in creating this write token
|
|
620
640
|
this.RecordWriteToken({writeToken: createResponse.write_token, fabricNodeUrl: nodeUrl});
|
|
621
641
|
|
|
@@ -1449,14 +1469,14 @@ exports.CreateLinks = async function({
|
|
|
1449
1469
|
10,
|
|
1450
1470
|
links,
|
|
1451
1471
|
async info => {
|
|
1452
|
-
const path = info.path.replace(/^(
|
|
1472
|
+
const path = info.path.replace(/^([/.])+/, "");
|
|
1453
1473
|
|
|
1454
1474
|
let type = (info.type || "file") === "file" ? "files" : info.type;
|
|
1455
1475
|
if(type === "metadata") { type = "meta"; }
|
|
1456
1476
|
|
|
1457
1477
|
let target;
|
|
1458
1478
|
let authTarget;
|
|
1459
|
-
target = authTarget = info.target.replace(/^(
|
|
1479
|
+
target = authTarget = info.target.replace(/^([/.])+/, "");
|
|
1460
1480
|
if(info.targetHash) {
|
|
1461
1481
|
target = `/qfab/${info.targetHash}/${type}/${target}`;
|
|
1462
1482
|
} else {
|
package/src/client/LiveConf.js
CHANGED
|
@@ -443,6 +443,10 @@ class LiveConf {
|
|
|
443
443
|
conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
+
if(Object.hasOwn(customSettings, "persistent")) {
|
|
447
|
+
conf.live_recording.recording_config.recording_params.persistent = customSettings.persistent;
|
|
448
|
+
}
|
|
449
|
+
|
|
446
450
|
if(customSettings.connection_timeout) {
|
|
447
451
|
conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
|
|
448
452
|
}
|
|
@@ -451,6 +455,10 @@ class LiveConf {
|
|
|
451
455
|
conf.live_recording.recording_config.recording_params.reconnect_timeout = customSettings.reconnect_timeout;
|
|
452
456
|
}
|
|
453
457
|
|
|
458
|
+
if(Object.hasOwn(customSettings, "copy_mpegts")) {
|
|
459
|
+
conf.live_recording.recording_config.recording_params.xc_params.copy_mpegts = customSettings.copy_mpegts;
|
|
460
|
+
}
|
|
461
|
+
|
|
454
462
|
// Fill in specifics for protocol
|
|
455
463
|
switch(this.probeKind()) {
|
|
456
464
|
case "udp":
|
package/src/client/Shares.js
CHANGED
|
@@ -18,6 +18,7 @@ const UrlJoin = require("url-join");
|
|
|
18
18
|
*/
|
|
19
19
|
exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
20
20
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
21
|
+
const token = await this.CreateFabricToken({});
|
|
21
22
|
|
|
22
23
|
params.object_id = objectId;
|
|
23
24
|
|
|
@@ -25,15 +26,20 @@ exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
|
25
26
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
const share = await this.MakeAuthServiceRequest({
|
|
29
30
|
path: UrlJoin("as", "sharing", tenantId, "share"),
|
|
30
31
|
method: "POST",
|
|
31
32
|
format: "JSON",
|
|
32
33
|
body: params,
|
|
33
34
|
headers: {
|
|
34
|
-
Authorization: `Bearer ${
|
|
35
|
+
Authorization: `Bearer ${token}`
|
|
35
36
|
}
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
share.start_time = share.start_time ? new Date(share.start_time * 1000).toISOString() : undefined;
|
|
40
|
+
share.end_time = share.end_time ? new Date(share.end_time * 1000).toISOString() : undefined;
|
|
41
|
+
|
|
42
|
+
return share;
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
/**
|
|
@@ -49,6 +55,7 @@ exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
|
49
55
|
*/
|
|
50
56
|
exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
51
57
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
58
|
+
const token = await this.CreateFabricToken({});
|
|
52
59
|
|
|
53
60
|
const response = await this.MakeAuthServiceRequest({
|
|
54
61
|
path: UrlJoin("as", "sharing", tenantId, "shares"),
|
|
@@ -57,7 +64,7 @@ exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
|
57
64
|
body: objectId ? {object_id: objectId, ...params} : undefined,
|
|
58
65
|
format: "JSON",
|
|
59
66
|
headers: {
|
|
60
|
-
Authorization: `Bearer ${
|
|
67
|
+
Authorization: `Bearer ${token}`
|
|
61
68
|
}
|
|
62
69
|
});
|
|
63
70
|
|
|
@@ -85,6 +92,7 @@ exports.Shares = async function({objectId, limit=100, offset=0, params={}}={}) {
|
|
|
85
92
|
*/
|
|
86
93
|
exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
87
94
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
95
|
+
const token = await this.CreateFabricToken({});
|
|
88
96
|
|
|
89
97
|
if(expiresAt) {
|
|
90
98
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
@@ -96,7 +104,7 @@ exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
|
96
104
|
format: "JSON",
|
|
97
105
|
body: params,
|
|
98
106
|
headers: {
|
|
99
|
-
Authorization: `Bearer ${
|
|
107
|
+
Authorization: `Bearer ${token}`
|
|
100
108
|
}
|
|
101
109
|
});
|
|
102
110
|
};
|
|
@@ -109,13 +117,14 @@ exports.UpdateShare = async function({shareId, expiresAt, params={}}) {
|
|
|
109
117
|
*/
|
|
110
118
|
exports.RevokeShare = async function({shareId}) {
|
|
111
119
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
120
|
+
const token = await this.CreateFabricToken({});
|
|
112
121
|
|
|
113
122
|
return await this.MakeAuthServiceRequest({
|
|
114
123
|
path: UrlJoin("as", "sharing", tenantId, "share", shareId, "revoke"),
|
|
115
124
|
method: "PUT",
|
|
116
125
|
format: "JSON",
|
|
117
126
|
headers: {
|
|
118
|
-
Authorization: `Bearer ${
|
|
127
|
+
Authorization: `Bearer ${token}`
|
|
119
128
|
}
|
|
120
129
|
});
|
|
121
130
|
};
|