encryptSymmetricBytes function

String encryptSymmetricBytes(
  1. Uint8List buffer,
  2. String passphrase
)

Encrypts the given data using NaCl SecretBox and returns a Base64 string containing nonce[24] + cipherText[]. The 24 first bytes represent the nonce, and the rest of the buffer contains the cipher text.

Implementation

String encryptSymmetricBytes(Uint8List buffer, String passphrase) {
  final encryptedBuffer = encryptSymmetricRaw(buffer, passphrase);
  return base64.encode(encryptedBuffer);
}