brinkhaustools

Module licence

Source
Expand description

Offline-verifiable, hardware-bound licences (feature licence).

A licence is a signed text block the operator pastes into the product. It names a product (and optionally a variant), the hardware identifiers it binds to (all must be present), a validity window (open end = lifetime), and product-defined features and quotas. Several licences add up: features are the union, quotas the sum, over the valid ones. Without any valid licence a product may run a trial (TrialRecord).

What the crate does not decide: what a feature or quota means, which durations enforce the licence (trial length, grace period, clock guard — keep them out of user-editable settings), or where licences are stored. Those are product decisions.

The issuing side (FleetManager) holds the Ed25519 seed; products only embed public keys. The Python variant (brinkhaustools.licence) implements the same format; both are pinned by test-fixtures/licence-vectors.json.

Protection limits, stated plainly: the binding stops a data directory from being carried to another machine. It does not stop root on the host from copying a machine-id or setting a MAC address.

Structs§

  • One binding in a licence or request: kind, display label, hash.
  • Highest system time ever seen, persisted. Detects a clock turned back to stretch a time-limited licence. Recovery is correcting the clock; if the clock had jumped into the future, the mark stays there until real time passes it or ClockMark::reset is run.
  • Everything an evaluation depends on.
  • One identifier read from a file the operator named (a container mounts each one individually, read-only).
  • What all licences together grant.
  • One identifier found on this machine.
  • All identifiers found on this machine, plus why others are missing.
  • Where the collector looks.
  • One evaluated licence.
  • The signed content of a licence.
  • A licence request: what a machine offers to bind to, copied from the product UI into the FleetManager when the machine is offline. Not signed — it only pre-fills the issuing form.
  • Licensee named in a licence.
  • A parsed (not yet verified) licence.
  • An Ed25519 signing key, stored as its 32-byte seed in hex.
  • What a trial grants and for how long. Product-defined; the durations that enforce a licence belong in the product’s catalogue, not in its settings.
  • A started trial.
  • Evaluated trial.
  • Public keys a product trusts, by key id.

Enums§

Constants§

Functions§

  • Decode Crockford Base32.
  • Encode bytes as Crockford Base32 (upper case, no padding).
  • Canonical JSON: object keys sorted, no insignificant whitespace.
  • Evaluate all licences and the trial. Licences OR together: features are the union, quotas the sum, over the valid licences only, each licence id counted once (a repeat is RejectReason::Duplicate).
  • Check one licence against the context. Order: signature first — nothing in an unauthenticated payload is reported as if it were true — then product, variant, hardware, time.
  • Salted hash of a normalised identifier value (lower-case hex).
  • Whether this process runs inside a container (Docker or Podman marker file).
  • Load the installation id from path, creating it on first use. Returns (id, created). The id recognises an installation; it binds nothing.
  • Key id: first 8 hex digits of SHA-256 over the raw public key.
  • The Serial line of /proc/cpuinfo (ARM), if present.
  • (Name, MacAddress) pairs from Get-NetAdapter | ConvertTo-Json (object or array).
  • Value of name in the output of reg query … /v name.
  • Parse a list of named sources of one kind: label=path,label=path or a single bare path (label = file name). Whitespace around items is ignored, empty items are skipped.
  • A random UUID v4 (licence ids, installation ids).