Runbeam SDK
A Rust library for integrating with the Runbeam Cloud API.
Features
- Dual Authentication Support
- JWT Token Validation - RS256 signature verification with automatic JWKS caching
- Laravel Sanctum API Tokens - Server-side validation for simpler auth flows
- API Client - Comprehensive HTTP client for Runbeam Cloud API
- Gateway management (list, get, create, update, delete)
- Service management (list, get, create, update, delete)
- Endpoint, Backend, and Pipeline management
- Gateway authorization and token management
- Secure Storage - OS-native credential storage (Keychain/Secret Service/Credential Manager)
- Machine Tokens - Autonomous gateway authentication with 30-day expiry
- Cross-Platform - Works on macOS, Linux, and Windows
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Using JWT Tokens
use ;
async
Using Laravel Sanctum Tokens
use ;
async
Authentication Methods
The SDK supports two authentication methods:
JWT Token Authentication
JWT tokens are validated locally using RS256 signature verification with JWKS endpoint discovery.
Use JWT tokens when:
- You need local token validation before making API calls
- You need to extract claims (user info, team info) from the token
- You're working with existing JWT-based infrastructure
- You want to verify token authenticity without server roundtrips
Authorization Flow:
- CLI sends user JWT token to Harmony Management API
- Harmony validates JWT locally (signature verification via JWKS)
- Harmony exchanges user JWT for machine token from Runbeam Cloud
- Runbeam Cloud issues machine-scoped token (30-day expiry)
- Machine token is stored securely for autonomous API access
Laravel Sanctum API Token Authentication
Sanctum tokens (format: {id}|{token}) are passed directly to the server for validation.
Use Sanctum tokens when:
- You want simpler authentication without local validation complexity
- Your application doesn't need to inspect token claims locally
- You're integrating with Laravel-based authentication systems
- You prefer server-side token validation
Authorization Flow:
- CLI sends user Sanctum API token to Harmony Management API
- Harmony passes token directly to Runbeam Cloud (no local validation)
- Runbeam Cloud validates token and issues machine-scoped token (30-day expiry)
- Machine token is stored securely for autonomous API access
Note: All API methods accept both JWT and Sanctum tokens interchangeably.
Storage Options
KeyringStorage (Recommended)
Uses OS-native secure credential storage:
- macOS: Keychain
- Linux: Secret Service API
- Windows: Credential Manager
use KeyringStorage;
let storage = new;
FilesystemStorage (Development/Testing)
Stores tokens in the filesystem:
use FilesystemStorage;
let storage = new?;
Development
Build
Test
Lint
Documentation
API Usage
All API methods accept JWT tokens, Sanctum tokens, or machine tokens for authentication.
List Gateways
use RunbeamClient;
async
Manage Services
use RunbeamClient;
async
Download Full Configuration
use RunbeamClient;
async
Architecture
runbeam_api/client.rs- HTTP client for Runbeam Cloud APIrunbeam_api/jwt.rs- JWT validation with JWKS cachingrunbeam_api/resources.rs- API resource types (Gateway, Service, etc.)runbeam_api/token_storage.rs- Token persistence operationsrunbeam_api/types.rs- Error types and API structuresstorage/mod.rs- Storage backend trait and implementations
License
Part of the Runbeam project.