Per Sviluppatori
Costruisci dispositivi compatibili e integrazioni usando il protocollo aperto WFAS, senza reverse engineering.
Perché il protocollo è separato dalle app
Le app WFAS (Desktop e Android) sono rilasciate sotto licenza EUPL, una licenza copyleft forte che garantisce che le app stesse rimangano libere e open source per sempre.
La libreria del protocollo, invece, è rilasciata sotto licenza MIT, una licenza permissiva che ti permette di usarla in qualsiasi progetto, inclusi prodotti commerciali e closed-source.
La logica: vogliamo che chiunque possa costruire dispositivi compatibili, anche commerciali, anche closed-source, senza dover riscrivere tutto da capo, mentre le nostre app restano libere per sempre per gli utenti finali.
La libreria wfas-protocol
Una libreria C99 autocontenuta progettata per ambienti con risorse limitate. Implementa il protocollo completo WFAS v2, dall'handshake e autenticazione alla pacchettizzazione e decifratura audio.
Nessuna chiamata a malloc/free nella libreria. Tutto lo stato è allocato sullo stack o fornito dal chiamante, sicuro per microcontrollori con heap limitato o assente.
Tutti i campi multi-byte sono esplicitamente codificati in network byte order. Funziona correttamente su architetture little-endian e big-endian.
Le primitive crittografiche (ChaCha20-Poly1305, HMAC-SHA256) sono validate contro i vettori di test ufficiali dei rispettivi documenti IETF.
Solo libreria standard C99. Nessuna libreria crypto di terze parti da linkare, nessun SDK di piattaforma oltre a quello già fornito dal target.
Progettata e testata su piattaforme embedded comuni. Funziona con FreeRTOS e bare-metal, oltre che su Linux embedded (Raspberry Pi, OpenWrt).
Laboratorio del protocollo
Tutto ciò che segue viene eseguito live in questa pagina, vera HMAC-SHA256 e HKDF-SHA256 tramite la Web Crypto API del browser, e un'implementazione ChaCha20-Poly1305 scritta da zero e verificata rispetto all'esatto vettore RFC 8439 usato in wfas_test.c. Nulla viene inviato in rete.
Every WFAS audio packet starts with the same 10-byte header. Edit the hex below (or generate a sample) and watch it decode field by field, exactly like wfas_parse_header().
WFAS uses symmetric (pre-shared key) authentication, not asymmetric/public-key like SSH or TLS certificates. The exact same secret must already be configured on the server, before it starts streaming, and on the client, when it tries to connect. Nothing publishable, nothing exchanged automatically: you tell both devices the same passphrase yourself.
Encrypts a short message as if it were a PCM payload, using the same packet layout as wfas_encrypt_packet(): [header 10B][counter 8B][ciphertext][tag 16B]. The demo key is SHA-256 of your passphrase, simplified for the browser, not the real HKDF session-key derivation.
The same seven checks as wfas_test.c selftest(), HMAC, AEAD and HKDF against their official RFC vectors, plus a full encrypt/decrypt roundtrip, an anti-replay drop, and a multicast beacon epoch check, run here in JavaScript instead of C. Each line below prints the number this page actually computed, view the unminified source running it.
This lab is a from-scratch JavaScript port for teaching purposes, verified against the same test vectors as the C library, it is not the compiled wfas.c running as WebAssembly. For production use, link the actual C library from wfas-protocol.
Esempio di avvio rapido
Inizializzazione di un contesto ricevitore WFAS in un progetto embedded:
#include "wfas.h"
wfas_sender tx;
wfas_sender_init(&tx);
uint8_t packet[WFAS_MTU];
int len = wfas_build_audio(&tx, packet, sizeof(packet), pcm_samples, frame_count, 2);
if (len > 0) udp_send(packet, len);
/* On the receiving end: */
wfas_header hdr;
const uint8_t *pcm; size_t pcm_len;
if (wfas_parse_audio(rx_buf, n, &hdr, &pcm, &pcm_len) == 0) {
audio_output_write(pcm, pcm_len, hdr.seq, hdr.sample_pos);
}
Real function names and signatures from wfas.h, not a placeholder API.
Dentro la prova dell'handshake
What the lab above is actually computing, straight from wfas.c:
void wfas_auth_proof(const char *key, char side,
const char *cn, const char *sn, char *out) {
/* in = "WFAS-" + side + ":" + cnonce + ":" + snonce */
uint8_t mac[32];
wfas_hmac_sha256((const uint8_t *)key, strlen(key),
(const uint8_t *)in, n, mac);
to_hex(mac, 32, out);
}
Compilalo da solo
The library is a single .c/.h pair, no build system required beyond a C99 compiler.
$ cc -std=c99 -Wall -Wextra -O2 -o wfas_test wfas.c wfas_test.c -lm
$ ./wfas_test selftest
HMAC-SHA256 RFC4231 TC1: OK
domain separation (S != C): OK
ChaCha20-Poly1305 AEAD RFC8439: OK
HKDF-SHA256 RFC5869: OK
encrypted packet roundtrip: OK
anti-replay drops duplicate: OK
multicast beacon + ghost-replay guard: OK
$ ./wfas_test server --key mysecret
$ ./wfas_test client 192.168.1.42 --key mysecret
Note: the repository's Makefile currently targets an example.c entry point rather than wfas_test.c, if you're following along from the source tree, build with the command above until that's reconciled.
Idee di progetti
Cose che la community ha costruito o sta costruendo con il protocollo aperto:
Altoparlante Wi-Fi DIY su ESP32
Accoppia un ESP32 con un DAC I2S e un piccolo amplificatore. Flasha il firmware del ricevitore WFAS e ottieni un altoparlante wireless che riceve audio dal PC, costo totale meno di €15.
Integrazione con Home Assistant
Crea un componente personalizzato che permette a Home Assistant di ricevere o inviare stream audio WFAS, abilitando annunci o audio multi-stanza attivati da automazioni.
Ricevitore Raspberry Pi headless
Esegui il ricevitore WFAS come servizio systemd su un Raspberry Pi collegato al tuo stereo. Nessuno schermo, nessuna tastiera, solo audio via Wi-Fi.
Client personalizzato per un'altra piattaforma
Vuoi WFAS su tvOS, watchOS o un chiosco Linux personalizzato? La libreria di protocollo ti fornisce un punto di partenza conforme senza reverse engineering del formato wire.