encryptText static method

EncryptedPayload encryptText(
  1. String text, {
  2. Uint8List? key,
  3. Uint8List? nonce,
  4. List<int>? aad,
})

Criptografa text com ChaCha20-Poly1305 e retorna um EncryptedPayload.

  • key : 32 bytes. Se omitido, gera uma chave aleatória segura.
  • nonce : 12 bytes. Se omitido, gera um nonce aleatório seguro.
  • aad : dados autenticados mas não cifrados (opcional).

Implementation

static EncryptedPayload encryptText(
  String text, {
  Uint8List? key,
  Uint8List? nonce,
  List<int>? aad,
}) =>
    encryptBytes(utf8.encode(text), key: key, nonce: nonce, aad: aad);