How to use the libsodium-wrappers.crypto_secretbox_easy function in libsodium-wrappers

To help you get started, we’ve selected a few libsodium-wrappers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zefau / ioBroker.roomba / library.js View on Github external
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;
		}
	}
github maidsafe / safe_examples / dns_example / src / scripts / safe_api / request_manager.js View on Github external
var encrypt = function(data) {
    return getValuesFromMap(sodium.crypto_secretbox_easy(data, encryptionNonce, encryptionKey));
  };
github samuelmaddock / metastream / packages / metastream-app / src / platform / web / crypto.ts View on Github external
export const encrypt = (msg: Data, nonce: Data, key: Key) =>
  sodium.crypto_secretbox_easy(msg, nonce, key)