keyflint-verify
Offline verifier for KeyFlint license tokens (LIC-<TIER>-<PAYLOAD>.<SIGNATURE>). It is pure Python standard library: no C compiler and no dependencies. If cryptography is installed it is used automatically (pip install keyflint-verify[fast]).
from keyflint_verify import verify_license
r = verify_license("LIC-PRO-eyJ...", PUBLIC_KEY_HEX, machine_id="ws-node-01")
if not r: raise SystemExit(r.error) # e.g. ERR_LICENSE_EXPIRED
print(r.payload["tier"], r.payload["features"])
MCP servers
from keyflint_verify.mcp import KeyFlint
kf = KeyFlint() # KEYFLINT_LICENSE, KEYFLINT_PUBLIC_KEYS, KEYFLINT_URL, KEYFLINT_CHECKOUT_URL
@mcp.tool()
@kf.require_license(features=["core"]) # offline only
def search(query: str) -> str: ...
@mcp.tool()
@kf.metered(credits=5) # offline check + POST /api/v1/quota/deduct
async def summarize(url: str) -> str: ...
- Works with sync and async tools and with MCPServer / FastMCP (
mcpv1 and v2). Put the KeyFlint decorator below@mcp.tool(). The signature is preserved, so the tool schema does not change. @meteredcharges before the tool runs. It sends an automaticIdempotency-Keyand reuses it on its single network retry, so a retry never charges twice.- Failures raise
LicenseError, a subclass of the SDK's standard MCP error. The client receives a JSON-RPC error:-32060invalid license,-32061feature not in plan,-32062credits exhausted (HTTP 402, withcheckout_urlindata),-32063gateway error (-32042is reserved by MCP for URL elicitation). Each message states the cause, whether credits were charged, and the next step. - For node-locked licenses the machine id is computed automatically with the same algorithm as the gateway (
keyflint_verify.fingerprint).
Activate a license for end users (v1.2)
Your customers do not need to edit claude_desktop_config.json by hand:
uvx keyflint-verify activate LIC-PRO-... [--client claude|cursor|windsurf] [--server NAME] [--dry-run]
It finds the config of Claude Desktop, Cursor and/or Windsurf for the OS, keeps a .bak copy,
sets env.KEYFLINT_LICENSE on the server that already uses KeyFlint (or the only server, or
--server NAME), and checks the result is valid JSON. Invalid JSON is never modified.
npx keyflint-verify activate does the same.
Key rotation
public_keys can be a single hex key, a list of historical keys, or a {kid: hex} mapping. Tokens without kid (every token issued by KeyFlint v1.0) are tried against all the keys. With a {kid: hex} mapping, a token with a signed kid is checked only against that key (ERR_UNKNOWN_KID if absent); strings and lists are tried key by key. KEYFLINT_PUBLIC_KEYS accepts the gateway's published keyring and mixed lists (oldhex,k2=newhex). To contain a leaked key, remove it from the ring. r.key_id tells you which key verified the token.
Guarantees
validate_offlineis a byte-for-byte copy of the gateway'soffline_validator.py. A test fails if the two drift apart.- Tokens whose signed
issued_atis more than 300 s ahead of the local clock fail withERR_CLOCK_BEFORE_ISSUANCE(rolled-back clock). Expiry has no extra tolerance. Offline checks cannot stop a determined clock rollback; use short expirations with online renewal when that matters. - The same 50 conformance vectors as the npm
keyflint-verifypackage, run on both the OpenSSL path and the pure RFC 8032 path.
python -m unittest discover -s tests # from sdks/python-verify, with src on PYTHONPATH or after pip install -e .
Metadata
Release files for keyflint-verify 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keyflint_verify-1.2.0.tar.gz | 29.7 kB | With provenance | Details for keyflint_verify-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keyflint_verify-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for keyflint_verify-1.2.0-py3-none-any.whl |
Total release size: 54.4 kB
Release files / keyflint_verify-1.2.0.tar.gz
| Download URL | keyflint_verify-1.2.0.tar.gz |
|---|---|
| Size | 29.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a672392d9a8cf13b16f39210c3afd22e6c6c063c5905acfb83667497a72fbb4c
|
|
BLAKE2b-256 checksum How to use checksums |
e6e90e51403b41361694936b3007fb3a5d8a4376702541b9f62a15af05f66e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / keyflint_verify-1.2.0-py3-none-any.whl
| Download URL | keyflint_verify-1.2.0-py3-none-any.whl |
|---|---|
| Size | 24.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
052a9971213098d33f50de3f04cd25e72b4146ed3950b57614d9633b14a45120
|
|
BLAKE2b-256 checksum How to use checksums |
34251bafe1db789fb68a165f3500b1ad1fbd210874702129cfdc999cc4f5fa98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for keyflint-verify 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for keyflint_verify-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.