# Rust SDK

The Rust client is the reference implementation, located in
`crates/quicprochat-client/`. It is built on top of the `quicprochat-sdk` crate,
which provides the high-level v2 API over QUIC + Protobuf.

## Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
quicprochat-sdk = { path = "crates/quicprochat-sdk" }
```

## Connection

```rust
use quicprochat_sdk::QpqClient;

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

## CLI Client Usage

The `quicprochat-client` binary provides a CLI/TUI interface:

```rust
use quicprochat_client::{cmd_health, cmd_login, cmd_send};

// 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 (`--sealed-sender` flag)
- v2 QUIC + Protobuf transport via the `quicprochat-sdk` crate

## Crate Structure

| Crate | Purpose |
|-------|---------|
| `quicprochat-core` | Crypto primitives, MLS, hybrid KEM |
| `quicprochat-proto` | Protobuf generated types |
| `quicprochat-rpc` | QUIC RPC framework (framing, dispatch) |
| `quicprochat-sdk` | High-level client SDK (`QpqClient`) |
| `quicprochat-client` | CLI/TUI client application |

## Related

- [Wire Format Reference](wire-format.md) -- frame layout and method IDs
- [SDK Overview](index.md) -- all language SDKs
