← All projects

Latest test build

Build 620 Oct 2026

Newest test build, not an official version.

VLight Secure Provisioning & Mutual Pairing

1. Security Threat Model

In conventional smart-home systems, devices often enroll automatically or rely on open, unauthenticated Wi-Fi APs without proof of physical ownership. VLight guarantees that only devices physically held by an authorized administrator can be enrolled into the cluster.


2. The 120-Second Pairing Window

  1. The pairing window is closed by default. All enrollment requests received while closed return HTTP 403 Forbidden.
  2. An authorized user opens the pairing window via:
    • Server CLI: vlight-server pair open
    • Android App: Tapping Pair on the home screen (POST /api/v1/pairing/open).
  3. The server generates a single-use cryptographically random Hub Nonce (hub_nonce_<hex16>) and starts a 120-second countdown in SQLite.

3. Mutual Challenge-Response Handshake

sequenceDiagram
    participant User as Admin User
    participant Server as VLight Server Hub
    participant Node as ESP32 Node (Physical)

    User->>Server: Open Pairing Window (CLI / App)
    Server-->>Server: Generate Hub Nonce (120s TTL)
    User->>Node: Press Physical BOOT Button (3 sec)
    Node->>Server: UDP Beacon (boot_pressed: true)
    Node->>Server: POST /api/v1/pairing/enroll (node_id, proof)
    Note over Server: Check window open?<br/>Verify HMAC proof
    Server-->>Node: HTTP 200 OK (issued auth_token)
    Node->>Node: Store auth_token in NVS Flash
    Server->>Server: Store token_hash in SQLite
    Node->>Server: Authenticated Control Stream (Token Auth)

Physical Proof Verification

  • When the BOOT button (GPIO0 / GPIO9) is held, the node computes a cryptographic challenge proof: $$\text{Proof} = \text{SHA256}(\text{DeviceKey} \parallel \text{HubNonce} \parallel \text{DeviceNonce})$$
  • The server validates this proof against the active HubNonce.
  • Upon success, the server issues a permanent token vlt_sec_<hex24> and records its SHA-256 hash in SQLite. The plain token is never stored on the server.
  • The node saves this token to its internal Non-Volatile Storage (NVS). On subsequent reboots, the node reconnects immediately without requiring button interaction.