decryptSymmetricString function

String decryptSymmetricString(
  1. String encryptedBase64,
  2. String passphrase
)

Decrypts a byte array containing nonce[24] + cipherText[] into a String using NaCl SecretBox: https://github.com/ilap/pinenacl-dart#a-secret-key-encryption-example

Implementation

String decryptSymmetricString(String encryptedBase64, String passphrase) {
  final encryptedBuffer = base64.decode(encryptedBase64);
  final strBytes = decryptSymmetricRaw(encryptedBuffer, passphrase);

  return utf8.decode(strBytes);
}