Skip to main content

Crate licenseseat

Crate licenseseat 

Source
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 support
  • native-tls - Use system TLS instead of rustls
  • offline - Enable offline support when you disable default features

Structs§

ActivationNested
Nested activation in validation response (avoids circular reference).
ActivationOptions
Options for license activation.
ActivationResponse
Activation response from the API.
Config
SDK configuration options.
DeactivationResponse
Deactivation response from the API.
DownloadToken
Download-token response returned by the releases API.
Entitlement
Entitlement (feature flag) attached to a license.
EntitlementStatus
Result of checking a specific entitlement.
Event
Event emitted by the SDK during license lifecycle operations.
HealthResponse
Health check response.
HeartbeatResponse
Heartbeat response from the API.
License
Cached license data used by the SDK.
LicenseResponse
License object as returned by the API.
LicenseSeat
The main LicenseSeat SDK client.
LicenseStatusDetails
Details for an active license.
MachineFile
Cached machine-file metadata and certificate.
MachineFileCheckoutOptions
Options for machine-file checkout.
MachineFilePayload
Decrypted machine-file payload used for offline validation.
MachineFileVerificationResult
Result of local machine-file verification.
OfflineEntitlement
Entitlement in offline token (uses Unix timestamps).
OfflineTokenPayload
Offline token payload.
OfflineTokenResponse
Offline token response from the API.
OfflineTokenSignature
Offline token signature block.
Product
Product information included in license responses.
Release
Release metadata returned by the API.
ReleaseList
Paginated release list response returned by the API.
ReleaseListOptions
Options for paginated release listing.
RestoreResult
Result of restoring a cached license session.
SigningKeyResponse
Signing key from the API.
ValidationResult
Validation result from the API or local offline verification.
ValidationWarning
Validation warning returned by the API.

Enums§

ClientStatus
Summary status for the overall SDK/client state.
EntitlementReason
Reason why an entitlement is not active.
Error
Error types that can occur when using the LicenseSeat SDK.
EventData
Data associated with an event.
EventKind
Types of events emitted by the SDK.
LicenseStatus
License status enum for easy status checking.
OfflineFallbackMode
Offline fallback behavior when network validation fails.
TrustedLicenseSource
Source of trusted rich license metadata used for offline recovery.

Constants§

SDK_NAME
SDK name (used in telemetry)
VERSION
SDK version

Type Aliases§

Result
Result type alias for LicenseSeat operations.