#### setapp_click.p12
> ⚠️ While exporting a .p12 certificate you should specify a password. You can find it [here](https://github.com/MacPaw/setapp-desktop/blob/develop/Modules/SetappHTTPSServer/Sources/SetappHTTPSServer/Server/Secrets.swift).

This is an SSL certificate with a private key inside. Used by the front-end in the application pages ([like this one](https://setapp.com/apps/clearvpn)) to change the `Download Setapp` button and actual Installer download to the `Launch app` button & open Setapp on the app page action. The change happens only if the Agent is running.\
Magic (or crutches 🤷‍♀️) behind:
1. setapp.click is a registered domain with localhost (127.1, 127.0.0.1) as an IP address (DevOps team is responsible for managing AAAA record).
1. The Agent uses [SwiftNIO](https://github.com/apple/swift-nio) dependency to start local server to answer HTTP requests.
1. Valid certificate issued by the trusted authority is needed to prove that the Agent is a valid http://setapp.click site.
1. HTTP server listens for ports `2432`, `6385`, `18671`, `29302`, `43724`.
1. Frond-end pings localhost on those ports and replaces the `Download Setapp` button title with `Launch app` if the open port check succeeds.
