tamga-rust
Official Rust SDK for Tamga. Integrate license activation, offline verification, and machine management into your Rust applications.
Status: Sections A–L implemented and tested (client/transport, license validation/check-in/checkout, machine checkout/management/offline proof, components/processes, entitlements, error model). Sections E, F, and H (all cryptographic code) have each passed a dedicated
security-reviewerpass. Not yet done: Section M (CI/release automation hasn't been exercised against a real CI run yet) and capturing realtests/fixtures/*.lic/*.machfiles from a live server (current tests generate fixtures in-process against the documented wire format instead).
Install
Published on crates.io as the bare name
tamga — see docs/sdk.md
in tamga-api for the full cross-SDK naming rationale.
Quickstart
See also examples/validate_license.rs for a complete, runnable version of
this.
use AuthTransport;
use ;
async
Offline verification
The core value proposition of this SDK over hand-rolling HTTP calls is that,
once you check out a signed .lic/.mach file and embed the relevant public
key in your application, verification works with no network access at
all:
let license = verify_license_file?;
Security notes
Two intentional, non-obvious cryptographic choices in this SDK's .lic
verifier exist because they replicate exact server behavior — do not
"fix" either of them:
- Signature covers the base64 string, not decoded bytes. The
.licfile's Ed25519 signature is computed over the ASCII/UTF-8 bytes of theencfield's base64-encoded string, not the bytes you get after base64-decoding it. Verifying against the decoded bytes will silently fail against every real server-issued file. - License file encryption key is not a KDF. The AES-256-GCM key for an
encrypted
.licfile is the raw UTF-8 bytes of the license key string, zero-padded or truncated to exactly 32 bytes — not a hash, not HKDF, not PBKDF2. Machine files (.mach), by contrast, do use a proper HKDF-SHA256 derivation. Don't assume the two formats share a key-derivation strategy.
See src/crypto/naive_key.rs and src/crypto/ed25519.rs for the
authoritative doc comments — both crypto sections (E and F) have passed a
dedicated security-reviewer pass.
Known Server-Side Gaps (scoped to this SDK)
The full list lives in tamga-api's
docs/sdk.md
→ "Known Server-Side Gaps". Items that affect this SDK's implemented
surface:
- Only 14 of 24
ValidationCodevalues are reachable today; this crate models all 24 but only the reachable subset is exercised by tests. - Auth (
Authorizationheader) is not enforced server-side on license or machine endpoints yet — send real credentials anyway; don't assume a bad credential is rejected today. - The server never returns
429 Too Many Requestsunder the current deployment — this SDK has no client-side backoff logic keyed on it. - Freshly-created policies report non-existent enum strings
(
"DENY_ACCESS","NO_RESURRECTION") as their defaults; this SDK treats any unrecognized policy-field value as the "no restriction" variant to match actual server behavior rather than the literal string. - Auto-update / release-checking (
GET /releases/actions/upgrade) is not built into this SDK — it crashes at runtime server-side today.
Documentation
docs/sdk.mdintamga-api— the authoritative protocol/feature specification every field name, endpoint, and enum value in this SDK is verified against.- docs.rs/tamga — generated API reference (once published).
License
Licensed under the MIT License. See LICENSE.