progdisc/AwesomeBot

View on GitHub
commands/eval/gentoken.js

Summary

Maintainability
A
0 mins
Test Coverage
const crypto = require('crypto');

module.exports = (replitApiKey) => {
  const hmac = crypto.createHmac('sha256', replitApiKey);

  const timeCreated = Date.now();
  hmac.update(timeCreated.toString());
  const msgMac = hmac.digest('base64');

  return {
    time_created: timeCreated,
    msg_mac: msgMac,
  };
};