generateNewPrivateKey function
Generates a new private key using the random instance provided. Please make sure you're using a cryptographically secure generator.
Implementation
BigInt generateNewPrivateKey(Random random) {
final generator = ECKeyGenerator();
final keyParams = ECKeyGeneratorParameters(params);
generator.init(ParametersWithRandom(keyParams, RandomBridge(random)));
final key = generator.generateKeyPair();
final privateKey = key.privateKey as ECPrivateKey;
return privateKey.d!;
}