CatzConnect SDK (Rust)
A secure, minimal SDK for sending encrypted communication requests (e.g., email OTP) to the CatzConnect API.
✨ Features
- 🔐 End-to-end payload encryption (X25519 ECDH + BLAKE2b-256 + ChaCha20-Poly1305 IETF)
- ⚡ Stateless design — no
init()required - 🧠 Automatic payload validation
- 🔑 API key via environment variable (Bearer token)
- 🦀 Pure Rust — no libsodium C dependency
📦 Installation
Add to your Cargo.toml:
[]
= "1.0.0"
= { = "1", = ["full"] }
= "0.15"
⚙️ Environment Setup
Create a .env file (or export these variables):
API_KEY=your_api_key
PRIVATE_KEY=your_base64_private_key
SERVER_PUBLIC_KEY=server_base64_public_key
⚠️ Never expose these values in public environments.
🚀 Usage
use ;
async
📬 Supported Operation
Email Verification OTP
SendInput
🔐 How It Works
- Validate Input — ensures required fields are present and the email is valid
- Encrypt Payload
- X25519 ECDH shared secret:
scalarmult(client_priv, server_pub) master = BLAKE2b-256(shared)key_enc = BLAKE2b-256(master || "CONNECT-@-2026-HS-@-CATZ")- ChaCha20-Poly1305 IETF encrypt with a random 12-byte nonce
- X25519 ECDH shared secret:
- Send Request —
POST /sdk/sendwith{ nonce, ciphertext }JSON andAuthorization: Bearer <key>
❌ Error Handling
match send.await
All errors implement std::error::Error via thiserror.
🧩 Example Response
🛠 Development