package com.example.aiapp import com.example.wgapplink.PinnedTls import java.net.HttpURLConnection // PINNED_CA_PEM is generated at build time from the CA on the machine doing the build -- see the // generatePinnedCert task in build.gradle.kts. It is deliberately not a checked-in constant: the // private key that signs against it must never be anywhere this repo is, and an APK should pin // whatever CA the backend it was built for actually serves. // // The pinning itself lives in wg-app-link, since dev-updater needs exactly the same thing. What // stays here is which certificate this app pins. private val pinned = PinnedTls(PINNED_CA_PEM) /** Every request this app makes goes through this -- there is no unpinned path. */ fun HttpURLConnection.applyPinnedTls() = pinned.applyTo(this)