I\'m trying to port the following php code to javascript on node.js:
$mac = hash_hmac(\'SHA256\', \'string\', \'secret\', true); $coded = base64_encode($mac);
You want to use the createHmac function instead.
createHmac
Crypto.createHmac("SHA256", 'secret').update('string').digest('base64')