encryptText static method
Cifra text (UTF-8) e retorna um CryptEnvelope sem chave.
key: obrigatória; tamanho depende dealgorithm.algorithm: padrão CryptAlgorithm.chacha20Poly1305 (AEAD).nonce: nonce/IV/ICB; se omitido, gerado aleatoriamente.aad: dados autenticados não cifrados (apenas modos AEAD).
Implementation
static CryptEnvelope encryptText(
String text, {
required Uint8List key,
CryptAlgorithm algorithm = CryptAlgorithm.chacha20Poly1305,
Uint8List? nonce,
List<int>? aad,
}) =>
encryptBytes(
utf8.encode(text),
key: key,
algorithm: algorithm,
nonce: nonce,
aad: aad,
);