Metadata-Version: 2.4
Name: jamlib
Version: 3.1.2
Summary: Simple and universal library for authorization.
Author-email: Makridenko Adrian <adrianmakridenko@duck.com>, Ksenia Travnikova <kseniatravnikova@duck.com>
License: Apache-2.0
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/blob/master/CHANGELOG.md
Keywords: Authentication,Backend,JWT,Sessions,OTP,TOTP,OAuth2,Litestar,FastAPI,Starlette,Flask
Classifier: License :: OSI Approved :: Apache Software 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.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.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: cryptography>=48.0.0
Provides-Extra: cli
Requires-Dist: click>=8.3.1; extra == "cli"
Provides-Extra: redis
Requires-Dist: redis>=7.3.0; extra == "redis"
Provides-Extra: json
Requires-Dist: tinydb>=4.8.2; extra == "json"
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0.3; extra == "yaml"
Provides-Extra: toml
Requires-Dist: toml>=0.10.2; extra == "toml"
Provides-Extra: litestar
Requires-Dist: litestar>=2.21.1; extra == "litestar"
Provides-Extra: starlette
Requires-Dist: starlette>=0.52.1; extra == "starlette"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.135.1; 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)

![Python Version](https://img.shields.io/badge/Python-3.10+-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)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/lyaguxafrog/jam)
[![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)
* Changelog: [CHANGELOG.md](https://github.com/lyaguxafrog/jam/blob/master/CHANGELOG.md)


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

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

jam = Jam(config="config.toml")

jwt = jam.jwt_create({"user": 1})
session_id = jam.session_create(session_key="username", data={"user": 1})
otp_code = jam.otp_code(secret="3DB7FOAOFBCI3WFDRE7EPF43CA")
```

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

* [JWT](https://jam.makridenko.ru/usage/jwt/)
* [PASETO](https://jam.makridenko.ru/usage/paseto/)
* [Server side sessions](https://jam.makridenko.ru/usage/sessions/)
* [OTP](https://jam.makridenko.ru/usage/otp/)
* [OAuth2](https://jam.makridenko.ru/usage/oauth2/)

### Framework integrations

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

* [FastAPI](https://jam.makridenko.ru/framework_integrations/fastapi)
* [Starlette](https://jam.makridenko.ru/framework_integrations/starlette)
* [Litestar](https://jam.makridenko.ru/framework_integrations/litestar)
* [Flask](https://jam.makridenko.ru/framework_integrations/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 | ✅     | ❌                               | ❌                                    | ❌                                  | ❌                                   |
| PASETO                | ✅     | ❌                               | ❌                                    | ❌                                  | ❌                                   |
| Server side sessions  | ✅     | ✅                               | ❌                                    | ❌                                  | ❌                                   |
| OTP                   | ✅     | ❌                               | ❌                                    | ❌                                  | ✅                                   |
| OAuth2                | ✅     | ✅                               | ❌                                    | ✅                                  | ❌                                   |
| Flexible config       | ✅     | ❌                               | ❌                                    | ❌                                  | ❌                                   |
| Modularity            | ✅     | ❌                               | ❌                                    | ❌                                  | ❌                                   |
