ToplSigningKey.createRandom constructor

ToplSigningKey.createRandom(
  1. NetworkId n,
  2. PropositionType p
)

Creates a new, random private key from the random number generator.

For security reasons, it is very important that the random generator used is cryptographically secure. The private key could be reconstructed by someone else otherwise. Just using Random() is a very bad idea! At least use Random.secure().

Implementation

factory ToplSigningKey.createRandom(NetworkId n, PropositionType p) {
  final key = Bip32SigningKey.generate();
  return ToplSigningKey(key, n, p);
}