remotePeer property

  1. @override
PeerId get remotePeer
override

The remote peer identity for this QUIC connection.

The peer's certificate bytes are captured during the handshake but are not validated until verifyPeerCertificate or verifyPeerFromHandshake is called. This getter throws StateError until verification has been performed and the remote PeerId has been established.

Implementation

@override
libp2p.PeerId get remotePeer {
  final quicPeerId = _delegate.peerId;
  if (quicPeerId != null) {
    return libp2p.PeerId.fromString(quicPeerId.toBase58());
  }
  throw StateError(
    'Remote PeerId not yet established for this QUIC connection. '
    'Call verifyPeer() after the handshake completes.',
  );
}