sharedSecretSync abstract method
Computes shared secret synchronously (unlike sharedSecretKey).
Example
In this example, we use DartX25519 class:
import 'package:cryptography/cryptography.dart';
void main() async {
final algorithm = DartX25519();
// We need the private key pair of Alice.
final aliceKeyPair = algorithm.newKeyPairSync();
// We need only public key of Bob.
final bobKeyPair = algorithm.newKeyPairSync();
final bobPublicKey = bobKeyPair.publicKey;
// We can now calculate a 32-byte shared secret key.
final sharedSecretKey = algorithm.sharedSecretKeySync(
keyPair: aliceKeyPair,
remotePublicKey: bobPublicKey,
);
}
Implementation
SecretKey sharedSecretSync({
required KeyPairData keyPairData,
required PublicKey remotePublicKey,
});