@eluvio/elv-client-js 4.0.84 → 4.0.86
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 +12 -13
- package/dist/ElvClient-node-min.js +13 -14
- package/dist/ElvFrameClient-min.js +9 -9
- package/dist/ElvPermissionsClient-min.js +10 -10
- package/dist/ElvWalletClient-min.js +13 -14
- package/dist/ElvWalletClient-node-min.js +13 -14
- package/dist/src/AuthorizationClient.js +5 -4
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +2 -2
- package/dist/src/EthClient.js +2 -2
- package/dist/src/FrameClient.js +3 -3
- package/dist/src/PermissionsClient.js +2 -2
- package/dist/src/Utils.js +2 -2
- package/dist/src/abr_profiles/abr_profile_live_to_vod.js +0 -7
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +757 -821
- package/dist/src/client/ContentManagement.js +5 -37
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +35 -144
- package/dist/src/client/LiveStream.js +529 -1054
- package/dist/src/client/NFT.js +2 -2
- 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 +2 -2
- package/package.json +1 -1
- package/src/ElvClient.js +80 -81
- package/src/RemoteSigner.js +54 -0
- package/src/client/ContentAccess.js +6 -6
- package/src/client/ContentManagement.js +20 -6
- package/src/client/LiveConf.js +3 -3
- package/src/client/LiveStream.js +13 -10
- package/src/walletClient/index.js +40 -13
package/dist/src/client/NFT.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
2
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
/**
|
|
7
7
|
* Methods for creating and managing NFTs
|
|
8
8
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
var Utils = require("../Utils");
|
|
7
7
|
var UrlJoin = require("url-join");
|
|
8
8
|
var _require = require("./Utils"),
|
|
@@ -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(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; }
|
|
6
|
+
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; }
|
|
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(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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var RarityToPercentage = function RarityToPercentage(rarity) {
|
|
9
9
|
if (!rarity) {
|
|
@@ -5,8 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
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
|
var _require = require("../ElvClient"),
|
|
11
11
|
ElvClient = _require.ElvClient;
|
|
12
12
|
var Configuration = require("./Configuration");
|
package/package.json
CHANGED
package/src/ElvClient.js
CHANGED
|
@@ -20,12 +20,13 @@ const Pako = require("pako");
|
|
|
20
20
|
const {
|
|
21
21
|
ValidatePresence
|
|
22
22
|
} = require("./Validation");
|
|
23
|
-
const
|
|
23
|
+
const UrlJoin = require("url-join");
|
|
24
24
|
|
|
25
25
|
const networks = {
|
|
26
26
|
"main": "https://main.net955305.contentfabric.io",
|
|
27
27
|
"demo": "https://demov3.net955210.contentfabric.io",
|
|
28
28
|
"demov3": "https://demov3.net955210.contentfabric.io",
|
|
29
|
+
"local": "http://127.0.0.1:8008/config?qspace=dev&self",
|
|
29
30
|
"test": "https://test.net955203.contentfabric.io"
|
|
30
31
|
};
|
|
31
32
|
|
|
@@ -134,7 +135,7 @@ class ElvClient {
|
|
|
134
135
|
* @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
|
|
135
136
|
* @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
|
|
136
137
|
* @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
|
|
137
|
-
* @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
|
|
138
|
+
* @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth. Also known as an anonymous token containing the space
|
|
138
139
|
* @param {boolean=} noCache=false - If enabled, blockchain transactions will not be cached
|
|
139
140
|
* @param {boolean=} noAuth=false - If enabled, blockchain authorization will not be performed
|
|
140
141
|
* @param {boolean=} assumeV3=false - If enabled, V3 fabric will be assumed
|
|
@@ -274,6 +275,17 @@ class ElvClient {
|
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Return a list of valid Eluvio Content Fabric network names and their associated configuration URLs
|
|
280
|
+
*
|
|
281
|
+
* @methodGroup Miscellaneous
|
|
282
|
+
*
|
|
283
|
+
* @return {Object} - An object using network names as keys and configuration URLs as values.
|
|
284
|
+
*/
|
|
285
|
+
static Networks() {
|
|
286
|
+
return networks;
|
|
287
|
+
}
|
|
288
|
+
|
|
277
289
|
/**
|
|
278
290
|
* Create a new ElvClient for the specified network
|
|
279
291
|
*
|
|
@@ -574,78 +586,65 @@ class ElvClient {
|
|
|
574
586
|
* @param {string=} matchEndpoint - Return node(s) matching the specified endpoint
|
|
575
587
|
* @param {string=} matchNodeId - Return node(s) matching the specified node ID
|
|
576
588
|
*
|
|
577
|
-
* @return {Array<Object
|
|
589
|
+
* @return {Promise<Array<Object>>} - A list of nodes in the space matching the parameters
|
|
578
590
|
*/
|
|
579
591
|
async SpaceNodes({matchEndpoint, matchNodeId}={}) {
|
|
580
|
-
let
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
methodName: "activeNodeAddresses",
|
|
594
|
-
methodArgs: [bigi],
|
|
595
|
-
formatArguments: true
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
let nodeId = this.utils.AddressToNodeId(addr);
|
|
599
|
-
|
|
600
|
-
if(matchNodeId && nodeId !== matchNodeId) {
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
let locatorsHex = await this.CallContractMethod({
|
|
605
|
-
contractAddress: this.contentSpaceAddress,
|
|
606
|
-
methodName: "activeNodeLocators",
|
|
607
|
-
methodArgs: [bigi]
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
let node = {id: nodeId, endpoints: []};
|
|
592
|
+
let nodes;
|
|
593
|
+
this.SetStaticToken();
|
|
594
|
+
|
|
595
|
+
if(matchEndpoint) {
|
|
596
|
+
({nodes} = await this.utils.ResponseToJson(
|
|
597
|
+
this.HttpClient.Request({
|
|
598
|
+
path: UrlJoin("nodes"),
|
|
599
|
+
method: "GET",
|
|
600
|
+
headers: {
|
|
601
|
+
Authorization: `Bearer ${this.staticToken}`
|
|
602
|
+
}
|
|
603
|
+
})
|
|
604
|
+
));
|
|
611
605
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
locatorsHex.slice(2, locatorsHex.length),
|
|
616
|
-
"hex"
|
|
617
|
-
)
|
|
618
|
-
);
|
|
606
|
+
if(!nodes || !Array.isArray(nodes) || nodes.length === 0) {
|
|
607
|
+
return [];
|
|
608
|
+
}
|
|
619
609
|
|
|
610
|
+
return nodes.filter(node => {
|
|
620
611
|
let match = false;
|
|
621
612
|
|
|
622
|
-
if(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
613
|
+
if(
|
|
614
|
+
node.services &&
|
|
615
|
+
node.services.fabric_api &&
|
|
616
|
+
node.services.fabric_api.urls
|
|
617
|
+
) {
|
|
618
|
+
const results = (node.services.fabric_api.urls || []).find(url => url.includes(matchEndpoint));
|
|
627
619
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
620
|
+
if(results) {
|
|
621
|
+
match = true;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
631
624
|
|
|
632
|
-
|
|
633
|
-
|
|
625
|
+
if(matchNodeId && node.id === matchNodeId) {
|
|
626
|
+
match = true;
|
|
627
|
+
}
|
|
634
628
|
|
|
635
|
-
|
|
636
|
-
endpoint = endpoint + ":" + fabArray[i].port;
|
|
637
|
-
}
|
|
629
|
+
this.ClearStaticToken();
|
|
638
630
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
631
|
+
return match;
|
|
632
|
+
});
|
|
633
|
+
} else if(matchNodeId) {
|
|
634
|
+
this.SetStaticToken();
|
|
635
|
+
let node = await this.utils.ResponseToJson(
|
|
636
|
+
this.HttpClient.Request({
|
|
637
|
+
path: UrlJoin("nodes", matchNodeId),
|
|
638
|
+
method: "GET",
|
|
639
|
+
headers: {
|
|
640
|
+
Authorization: `Bearer ${this.staticToken}`
|
|
642
641
|
}
|
|
643
|
-
}
|
|
642
|
+
})
|
|
643
|
+
);
|
|
644
644
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
.filter(n => n);
|
|
645
|
+
this.ClearStaticToken();
|
|
646
|
+
return [node];
|
|
647
|
+
}
|
|
649
648
|
}
|
|
650
649
|
|
|
651
650
|
/**
|
|
@@ -991,11 +990,11 @@ class ElvClient {
|
|
|
991
990
|
* @param {string} messasge - A JSON object representing the message to sign
|
|
992
991
|
*/
|
|
993
992
|
async CreateSignedMessageJSON({
|
|
994
|
-
|
|
993
|
+
message
|
|
995
994
|
}) {
|
|
996
995
|
|
|
997
996
|
// Only one kind of signature supported currently
|
|
998
|
-
const type = "mje_" // JSON message, EIP192 signature
|
|
997
|
+
const type = "mje_"; // JSON message, EIP192 signature
|
|
999
998
|
|
|
1000
999
|
const msg = JSON.stringify(message);
|
|
1001
1000
|
const signature = await this.PersonalSign({message: msg, addEthereumPrefix: true});
|
|
@@ -1020,23 +1019,23 @@ class ElvClient {
|
|
|
1020
1019
|
}) {
|
|
1021
1020
|
const type = signedMessage.slice(0,4);
|
|
1022
1021
|
switch(type) {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1022
|
+
case "mje_":
|
|
1023
|
+
const msgBytes = Utils.FromB58(signedMessage.slice(4));
|
|
1024
|
+
const signature = msgBytes.slice(0, 65);
|
|
1025
|
+
const msg = msgBytes.slice(65);
|
|
1026
|
+
const obj = JSON.parse(msg);
|
|
1027
|
+
|
|
1028
|
+
const prefixedMsgHash = Ethers.utils.keccak256(Buffer.from(`\x19Ethereum Signed Message:\n${msg.length}${msg}`, "utf-8"));
|
|
1029
|
+
const signerAddr = Ethers.utils.recoverAddress(prefixedMsgHash, signature);
|
|
1030
|
+
|
|
1031
|
+
return {
|
|
1032
|
+
type: type,
|
|
1033
|
+
message: obj,
|
|
1034
|
+
signerAddress: signerAddr,
|
|
1035
|
+
signature: "0x" + signature.toString("hex")
|
|
1036
|
+
};
|
|
1037
|
+
default:
|
|
1038
|
+
throw new Error(`Bad message type: ${type}`);
|
|
1040
1039
|
}
|
|
1041
1040
|
}
|
|
1042
1041
|
|
package/src/RemoteSigner.js
CHANGED
|
@@ -2,6 +2,7 @@ const Ethers = require("ethers");
|
|
|
2
2
|
const Utils = require("./Utils");
|
|
3
3
|
const HttpClient = require("./HttpClient");
|
|
4
4
|
const UrlJoin = require("url-join");
|
|
5
|
+
const UUID = require("uuid");
|
|
5
6
|
|
|
6
7
|
class RemoteSigner extends Ethers.Signer {
|
|
7
8
|
constructor({
|
|
@@ -72,6 +73,59 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
72
73
|
this.signer = this.provider.getSigner(this.address);
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
async RetrieveCSAT({email, nonce, force=false}) {
|
|
77
|
+
nonce = nonce || Utils.B58(UUID.parse(UUID.v4()));
|
|
78
|
+
|
|
79
|
+
let response = await Utils.ResponseToJson(
|
|
80
|
+
this.HttpClient.Request({
|
|
81
|
+
method: "POST",
|
|
82
|
+
body: {
|
|
83
|
+
email,
|
|
84
|
+
nonce,
|
|
85
|
+
force
|
|
86
|
+
},
|
|
87
|
+
path: UrlJoin("as", "wlt", "sign", "csat"),
|
|
88
|
+
headers: {
|
|
89
|
+
Authorization: `Bearer ${this.authToken}`
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
response.nonce = nonce;
|
|
95
|
+
|
|
96
|
+
return response;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async CSATStatus({accessToken}) {
|
|
100
|
+
try {
|
|
101
|
+
const response = await Utils.ResponseToJson(
|
|
102
|
+
this.HttpClient.Request({
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: UrlJoin("as", "wlt", "login", "status"),
|
|
105
|
+
headers: {
|
|
106
|
+
Authorization: `Bearer ${accessToken}`
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return response && response.is_active;
|
|
112
|
+
} catch(error) {
|
|
113
|
+
return !error || error.status !== 403;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async ReleaseCSAT({accessToken}) {
|
|
118
|
+
return await Utils.ResponseToJson(
|
|
119
|
+
this.HttpClient.Request({
|
|
120
|
+
method: "POST",
|
|
121
|
+
path: UrlJoin("as", "wlt", "login", "release"),
|
|
122
|
+
headers: {
|
|
123
|
+
Authorization: `Bearer ${accessToken}`
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
75
129
|
// Overrides
|
|
76
130
|
|
|
77
131
|
getAddress() {
|
|
@@ -1152,8 +1152,8 @@ exports.LatestVersionHashV2 = async function({objectId, versionHash}) {
|
|
|
1152
1152
|
latestHash = q.hash;
|
|
1153
1153
|
|
|
1154
1154
|
} catch(error) {
|
|
1155
|
-
|
|
1156
|
-
throw
|
|
1155
|
+
error.message = `Unable to determine latest version hash for ${versionHash || objectId}`;
|
|
1156
|
+
throw error;
|
|
1157
1157
|
}
|
|
1158
1158
|
return latestHash;
|
|
1159
1159
|
};
|
|
@@ -2322,17 +2322,17 @@ exports.EmbedUrl = async function({
|
|
|
2322
2322
|
break;
|
|
2323
2323
|
case "useTicketCodes":
|
|
2324
2324
|
embedUrl.searchParams.set("ptk", "");
|
|
2325
|
-
if
|
|
2325
|
+
if(options.tenantId) {
|
|
2326
2326
|
embedUrl.searchParams.set("ten", options.tenantId);
|
|
2327
2327
|
}
|
|
2328
|
-
if
|
|
2328
|
+
if(options.ntpId) {
|
|
2329
2329
|
embedUrl.searchParams.set("ntp", options.ntpId);
|
|
2330
2330
|
}
|
|
2331
|
-
if
|
|
2331
|
+
if(options.ticketCode) {
|
|
2332
2332
|
embedUrl.searchParams.set("tk", Buffer.from(options.ticketCode).toString("base64"));
|
|
2333
2333
|
|
|
2334
2334
|
}
|
|
2335
|
-
if
|
|
2335
|
+
if(options.ticketSubject) {
|
|
2336
2336
|
embedUrl.searchParams.set("sbj", Buffer.from(options.ticketSubject).toString("base64"));
|
|
2337
2337
|
}
|
|
2338
2338
|
break;
|
|
@@ -1054,13 +1054,27 @@ exports.PublishContentVersion = async function({objectId, versionHash, awaitComm
|
|
|
1054
1054
|
if(awaitCommitConfirmation) {
|
|
1055
1055
|
const pollingInterval = 500; // ms
|
|
1056
1056
|
let tries = 20;
|
|
1057
|
-
while
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1057
|
+
while(tries > 0) {
|
|
1058
|
+
let h;
|
|
1059
|
+
|
|
1060
|
+
try {
|
|
1061
|
+
h = await this.LatestVersionHashV2({objectId});
|
|
1062
|
+
|
|
1063
|
+
if(h === versionHash) {
|
|
1064
|
+
this.Log(`Commit confirmed on fabric node: ${versionHash}`);
|
|
1065
|
+
break;
|
|
1066
|
+
} else {
|
|
1067
|
+
tries--;
|
|
1068
|
+
await new Promise(resolve => setTimeout(resolve, pollingInterval));
|
|
1069
|
+
}
|
|
1070
|
+
} catch(error) {
|
|
1071
|
+
if(error.status !== 404) {
|
|
1072
|
+
throw error;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
tries--;
|
|
1076
|
+
await new Promise(resolve => setTimeout(resolve, pollingInterval));
|
|
1062
1077
|
}
|
|
1063
|
-
await new Promise(resolve => setTimeout(resolve, pollingInterval));
|
|
1064
1078
|
}
|
|
1065
1079
|
}
|
|
1066
1080
|
|
package/src/client/LiveConf.js
CHANGED
|
@@ -232,13 +232,13 @@ class LiveConf {
|
|
|
232
232
|
return seg;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
/*
|
|
236
236
|
* Calculate output timebase from the encoder (codec) timebase. The videoTimeBase parameter
|
|
237
237
|
* represents the encoder timebase. The format muxer will change it so it is greater than 10000.
|
|
238
238
|
*/
|
|
239
239
|
calcOutputTimebase(codecTimebase) {
|
|
240
240
|
let outputTimebase = codecTimebase;
|
|
241
|
-
while
|
|
241
|
+
while(outputTimebase < 10000)
|
|
242
242
|
outputTimebase = outputTimebase * 2;
|
|
243
243
|
return outputTimebase;
|
|
244
244
|
}
|
|
@@ -404,7 +404,7 @@ class LiveConf {
|
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
// If no audio streams specified in custom config, set up all the suitable audio streams in the probe
|
|
407
|
-
if (
|
|
407
|
+
if (!customSettings.audio) {
|
|
408
408
|
audioStreams = this.getAudioStreamsFromProbe();
|
|
409
409
|
}
|
|
410
410
|
|
package/src/client/LiveStream.js
CHANGED
|
@@ -29,18 +29,18 @@ const CueInfo = async ({eventId, status}) => {
|
|
|
29
29
|
const lroStatusResponse = await this.utils.ResponseToJson(
|
|
30
30
|
await HttpClient.Fetch(status.lro_status_url)
|
|
31
31
|
);
|
|
32
|
-
console.log("lroStatusResponse", lroStatusResponse)
|
|
32
|
+
console.log("lroStatusResponse", lroStatusResponse);
|
|
33
33
|
cues = lroStatusResponse.custom.cues;
|
|
34
|
-
} catch
|
|
34
|
+
} catch(error) {
|
|
35
35
|
console.log("LRO status failed", error);
|
|
36
36
|
return {error: "failed to retrieve status", eventId};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
let eventStart, eventEnd;
|
|
40
|
-
for
|
|
41
|
-
for
|
|
42
|
-
if
|
|
43
|
-
switch
|
|
40
|
+
for(const value of Object.values(cues)) {
|
|
41
|
+
for(const event of Object.values(value.descriptors)) {
|
|
42
|
+
if(event.id == eventId) {
|
|
43
|
+
switch(event.type_id) {
|
|
44
44
|
case 32:
|
|
45
45
|
case 16:
|
|
46
46
|
eventStart = value.insertion_time;
|
|
@@ -56,7 +56,7 @@ const CueInfo = async ({eventId, status}) => {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return {eventStart, eventEnd, eventId};
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Set the offering for the live stream
|
|
@@ -860,7 +860,7 @@ exports.StreamStopSession = async function({name}) {
|
|
|
860
860
|
return {
|
|
861
861
|
state: status.state,
|
|
862
862
|
error: "The stream must be stopped before terminating"
|
|
863
|
-
}
|
|
863
|
+
};
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
await this.DeleteWriteToken({
|
|
@@ -1355,7 +1355,10 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
|
|
|
1355
1355
|
status.error = "No node matching stream URL " + streamUrl.href;
|
|
1356
1356
|
return status;
|
|
1357
1357
|
}
|
|
1358
|
-
const node =
|
|
1358
|
+
const node = {
|
|
1359
|
+
endpoints: nodes[0].services.fabric_api.urls,
|
|
1360
|
+
id: nodes[0].id
|
|
1361
|
+
};
|
|
1359
1362
|
status.node = node;
|
|
1360
1363
|
let endpoint = node.endpoints[0];
|
|
1361
1364
|
|
|
@@ -1547,7 +1550,7 @@ exports.StreamListUrls = async function({siteId}={}) {
|
|
|
1547
1550
|
url,
|
|
1548
1551
|
active: activeUrlMap[url] || false
|
|
1549
1552
|
};
|
|
1550
|
-
})
|
|
1553
|
+
});
|
|
1551
1554
|
});
|
|
1552
1555
|
|
|
1553
1556
|
return streamUrlStatus;
|
|
@@ -395,7 +395,15 @@ class ElvWalletClient {
|
|
|
395
395
|
*
|
|
396
396
|
* @methodGroup Login
|
|
397
397
|
*/
|
|
398
|
-
LogOut() {
|
|
398
|
+
async LogOut() {
|
|
399
|
+
if(this.__authorization.nonce) {
|
|
400
|
+
try {
|
|
401
|
+
await this.client.signer.ReleaseCSAT({accessToken: this.AuthToken()});
|
|
402
|
+
} catch(error) {
|
|
403
|
+
this.Log("Failed to release token", true, error);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
399
407
|
this.__authorization = {};
|
|
400
408
|
this.loggedIn = false;
|
|
401
409
|
|
|
@@ -410,6 +418,14 @@ class ElvWalletClient {
|
|
|
410
418
|
}
|
|
411
419
|
}
|
|
412
420
|
|
|
421
|
+
async TokenStatus() {
|
|
422
|
+
if(!this.__authorization || !this.__authorization.nonce) {
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return await this.client.signer.CSATStatus({accessToken: this.AuthToken()});
|
|
427
|
+
}
|
|
428
|
+
|
|
413
429
|
/**
|
|
414
430
|
* Authenticate with an ElvWalletClient authorization token
|
|
415
431
|
*
|
|
@@ -457,7 +473,7 @@ class ElvWalletClient {
|
|
|
457
473
|
* - 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
|
|
458
474
|
* shared with third parties.
|
|
459
475
|
*/
|
|
460
|
-
async AuthenticateOAuth({idToken, tenantId, email, signerURIs, shareEmail=false}) {
|
|
476
|
+
async AuthenticateOAuth({idToken, tenantId, email, signerURIs, shareEmail=false, extraData={}, nonce, createRemoteToken=true, force=false}) {
|
|
461
477
|
let tokenDuration = 24;
|
|
462
478
|
|
|
463
479
|
if(!tenantId && this.selectedMarketplaceInfo) {
|
|
@@ -466,13 +482,21 @@ class ElvWalletClient {
|
|
|
466
482
|
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
467
483
|
}
|
|
468
484
|
|
|
469
|
-
await this.client.SetRemoteSigner({idToken, tenantId, signerURIs, extraData: { share_email: shareEmail }, unsignedPublicAuth: true});
|
|
485
|
+
await this.client.SetRemoteSigner({idToken, tenantId, signerURIs, extraData: { ...extraData, share_email: shareEmail }, unsignedPublicAuth: true});
|
|
470
486
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
487
|
+
let fabricToken, expiresAt;
|
|
488
|
+
if(createRemoteToken && this.client.signer.remoteSigner) {
|
|
489
|
+
expiresAt = Date.now() + 24 * 60 * 60 * 1000;
|
|
490
|
+
const tokenResponse = await this.client.signer.RetrieveCSAT({email, nonce, force});
|
|
491
|
+
fabricToken = tokenResponse.token;
|
|
492
|
+
nonce = tokenResponse.nonce;
|
|
493
|
+
} else {
|
|
494
|
+
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
495
|
+
fabricToken = await this.client.CreateFabricToken({
|
|
496
|
+
duration: tokenDuration * 60 * 60 * 1000,
|
|
497
|
+
context: email ? {usr: {email}} : {}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
476
500
|
const address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
477
501
|
|
|
478
502
|
if(!email) {
|
|
@@ -496,7 +520,8 @@ class ElvWalletClient {
|
|
|
496
520
|
signerURIs,
|
|
497
521
|
walletType: "Custodial",
|
|
498
522
|
walletName: "Eluvio",
|
|
499
|
-
register: true
|
|
523
|
+
register: true,
|
|
524
|
+
nonce
|
|
500
525
|
}),
|
|
501
526
|
signingToken: this.SetAuthorization({
|
|
502
527
|
clusterToken: this.client.signer.authToken,
|
|
@@ -507,7 +532,8 @@ class ElvWalletClient {
|
|
|
507
532
|
expiresAt,
|
|
508
533
|
signerURIs,
|
|
509
534
|
walletType: "Custodial",
|
|
510
|
-
walletName: "Eluvio"
|
|
535
|
+
walletName: "Eluvio",
|
|
536
|
+
nonce
|
|
511
537
|
})
|
|
512
538
|
};
|
|
513
539
|
}
|
|
@@ -568,7 +594,7 @@ class ElvWalletClient {
|
|
|
568
594
|
return this.__authorization.fabricToken;
|
|
569
595
|
}
|
|
570
596
|
|
|
571
|
-
SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName, register=false}) {
|
|
597
|
+
SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName, nonce, register=false}) {
|
|
572
598
|
address = this.client.utils.FormatAddress(address);
|
|
573
599
|
|
|
574
600
|
this.__authorization = {
|
|
@@ -578,7 +604,8 @@ class ElvWalletClient {
|
|
|
578
604
|
email,
|
|
579
605
|
expiresAt,
|
|
580
606
|
walletType,
|
|
581
|
-
walletName
|
|
607
|
+
walletName,
|
|
608
|
+
nonce
|
|
582
609
|
};
|
|
583
610
|
|
|
584
611
|
if(clusterToken) {
|
|
@@ -1328,7 +1355,7 @@ class ElvWalletClient {
|
|
|
1328
1355
|
|
|
1329
1356
|
if(op === "nft-claim-entitlement") {
|
|
1330
1357
|
let [op, marketplace, sku, purchaseId ] = status.op.split(":");
|
|
1331
|
-
confirmationId = purchaseId
|
|
1358
|
+
confirmationId = purchaseId;
|
|
1332
1359
|
if(status.extra && status.extra["0"]) {
|
|
1333
1360
|
address = status.extra["0"].token_addr;
|
|
1334
1361
|
tokenId = status.extra["0"].token_id;
|