generateKeyPair method
- Uint8List? seed,
Generates a new Ed25519 key pair.
Optionally accepts a 32-byte seed for deterministic key generation.
If no seed is provided, a cryptographically secure random seed is used.
Throws ArgumentError if seed is not 32 bytes.
Implementation
Future<SimpleKeyPair> generateKeyPair({Uint8List? seed}) async {
if (seed != null) {
if (seed.length != 32) {
throw ArgumentError('Seed must be exactly 32 bytes for Ed25519');
}
return _algorithm.newKeyPairFromSeed(seed);
}
return _algorithm.newKeyPair();
}