randomSecret method

String randomSecret ()

Generates a cryptographically secure random secret in base32 string format.

Implementation

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

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

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