Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const JITSI_OPTIONS = {
jitsi_domain: jitsiDomain,
jitsi_lifetime_token: '1hour', // only 1 hour (for security reasons)
jitsi_application_id: jitsiApplicationId,
jitsi_application_secret: jitsiApplicationSecret,
};
const HEADER = {
typ: 'JWT',
alg: 'HS256',
};
const commonPayload = {
iss: JITSI_OPTIONS.jitsi_application_id,
sub: JITSI_OPTIONS.jitsi_domain,
iat: jws.IntDate.get('now'),
nbf: jws.IntDate.get('now'),
exp: jws.IntDate.get(`now + ${ JITSI_OPTIONS.jitsi_lifetime_token }`),
aud: 'RocketChat',
room: '*',
context: '', // first empty
};
const header = JSON.stringify(HEADER);
const payload = JSON.stringify(addUserContextToPayload(commonPayload));
return jws.JWS.sign(HEADER.alg, header, payload, { rstr: JITSI_OPTIONS.jitsi_application_secret });
},
});
jitsi_domain: jitsiDomain,
jitsi_lifetime_token: '1hour', // only 1 hour (for security reasons)
jitsi_application_id: jitsiApplicationId,
jitsi_application_secret: jitsiApplicationSecret,
};
const HEADER = {
typ: 'JWT',
alg: 'HS256',
};
const commonPayload = {
iss: JITSI_OPTIONS.jitsi_application_id,
sub: JITSI_OPTIONS.jitsi_domain,
iat: jws.IntDate.get('now'),
nbf: jws.IntDate.get('now'),
exp: jws.IntDate.get(`now + ${ JITSI_OPTIONS.jitsi_lifetime_token }`),
aud: 'RocketChat',
room: '*',
context: '', // first empty
};
const header = JSON.stringify(HEADER);
const payload = JSON.stringify(addUserContextToPayload(commonPayload));
return jws.JWS.sign(HEADER.alg, header, payload, { rstr: JITSI_OPTIONS.jitsi_application_secret });
},
});