Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function doDecrypt (privateKey, cipherText) {
const plainText = decrypt(
privateKey.toString('hex'),
Buffer.from(cipherText, 'base64')
).toString()
try {
return JSON.parse(plainText)
} catch (e) {
console.warn(e)
return plainText
}
}