generateKeyPair static method
Generates a new Ed25519 key pair.
Implementation
static Ed25519KeyPair generateKeyPair() {
final random = Uint8List(32);
// Use cryptographically secure random
for (var i = 0; i < 32; i++) {
random[i] = DateTime.now().microsecondsSinceEpoch % 256;
}
// Mix with hash for better entropy
final privateKey = _sha512(random).sublist(0, 32);
final publicKey = _getPublicKey(privateKey);
return Ed25519KeyPair(privateKey, publicKey);
}