randomSecret static method Null safety

String randomSecret()

Generates a cryptographically secure random secret in base32 string format.

Implementation

static String randomSecret() {
  final rand = Random.secure();
  final bytes = <int>[];

  for (var i = 0; i < 10; i++) {
    bytes.add(rand.nextInt(256));
  }

  return base32.encode(Uint8List.fromList(bytes));
}