@eluvio/elv-client-js 4.2.23 → 4.2.25
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 +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +7 -12
- package/dist/src/ContentObjectAudit.js +2 -1
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +33 -5
- package/dist/src/ElvClient.js +9 -10
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +90 -47
- package/dist/src/NetworkUrls.js +8 -0
- package/dist/src/RemoteSigner.js +170 -70
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/dist/src/client/ContentAccess.js +1165 -1149
- package/dist/src/client/ContentManagement.js +2 -2
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/LiveConf.js +171 -84
- package/dist/src/client/LiveStream.js +5649 -2155
- package/dist/src/client/NTP.js +172 -77
- package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
- package/package.json +1 -1
- package/src/FrameClient.js +2 -0
- package/src/client/Contracts.js +1 -1
- package/src/client/LiveConf.js +46 -27
- package/src/client/LiveStream.js +337 -92
- package/utilities/LiveOutputs.js +9 -4
|
@@ -732,7 +732,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
732
732
|
key: "GenerateChannelContentToken",
|
|
733
733
|
value: function () {
|
|
734
734
|
var _GenerateChannelContentToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
|
|
735
|
-
var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref8$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams
|
|
735
|
+
var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref8$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams;
|
|
736
736
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
737
737
|
while (1) switch (_context7.prev = _context7.next) {
|
|
738
738
|
case 0:
|
|
@@ -828,7 +828,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
828
828
|
case 40:
|
|
829
829
|
// Pull target object from token so token can be cached
|
|
830
830
|
objectId = JSON.parse(Utils.FromB64(token)).qid;
|
|
831
|
-
_context7.next =
|
|
831
|
+
_context7.next = 49;
|
|
832
832
|
break;
|
|
833
833
|
case 43:
|
|
834
834
|
// State channel API
|
|
@@ -850,14 +850,8 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
850
850
|
additionalParams: additionalParams
|
|
851
851
|
});
|
|
852
852
|
case 48:
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(payload)));
|
|
856
|
-
case 51:
|
|
857
|
-
signature = _context7.sent;
|
|
858
|
-
multiSig = Utils.FormatSignature(signature);
|
|
859
|
-
token = "".concat(payload, ".").concat(Utils.B64(multiSig));
|
|
860
|
-
case 54:
|
|
853
|
+
token = _context7.sent;
|
|
854
|
+
case 49:
|
|
861
855
|
if (!this.noCache) {
|
|
862
856
|
this.channelContentTokens[objectId] = {
|
|
863
857
|
token: token,
|
|
@@ -865,7 +859,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
865
859
|
};
|
|
866
860
|
}
|
|
867
861
|
return _context7.abrupt("return", token);
|
|
868
|
-
case
|
|
862
|
+
case 51:
|
|
869
863
|
case "end":
|
|
870
864
|
return _context7.stop();
|
|
871
865
|
}
|
|
@@ -1775,7 +1769,8 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1775
1769
|
throw Error("No KMS info set for ".concat(versionHash || objectId || "default KMS"));
|
|
1776
1770
|
case 15:
|
|
1777
1771
|
kmsHttpClient = new HttpClient({
|
|
1778
|
-
uris: kmsUrls
|
|
1772
|
+
uris: kmsUrls,
|
|
1773
|
+
networkName: this.client.networkName
|
|
1779
1774
|
});
|
|
1780
1775
|
_context24.next = 18;
|
|
1781
1776
|
return kmsHttpClient.Request({
|
|
@@ -69,7 +69,8 @@ var ContentObjectAudit = {
|
|
|
69
69
|
return s.indexOf(v) === i;
|
|
70
70
|
});
|
|
71
71
|
httpClient = new HttpClient({
|
|
72
|
-
uris: uris
|
|
72
|
+
uris: uris,
|
|
73
|
+
networkName: client.networkName
|
|
73
74
|
});
|
|
74
75
|
path = UrlJoin("qlibs", libraryId, "q", versionHash || objectId, live ? "call/live/audit" : "audit");
|
|
75
76
|
_context.t4 = httpClient;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
3
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
var CBOR = require("cbor");
|
|
7
|
+
var SJCL = require("sjcl");
|
|
8
|
+
var MultiHash = require("multihashes");
|
|
9
|
+
var DeepEqual = require("deep-equal");
|
|
10
|
+
var Utils = require("./Utils");
|
|
11
|
+
var ContentObjectVerification = {
|
|
12
|
+
VerifyContentObject: function VerifyContentObject(_ref) {
|
|
13
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
14
|
+
var client, libraryId, objectId, versionHash, response, partHash, qpartsResponse, partVerification, qmdHash, metadataPartHash, metadataPartResponse, metadataVerification, metadata, qstructHash, structPartHash, structPartResponse, structVerification;
|
|
15
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
client = _ref.client, libraryId = _ref.libraryId, objectId = _ref.objectId, versionHash = _ref.versionHash;
|
|
19
|
+
response = {
|
|
20
|
+
hash: versionHash
|
|
21
|
+
};
|
|
22
|
+
partHash = Utils.DecodeVersionHash(versionHash).partHash;
|
|
23
|
+
_context.next = 5;
|
|
24
|
+
return client.QParts({
|
|
25
|
+
libraryId: libraryId,
|
|
26
|
+
objectId: objectId,
|
|
27
|
+
partHash: partHash,
|
|
28
|
+
format: "arrayBuffer"
|
|
29
|
+
}).then(function (response) {
|
|
30
|
+
return Buffer.from(response);
|
|
31
|
+
});
|
|
32
|
+
case 5:
|
|
33
|
+
qpartsResponse = _context.sent;
|
|
34
|
+
partVerification = ContentObjectVerification._VerifyPart({
|
|
35
|
+
partHash: partHash,
|
|
36
|
+
qpartsResponse: qpartsResponse
|
|
37
|
+
});
|
|
38
|
+
if (partVerification.valid) {
|
|
39
|
+
response.qref = {
|
|
40
|
+
valid: true
|
|
41
|
+
};
|
|
42
|
+
} else {
|
|
43
|
+
response.qref = {
|
|
44
|
+
valid: false,
|
|
45
|
+
error: partVerification.error.message
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
response.qref.hash = partHash;
|
|
49
|
+
if (!response.qref.valid) {
|
|
50
|
+
_context.next = 32;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
// Validate Metadata
|
|
54
|
+
qmdHash = partVerification.cbor.QmdHash.value;
|
|
55
|
+
metadataPartHash = "hqp_" + MultiHash.toB58String(qmdHash.slice(1, qmdHash.length));
|
|
56
|
+
_context.next = 14;
|
|
57
|
+
return client.QParts({
|
|
58
|
+
libraryId: libraryId,
|
|
59
|
+
objectId: objectId,
|
|
60
|
+
partHash: metadataPartHash,
|
|
61
|
+
format: "arrayBuffer"
|
|
62
|
+
}).then(function (response) {
|
|
63
|
+
return Buffer.from(response);
|
|
64
|
+
});
|
|
65
|
+
case 14:
|
|
66
|
+
metadataPartResponse = _context.sent;
|
|
67
|
+
metadataVerification = ContentObjectVerification._VerifyPart({
|
|
68
|
+
partHash: metadataPartHash,
|
|
69
|
+
qpartsResponse: metadataPartResponse
|
|
70
|
+
});
|
|
71
|
+
if (metadataVerification.valid) {
|
|
72
|
+
response.qmd = {
|
|
73
|
+
valid: true
|
|
74
|
+
};
|
|
75
|
+
} else {
|
|
76
|
+
response.qmd = {
|
|
77
|
+
valid: false,
|
|
78
|
+
error: metadataVerification.error.message
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
response.qmd.hash = metadataPartHash;
|
|
82
|
+
if (!(response.qmd.valid && libraryId)) {
|
|
83
|
+
_context.next = 23;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
_context.next = 21;
|
|
87
|
+
return client.ContentObjectMetadata({
|
|
88
|
+
libraryId: libraryId,
|
|
89
|
+
objectId: objectId,
|
|
90
|
+
versionHash: partHash.replace("hqp_", "hq__")
|
|
91
|
+
});
|
|
92
|
+
case 21:
|
|
93
|
+
metadata = _context.sent;
|
|
94
|
+
response.qmd.check = ContentObjectVerification._VerifyMetadata({
|
|
95
|
+
metadataCbor: metadataVerification.cbor,
|
|
96
|
+
metadata: metadata
|
|
97
|
+
});
|
|
98
|
+
case 23:
|
|
99
|
+
// Validate Qstruct
|
|
100
|
+
qstructHash = partVerification.cbor.QstructHash.value;
|
|
101
|
+
structPartHash = "hqp_" + MultiHash.toB58String(qstructHash.slice(1, qstructHash.length));
|
|
102
|
+
_context.next = 27;
|
|
103
|
+
return client.QParts({
|
|
104
|
+
libraryId: libraryId,
|
|
105
|
+
objectId: objectId,
|
|
106
|
+
partHash: structPartHash,
|
|
107
|
+
format: "arrayBuffer"
|
|
108
|
+
}).then(function (response) {
|
|
109
|
+
return Buffer.from(response);
|
|
110
|
+
});
|
|
111
|
+
case 27:
|
|
112
|
+
structPartResponse = _context.sent;
|
|
113
|
+
structVerification = ContentObjectVerification._VerifyPart({
|
|
114
|
+
partHash: structPartHash,
|
|
115
|
+
qpartsResponse: structPartResponse
|
|
116
|
+
});
|
|
117
|
+
if (structVerification.valid) {
|
|
118
|
+
response.qstruct = {
|
|
119
|
+
valid: true
|
|
120
|
+
};
|
|
121
|
+
} else {
|
|
122
|
+
response.qstruct = {
|
|
123
|
+
valid: false,
|
|
124
|
+
error: structVerification.error.message
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
response.qstruct.hash = structPartHash;
|
|
128
|
+
if (response.qstruct.valid) {
|
|
129
|
+
response.qstruct.parts = ContentObjectVerification._FormatQStruct(structVerification.cbor.Parts);
|
|
130
|
+
}
|
|
131
|
+
case 32:
|
|
132
|
+
response.valid = response.qref.valid && response.qmd.valid && response.qstruct.valid && (!response.qmd.check || response.qmd.check.valid);
|
|
133
|
+
return _context.abrupt("return", response);
|
|
134
|
+
case 34:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee);
|
|
139
|
+
}))();
|
|
140
|
+
},
|
|
141
|
+
// Content verification methods //
|
|
142
|
+
_FormatQStruct: function _FormatQStruct(structParts) {
|
|
143
|
+
if (!structParts) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
return structParts.map(function (structPart) {
|
|
147
|
+
return {
|
|
148
|
+
hash: "hqp_" + MultiHash.toB58String(structPart.Hash.value.slice(1, structPart.Hash.length)),
|
|
149
|
+
size: structPart.Size
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
_Hash: function _Hash(thing) {
|
|
154
|
+
function fromBits(arr) {
|
|
155
|
+
var out = [],
|
|
156
|
+
bl = SJCL.bitArray.bitLength(arr),
|
|
157
|
+
i,
|
|
158
|
+
tmp;
|
|
159
|
+
for (i = 0; i < bl / 8; i++) {
|
|
160
|
+
if ((i & 3) === 0) {
|
|
161
|
+
tmp = arr[i / 4];
|
|
162
|
+
}
|
|
163
|
+
out.push(tmp >>> 24);
|
|
164
|
+
tmp <<= 8;
|
|
165
|
+
}
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
function toBits(bytes) {
|
|
169
|
+
var out = [],
|
|
170
|
+
i,
|
|
171
|
+
tmp = 0;
|
|
172
|
+
for (i = 0; i < bytes.length; i++) {
|
|
173
|
+
tmp = tmp << 8 | bytes[i];
|
|
174
|
+
if ((i & 3) === 3) {
|
|
175
|
+
out.push(tmp);
|
|
176
|
+
tmp = 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (i & 3) {
|
|
180
|
+
out.push(SJCL.bitArray.partial(8 * (i & 3), tmp));
|
|
181
|
+
}
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
var digest = SJCL.hash.sha256.hash(toBits(thing));
|
|
185
|
+
var bytes = fromBits(digest);
|
|
186
|
+
var out = Buffer.from(bytes, "binary");
|
|
187
|
+
return MultiHash.toB58String(MultiHash.encode(out, "sha2-256"));
|
|
188
|
+
},
|
|
189
|
+
_ParseCBOR: function _ParseCBOR(cborResponse) {
|
|
190
|
+
var buffer = cborResponse.slice(7, cborResponse.length);
|
|
191
|
+
var hex = buffer.toString("hex");
|
|
192
|
+
return CBOR.decodeFirstSync(hex);
|
|
193
|
+
},
|
|
194
|
+
_VerifyPart: function _VerifyPart(_ref2) {
|
|
195
|
+
var partHash = _ref2.partHash,
|
|
196
|
+
qpartsResponse = _ref2.qpartsResponse;
|
|
197
|
+
try {
|
|
198
|
+
if (ContentObjectVerification._Hash(qpartsResponse) !== partHash.replace("hqp_", "")) {
|
|
199
|
+
throw Error("Hashes do not match");
|
|
200
|
+
}
|
|
201
|
+
var cbor = ContentObjectVerification._ParseCBOR(qpartsResponse);
|
|
202
|
+
return {
|
|
203
|
+
valid: true,
|
|
204
|
+
cbor: cbor
|
|
205
|
+
};
|
|
206
|
+
} catch (error) {
|
|
207
|
+
return {
|
|
208
|
+
valid: false,
|
|
209
|
+
error: error
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
_VerifyMetadata: function _VerifyMetadata(_ref3) {
|
|
214
|
+
var metadataCbor = _ref3.metadataCbor,
|
|
215
|
+
metadata = _ref3.metadata;
|
|
216
|
+
if (!metadataCbor) {
|
|
217
|
+
metadataCbor = {};
|
|
218
|
+
}
|
|
219
|
+
if (!metadata) {
|
|
220
|
+
metadata = {};
|
|
221
|
+
}
|
|
222
|
+
var response = {
|
|
223
|
+
valid: true,
|
|
224
|
+
invalidValues: []
|
|
225
|
+
};
|
|
226
|
+
var cborKeys = Object.keys(metadataCbor);
|
|
227
|
+
var metadataKeys = Object.keys(metadata);
|
|
228
|
+
|
|
229
|
+
// Find any difference between top level keys
|
|
230
|
+
var differentKeys = cborKeys.filter(function (x) {
|
|
231
|
+
return !metadataKeys.includes(x);
|
|
232
|
+
}).concat(metadataKeys.filter(function (x) {
|
|
233
|
+
return !cborKeys.includes(x);
|
|
234
|
+
}));
|
|
235
|
+
var _iterator = _createForOfIteratorHelper(differentKeys),
|
|
236
|
+
_step;
|
|
237
|
+
try {
|
|
238
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
239
|
+
var key = _step.value;
|
|
240
|
+
var cborValue = metadataCbor[key];
|
|
241
|
+
var metadataValue = metadata[key];
|
|
242
|
+
response.invalidValues.push({
|
|
243
|
+
key: key,
|
|
244
|
+
cborValue: cborValue,
|
|
245
|
+
metadataValue: metadataValue
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Deep comparison of up to 5 keys
|
|
250
|
+
} catch (err) {
|
|
251
|
+
_iterator.e(err);
|
|
252
|
+
} finally {
|
|
253
|
+
_iterator.f();
|
|
254
|
+
}
|
|
255
|
+
var _iterator2 = _createForOfIteratorHelper(Object.keys(metadataCbor).slice(0, 5)),
|
|
256
|
+
_step2;
|
|
257
|
+
try {
|
|
258
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
259
|
+
var fieldToValidate = _step2.value;
|
|
260
|
+
var _cborValue = metadataCbor[fieldToValidate];
|
|
261
|
+
var _metadataValue = metadata[fieldToValidate];
|
|
262
|
+
if (!DeepEqual(_cborValue, _metadataValue)) {
|
|
263
|
+
response.invalidValues.push({
|
|
264
|
+
key: fieldToValidate,
|
|
265
|
+
cborValue: _cborValue,
|
|
266
|
+
metadataValue: _metadataValue
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
} catch (err) {
|
|
271
|
+
_iterator2.e(err);
|
|
272
|
+
} finally {
|
|
273
|
+
_iterator2.f();
|
|
274
|
+
}
|
|
275
|
+
if (response.invalidValues.length !== 0) {
|
|
276
|
+
response.valid = false;
|
|
277
|
+
}
|
|
278
|
+
return response;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
module.exports = ContentObjectVerification;
|
package/dist/src/Crypto.js
CHANGED
|
@@ -117,15 +117,43 @@ var Crypto = {
|
|
|
117
117
|
}, _callee2);
|
|
118
118
|
}))();
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
// accepts either a raw private key string (legacy usage) or a signer
|
|
121
|
+
DecryptCap: function DecryptCap(encryptedCap, signerOrPrivateKey) {
|
|
121
122
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
122
|
-
var elvCrypto, ephemeralKey, tag, data, cap;
|
|
123
|
+
var privateKey, elvCrypto, ephemeralKey, tag, data, cap;
|
|
123
124
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
124
125
|
while (1) switch (_context3.prev = _context3.next) {
|
|
125
126
|
case 0:
|
|
126
|
-
|
|
127
|
+
if (!(typeof signerOrPrivateKey === "string")) {
|
|
128
|
+
_context3.next = 4;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
privateKey = signerOrPrivateKey;
|
|
132
|
+
_context3.next = 15;
|
|
133
|
+
break;
|
|
134
|
+
case 4:
|
|
135
|
+
if (!(signerOrPrivateKey && signerOrPrivateKey.remoteSigner)) {
|
|
136
|
+
_context3.next = 10;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
_context3.next = 7;
|
|
140
|
+
return signerOrPrivateKey.DecryptCap(encryptedCap);
|
|
141
|
+
case 7:
|
|
142
|
+
return _context3.abrupt("return", _context3.sent);
|
|
143
|
+
case 10:
|
|
144
|
+
if (!(signerOrPrivateKey && typeof signerOrPrivateKey._signingKey === "function")) {
|
|
145
|
+
_context3.next = 14;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
privateKey = signerOrPrivateKey._signingKey().privateKey;
|
|
149
|
+
_context3.next = 15;
|
|
150
|
+
break;
|
|
151
|
+
case 14:
|
|
152
|
+
throw Error("Crypto.DecryptCap: second argument must be a signer or a private key string");
|
|
153
|
+
case 15:
|
|
154
|
+
_context3.next = 17;
|
|
127
155
|
return Crypto.ElvCrypto();
|
|
128
|
-
case
|
|
156
|
+
case 17:
|
|
129
157
|
elvCrypto = _context3.sent;
|
|
130
158
|
privateKey = new Uint8Array(Buffer.from(privateKey.replace("0x", ""), "hex"));
|
|
131
159
|
encryptedCap = Buffer.from(encryptedCap, "base64");
|
|
@@ -134,7 +162,7 @@ var Crypto = {
|
|
|
134
162
|
data = encryptedCap.slice(81);
|
|
135
163
|
cap = elvCrypto.decryptECIES(new Uint8Array(data), privateKey, new Uint8Array(ephemeralKey), new Uint8Array(tag));
|
|
136
164
|
return _context3.abrupt("return", JSON.parse(Buffer.from(cap).toString()));
|
|
137
|
-
case
|
|
165
|
+
case 25:
|
|
138
166
|
case "end":
|
|
139
167
|
return _context3.stop();
|
|
140
168
|
}
|
package/dist/src/ElvClient.js
CHANGED
|
@@ -20,6 +20,7 @@ var HttpClient = require("./HttpClient");
|
|
|
20
20
|
var RemoteSigner = require("./RemoteSigner");
|
|
21
21
|
var Utils = require("./Utils");
|
|
22
22
|
var Crypto = require("./Crypto");
|
|
23
|
+
var NetworkUrls = require("./NetworkUrls");
|
|
23
24
|
var _require = require("./LogMessage"),
|
|
24
25
|
LogMessage = _require.LogMessage;
|
|
25
26
|
var Pako = require("pako");
|
|
@@ -27,13 +28,6 @@ var _require2 = require("./Validation"),
|
|
|
27
28
|
ValidatePresence = _require2.ValidatePresence,
|
|
28
29
|
ValidateWriteToken = _require2.ValidateWriteToken;
|
|
29
30
|
var UrlJoin = require("url-join");
|
|
30
|
-
var networks = {
|
|
31
|
-
"main": "https://main.net955305.contentfabric.io",
|
|
32
|
-
"demo": "https://demov3.net955210.contentfabric.io",
|
|
33
|
-
"demov3": "https://demov3.net955210.contentfabric.io",
|
|
34
|
-
"local": "http://127.0.0.1:8008/config?qspace=dev&self",
|
|
35
|
-
"test": "https://test.net955203.contentfabric.io"
|
|
36
|
-
};
|
|
37
31
|
if (Utils.Platform() === Utils.PLATFORM_NODE) {
|
|
38
32
|
// Define Response in node
|
|
39
33
|
// eslint-disable-next-line no-global-assign
|
|
@@ -260,18 +254,22 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
260
254
|
uris = this.service === "search" ? this.searchURIs : this.fabricURIs;
|
|
261
255
|
this.HttpClient = new HttpClient({
|
|
262
256
|
uris: uris,
|
|
257
|
+
networkName: this.networkName,
|
|
263
258
|
debug: this.debug
|
|
264
259
|
});
|
|
265
260
|
this.AuthHttpClient = new HttpClient({
|
|
266
261
|
uris: this.authServiceURIs,
|
|
262
|
+
networkName: this.networkName,
|
|
267
263
|
debug: this.debug
|
|
268
264
|
});
|
|
269
265
|
this.FileServiceHttpClient = new HttpClient({
|
|
270
266
|
uris: this.fileServiceURIs,
|
|
267
|
+
networkName: this.networkName,
|
|
271
268
|
debug: this.debug
|
|
272
269
|
});
|
|
273
270
|
this.SearchHttpClient = new HttpClient({
|
|
274
271
|
uris: this.searchURIs || [],
|
|
272
|
+
networkName: this.networkName,
|
|
275
273
|
debug: this.debug
|
|
276
274
|
});
|
|
277
275
|
this.ethClient = new EthClient({
|
|
@@ -1489,6 +1487,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1489
1487
|
path = "/ks/jwt/wlt";
|
|
1490
1488
|
httpClient = new HttpClient({
|
|
1491
1489
|
uris: this.kmsURIs,
|
|
1490
|
+
networkName: this.networkName,
|
|
1492
1491
|
debug: this.debug
|
|
1493
1492
|
});
|
|
1494
1493
|
_context19.next = 22;
|
|
@@ -1726,7 +1725,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1726
1725
|
case 3:
|
|
1727
1726
|
ValidatePresence("message", message);
|
|
1728
1727
|
_context23.next = 6;
|
|
1729
|
-
return this.Crypto.DecryptCap(message, this.signer
|
|
1728
|
+
return this.Crypto.DecryptCap(message, this.signer);
|
|
1730
1729
|
case 6:
|
|
1731
1730
|
return _context23.abrupt("return", _context23.sent);
|
|
1732
1731
|
case 7:
|
|
@@ -2019,7 +2018,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2019
2018
|
}, {
|
|
2020
2019
|
key: "Networks",
|
|
2021
2020
|
value: function Networks() {
|
|
2022
|
-
return Object.assign({},
|
|
2021
|
+
return Object.assign({}, NetworkUrls);
|
|
2023
2022
|
}
|
|
2024
2023
|
|
|
2025
2024
|
/**
|
|
@@ -2047,7 +2046,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
2047
2046
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2048
2047
|
case 0:
|
|
2049
2048
|
networkName = _ref31.networkName, region = _ref31.region, clientIP = _ref31.clientIP, trustAuthorityId = _ref31.trustAuthorityId, staticToken = _ref31.staticToken, _ref31$ethereumContra = _ref31.ethereumContractTimeout, ethereumContractTimeout = _ref31$ethereumContra === void 0 ? 10 : _ref31$ethereumContra, _ref31$noCache = _ref31.noCache, noCache = _ref31$noCache === void 0 ? false : _ref31$noCache, _ref31$noAuth = _ref31.noAuth, noAuth = _ref31$noAuth === void 0 ? false : _ref31$noAuth, assumeV3 = _ref31.assumeV3;
|
|
2050
|
-
configUrl =
|
|
2049
|
+
configUrl = this.Networks()[networkName];
|
|
2051
2050
|
if (configUrl) {
|
|
2052
2051
|
_context28.next = 4;
|
|
2053
2052
|
break;
|
package/dist/src/FrameClient.js
CHANGED
|
@@ -449,7 +449,7 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
449
449
|
}, {
|
|
450
450
|
key: "AllowedMethods",
|
|
451
451
|
value: function AllowedMethods() {
|
|
452
|
-
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateAuthorizationToken", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeleteWriteToken", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamConfig", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamListUrls", "StreamRemoveWatermark", "StreamSetOfferingAndDRM", "
|
|
452
|
+
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateAuthorizationToken", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeleteWriteToken", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "OutputsCreate", "OutputsDelete", "OutputsDeleteBatch", "OutputsList", "OutputsListItem", "OutputsModify", "OutputsModifyBatch", "OutputsReset", "OutputsResolveSrtPullUrls", "OutputsState", "OutputsStop", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "StreamApplyProfile", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamApplyProfile", "StreamAssignProfile", "StreamConfig", "StreamConfigProfile", "StreamConfigProfiles", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamLinkToSite", "StreamListUrls", "StreamRemoveLinkToSite", "StreamRemoveWatermark", "StreamSaveConfigProfile", "StreamSetOfferingAndDRM", "StreamSiteSettings", "StreamStartRecording", "StreamStartOrStopOrReset", "StreamStatus", "StreamStopRecording", "StreamUnassignProfile", "StreamUpdateConfig", "SuspendNTPInstance", "TenantContractId", "TenantId", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UpdateShare", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrlLocal", "WriteTokenNodeUrlNetwork"];
|
|
453
453
|
}
|
|
454
454
|
}, {
|
|
455
455
|
key: "AllowedUserProfileMethods",
|