encryptBytes static method

CryptEnvelope encryptBytes(
  1. List<int> bytes, {
  2. required Uint8List key,
  3. CryptAlgorithm algorithm = CryptAlgorithm.chacha20Poly1305,
  4. Uint8List? nonce,
  5. List<int>? aad,
})

Cifra bytes e retorna um CryptEnvelope sem chave.

Implementation

static CryptEnvelope encryptBytes(
  List<int> bytes, {
  required Uint8List key,
  CryptAlgorithm algorithm = CryptAlgorithm.chacha20Poly1305,
  Uint8List? nonce,
  List<int>? aad,
}) {
  final legacy = _encryptViaAlgorithm(
    bytes,
    key: key,
    algorithm: algorithm,
    nonce: nonce,
    aad: aad,
  );
  return CryptEnvelope(
    algorithm: legacy.algorithm,
    ciphertext: legacy.ciphertext,
    nonce: legacy.nonce,
    tag: legacy.tag,
    aad: legacy.aad,
  );
}