Skip to main content

eero_api/
lib.rs

1#![deny(dead_code)]
2//! Rust client library for the eero WiFi router API.
3//!
4//! This crate provides an async client for interacting with eero mesh WiFi
5//! routers. It covers authentication, network management, device tracking,
6//! eero node control, profiles (parental controls), port forwarding,
7//! activity monitoring, diagnostics, and speed tests.
8//!
9//! # Quick start
10//!
11//! ```rust,no_run
12//! use eero_api::{EeroClient, InMemoryStore, ClientBuilder};
13//!
14//! # async fn example() -> eero_api::Result<()> {
15//! // Authenticate with a known session token
16//! let store = InMemoryStore::new();
17//! let client = ClientBuilder::new()
18//!     .credential_store(Box::new(store))
19//!     .build()?;
20//! client.credentials().set_session_token("your_token").await?;
21//!
22//! // List networks
23//! let account = client.get_account().await?;
24//! for net in &account.networks.data {
25//!     println!("{}: {}", net.url, net.name.as_deref().unwrap_or("unnamed"));
26//! }
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! # Authentication flow
32//!
33//! The eero API uses a two-step authentication flow:
34//!
35//! 1. Call [`EeroClient::login`] with an email or phone number. This sends a
36//!    verification code to that address and returns a temporary user token.
37//! 2. Call [`EeroClient::verify`] with the code. This exchanges the user token
38//!    for a persistent session token stored in the credential store.
39//!
40//! # Credential backends
41//!
42//! Session tokens can be stored in several backends via the
43//! [`CredentialStore`] trait:
44//!
45//! | Backend | Feature flag | Description |
46//! |---------|-------------|-------------|
47//! | [`credential::file::FileStore`] | *(default)* | Plain text files in `~/.config/eero/` |
48//! | [`credential::memory::InMemoryStore`] | *(default)* | Non-persistent, for testing or CLI token flags |
49//! | `credential::keyring::KeyringStore` | `keyring` | OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) |
50//! | `credential::op::OpStore` | `op` | 1Password CLI (`op`) |
51//! | `credential::dpapi::DpapiStore` | `dpapi` | Windows DPAPI encrypted files (Windows only) |
52
53pub mod api;
54pub mod client;
55pub mod credential;
56pub mod error;
57pub mod types;
58
59pub use client::{ClientBuilder, EeroClient};
60pub use credential::memory::InMemoryStore;
61pub use credential::CredentialStore;
62pub use error::{Error, Result};