Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function box (data, key) {
if(!data) return
var b = Buffer.from(JSON.stringify(data))
return chloride.crypto_secretbox_easy(b, key.slice(0, 24), key).toString('base64')
}
exports.secretBox = function secretBox (data, key) {
if(!data) return
var ptxt = Buffer.from(JSON.stringify(data))
return sodium.crypto_secretbox_easy(ptxt, key.slice(0, 24), key)
}