# Rust license client

```rust
use license_client::LicenseClient;

let client = LicenseClient::new(
    "https://YOUR-SERVER",
    "your-product-slug",
    "PASTE_SIGNING_PUBLIC_KEY_FROM_/docs_HERE",
)?;

let result = client.check(license_key);
if result.valid {
    println!("licensed, status: {:?}, expires: {:?}", result.status, result.expires_at);
} else {
    println!("not licensed: {:?}", result.reason);
}
```

Copy `src/lib.rs` into your own crate (or depend on this path locally), or
run `cargo run --example basic -- <key>` here to try it against your server.
See the `/docs` page on your server for the full protocol reference.

`check()` calls `/api/v1/verify` first, and transparently falls back to
`/api/v1/activate` the first time a key is used on a device. Every response
is Ed25519-verified locally before being trusted or cached. If the server is
unreachable, the last-known-good signed response is used for up to 72h
(`from_offline_cache: true` on the result) before failing closed. `check()`
never panics or returns an `Err` — every failure mode is a `LicenseResult`
with `valid: false` and a `reason`.
