const crypto = require('crypto');
...
const header = event.headers['X-ANET-Signature'];
const body = event.body;
const hash = crypto.createHmac('sha512', AUTHORIZENET_SIGNATURE_KEY).update(body).digest('hex');
if (header == `sha512=${hash.toUpperCase()}`) {
// Verified!
}