sharedKey method

Future<String> sharedKey(
  1. String otherPk
)

Implementation

Future<String> sharedKey(String otherPk) async {
  final algorithm = c.X25519();
  final keyPair = c.SimpleKeyPairData(
    hex.decode(sk),
    publicKey: c.SimplePublicKey(hex.decode(pk), type: c.KeyPairType.x25519),
    type: c.KeyPairType.x25519,
  );
  final sharedSecretKey = await algorithm.sharedSecretKey(
    keyPair: keyPair,
    remotePublicKey: c.SimplePublicKey(
      hex.decode(otherPk),
      type: c.KeyPairType.x25519,
    ),
  );
  return hex.encode(await sharedSecretKey.extractBytes());
}