aeadEncrypt method

EncryptedBuffer aeadEncrypt({
  1. required Uint8List message,
  2. Uint8List? nonce,
  3. Uint8List? aad,
})

Encrypts a message using AEAD.

Throws an AskarKeyException if encryption fails.

Implementation

EncryptedBuffer aeadEncrypt({
  required Uint8List message,
  Uint8List? nonce,
  Uint8List? aad,
}) {
  try {
    return askarKeyAeadEncrypt(
      localKeyHandle,
      message,
      nonce: nonce,
      aad: aad,
    ).getValueOrException();
  } catch (e) {
    throw AskarKeyException('Error on AEAD Encryption: $e');
  }
}