performECDH static method
Performs ECDH key agreement
Implementation
static Uint8List performECDH(ECPrivateKey privateKey, ECPublicKey publicKey) {
final agreement = ECDHBasicAgreement();
agreement.init(privateKey);
final sharedSecret = agreement.calculateAgreement(publicKey);
// Convert BigInt to bytes
final bytes = sharedSecret.toRadixString(16);
final paddedBytes = bytes.length % 2 == 0 ? bytes : '0$bytes';
return KeyEncodingUtils.hexToBytes(paddedBytes);
}