Skip to content

Commit 294d86c

Browse files
philcluffjsanford8
authored andcommitted
Lint/prettier and add .tool-versions file
1 parent a73dcda commit 294d86c

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodejs 18.17.0
2+
yarn 1.22.22

src/resources/jwt.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ export class Jwt extends APIResource {
3737
/**
3838
* Creates a new token for a license for playing back DRM'd video content
3939
*/
40-
async signDrmLicense(
41-
playbackId: string,
42-
config: MuxJWTSignOptions<keyof typeof TypeClaim> = {},
43-
): Promise<string> {
44-
const claim = TypeClaim[config.type ?? 'drm_license'];
45-
if (!claim) {
46-
throw new Error(`Invalid signature type: ${config.type}; Expected one of ${Object.keys(TypeClaim)}`);
47-
}
48-
49-
const tokenOptions: SignOptions = {
50-
keyid: jwt.getSigningKey(this._client, config),
51-
subject: playbackId,
52-
audience: claim,
53-
expiresIn: config.expiration ?? '7d',
54-
noTimestamp: true,
55-
algorithm: 'RS256',
56-
};
57-
58-
return jwt.sign(config.params ?? {}, await jwt.getPrivateKey(this._client, config), tokenOptions);
40+
async signDrmLicense(
41+
playbackId: string,
42+
config: MuxJWTSignOptions<keyof typeof TypeClaim> = {},
43+
): Promise<string> {
44+
const claim = TypeClaim[config.type ?? 'drm_license'];
45+
if (!claim) {
46+
throw new Error(`Invalid signature type: ${config.type}; Expected one of ${Object.keys(TypeClaim)}`);
5947
}
6048

49+
const tokenOptions: SignOptions = {
50+
keyid: jwt.getSigningKey(this._client, config),
51+
subject: playbackId,
52+
audience: claim,
53+
expiresIn: config.expiration ?? '7d',
54+
noTimestamp: true,
55+
algorithm: 'RS256',
56+
};
57+
58+
return jwt.sign(config.params ?? {}, await jwt.getPrivateKey(this._client, config), tokenOptions);
59+
}
60+
6161
/**
6262
* Creates a new token to be used with a space
6363
* @deprecated Mux Real-Time Video (spaces) has been shut down. This function will be removed in the next major version.

0 commit comments

Comments
 (0)