ECPair.makeRandom constructor
ECPair.makeRandom({
- NetworkType network = mainnet,
- bool compressed = true,
- Function? rng,
Implementation
factory ECPair.makeRandom(
{NetworkType network = mainnet, bool compressed = true, Function? rng}) {
final rfunc = rng ?? _randomBytes;
Uint8List? d;
do {
d = rfunc(32);
if (d!.length != 32) throw ArgumentError('Expected Buffer(Length: 32)');
} while (!ecc.isPrivate(d));
return ECPair.fromPrivateKey(d, network: network, compressed: compressed);
}