$ show toniebox-reverse-engineering/teddycloud
teddyCloud is a self-hosted, open-source replacement server for the Toniebox children's audio player. It implements the entire cloud-side protocol stackβincluding HTTPS, TLS, MQTT, and custom protobuf-based APIsβto intercept, proxy, cache, and serve audio content to physical Toniebox devices. The application is written in C, builds on the CycloneTCP networking library, and integrates a full MQTT server, a Home Assistant bridge, a web administration interface, and tools for firmware patching (ESP32, CC3200, CC3235) and certificate generation. It also includes a WebAssembly-based TAF audio encoder for browser-side use. The codebase is a result of extensive reverse engineering of the Toniebox protocol, demonstrating deep expertise in embedded systems, cryptography, and IoT networking. While tightly coupled to the Toniebox ecosystem, several components (MQTT server, settings overlay system, WASM encoder) are designed with sufficient abstraction to be reusable in other contexts.
The LLM identified 3 files worth highlighting for reuse:
A self-contained WebAssembly module for encoding audio into the Toniebox TAF format (Opus/Ogg with protobuf header). Uses a global memory-based file wrapper to avoid filesystem dependencies, making it directly callable from JavaScript via Emscripten. Demonstrates clean separation of encoder logic from I/O, enabling reuse in any browser-based audio encoding pipeline.
Implements a multi-overlay configuration system where base settings can be overridden per device (or per context). Supports key-value pairs with auto-detection of types (bool, int, float, string, u64 array), runtime change detection, and certificate loading. The overlay pattern is generic and could be extracted to manage per-user or per-tenant configuration in other server applications.
A lightweight MQTT server/broker implementation supporting CONNECT, PUBLISH, SUBSCRIBE, PINGREQ, and DISCONNECT with optional TLS. It handles topic matching, client session management, and publish delivery. While currently tailored to Toniebox topics, the core broker logic is self-contained and could serve as a basis for a minimal MQTT broker in embedded or resource-constrained environments.