I have create a package for Wowza streaming platform in nodejs to generate secure token
I inspired from remiheens/WowzaSecureToken
Install the package :
npm install wowza-generate-token
- Import the package: In your JavaScript file where you want to use the package, import it using the require or import statement:
const { WowzaGenerateToken } = require('wowza-generate-token')
const token = new WowzaGenerateToken('wowzaprefix','mySharedSecret');
token.setClientIP('192.168.1.1');
token.setURL('https://r1.test.com:443/vod_test/_definst_/mehdi/kiasalar/2/smil:hd_test.smil/playlist.m3u8');
token.setHashMethod(WowzaGenerateToken.SHA256);
const startTime = Math.floor(Date.now() / 1000);
const endTime = Math.floor(Date.now() / 1000) + (3 * 60 * 60); //3 hours
token.setExtraParams({ endtime: endTime, starttime: startTime, CustomParam1 : 'CustomValue' });
const secureToken = token.getHash();
const securedURL = token.getFullURL();
console.log(securedURL)