ECPair.makeRandom constructor
ECPair.makeRandom([
- ECPairOptions? options
Make Random Pair
Implementation
factory ECPair.makeRandom([ECPairOptions? options]) {
options ??= ECPairOptions();
final rng = options.rng ?? (int arg0) => randomBytes(arg0, secure: true);
Uint8List d;
do {
d = rng(32);
if (d.length != 32) {
throw RangeError.value(d.length, 'rng', 'Returned value must be 32');
}
} while (!ecc.isPrivate(d));
return ECPair.fromPrivateKey(d, options);
}