# Circle WebSocket Client A Rust library for connecting to Circle WebSocket servers with authentication support. ## Features - Cross-platform WebSocket client (native and WASM) - secp256k1 cryptographic authentication - JSON-RPC 2.0 protocol support - Async/await interface with Tokio - Built on tokio-tungstenite for reliable WebSocket connections ## Usage Add this to your `Cargo.toml`: ```toml [dependencies] circle_client_ws = { path = "../client_ws" } ``` ### Basic Example ```rust use circle_client_ws::CircleWsClientBuilder; #[tokio::main] async fn main() -> Result<(), Box> { // Create client with private key let private_key = "your_private_key_hex"; let client = CircleWsClientBuilder::new() .with_private_key(private_key)? .build(); // Connect and authenticate client.connect("ws://localhost:8080").await?; // Use the authenticated client... Ok(()) } ``` ### Authentication Flow The client automatically handles the secp256k1 authentication flow: 1. Connects to WebSocket server 2. Receives authentication challenge 3. Signs challenge with private key 4. Sends signed response 5. Receives authentication confirmation ## Binary Tool A command-line binary is also available for interactive use and script execution. See [`cmd/README.md`](cmd/README.md) for details. ## Platform Support - **Native**: Full support on all Rust-supported platforms - **WASM**: Browser support with web-sys bindings ## Dependencies - `tokio-tungstenite`: WebSocket implementation - `secp256k1`: Cryptographic operations - `serde`: JSON serialization - `uuid`: Request ID generation