generateX25519EphemeralKeyPair function

Future<(List<int>, List<int>)> generateX25519EphemeralKeyPair()

Generates a X25519 ephemeral key pair. Returns a Future that completes with a tuple containing the private key and the public key.

Implementation

Future<(List<int>, List<int>)> generateX25519EphemeralKeyPair() async {
  final algorithm = X25519();
  final keyPair = await algorithm.newKeyPair();
  final publicKey = await keyPair.extractPublicKey();
  final privateKey = await keyPair.extractPrivateKeyBytes();
  return (privateKey, publicKey.bytes);
}