Skip to main content

tai42-identity-redis

CI License: Apache 2.0

The Redis-backed api-key identity provider for the TAI ecosystem — an installable plugin that registers itself as the "redis" identity provider and resolves an inbound api key to an authenticated identity.

Importing the package registers the provider in tai42-contract's module-level identity-provider registry (register_identity_provider("redis", ...)), with no tai42_app handle involved — so it registers in any process that imports it, including ones that never start(). A deployment selects it by including redis in the access-control auth_providers list.

Its only tai-* dependencies are tai42-contract (the identity ABCs and the registry it registers through) and tai42-kit (the Redis client, the hash typing seams, and the api-key hash). It never imports the skeleton — the plugin is contract-facing, and the import is banned by ruff.

The TAI ecosystem

TAI is an open-source runtime for MCP tools, agents, and workflows. An identity provider is how the runtime answers "who is this caller?": it resolves an inbound credential to an authenticated identity, and access control decides what that identity may do. This package is one such provider (api keys over Redis); any package can back the same contract, so this repo is this provider's own full doc home, and the documentation site covers the platform-level story:

What it stores

The provider owns the whole api-key identity record in its own plain-Redis storage:

  • ac:key:{sha256(raw)} — a Redis hash {"user_id", "description"} (the identity a raw key resolves to).
  • ac:management:key:{user_id} — the user_id -> hash reverse lookup, so a user id resolves to its stored hash for revoke/edit without a scan.

Key material is never stored — only the SHA-256 hash of the raw key.

Surface

The provider implements tai42_contract.access_control.identity.ApiKeyIdentityProvider:

Method Does
validate_token(token) Reads ac:key:{hash} and returns the AuthIdentity, or None for an unknown token. A backend error fails closed by raising.
provision(user_id, description, *, owner_user_id=None) Mints a raw sk-… key, writes the identity record + reverse lookup in one transaction, and returns the raw key (surfaced once). When owner_user_id is given, it is stored in the identity record as the owner claim, so validate_token surfaces it for per-request attenuation.
revoke(user_id) Deletes the identity record + reverse lookup; False if the user is unknown.
update_description(user_id, description) Rewrites the record's description; False if the user is unknown.
list_identities() SCANs ac:key:* and returns every stored (user_id, description).
healthcheck() Probes the provider's OWN Redis storage; raises loudly if the record store is unreachable or broken.

Requirements

Requires Python 3.13+ and any plain Redis — no modules required. The identity records are plain Redis hashes, so redis, valkey, or any module-less redis-server works. An unreachable or broken store is caught loudly by healthcheck() at startup rather than failing per-request.

Install

Requires Python 3.13+. Install from PyPI into the environment that runs the server:

uv add tai42-identity-redis

Or from source — clone this repo and add it as an editable dependency. Clone tai-contract and tai-kit beside this repo first — [tool.uv.sources] resolves them from sibling paths.

git clone https://github.com/tai42ai/tai-identity-redis   # next to your app checkout
cd /path/to/your/app
uv add --editable ../tai-identity-redis

Development

uv venv --python 3.13
uv pip install --no-sources --editable ".[dev]"
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
uv run --no-sync pyright
uv run --no-sync pytest --cov --cov-report=term-missing

License

Apache-2.0. See LICENSE and NOTICE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tai42_identity_redis-0.2.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tai42_identity_redis-0.2.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file tai42_identity_redis-0.2.1.tar.gz.

File metadata

  • Download URL: tai42_identity_redis-0.2.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tai42_identity_redis-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1c44c2b43e3305067d788f0e6bf7c4ef4fc0eb5630ea8d0beeebdccce1e6f4c0
MD5 1da3056d9d6721254bc1cb2725269557
BLAKE2b-256 378c81458f56dc4cecd0169d857e59a360cc1369c64ad5ad45e9317d322fd66c

See more details on using hashes here.

File details

Details for the file tai42_identity_redis-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tai42_identity_redis-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da3f144fae5c37e5e1fbcf2a7914dff75017926a1cc8380f94363bc740d52000
MD5 42e593ee457ee042169578b48bdea930
BLAKE2b-256 9c6870274ed860aeddb98824e314206f5acd5ae4a4c1dd6a23707e8610322ec2

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.3.0

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page