|
| 1 | +# CipherToken |
| 2 | + |
| 3 | +**CipherToken** is a next-generation token engine for developers who demand speed, security, and reliability. Unlike conventional JWT libraries, CipherToken delivers a complete token lifecycle — from creation and decoding to rotation and expiry tracking — all backed by the raw performance of **Rust**. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Why CipherToken? |
| 8 | + |
| 9 | +| | Conventional JWT Libraries | CipherToken | |
| 10 | +|---|---|---| |
| 11 | +| **Language** | Pure Python | Rust + PyO3 | |
| 12 | +| **Performance** | Interpreted overhead | Near-native speed | |
| 13 | +| **Async** | Often limited or absent | Fully async (Tokio) | |
| 14 | +| **Token lifecycle** | Generate / verify | Create · Decode · Verify · Rotate · Inspect | |
| 15 | +| **Key management** | Manual | Built-in HMAC + RSA key generation | |
| 16 | +| **Expiry tracking** | Manual | Built-in (`remaining_time`) | |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Quick Install |
| 21 | + |
| 22 | +```bash |
| 23 | +pip install ciphertoken |
| 24 | +``` |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Quick Example |
| 29 | + |
| 30 | +```python |
| 31 | +from ciphertoken import CipherToken |
| 32 | +from ciphertoken.algorithms import HS256 |
| 33 | +from ciphertoken.time import minutes, days |
| 34 | +from ciphertoken.jwt import access, refresh, rotation |
| 35 | + |
| 36 | +token = CipherToken( |
| 37 | + secret="your-strong-secret-key", |
| 38 | + algorithm=HS256, |
| 39 | + access_ttl=minutes(10), |
| 40 | + refresh_ttl=days(7), |
| 41 | +) |
| 42 | + |
| 43 | +access_token = access(token, payload={"user_id": 42}) |
| 44 | +refresh_token = refresh(token, payload={"user_id": 42}) |
| 45 | +new_access, new_refresh = rotation(token, refresh_token) |
| 46 | + |
| 47 | +print(token.verify(access_token)) # True |
| 48 | +``` |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Get Started |
| 53 | + |
| 54 | +<div class="grid cards" markdown> |
| 55 | + |
| 56 | +- :fontawesome-solid-download: [Installation](getting-started/installation.md) — pip, poetry, pdm, and more |
| 57 | + |
| 58 | +- :fontawesome-solid-bolt: [Quick Start](getting-started/quick-start.md) — Your first tokens in under 2 minutes |
| 59 | + |
| 60 | +- :fontawesome-solid-book: [API Reference](reference/index.md) — Complete module documentation |
| 61 | + |
| 62 | +- :fontawesome-solid-gear: [Advanced Guide](advanced/index.md) — Production best practices |
| 63 | + |
| 64 | +</div> |
0 commit comments