Metadata-Version: 2.1
Name: securely
Version: 0.2.0
Summary: This package will help you while authorization and authentication in fastapi
Home-page: https://github.com/coderxuz/securely
Author: Xursand
Author-email: coderxuz2009@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: passlib
Requires-Dist: authlib
Requires-Dist: bcrypt

# Source code:https://github.com/coderxuz/securely
# Securely

**Securely** is a Python package that helps with authentication and authorization in FastAPI applications.

## Installation

You can install the package via `pip`:

```bash
pip install securely
```

# Quick start
```markdown
from securely import Auth
from fastapi import FastAPI


from datetime import timedelta

app = FastAPI()

auth = Auth(
    secret_key="bla bla",
    access_token_expires=timedelta(days=1),
    refresh_token_expires=timedelta(days=7),
)

just_db = [{"username": "john", "password": "gdfdfgdgdrgdr"}]


@app.post("/login")
async def login(data: dict):
    new_user = {"username": data.get("username")}

    new_user["password"] = auth.hash_password(password=data.get("password"))

    just_db.append(new_user)

    tokens = auth.create_tokens(subject=new_user.get("username"))

    return tokens

```
