makeSharedKey function
Makes a 32-byte shared key from the private key and the public key. Returns a Future that completes with the shared key.
Implementation
Future<List<int>> makeSharedKey(
List<int> privateKey,
List<int> publicKey,
) async {
final algorithm = X25519();
final sharedSecretKey = await algorithm.sharedSecretKey(
keyPair: await algorithm.newKeyPairFromSeed(privateKey),
remotePublicKey: SimplePublicKey(publicKey, type: KeyPairType.x25519),
);
return sharedSecretKey.extractBytes();
}