package handler import ( "net/http" "github.com/panelhosting/panel/internal/ssl" ) type ACMEHandler struct { store *ssl.ChallengeStore } func NewACMEHandler(store *ssl.ChallengeStore) *ACMEHandler { return &ACMEHandler{store: store} } func (h *ACMEHandler) Challenge(w http.ResponseWriter, r *http.Request) { token := r.PathValue("token") if token == "" { http.NotFound(w, r) return } keyAuth, ok := h.store.Get(token) if !ok { http.NotFound(w, r) return } w.Header().Set("Content-Type", "text/plain") _, _ = w.Write([]byte(keyAuth)) }