files/en-us/web/api/rtccertificatestats/index.md
{{APIRef("WebRTC")}}
The RTCCertificateStats dictionary of the WebRTC API is used to report information about a certificate used by an {{domxref("RTCDtlsTransport")}} and its underlying {{domxref("RTCIceTransport")}}.
The report can be obtained by iterating the {{domxref("RTCStatsReport")}} returned by {{domxref("RTCPeerConnection.getStats()")}} until you find an entry with the type of certificate.
fingerprintAlgorithm.fingerprint, such as "sha-256".The following properties are common to all WebRTC statistics objects (See RTCStatsReport for more information).
"certificate", indicating the type of statistics that the object contains.Given a variable myPeerConnection, which is an instance of {{domxref("RTCPeerConnection")}}, the code below uses await to wait for the statistics report, and then iterates it using RTCStatsReport.forEach().
It then filters the dictionaries for just those reports that have the type of certificate and logs the result.
const stats = await myPeerConnection.getStats();
stats.forEach((report) => {
if (report.type === "certificate") {
// Log the certificate information
console.log(report);
}
});
{{Specifications}}
{{Compat}}