#pragma once #include #include "esp_http_server.h" #define CAM_AUTH_REALM "ESP32-Cam" /* Set the single account used by every service (RTSP, /pic, /stream, /mic, /spk, /vol). * user NULL or "" disables authentication completely. * Use letters and digits only in the password, it also travels inside URLs. */ void cam_auth_init(const char *user, const char *pass); bool cam_auth_enabled(void); /* ---------- HTTP ---------- * Accepts either "Authorization: Basic ..." or "?key=" in the URL. * On failure it sends 401 itself and returns false, so a handler does: * if (!cam_http_check(req)) return ESP_OK; */ bool cam_http_check(httpd_req_t *req); /* ---------- RTSP (Digest, MD5, no qop) ---------- */ void cam_rtsp_make_nonce(char out[33]); bool cam_rtsp_digest_ok(const char *method, const char *authz_header_value, const char *nonce);