generateKeyPair static method

Future<KeyPair> generateKeyPair()

Generate a new Ed25519 key pair

Implementation

static Future<KeyPair> generateKeyPair() async {
  final algorithm = crypto.Ed25519();
  final keyPair = await algorithm.newKeyPair();
  final publicKeyObj = await keyPair.extractPublicKey();

  final publicKey = Ed25519PublicKey(publicKeyObj);
  final privateKey = await Ed25519PrivateKey.create(keyPair);

  return KeyPair(publicKey, privateKey);
}