Metadata-Version: 2.4
Name: jamlib
Version: 2.6.0b0.dev2
Summary: Simple and universal library for authorization.
Author-email: Makridenko Adrian <adrianmakridenko@duck.com>, Ksenia Travnikova <kseniatravnikova@duck.com>
License: MIT License
Project-URL: Homepage, https://jam.makridenko.ru
Project-URL: Repository, https://github.com/lyaguxafrog/jam
Project-URL: Issues, https://github.com/lyaguxafrog/jam/issues
Project-URL: Changelog, https://github.com/lyaguxafrog/jam/releases
Keywords: Authentication,Backend,JWT,Sessions,OTP,TOTP,OAuth2,Litestar,FastAPI,Starlette,Flask
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP :: Session
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet
Classifier: Typing :: Typed
Classifier: Framework :: Flask
Classifier: Framework :: FastAPI
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: pycryptodome<4.0.0,>=3.21.0
Requires-Dist: cryptography<45.0.0,>=44.0.2
Provides-Extra: redis
Requires-Dist: redis>=6.4.0; extra == "redis"
Provides-Extra: json
Requires-Dist: tinydb>=4.8.2; extra == "json"
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0.2; extra == "yaml"
Provides-Extra: toml
Requires-Dist: toml>=0.10.2; extra == "toml"
Provides-Extra: litestar
Requires-Dist: litestar>=2.18.0; extra == "litestar"
Provides-Extra: starlette
Requires-Dist: starlette>=0.48.0; extra == "starlette"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.119.0; extra == "fastapi"
Provides-Extra: flask
Requires-Dist: flask>=3.1.2; extra == "flask"
Dynamic: license-file

# Jam

![logo](https://github.com/lyaguxafrog/jam/blob/master/docs/assets/h_logo_n_title.png?raw=true)

![Static Badge](https://img.shields.io/badge/Python-3.9%2B-blue?logo=python&logoColor=white)
[![PyPI - Version](https://img.shields.io/pypi/v/jamlib)](https://pypi.org/project/jamlib/)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/jamlib?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=RED&left_text=Downloads)](https://pypi.org/project/jamlib/)
![tests](https://github.com/lyaguxafrog/jam/actions/workflows/run-tests.yml/badge.svg)
[![GitHub License](https://img.shields.io/github/license/lyaguxafrog/jam)](https://github.com/lyaguxafrog/jam/blob/master/LICENSE.md)

Documentation: [jam.makridenko.ru](https://jam.makridenko.ru)


## Install
```bash
pip install jamlib
```

## Quick example
```python
from jam import Jam

jam = Jam()

jwt = jam.jwt_create_token({"user": 1})
decoded_payload = jam.jwt_verify_token(jwt)
```

## Why Jam?
Jam is a library that provides the most popular AUTH* mechanisms right out of the box.

* [JWT](https://jam.makridenko.ru/jwt/instance/)
* PASETO
* [Server side sessions](https://jam.makridenko.ru/sessions/instance/)
* OTP
  * [TOTP](https://jam.makridenko.ru/otp/totp/)
  * [HOTP](https://jam.makridenko.ru/otp/hotp/)
* [OAuth2](https://jam.makridenko.ru/oauth2/instance/)

### Framework integrations

Jam provides ready-to-use integrations for the most popular frameworks:

* [FastAPI](https://jam.makridenko.ru/extensions/fastapi)
* [Starlette](https://jam.makridenko.ru/extensions/starlette)
* [Litestar](https://jam.makridenko.ru/extensions/litestar)
* [Flask](https://jam.makridenko.ru/extensions/flask)

Each integration offers built-in middleware or plugin support for JWT and session-based authentication.

### Why choose Jam?
Jam supports many authentication methods out of the box with minimal dependencies.
Here is a comparison with other libraries:

| Features / Library   | **Jam** | [Authx](https://authx.yezz.me/) | [PyJWT](https://pyjwt.readthedocs.io) | [AuthLib](https://docs.authlib.org) | [OTP Auth](https://otp.authlib.org/) |
|----------------------|---------|---------------------------------|---------------------------------------|-------------------------------------|--------------------------------------|
| JWT                  | ✅       | ✅                               | ✅                                     | ✅                                   | ❌                                    |
| JWT black/white lists | ✅       | ❌                               | ❌                                     | ❌                                   | ❌                                    |
| Server side sessions | ✅       | ✅                               | ❌                                     | ❌                                   | ❌                                    |
| OTP                  | ✅       | ❌                               | ❌                                     | ❌                                   | ✅                                    |
| OAuth2               | ✅       | ✅                               | ❌                                     | ✅                                   | ❌                                    |
| PASETO               | ✅       | ❌                               | ❌                                     | ❌                                   | ❌                                    |
| Flexible config      | ✅       | ❌                               | ❌                                     | ❌                                   | ❌                                    |
| Modularity           | ✅       | ❌                               | ❌                                     | ❌                                   | ❌                                    |

