Skip to main content

Crate hymmalm

Crate hymmalm 

Source
Expand description

§hymmalm — Rust wrapper for license-management-core

Safe Rust binding over the vendored native hymmalm core (include/hymma/hlm_ffi.h). All licensing logic — JWS verification, status rules, machine fingerprinting, the REST client flow, retry policy and clock-tamper resistance — lives in the native core, so every language wrapper behaves identically. This crate only marshals. The C sources are compiled by build.rs and linked statically, so the crate is fully self-contained (no shared library to ship) — ideal for Tauri apps.

Typical use:

use hymmalm::{LicenseClient, LicenseClientOptions, LicenseStatus};

let mut client = LicenseClient::new(LicenseClientOptions {
    product_id: "PRD_01KWWPEPM0N070BDAHJ7G09RGV".into(),
    client_api_key: "PUB_...".into(),               // never a MST_ key
    jwks_json: std::fs::read_to_string("signingkeys.json").unwrap(),
    license_path: Some("/home/me/.myapp/license.lic".into()),
    ..Default::default()
})?;

let status = client.check()?;                       // trial bootstrap on first run
if status == LicenseStatus::InvalidTrial {
    client.activate("RCPT-CODE-FROM-USER")?;
}

Offline verification only (no network, e.g. checking a provisioned file):

let status = hymmalm::verify(&jws_string, &jwks_json, None, None, None)?;

Modules§

ffi
Raw extern "C" declarations for the flat FFI surface of license-management-core (include/hymma/hlm_ffi.h), hand-written — no bindgen.

Structs§

LicenseClient
High-level licensing client (check / activate / deactivate / refresh).
LicenseClientOptions
Options for LicenseClient::new. product_id, client_api_key and jwks_json are required; everything else has a sensible default.
LicenseError
Error reported by the native core.
LicenseImportResult
What happened to an imported license file, with a message written for the end user.

Enums§

LicenseImportOutcome
Outcome of LicenseClient::import_license (native hlm_import_result; the .NET SDK’s LicenseImportOutcome).
LicenseStatus
Mirrors the native hlm_status / the .NET SDK’s LicenseStatusTitles.
NetworkFailure
Why the license server could not be reached (native hlm_net_failure; the .NET SDK’s NetworkFailureReason).
SignedFormat
Signed-license wire formats the server can emit.

Functions§

machine_id
This machine’s hardware fingerprint (52-char Crockford Base32) — identical to the .NET SDK’s DeviceId on the same machine.
machine_id_v2
Identity v2: the MachineGuid fingerprint on Windows (unique per Windows install — the v1 sources collide across machines); identical to machine_id on POSIX.
machine_name
This computer’s name, as the SDK would send it.
verify
Offline one-shot: verify a signed license string against jwks_json and report its status at now (default: the system clock). Fails with code -3/-4 when the string is malformed or tampered, -10/-11 when the product/machine binding does not match.

Type Aliases§

Result
Result alias for this crate.