Expand description
Offline Ed25519-signed license JWT verification for the fallow CLI.
This crate is the public-binary side of fallow’s paid-feature gating. It
does NOT perform any network I/O; the license file is loaded from disk or
environment, the signature is verified against a public key compiled in by
the embedding binary, and the result is exposed as a LicenseStatus.
§Storage precedence
License material is sourced in this order (first match wins):
$FALLOW_LICENSEenvironment variable (full JWT string).$FALLOW_LICENSE_PATHenvironment variable (path to a file containing the JWT).~/.fallow/license.jwt(default path under the user’s home directory).
§Algorithm pinning
Only Ed25519 (EdDSA) is accepted. The JWT header’s alg claim is verified
to equal "EdDSA" after base64 decoding; we never trust the header to pick
the algorithm.
§Grace ladder
Matches Docker Desktop / JetBrains conventions. See grace_state.
Structs§
- License
Claims - JWT claims emitted by
api.fallow.cloudfor fallow CLI licenses.
Enums§
- Feature
- Feature flag enum aligned with the protocol’s
Featurestrings. - License
Error - Errors returned by
load_and_verifywhen the license material is present but malformed (vs simply missing, which is reported viaLicenseStatus::Missing). - License
Status - Outcome of
load_and_verify.
Constants§
- DEFAULT_
HARD_ FAIL_ DAYS - Default cap on the grace window before hard-fail in the public CLI.
- DEFAULT_
SKEW_ TOLERANCE_ SECONDS - Default tolerance (in seconds) for
iatclock skew: 24h. - SKEW_
TOLERANCE_ ENV - Env var name for overriding
DEFAULT_SKEW_TOLERANCE_SECONDS. - WATERMARK_
DAYS - Days post-expiry after which the public output gains a visible watermark.
Functions§
- current_
unix_ seconds - Wrapper around
SystemTime::now()returning unix seconds. - default_
license_ path - Compute the canonical default license path (
~/.fallow/license.jwt). - grace_
state - Map a verified
LicenseClaimsto aLicenseStatususing the 7/cap/hard-fail ladder. - load_
and_ verify - Discover and load a license JWT according to the storage precedence rules, then verify it and apply the grace ladder.
- load_
raw_ jwt - Resolve the JWT source according to storage precedence.
- normalize_
jwt - Strip whitespace and embedded line breaks from a pasted JWT.
- skew_
tolerance_ seconds_ from_ env - Resolve the clock-skew tolerance (in seconds) from
FALLOW_LICENSE_SKEW_TOLERANCE_SECONDS, falling back toDEFAULT_SKEW_TOLERANCE_SECONDSwhen the variable is unset, empty, whitespace-only, or unparsable. - user_
home_ dir - Resolve the user’s home directory in a cross-platform way.
- verify_
jwt - Verify a raw JWT string against the supplied public key and (optionally)
the wall clock. The
nowparameter is the unix-seconds reference used to classify expiry; passcurrent_unix_secondsin production. - verify_
jwt_ with_ skew - Verify a raw JWT string with an explicit clock-skew tolerance.