Where in the codebase does it request the ssl cert?

I’m trying to learn how caddy makes a request out to lets-encrypt and fetchings the SSL certicate and stores it on the filesystem.

I can’t seem to find any reference to the certification request and storage etc.

Hoping someone can point me to the area on github.

Thanks!

caddy uses the Lego library from Xenolf to work with Lets Encrypt.