generateKeyPair function
Generates a new random Ed25519 key pair.
Returns a KeyPair with a randomly generated 32-byte private key and its corresponding 32-byte public key.
Implementation
KeyPair generateKeyPair() {
final keyPair = ed.generateKey();
final seed = keyPair.privateKey.bytes.sublist(0, 32);
final publicKeyBytes = keyPair.publicKey.bytes;
return KeyPair(
privateKey: Uint8List.fromList(seed),
publicKey: Uint8List.fromList(publicKeyBytes),
);
}