Encrypt a message with a symmetric (shared) key.
The plaintext message to encrypt.
A number that must be only used once, per message. 24 bytes long. This is a large enough bound to generate randomly (i.e. random_bytes).
Encryption key (256-bit).
Returns the encrypted string.
Exceptions and Errors
If nonce has a length of bytes different than SODIUM_CRYPTO_SECRETBOX_NONCEBYTES (24 bytes), a SodiumException will be thrown.
If key has a length of bytes different than SODIUM_CRYPTO_SECRETBOX_KEYBYTES (32 bytes), a SodiumException will be thrown.
Throws a SodiumException on failure.