MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / peer_leaf_cert_der

Function peer_leaf_cert_der

nodedb-cluster/src/transport/server.rs:120–124  ·  view source on GitHub ↗

Extract the peer's leaf certificate DER bytes from a QUIC connection. Returns `None` if the peer did not present a certificate (insecure transport) or if the runtime-type downcast fails.

(conn: &quinn::Connection)

Source from the content-addressed store, hash-verified

118/// Returns `None` if the peer did not present a certificate (insecure
119/// transport) or if the runtime-type downcast fails.
120fn peer_leaf_cert_der(conn: &quinn::Connection) -> Option<Vec<u8>> {
121 let identity = conn.peer_identity()?;
122 let certs: &Vec<CertificateDer<'static>> = identity.downcast_ref()?;
123 certs.first().map(|c| c.as_ref().to_vec())
124}
125
126/// Handle all bidi streams on a single connection.
127///

Callers 1

handle_connectionFunction · 0.85

Calls 3

firstMethod · 0.80
to_vecMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected