verifyPeerCertificate method

Future<bool> verifyPeerCertificate(
  1. List<int> certBytes, {
  2. PeerId? expectedPeerId,
})

Verifies the peer's certificate using the libp2p TLS extension.

certBytes is the raw DER-encoded X.509 certificate received from the peer during the TLS handshake. When expectedPeerId is provided, the derived peer identity must match it.

Returns true if the certificate contains the libp2p extension, the signature is valid, and the derived peer identity matches expectedPeerId (when given).

Implementation

Future<bool> verifyPeerCertificate(
  List<int> certBytes, {
  quic_lib.PeerId? expectedPeerId,
}) async {
  final backend = quic_lib.DefaultCryptoBackend();
  return _delegate.verifyPeerCertificate(
    certBytes,
    expectedPeerId: expectedPeerId,
    backend: backend,
  );
}