Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
encrypt(key, message)
{
var nonce = _sodium.randombytes_buf(_sodium.crypto_secretbox_NONCEBYTES);
try
{
return _sodium.to_hex(_concat(Uint8Array, nonce, _sodium.crypto_secretbox_easy(message, nonce, _sodium.from_hex(key))));
}
catch(e)
{
this._adapter.log.warn(e.message);
return false;
}
}
var encrypt = function(data) {
return getValuesFromMap(sodium.crypto_secretbox_easy(data, encryptionNonce, encryptionKey));
};
export const encrypt = (msg: Data, nonce: Data, key: Key) =>
sodium.crypto_secretbox_easy(msg, nonce, key)