@eluvio/elv-client-js 4.0.116 → 4.0.117
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/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/client/LiveConf.js +1 -1
- package/package.json +1 -1
- package/src/client/LiveConf.js +1 -1
- package/utilities/GenerateEditorSignedAccessToken.js +72 -0
|
@@ -268,7 +268,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
268
268
|
break;
|
|
269
269
|
case "30000/1001":
|
|
270
270
|
//seg.videoFrameDurationTs = 3003;
|
|
271
|
-
seg.video = sourceTimescale * 30;
|
|
271
|
+
seg.video = sourceTimescale * 30.03;
|
|
272
272
|
seg.keyint = 60;
|
|
273
273
|
seg.duration = "30.03";
|
|
274
274
|
break;
|
package/package.json
CHANGED
package/src/client/LiveConf.js
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate an Editor Signed Access Token (ESAT)
|
|
3
|
+
*
|
|
4
|
+
* ESAT tokens can be content-based or policy-based.
|
|
5
|
+
* - content-based tokens are specifically for one content
|
|
6
|
+
* - policy-based tokens can give permissions to a list of content objects and can specifically
|
|
7
|
+
* restrict access to playout offerings, files, metadata subtrees and /rep calls
|
|
8
|
+
*/
|
|
9
|
+
const { ElvClient } = require("../src/ElvClient");
|
|
10
|
+
|
|
11
|
+
const yargs = require("yargs");
|
|
12
|
+
const argv = yargs
|
|
13
|
+
.option("object-id", {
|
|
14
|
+
description: "Object ID to give access to",
|
|
15
|
+
type: "string"
|
|
16
|
+
})
|
|
17
|
+
.option("subject", {
|
|
18
|
+
description: "Subject (user) of the token",
|
|
19
|
+
type: "string"
|
|
20
|
+
})
|
|
21
|
+
.demandOption(
|
|
22
|
+
["subject"],
|
|
23
|
+
"\nUsage: PRIVATE_KEY=<private-key> node GenerateEditorSignedAccessToken.js --subject <sub> --object-id <qid>\n"
|
|
24
|
+
)
|
|
25
|
+
.strict().argv;
|
|
26
|
+
|
|
27
|
+
const sampleContext = {
|
|
28
|
+
usr: {
|
|
29
|
+
email: 'jane@example.com',
|
|
30
|
+
tags: ["000", "001"]
|
|
31
|
+
},
|
|
32
|
+
authorized_offerings: [
|
|
33
|
+
"default",
|
|
34
|
+
"default_clear"
|
|
35
|
+
],
|
|
36
|
+
authorized_qids: [
|
|
37
|
+
"iq__2LUxseAk7qkZ5t5XFNWE45vBmwhZ"
|
|
38
|
+
],
|
|
39
|
+
authorized_meta: [
|
|
40
|
+
"/offerings/default"
|
|
41
|
+
],
|
|
42
|
+
authorized_reps: [
|
|
43
|
+
"playout",
|
|
44
|
+
"image",
|
|
45
|
+
"thumbnails",
|
|
46
|
+
"media_download"
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const GenerateEditorSignedAccessToken = async ({objectId, subject}) => {
|
|
51
|
+
const client = await ElvClient.FromNetworkName({networkName: "main"});
|
|
52
|
+
|
|
53
|
+
const wallet = client.GenerateWallet();
|
|
54
|
+
const signer = wallet.AddAccount({
|
|
55
|
+
privateKey: process.env.PRIVATE_KEY
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
client.SetSigner({signer});
|
|
59
|
+
|
|
60
|
+
var tok = await client.CreateSignedToken({
|
|
61
|
+
objectId,
|
|
62
|
+
subject,
|
|
63
|
+
duration: 30 * 86400000 // 1 month
|
|
64
|
+
//policyId,
|
|
65
|
+
//context,
|
|
66
|
+
});
|
|
67
|
+
console.log(tok);
|
|
68
|
+
return tok;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
GenerateEditorSignedAccessToken({objectId: argv["object-id"], subject: argv.subject});
|
|
72
|
+
|