Metadata-Version: 2.4
Name: cattle_grid
Version: 0.5.3
Summary: Middleware for the Fediverse
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: alembic>=1.16.5
Requires-Dist: almabtrieb>=0.2
Requires-Dist: argon2-cffi>=23.1.0
Requires-Dist: asyncpg>=0.30.0
Requires-Dist: bleach>=6.2.0
Requires-Dist: bovine>=0.5.13
Requires-Dist: dynaconf>=3.2.6
Requires-Dist: fastapi>=0.115.4
Requires-Dist: faststream[cli,rabbit]>=0.5.25
Requires-Dist: fediverse-pasture>=0.2.14
Requires-Dist: jinja2>=3.1.6
Requires-Dist: muck-out
Requires-Dist: python-multipart>=0.0.17
Requires-Dist: quart>=0.19.6
Requires-Dist: sqlalchemy-utils>=0.41.2
Requires-Dist: sqlalchemy[asyncio]>=2.0.36
Requires-Dist: tomli-w>=1.0.0
Requires-Dist: uuid6>=2024.7.10
Provides-Extra: cache
Requires-Dist: redis>=5.2.1; extra == 'cache'
Description-Content-Type: text/markdown

# cattle_grid

THIS README needs to be updated for cattle_grid 0.2.0

cattle_grid is meant to simplify handling authentication in server to
server communication of the Fediverse. cattle_grid checks the HTTP
signatures based on the headers. For this public keys are retrieved
and cached.

For installation instructions see the [documentation](https://bovine.codeberg.page/cattle_grid/).

## Running

After creating a configuration file, one can run cattle_grid via

```bash
poetry run uvicorn cattle_grid:create_app
```

## Development

One can run the pytest tests via

```bash
poetry install
poetry run pytest
```

## Development with Fediverse pasture

In your Funfedi.dev directory (see [here](https://funfedi.dev/testing_tools/verify_actor/)
for details), run

```bash
cd fediverse-pasture
docker compose --file pasture.yml up pasture_verify_actor
```

Now in the cattle grid directory, run

```bash
poetry run python -mcattle_grid.config --actor_id http://cattle_grid/actor
```

to create a `cattle_grid.toml` file. Then start the docker containers via

```bash
docker compose up
```

By opening [http://localhost:2909/?actor_uri=jskitten@cattle_grid_demo](http://localhost:2909/?actor_uri=jskitten%40cattle_grid_demo), you should then be able to view the verify actor result. By refreshing the page and inspecting the log files, you can also check that the requests only ran once.

### Creating an user

By running

```bash
docker compose run runner
```

one can start a shell in the docker environment. By then running in it

```bash
curl abel/admin/create -X POST -F username=name -F password=secret
```

one can create the user with handle `@name@abel`.

## Running GUI tests with the pasture

Start mastodon accessible through your browser

```bash
cd fediverse-pasture
docker compose --file mastodon42.yml --profile nginx up
```

See [Fun Fediverse Development](https://funfedi.dev/fediverse_pasture/applications/mastodon_4_2/) for instructions.

Then you can open [mastodon42web](http://mastodon42web) and lookup `jskitten@cattle_grid_demo`.
When you send a message to this kitten, it should reply with a meow, e.g.

![Kitten meows](mastodon.png)
