# Coffrify — Rust SDK
Official Rust SDK for [Coffrify](https://coffrify.com), encrypted file transfer infrastructure.
Built on `reqwest` (rustls), `hmac`, `sha2`, `serde_json`. Async (works with any Tokio runtime).
## Install
```toml
[dependencies]
coffrify = "0.1"
tokio = { version = "1", features = ["full"] }
```
## Quickstart
```rust
use serde_json::json;
#[tokio::main]
async fn main() -> coffrify::Result<()> {
let coffrify = coffrify::Client::new(std::env::var("COFFRIFY_API_KEY")?)?;
let res: serde_json::Value = coffrify.create_transfer(&json!({
"files": [{ "name": "report.pdf", "size": 1_240_000, "mime_type": "application/pdf" }],
"expires_in_hours": 72,
"max_downloads": 10,
"password": "s3cret!",
})).await?;
println!("Share URL: {}", res["share_url"]);
Ok(())
}
```
## Webhook signature verification (Axum example)
```rust
use axum::{routing::post, Router, extract::State, http::HeaderMap, body::Bytes};
async fn handler(headers: HeaderMap, body: Bytes) -> axum::http::StatusCode {
let raw = std::str::from_utf8(&body).unwrap_or("");
let sig = headers.get("X-Coffrify-Signature").and_then(|h| h.to_str().ok()).unwrap_or("");
let secret = std::env::var("COFFRIFY_WEBHOOK_SECRET").unwrap();
let v = coffrify::webhook::verify(raw, sig, &secret);
if !v.valid { return axum::http::StatusCode::BAD_REQUEST; }
// process v.event ...
axum::http::StatusCode::OK
}
```
## License
MIT.