nonce function

  1. @untestable
String nonce([
  1. int length = 32
])

Generates a random nonce.

Implementation

@untestable
String nonce([int length = 32]) {
  const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._';

  final random = Random.secure();
  return List.generate(length, (_) => charset[random.nextInt(charset.length)]).join();
}