# nwep

Rust bindings for the [NWEP](https://github.com/usenwep/nwep) (WEB/1) protocol library —
a decentralized, authenticated transport built on QUIC with Ed25519 identity, Merkle-log
provenance, and BLS threshold signatures.

## Features

- Mutual-authentication QUIC connections (client and server)
- Ed25519 keypair generation, signing, and verification
- Merkle log for append-only identity event records
- BLS threshold signatures and anchor quorums
- Identity cache with LRU eviction and TTL expiry
- Log server pool with health tracking and load balancing
- Trust store with equivocation detection

## Quick start

```rust
use nwep::{init, Keypair, client::ClientBuilder};

init().unwrap();
let keypair = Keypair::generate().unwrap();

let client = ClientBuilder::new()
    .connect(keypair, "web://example.com/")
    .unwrap();

let resp = client.get("/hello").unwrap();
println!("{}: {}", resp.status, String::from_utf8_lossy(&resp.body));
client.close();
```

See [`examples/server.rs`](examples/server.rs) and [`examples/client.rs`](examples/client.rs)
for runnable examples.

## Build requirements

The native library is downloaded automatically at build time by `setup.sh`. You need:

- **`curl`** — to fetch the release archive from GitHub
- **`tar`** (Linux/macOS) or **`unzip`** (Windows) — to extract it
- Internet access during the first build (subsequent builds reuse the cached library)

On Windows, run inside **Git Bash** or **WSL**. PowerShell is not supported.

To pre-populate the library without a network connection, download the appropriate release
archive from [github.com/usenwep/nwep/releases](https://github.com/usenwep/nwep/releases),
extract it to `third_party/nwep/`, and create a symlink (or directory junction on Windows)
named `current` pointing to the extracted directory.

## Supported platforms

| OS | Architecture |
|---|---|
| Linux | x86\_64, aarch64 |
| macOS | x86\_64, aarch64 (Apple Silicon) |
| Windows | x86\_64 |

## Feature flags

| Flag | Description |
|---|---|
| `regenerate-bindings` | Re-run `bindgen` from `nwep.h` to regenerate `src/bindings.rs`. Requires `clang`/`libclang`. |

## License

MIT — see [LICENSE](LICENSE).
