sharedSecretKey abstract method
Computes the shared secret key that this and the other party can compute using public keys known to each other.
Example
import 'package:cryptography_plus/cryptography_plus.dart';
Future<void> main() async {
final x25519 = X25519();
// Alice has her private key.
final aliceWand = await x25519.newKeyExchangeWand();
// Bob gives his public key to Alice.
final bobPublicKey = await (await x25519.newKeyPair()).extractPublicKey();
// Alice can now compute a shared secret key.
// If Bob does the same, he will get the same key.
// Other parties cannot compute the same key.
final secretKey = await aliceWand.sharedSecretKey(
remotePublicKey: bobPublicKey,
);
}
Implementation
Future<SecretKey> sharedSecretKey({
required PublicKey remotePublicKey,
});