deriveSharedKeyFactory function
Implementation
Function deriveSharedKeyFactory(String info, Function cryptoHash) {
final deriveSharedSecret = deriveSharedSecretFactory(cryptoHash);
return (Uint8List privateKeyBytes, ct.PublicKey otherPublicKey) {
final sharedSecret = deriveSharedSecret(privateKeyBytes, otherPublicKey);
var hkdf = pointy.KeyDerivator('SHA-256/HKDF');
var hkdfParams = pointy.HkdfParameters(
sharedSecret, 32, Uint8List(32), utf8ToBytes(info));
hkdf.init(hkdfParams);
var key = hkdf.process(Uint8List(0));
return ct.SharedKey256(key);
};
}