Created
March 8, 2017 22:02
-
-
Save smebberson/baf0556940a29cfd3ac14364f30cbe58 to your computer and use it in GitHub Desktop.
x-key header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper function to create an api key | |
* @param {String} data The string to encrypt | |
* @return {String} The sha256 hash result | |
*/ | |
function createHmac (data) { | |
const crypto = require('crypto'); | |
const hmac = crypto.createHmac('sha256', config.get('appSecret')); | |
hmac.update(data); | |
return hmac.digest('hex'); | |
} | |
const data = createHmac(config.get('appId')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment