Registry / security / fastokens

fastokens

JSON →
library0.2.0pypypi✓ verified 85d ago

Fastokens is a Python library for generating secure, time-limited tokens using cryptographic hashing and HMAC. It provides simple APIs for creating and verifying tokens with expiration, suitable for password reset links, API tokens, and one-time codes. Current version 0.2.0, released as an alpha. Release cadence is irregular.

pip install fastokens
INSTALL
IMPORT
SIG · FASTOKENS
F
fastokens
securitypythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tokenizer
✓ from fastokens import Tokenizer
✗ from fastokens import TokenManager
patch_transformers
✓ from fastokens import patch_transformers
unpatch_transformers
✓ from fastokens import unpatch_transformers

Initialize TokenManager with a secret and TTL, create a token from a dict, then verify it.

from fastokens import TokenManager import os secret = os.environ.get('FASTOKENS_SECRET', 'my-secret-key') tm = TokenManager(secret=secret, token_ttl=600) # 10 minutes token = tm.create(data={'user_id': 42}) print('Token:', token) data = tm.verify(token) print('Verified data:', data)
Debug
Known issues
breakingThe 'TokenManager' class was renamed from 'Token' in version 0.2.0. Code using 'from fastokens import Token' will fail.
fix
Replace 'Token' with 'TokenManager' in imports and instantiation.
affects: >=0.2.0
gotchaThe 'secret' parameter must be at least 32 bytes. A short secret will raise a ValueError.
fix
Ensure secret is at least 32 characters long, or use a secret generated by os.urandom(32).
affects: all
deprecatedThe 'data' parameter to create() must be a dict. Passing a string or int (as in some examples) is deprecated and will be removed in a future release.
fix
Always wrap non-dict values in a dict, e.g., create(data={'value': 'some_string'}).
affects: <0.3.0
Upgrade
Version history
0.2.0latest on PyPI · released May 17, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
Resources
fastokens — pip install fastokens · libregistry