$ show sasa1977/site_encrypt
SiteEncrypt is an Elixir library that provides automated SSL/TLS certificate management for web applications through integration with Let's Encrypt. It handles the complete certificate lifecycle including automatic obtainment, renewal, and configuration of web servers to use the certificates. The library supports both the official Certbot client and a native Elixir ACME protocol implementation, with automatic renewal scheduling designed to prevent thundering herd problems on certificate authorities. It integrates specifically with the Phoenix web framework but can work with other Erlang-based web servers through its adapter pattern.
The LLM identified 3 files worth highlighting for reuse:
A minimal, thoughtful HTTP client built on Mint that avoids connection pooling for infrequent burst usage. Demonstrates sound engineering judgment by choosing simplicity over premature optimization, with clear documentation explaining why connection pooling wasn't implemented and why alternatives like Finch were unsuitable. The component is isolated, depending only on Mint and Jason, and could be extracted for use in any project needing a straightforward HTTP client.
A clean Plug implementation for handling ACME HTTP-01 challenges used in domain validation. The component is focused on a single responsibility, properly implements Plug behavior with correct error handling, and extracts client IP from various headers. It could be extracted with minimal changes (primarily decoupling from the registry) and used in any Plug-based application needing to handle ACME challenges, demonstrating good understanding of Plug conventions and web security practices.
Implements periodic certificate renewal with randomized timing to prevent thundering herd problems on certificate authorities, following Let's Encrypt's recommendations. The component features a clean interface for checking renewal needs, uses Erlang's time functions effectively, and isolates the scheduling logic from certificate-specific concerns. This pattern could be extracted and applied to any periodic task that needs to avoid synchronized execution across multiple instances.