bibby — The Official Rust SDK for Bytebury
bibby is the official Rust SDK for Bytebury — strongly-typed async clients, smart .env initialization, constant-time webhook signature verification, and ergonomic macros for every Bytebury developer tool.
Supported Products
| Product | Client | Capabilities |
|---|---|---|
| Geo | client.geo() |
IPv4/IPv6 geolocation, SVG maps, random IPs, corrections |
| Images | client.images() |
Resize, crop, transform, background removal, vectorize, analyze, favicons, diff, QR codes |
client.pdf() |
HTML/CSS (MiniJinja templates) & URL-to-PDF rendering, Uploader saving | |
| Mailer | client.mailer() |
Transactional email (with idempotency & attachments) and email validation |
| Uploader | client.uploader() |
Raw binary uploads, signed download URLs, share links, one-time upload links, storage stats |
| Cron | client.cron() |
Scheduled UTC HTTP jobs, manual runs, run history, schedule previews |
| Forms | client.forms() |
Form endpoints, submissions, CSV export |
| Webhooks | client.webhooks() |
Endpoints, secret rotation, event publishing, replay, HMAC-SHA256 signature verification |
| Monitors | client.monitors() |
Uptime monitors, on-demand checks, 90-day status summaries, incidents, heartbeats |
| Vault | client.vault() |
Encrypted project secrets, .env import/export, versions, burn-after-reading shares |
Installation
Quick Start (Smart .env Initialization)
Put your Bytebury API key in .env (or export it in your environment):
BYTEBURY_API_TOKEN=bb_live_...
Then initialize the client with Bibby::init():
use *;
async
Custom Configuration
Use Bibby::new(...), Bibby::from_env_var(...), or Bibby::builder() when you need full control:
use Duration;
use Bibby;
let client = builder
.from_env
.timeout
.user_agent
.build?;
Bibby is cheaply cloneable (Arc-backed) and redacts your API key from Debug output.
Macros
| Macro | Purpose |
|---|---|
email! { ... } |
Build a mailer::SendEmailRequest with single or multiple recipients |
image_ops! [ ... ] |
Compose a Vec<images::Operation> transformation pipeline |
pdf! { ... } |
Build a pdf::RenderPdfRequest with inline JSON template data |
webhook_event!(...) |
Build a webhooks::PublishEventRequest with inline JSON payload |
headers! { ... } |
Construct a BTreeMap<String, String> of custom HTTP headers |
vault_ref!(proj, env, key) |
Format {{vault:proj/env/key}} header placeholders for Cron, Webhooks & Monitors |
Verifying Outgoing Webhooks
Bytebury Webhooks signs every delivery with X-Bytebury-Signature: t=<unix>,v1=<hex>. Verify incoming requests in constant time using your endpoint's whsec_... secret:
use webhooks;
Error Handling
All API errors return bibby::Error::Api { status, message } parsed directly from Bytebury's { "error": "..." } JSON responses, with ergonomic predicates:
match client.geo.lookup.await
License
MIT — see LICENSE.