TokenKeeper API
TokenKeeper is a secure, FastAPI-based service for managing and verifying personal access tokens. It integrates with AWS Cognito for user authentication and uses PostgreSQL for persistent storage. Tokens are hashed with Argon2 and optionally support expiration, revocation, and last-used tracking.
Features
- 🔐 Secure token generation using Argon2 hashing
- 📅 Optional token expiration and usage tracking
- ✅ Verification and revocation of tokens
- 🧾 List non-revoked, non-expired tokens
- 🪪 Cognito-based user authentication
- 🗃️ PostgreSQL + SQLAlchemy (async) backend
API Endpoints
POST /token— Create a new tokenPOST /token/verify— Verify token validityPOST /token/revoke— Revoke a token by nameGET /token— List current user’s active tokens
Requirements
- Python 3.12+
- PostgreSQL
- AWS Cognito User Pool
asyncpg,sqlalchemy,fastapi,passlib[argon2],cognito-jwt-verifier
Getting Started
- Update your database URL in db.py:
DATABASE_URL = "postgresql+asyncpg://user:password@localhost/tokenkeeper"
- Set up your Cognito issuer and client ID in auth.py:
ISSUER = "https://cognito-idp.<region>.amazonaws.com/<user_pool_id>"
CLIENT_IDS = ["<app_client_id>"]
- Run the FastAPI app:
uvicorn tokenkeeper.main:app --reload
License
MIT
Metadata
Release files for tokenkeeper-api 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tokenkeeper_api-0.0.4.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tokenkeeper_api-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / tokenkeeper_api-0.0.4.tar.gz
| Download URL | tokenkeeper_api-0.0.4.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
782496b775aff42a9aca0b1ec4ce19f5451c001757e31b3ffe0eee57d699afbd
|
|
BLAKE2b-256 checksum How to use checksums |
d9bc27e921112ddf38f6ab9f5420397e6bbba155236edac97930548a0d0b548b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / tokenkeeper_api-0.0.4-py3-none-any.whl
| Download URL | tokenkeeper_api-0.0.4-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a846d1cca8e76e7e25ad94d6ff1046b87b89206c14e12c0ddd2a529b98be3a78
|
|
BLAKE2b-256 checksum How to use checksums |
6a25494251cd084ef2b15acb2985966d08647d0092c1e48be6e36df2aa4679cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|