@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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.116",
3
+ "version": "4.0.117",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -261,7 +261,7 @@ class LiveConf {
261
261
  break;
262
262
  case "30000/1001":
263
263
  //seg.videoFrameDurationTs = 3003;
264
- seg.video = sourceTimescale * 30;
264
+ seg.video = sourceTimescale * 30.03;
265
265
  seg.keyint = 60;
266
266
  seg.duration = "30.03";
267
267
  break;
@@ -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
+