# Rust SDK

The Rust client is the reference implementation, located in `crates/quicproquo-client/`.

## Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
quicproquo-client = { path = "crates/quicproquo-client" }
```

## Connection

The Rust client connects directly over QUIC with Cap'n Proto RPC:

```rust
use quicproquo_client::{cmd_health, cmd_login, cmd_send, connect_node};

// Health check
cmd_health("127.0.0.1:5001", &ca_cert_path, "localhost").await?;

// Login via OPAQUE
cmd_login(
    "127.0.0.1:5001", &ca_cert_path, "localhost",
    "alice", "password123",
    None,                    // identity_key_hex
    Some(&state_path),       // state persistence
    None,                    // state_password
).await?;
```

## Key Features

- Full MLS (RFC 9420) group encryption
- Hybrid post-quantum KEM (X25519 + ML-KEM-768)
- OPAQUE authentication with zeroizing credential storage
- SQLCipher local state with Argon2id key derivation
- Sealed sender metadata protection
- v2 QUIC + Protobuf transport (via `quicproquo-sdk` crate)

## v2 SDK Crate

The `quicproquo-sdk` crate provides the higher-level v2 API:

```rust
use quicproquo_sdk::QpqClient;

let client = QpqClient::connect("127.0.0.1:5001", &tls_config).await?;
let health = client.health().await?;
```

## Crate Structure

| Crate | Purpose |
|---|---|
| `quicproquo-core` | Crypto primitives, MLS, hybrid KEM |
| `quicproquo-proto` | Protobuf + Cap'n Proto generated types |
| `quicproquo-rpc` | QUIC RPC framework (framing, dispatch) |
| `quicproquo-sdk` | High-level client SDK |
| `quicproquo-client` | CLI/TUI client application |
| `quicproquo-ffi` | C FFI bindings |
