ChaCha20Poly1305 constructor

ChaCha20Poly1305(
  1. List<int> key
)

Creates a ChaCha20-Poly1305 instance with the given 32-byte encryption key.

Implementation

ChaCha20Poly1305(List<int> key) {
  if (key.length != _keyLength) {
    throw ArgumentException.invalidOperationArguments(
      "ChaCha20Poly1305",
      name: "key",
      reason: "Invalid key bytes length.",
      expecteLen: _keyLength,
    );
  }
  _key = key.clone().asBytes;
}