---
title: "certificateValidator(_:)"
framework: network
role: symbol
role_heading: Instance Method
path: "network/quic/tls-swift.struct/certificatevalidator(_:)"
---

# certificateValidator(_:)

Set a block to provide custom verification of the peer’s credentials during the TLS handshake.

## Declaration

```swift
func certificateValidator(_ handler: @escaping @isolated(any) @Sendable (sec_protocol_metadata_t, sec_trust_t) async -> Bool) -> QUIC
```

## Discussion

Discussion This block may be called multiple times for each connection. It should return true if the credentials should be trusted and the handshake should proceed, false otherwise. warning: Most apps should not override the default system handling, as doing so can result in insecure network connections and major security vulnerabilities.
