Libraries
The following packages are included:
- moment - convert timestamps into date and time. Inskill timestamps like the start and end of a task are unix timestamps (seconds, not milliseconds) so use the proper initialization.
console.log(moment().format()); // print current time
console.log(moment.unix(ds.start).format()); // print time the task started- moment_timezone - timezone aware
- mqtt 5.13.1
- crypto - functions to sign requests, etc.
crypto
function generateHMAC(data, secret) {
const hmac = crypto.createHmac('sha256', secret);
hmac.update(data);
return hmac.digest('hex');
}
function generateHash(data) {
const hash = crypto.createHash('sha256');
hash.update(data);
return hash.digest('hex');
}
// HMAC Example
let data = 'myDataToHMAC';
let secret = 'mySecretKey';
let hashedData = generateHash(data);
let hmacResult = generateHMAC(data, secret);
console.log(hashedData);list of all the available crypto commands
console.log(Object.keys(crypto));Updated 10 days ago
