Skip to content

WiFi setup and pairing#

WiFi access uses token-based authorization. A token identifies a host and lets the SDK establish an authenticated runtime connection to that host over the local network.

Network requirements#

  • EP01 and the host computer must be on the same local network.
  • The network must allow mDNS / local discovery.
  • Client isolation should be disabled for the devices that need to communicate.
  • The host must be able to reach the endpoint advertised by the device.

USB-authenticated setup#

The simplest flow starts with EP01 attached over USB:

enody wifi-setup

The command scans networks, joins the selected SSID, generates a token through the USB-authenticated runtime, and saves that token in the standard Enody token store.

Example prompt shape:

Scanning for WiFi networks...
WiFi networks:
   1. Studio WiFi                      rssi= -42 channel=6  auth=secured
Pick a network number (Enter to type SSID):
Password (leave empty for open network):
Joining WiFi network 'Studio WiFi'...
Joined WiFi network 'Studio WiFi'.
Generating USB-authenticated WiFi token...
Saved token for host 00000000-0000-0000-0000-000000000000 to /home/user/.enody/tokens.json.

You can also provide the SSID directly:

enody wifi-setup --ssid "Studio WiFi"

WiFi token generation#

For integrations that pair over WiFi, discover EP01 devices over mDNS and generate a token after physical approval on the device:

enody wifi-generate-token

To target a known endpoint:

enody wifi-generate-token --endpoint 192.168.1.50:8788

Example prompt shape:

Searching for EP01s over mDNS...
Available EP01s:
   1. host=00000000-0000-0000-0000-000000000000 endpoint=192.168.1.50:8788 firmware=0.2.0
Pick an EP01 number [1-1]:
Generating WiFi token from 192.168.1.50:8788.
Approval required: approve pairing on the device
Verified WiFi token for host 00000000-0000-0000-0000-000000000000.
Saved token to /home/user/.enody/tokens.json.

Rust pairing#

use enody::token_store::TokenStore;
use enody::wifi::WifiConnection;
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<(), enody::Error> {
    let devices = WifiConnection::discover_token_generation_devices(
        Duration::from_millis(800),
    )
    .await?;

    let device = devices.first().ok_or(enody::Error::InsufficientData)?;
    let token = WifiConnection::generate_token_from_discovered_device_with_approval(
        device,
        |instruction| println!("Approval required: {instruction}"),
    )
    .await?;

    let path = TokenStore::save_token(&token)?;
    println!("saved token to {}", path.display());

    Ok(())
}

Use saved tokens#

use enody::environment::Environment;
use enody::token_store::TokenStore;
use enody::wifi::WifiEnvironment;

#[tokio::main]
async fn main() -> Result<(), enody::Error> {
    let store = TokenStore::load()?;
    let env = WifiEnvironment::new(store.tokens().iter().cloned()).await?;

    for runtime in env.runtimes() {
        let host = runtime.host().await?;
        println!("{} {}", host.identifier(), host.version());
    }

    Ok(())
}

Token storage#

By default, the token store is saved in the Enody config directory:

Tokens are secrets. The token store file authorizes access to the paired device. Treat it like other local credentials.

Rotation and removal#

To rotate a local token, generate a new token and save it. TokenStore.upsert() replaces the saved token for the same host identifier.

To remove local WiFi access from a computer, delete the saved token file or remove the token entry from it. If you believe a token has been copied from a machine you do not control, contact support for device-side remediation guidance.