OxL Reference

method TlsStream.peerCertSha256

Lowercase hex SHA-256 of the peer's leaf certificate (DER), usable as TlsConfig.pin; "" without a certificate.

Example:

oxl✓ checked in CI
use std.net { TlsStream, TlsConfig, SocketAddr }

// pin the certificate seen on a first connection (trust on first use)
fn pinned(addr: SocketAddr, pin: str) -> TlsStream | NetError  net {
  TlsStream.connect(addr, TlsConfig{ pin: pin })
}
pub(api) fn peerCertSha256() -> str

Since. 1.0.0-beta

Returns

str

Effects

none declared (pure unless the body says otherwise)

Defined in: std/net/tls.oxl:411

See also