Skip to content

Instantly share code, notes, and snippets.

@jacobwise
Created August 13, 2020 13:17
Show Gist options
  • Save jacobwise/16e86ddbd97eeb7fc3f59e94da22be45 to your computer and use it in GitHub Desktop.
Save jacobwise/16e86ddbd97eeb7fc3f59e94da22be45 to your computer and use it in GitHub Desktop.
var decrypt = function (encrypted, method, secret, hmac) {
var iv = new Buffer.from(encrypted.substr(0, 24), "base64").toString();
var decryptor = crypto.createDecipheriv(method, secret, iv);
return (
decryptor.update(encrypted.substr(24), "base64", "utf8") +
decryptor.final("utf8")
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment