pinnedHttpClient function

HttpClient pinnedHttpClient(
  1. List<String> rootsPem, {
  2. ProxyConfig? proxy,
})

A dart:io HttpClient that trusts rootsPem and nothing else.

Each entry is a PEM string holding one or more root or intermediate CA certificates. Throws a TlsException if one does not parse — at construction, so a bad certificate bundle fails where it is wired up.

Pass proxy to send its hosts through an HTTP proxy, as ApiConfig.proxy does; https is tunnelled, and still verified against rootsPem.

The client is yours: close it when you are done with it.

Implementation

HttpClient pinnedHttpClient(List<String> rootsPem, {ProxyConfig? proxy}) =>
    buildHttpClient(rootsPem: rootsPem, proxy: proxy);