Skip to main content

Crate licers

Crate licers 

Source
Expand description

§Licers

License-key verification for Rust apps, against the Licers service. Every answer is Ed25519-signed with your account key and checked here, with a fresh nonce per call, so a fake or replayed license server is refused.

use licers::LicenseClient;

let client = LicenseClient::builder("YOUR_PUBLIC_KEY")
    .product_id("YOUR_PRODUCT_ID")
    .app_version(env!("CARGO_PKG_VERSION"))
    .build()?;

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

The API is blocking (no async runtime needed). From async code, call it inside spawn_blocking.

Re-exports§

pub use serde_json;

Structs§

ClientBuilder
Builder for LicenseClient.
FloatingSession
A held floating seat, heartbeated on a background thread. The seat can be lost while your code runs — check FloatingSession::active or call FloatingSession::ensure_active at safe points. Loss is decided from signed evidence only; an unreachable server keeps the seat only until its last signed expiry. Dropping the session releases the seat.
Lease
LicenseClient
Verifies license keys against a Licers server. Every answer the app relies on is Ed25519-signed with your account key and checked here, with a fresh nonce each call, so a fake or replayed server response is refused.
SignIn
A sign-in waiting for the customer, from LicenseClient::start_sign_in.
UpdateInfo
Usage
A key’s credit balance, from a signed answer.
ValidationResult
Outcome of LicenseClient::validate.

Enums§

Error
Every error the SDK returns.
HeartbeatState

Constants§

DEFAULT_API
SDK_VERSION

Functions§

detect_os
“windows” | “macos” | “linux” | “” — the names the server uses.
get_hwid
This machine’s device id: 64 lowercase hex characters, stable across runs.
verify_offline_license
Verify a signed offline .lic file (a path, or the token itself) with zero network calls: signature, product, expiry, device and OS lock. Returns the signed payload. The expiry uses the local clock, which the user controls — keep offline files short-lived.

Type Aliases§

Result