rustify-licensing 0.1.0

Framework-agnostic in-app licensing (validate / machine-activate / offline-grace) for native Rust apps. Keygen provider + Bevy / egui / headless adapters.
Documentation

rustify-licensing

Framework-agnostic in-app licensing for native Rust desktop apps: validate a key, node-lock the machine, cache the result, and stay unlocked through a bounded offline grace window — failing closed on an authoritative denial.

Part of the rustify platform for shipping monetized native Rust apps.

What it does

  • Validate + activate a license key against Keygen, node-locking this machine via a persisted fingerprint.
  • Offline grace — stay unlocked N days off the last successful online check, but fail closed on an explicit denial. (The Denied vs Offline split is the load-bearing safety property: a wrong-account or revoked key must not ride grace.)
  • Runtime unlock — one build runs locked (free/demo) until a license validates, then unlocks features at runtime. No separate demo binary, no recompile.

Adapters

  • worker — a framework-agnostic threaded LicenseWorker for egui / Slint / any immediate-mode GUI or CLI (no framework dependency).
  • bevy (feature) — a LicensingPlugin with resources + a message API.
  • headless — a blocking check_blocking for CLIs and tests.

The backend is behind a LicenseProvider trait (Keygen today).

Quickstart (egui / any UI loop)

use rustify_licensing::{LicenseConfig, LicenseWorker, StorageConfig};

let config = LicenseConfig {
    account_id: "your-keygen-account-id".into(),
    api_base: "https://api.keygen.sh/v1".into(),
    grace_secs: 14 * 24 * 60 * 60,
    storage: StorageConfig::app_data("MyApp", "license.env", None, Some("MYAPP_LICENSE_KEY")),
    buy_url: "https://myapp.example/#pricing".into(),
};

let mut license = LicenseWorker::keygen(config); // loads state + starts a check
// each frame: license.poll();
// gate features on license.unlocked();
// bind a field to license.key_mut() and call license.activate() on a button.

License

Licensed under either of Apache-2.0 or MIT at your option.