Expand description
§LicenseSeat Rust SDK
Official Rust SDK for LicenseSeat - the simple, secure licensing platform for apps, games, and plugins.
§Features
- License Lifecycle - Activate, validate, and deactivate licenses
- Offline Validation - Machine-file-first Ed25519 + AES-256-GCM verification
- Automatic Re-validation - Background validation with configurable intervals
- Heartbeat - Periodic health-check pings for real-time seat tracking
- Entitlement Management - Fine-grained feature access control
- Device Telemetry - Auto-collected device metadata for analytics
- Network Resilience - Automatic retry with exponential backoff
§Quick Start
Use a pk_* publishable API key in client applications.
Keep sk_* secret keys server-side only.
use licenseseat::{LicenseSeat, Config};
#[tokio::main]
async fn main() -> Result<(), licenseseat::Error> {
// Create SDK instance
let sdk = LicenseSeat::new(Config {
api_key: "pk_live_xxx".into(),
product_slug: "your-product".into(),
..Default::default()
});
// Activate a license
let license = sdk.activate("USER-LICENSE-KEY").await?;
println!("Activated! Device ID: {}", license.device_id);
// Check entitlements
let status = sdk.check_entitlement("pro-features");
if status.active {
println!("Pro features enabled!");
}
// Deactivate when done
sdk.deactivate().await?;
Ok(())
}§Feature Flags
default- Uses rustls for TLS and enables offline supportnative-tls- Use system TLS instead of rustlsoffline- Enable offline support when you disable default features
Structs§
- Activation
Nested - Nested activation in validation response (avoids circular reference).
- Activation
Options - Options for license activation.
- Activation
Response - Activation response from the API.
- Config
- SDK configuration options.
- Deactivation
Response - Deactivation response from the API.
- Download
Token - Download-token response returned by the releases API.
- Entitlement
- Entitlement (feature flag) attached to a license.
- Entitlement
Status - Result of checking a specific entitlement.
- Event
- Event emitted by the SDK during license lifecycle operations.
- Health
Response - Health check response.
- Heartbeat
Response - Heartbeat response from the API.
- License
- Cached license data used by the SDK.
- License
Response - License object as returned by the API.
- License
Seat - The main LicenseSeat SDK client.
- License
Status Details - Details for an active license.
- Machine
File - Cached machine-file metadata and certificate.
- Machine
File Checkout Options - Options for machine-file checkout.
- Machine
File Payload - Decrypted machine-file payload used for offline validation.
- Machine
File Verification Result - Result of local machine-file verification.
- Offline
Entitlement - Entitlement in offline token (uses Unix timestamps).
- Offline
Token Payload - Offline token payload.
- Offline
Token Response - Offline token response from the API.
- Offline
Token Signature - Offline token signature block.
- Product
- Product information included in license responses.
- Release
- Release metadata returned by the API.
- Release
List - Paginated release list response returned by the API.
- Release
List Options - Options for paginated release listing.
- Restore
Result - Result of restoring a cached license session.
- Signing
KeyResponse - Signing key from the API.
- Validation
Result - Validation result from the API or local offline verification.
- Validation
Warning - Validation warning returned by the API.
Enums§
- Client
Status - Summary status for the overall SDK/client state.
- Entitlement
Reason - Reason why an entitlement is not active.
- Error
- Error types that can occur when using the LicenseSeat SDK.
- Event
Data - Data associated with an event.
- Event
Kind - Types of events emitted by the SDK.
- License
Status - License status enum for easy status checking.
- Offline
Fallback Mode - Offline fallback behavior when network validation fails.
- Trusted
License Source - Source of trusted rich license metadata used for offline recovery.
Constants§
Type Aliases§
- Result
- Result type alias for LicenseSeat operations.