generateRandomNonce static method

Uint8List generateRandomNonce(
  1. int length, {
  2. int bit = 256,
})

Generate a random nonce

Implementation

static Uint8List generateRandomNonce(int length, {int bit = 256}) {
  final random = Random.secure();
  final nonce = List<int>.generate(length, (_) => random.nextInt(bit));
  return Uint8List.fromList(nonce);
}