newNonce method
Generates a new nonce.
It will have the correct length (nonceLength
).
The source of random bytes is Random.secure (a cryptographically secure
random number generator) unless a custom random number generator was
specified when you constructed the cipher (or your Cryptography
instance).
Implementation
List<int> newNonce() {
final bytes = Uint8List(nonceLength);
fillBytesWithSecureRandom(
bytes,
random: random, // If null, the method will use Random.secure
);
return bytes;
}