hallmark-identity (Python)
Python port of Hallmark — open, IDP-agnostic identity for AI agents via OAuth 2.0 Token Exchange (RFC 8693).
Sync API, zero runtime dependencies, Python ≥3.10.
Install
pip install hallmark-identity # (PyPI publish pending)
Quick start
from hallmark_identity import create_identity, oidc
identity = create_identity(
idp=oidc(issuer="https://your-idp/", client_id="agent", client_secret="…"),
)
# "Who am I?" — the agent's own machine identity (client-credentials grant)
mine = identity.agent().token(audience="https://api.internal")
# "Who am I acting for?" — on behalf of a user (you bring the user's token)
on_behalf = identity.on_behalf_of(user_token).token(
audience="https://api.github.com", scopes=["repo"],
)
import urllib.request
req = urllib.request.Request(
"https://api.github.com/user/repos",
headers={"authorization": f"Bearer {on_behalf.raw}"},
)
Supported IDPs
Any RFC 8693-capable OIDC provider via oidc(), plus a keycloak() convenience adapter:
from hallmark_identity import oidc, keycloak
oidc(issuer="https://login.microsoftonline.com/<tenant>/v2.0", client_id=client_id, client_secret=client_secret)
keycloak(base_url="https://kc.example", realm="agents", client_id=client_id, client_secret=client_secret)
API
| Export | Purpose |
|---|---|
create_identity(idp, store=None, refresh_skew_seconds=30, http_request=None) |
Factory. |
identity.agent().token(audience=None, scopes=None) |
The agent's own identity. |
identity.on_behalf_of(subject_token, type="access_token").token(...) |
On-behalf-of a user. |
oidc(...) / keycloak(...) |
IDP adapters. |
memory_store() |
Default in-memory TokenStore; implement get/set to plug in Redis, etc. |
parse_token, is_expired, will_expire_within |
Token-claim helpers. |
HallmarkError, GrantError, TokenExchangeUnsupportedError |
Typed errors. |
A returned Token exposes .raw, .sub, .act, .aud, .scope, .exp — .raw is the string sent as a bearer token.
Development
uv sync # install deps
uv run pytest # unit tests
uv run pytest -c pytest-integration.ini # opt-in, requires a running Keycloak — see tests/integration/README.md
uv run mypy src # typecheck
uv build # build sdist + wheel
License
MIT
Metadata
Release files for hallmark-identity 0.1.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 |
|---|---|---|---|---|
| hallmark_identity-0.1.0.tar.gz | 60.4 kB | Without provenance | Details for hallmark_identity-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hallmark_identity-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hallmark_identity-0.1.0-py3-none-any.whl |
Total release size: 73.4 kB
Release files / hallmark_identity-0.1.0.tar.gz
| Download URL | hallmark_identity-0.1.0.tar.gz |
|---|---|
| Size | 60.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dabf70632142289de48e5237d364d69025b43af62789fa54faa6b624c5faacb6
|
|
BLAKE2b-256 checksum How to use checksums |
2f4804012f58878545710e7293b92e51cc1f21c3cda533667d4c41f6f3454073
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / hallmark_identity-0.1.0-py3-none-any.whl
| Download URL | hallmark_identity-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d63c30956a4260613441800c29d947cf29bd9968dfc3e8858b0ee6a0a203e14d
|
|
BLAKE2b-256 checksum How to use checksums |
936dd6c845e8a1851e5fd70132ee6fe91ae36ad61be30c2a34145951e0676a53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for hallmark-identity 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.