You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-214Lines changed: 2 additions & 214 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,6 @@
4
4
5
5
This library provides convenient access to the Mux REST API from server-side TypeScript or JavaScript.
6
6
7
-
> [!NOTE]
8
-
> In February 2024 this SDK was updated to Version 8.0. For upgrading to 8.x see [UPGRADE_8.x.md](https://github.com/muxinc/mux-node-sdk/blob/master/UPGRADE_8.x.md)
9
-
10
7
The REST API documentation can be found on [docs.mux.com](https://docs.mux.com). The full API of this library can be found in [api.md](api.md).
11
8
12
9
## Installation
@@ -66,215 +63,6 @@ main();
66
63
67
64
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
To simplify this use-case, you can provide multiple types to `signPlaybackId` to recieve multiple tokens. These tokens are provided in a format that Mux Player can take as props:
If you would like to provide params to a single token (e.g., if you would like to have a thumbnail `time`), you can provide `[type, typeParams]` instead of `type`:
Verifying Webhook Signatures is _optional but encouraged_. Learn more in our [Webhook Security Guide](https://docs.mux.com/docs/webhook-security)
214
-
215
-
```js
216
-
/*
217
-
If the header is valid, this function will not throw an error and will not return a value.
218
-
If the header is invalid, this function will throw one of the following errors:
219
-
- new Error(
220
-
"The webhook secret must either be set using the env var, MUX_WEBHOOK_SECRET, on the client class, Mux({ webhookSecret: '123' }), or passed to this function",
221
-
);
222
-
- new Error('Could not find a mux-signature header');
223
-
- new Error(
224
-
'Webhook body must be passed as the raw JSON string sent from the server (do not parse it first).',
225
-
);
226
-
- new Error('Unable to extract timestamp and signatures from header')
227
-
- new Error('No v1 signatures found');
228
-
- new Error('No signatures found matching the expected signature for payload.')
229
-
- new Error('Webhook timestamp is too old')
230
-
*/
231
-
232
-
/*
233
-
`body` is the raw request body. It should be a string representation of a JSON object.
234
-
`headers` is the value in request.headers
235
-
`secret` is the signing secret for this configured webhook. You can find that in your webhooks dashboard
236
-
(note that this secret is different than your API Secret Key)
Note that when passing in the payload (body) you want to pass in the raw un-parsed request body, not the parsed JSON. Here's an example if you are using express.
243
-
244
-
```js
245
-
constMux=require('@mux/mux-node');
246
-
constmux=newMux();
247
-
constexpress=require('express');
248
-
constbodyParser=require('body-parser');
249
-
250
-
/**
251
-
* You'll need to make sure this is externally accessible. ngrok (https://ngrok.com/)
0 commit comments