# ADR 0003: HTTPS Requirement & Local TLS Certificates for Media Access

* **Status**: Accepted
* **Date**: 2026-08-07
* **Deciders**: Core Development Team

---

## Context

The receiver web application requires access to the device camera stream via the WebRTC / HTML5 MediaDevices API (`navigator.mediaDevices.getUserMedia`). 

Modern web browser security specifications (W3C Secure Contexts) strictly prohibit camera access over unencrypted HTTP protocol connections (except on `localhost` loopback). When accessing the receiver UI from a remote mobile device over a local network, plain HTTP requests are blocked from opening camera hardware.

---

## Decision

We decided to build a lightweight Python HTTPS wrapper (`server.py`) bundled directly with self-signed TLS certificates in the repository (`./certs/cert.pem` and `./certs/key.pem`).

1. **Python SSL Wrapper**: `server.py` wraps Python's standard `http.server.HTTPServer` with `ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)`.
2. **Zero External Server Dependencies**: Uses standard Python standard library modules (`http.server`, `ssl`, `sys`).
3. **Bundled Credentials**: Ships pre-generated self-signed certificates so users can immediately launch an HTTPS server on port `8000`.

---

## Consequences

### Positive
* **Immediate Mobile Camera Access**: Enables camera streaming on mobile browsers over local Wi-Fi or LAN without complex web server setup (Nginx/Apache).
* **Zero Dependency Setup**: Runs natively on standard Python 3.x installations.

### Negative
* **Browser Self-Signed Warnings**: Browsers will present a standard "Untrusted / Self-Signed Certificate" warning page on first load, requiring users to explicitly click "Proceed / Accept Risk".
* **Key Management**: Certificates committed to git repo are intended exclusively for local testing and physical transceiver demonstration use cases.
