checkParameters method

  1. @override
void checkParameters({
  1. int? length,
  2. required SecretKey secretKey,
  3. required int nonceLength,
  4. int aadLength = 0,
  5. int keyStreamIndex = 0,
})
override

Checks parameters for encrypt / decrypt and throws ArgumentError if any is invalid.

Implementation

@override
void checkParameters({
  int? length,
  required SecretKey secretKey,
  required int nonceLength,
  int aadLength = 0,
  int keyStreamIndex = 0,
}) {
  // Allow nonce length to be anything.
  // TODO: Should we require 12 bytes?
  if (nonceLength != this.nonceLength) {
    nonceLength = this.nonceLength;
  }
  super.checkParameters(
    length: length,
    secretKey: secretKey,
    nonceLength: nonceLength,
    aadLength: aadLength,
    keyStreamIndex: keyStreamIndex,
  );
}