generateKey method

  1. @override
Future<Uint8List> generateKey({
  1. int length = 32,
  2. Random? random,
})
override

Generate a new random, cryptographically secure key.

Implementation

@override
Future<Uint8List> generateKey({int length = 32, Random? random}) async {
  var r = random ?? Random.secure();
  return Uint8List.fromList(
    List<int>.generate(length, (i) => r.nextInt(256)),
  );
}