licers 1.0.0

Licers license-key verification: Ed25519-signed responses, floating seats, usage credits, remote variables, offline licenses.
Documentation

licers

License-key verification for Rust apps, against Licers.

Every answer from the license server is Ed25519-signed with your account key and checked here (ed25519-dalek, strict verification), with a fresh random nonce per call — so a cracked "fake license server", an edited response or a replayed one is refused.

cargo add licers

Quick start

use licers::LicenseClient;

fn main() -> Result<(), licers::Error> {
    let client = LicenseClient::builder("YOUR_PUBLIC_KEY")
        .product_id("YOUR_PRODUCT_ID")              // rejects keys for your other products
        .app_version(env!("CARGO_PKG_VERSION"))     // shows in Analytics -> App versions
        .build()?;

    let result = client.validate("PY-XXXXXXXXXXXXXXXX")?;
    if !result.valid {
        eprintln!("Not licensed: {}", result.error.unwrap_or_default());
        std::process::exit(1);
    }
    if result.feature("pro") == Some(&licers::serde_json::json!(true)) {
        // unlock pro features
    }
    Ok(())
}

validate returns Ok with valid == false when the server refuses the key. It returns Err(Error::Signature(_)) for a forged or replayed answer and Error::Network / Error::Server when the server can't be reached — err.is_network() tells you to retry or apply a grace period rather than treat the user as unlicensed.

The API is blocking, so it needs no async runtime. From async code, call it in spawn_blocking.

Everything else

// Usage credits
let usage = client.record_usage(key, 1)?;          // Err(Error::UsageExceeded { .. }) when out
println!("{:?} left", usage.remaining());

// Remote variables (set on the dashboard; delivered only to valid keys)
let url = client.get_variable(key, "download_url")?;   // Option<String>

// Floating / concurrent seats: heartbeats on a background thread, freed on drop
let client = std::sync::Arc::new(client);
let session = licers::FloatingSession::start(client.clone(), key, None)?;
session.ensure_active()?;

// Updates (the "no update" answer is signed too; download_url is NOT signed)
let update = client.check_update(key, "2.4.1", "stable")?;

// Offline license files (.lic), zero network
let lic = licers::verify_offline_license("YOUR_PUBLIC_KEY", "license.lic", None, Some("YOUR_PRODUCT_ID"))?;

Device id

get_hwid() is SHA-256 of "licers:" + the OS machine id (Windows MachineGuid, Linux /etc/machine-id, macOS IOPlatformUUID) — the same value the Node and .NET SDKs produce on that machine. Where none is readable, a random id is stored once in the user's data folder (LICERS_HWID_DIR overrides). Use .hwid("...") on the builder to supply your own.

License

MIT