defaultIdempotencyKeyGenerator function
Emits a 128-bit hex-encoded key from Random.secure(), which uses the
platform CSPRNG (/dev/urandom, BCryptGenRandom, or Web Crypto).
FIPS 140-3 aligned on validated platforms.
Implementation
String defaultIdempotencyKeyGenerator() {
final rng = Random.secure();
final bytes = Uint8List(16);
for (var i = 0; i < bytes.length; i++) {
bytes[i] = rng.nextInt(256);
}
final buffer = StringBuffer();
for (final b in bytes) {
buffer.write(b.toRadixString(16).padLeft(2, '0'));
}
return buffer.toString();
}