key-verify-client
Shared credential → principal resolution client, used by every service that
resolves credentials against the central admin-platform: agent-platform,
border_collie, upload-service, ocr-service, asr-service,
summary-service.
3.0 is a breaking release.
KeyVerifyClient,VerificationResultandfail_openare gone. The abstraction moved from "is this API key valid?" to "which Principal does this trusted credential map to?".
2.x 3.0 KeyVerifyClient(verify_url=…)CredentialResolver(resolve_url=…, deployment_id=…)verify(api_key)resolve_principal(credential)result.clientresult.principal.client_scoperesult.tenantresult.principal.tenant_scoperesult.key_idresult.principal.key_idresult.source/.degradedresult.resolution.source/.degradedfail_open=Trueremoved — see below — principal.subject_type,.permissions,.allowed_tenants,.deployment_scope
Package naming
The three names intentionally differ by responsibility:
- Git repository:
key-verify-client - PyPI project / distribution:
keyverify - Python import package:
keyverify
Do not change [project].name in pyproject.toml to key-verify-client or
key_verify_client. The existing PyPI project is keyverify, and Trusted
Publishing authorizes that project name.
Install from PyPI:
pip install keyverify
Import from Python:
from keyverify import CredentialPrincipal, CredentialResolver, Resolution
Behavior
- Calls
POST /internal/resolve-principalover HTTP(S) with this deployment's own service credential. - Enforces the local identity boundaries: a
tenant-clientprincipal must match this process'sclient_scope; aservice/operatorprincipal must match itsdeployment_id. Central already checks caller ↔ target; this is target ↔ us. - Caches successful resolutions only, and caches the whole principal
(
subject_type, three scopes,allowed_tenants,permissions) — so revoking a grant converges within the TTL instead of never. cache_ttl=0disables caching so revocation is immediately visible.- Plaintext credentials are never used as cache dictionary keys; only SHA-256 digests are retained.
There is no fail-open
2.x had a fail_open switch. It did not simply let the request through: it
returned a fabricated identity whose client equalled the caller's own
client_scope — so the caller's local second line of defence compared against the
very value being forged, and the resulting audit record was indistinguishable from
a genuine request. It was one environment variable away from anyone firefighting at
3am.
3.0 does not offer it. When central cannot be reached you get:
Resolution(valid=False, reason="verification_unavailable",
resolution=ResolutionMeta(source="central", degraded=True))
verification_unavailable means our problem, not the holder's — map it to
503, never 401. Telling a client their key is invalid sends them off to
investigate a perfectly good credential (this happened; it cost three days).
What this library does not do
It does not do permission authorization. It hands you
principal.permissions and principal.has_permission(...); deciding which
permission a given route requires is the caller's job, because only the caller
knows that.
Local development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest -q
Build and verify release artifacts
Always clean old artifacts first:
rm -rf dist build *.egg-info src/*.egg-info
python -m build
python -m twine check dist/*
python scripts/verify_dist_metadata.py dist
For version 3.0.0, the artifact names must be:
keyverify-3.0.0-py3-none-any.whl
keyverify-3.0.0.tar.gz
The metadata verification command must report:
Name=keyverify Version=3.0.0
Only after those checks pass should CI upload dist/* to PyPI.
Metadata
Release files for keyverify 3.0.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 | |
|---|---|---|---|---|
| keyverify-3.0.0.tar.gz | 130.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keyverify-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.6 kB
Release files / keyverify-3.0.0.tar.gz
| Download URL | keyverify-3.0.0.tar.gz |
|---|---|
| Size | 130.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ed6055abc9a875ebc5741da85ba048f34df7ceadbc13fadb30895fe178982dc
|
|
BLAKE2b-256 checksum How to use checksums |
221df2f862c588ede028a5c7acad3e4e67df1fc293ba785707cc614427996aaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Sep 22, 2026.
Transparency logRelease files / keyverify-3.0.0-py3-none-any.whl
| Download URL | keyverify-3.0.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
213b0fd629c4fc8e84a3bf31b0ba94fa59cb6829ef29c84ec84ea36d975a5948
|
|
BLAKE2b-256 checksum How to use checksums |
8a3990082f3353c32d5d153acad2ce9b4e9b89a4bd372db834633758840044cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Sep 22, 2026.
Transparency logSecurity for keyverify 3.0.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 keyverify-3.0.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 Sep 22, 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.