peerIdToX25519PublicKey function
The X25519 public key of a peer, from the Ed25519 key its id embeds.
Implementation
Future<Uint8List> peerIdToX25519PublicKey(PeerId id) async {
final pub = await id.extractPublicKey();
if (pub == null) {
throw ArgumentError('peer id ${id.toBase58()} does not embed a public key');
}
return ed25519PublicKeyToX25519(pub.raw);
}