Metadata-Version: 2.4
Name: warp-server
Version: 0.1.0
Summary: WARP signature server API
Requires-Python: >=3.12
Requires-Dist: aiosqlite>=0.20
Requires-Dist: click>=8.1
Requires-Dist: fastapi>=0.115
Requires-Dist: flatbuffers>=25.12.19
Requires-Dist: pydantic-settings>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: sqlalchemy[asyncio]>=2.0
Requires-Dist: uvicorn[standard]>=0.30
Description-Content-Type: text/markdown

# warp-server

FastAPI implementation of the WARP signature server API.

## Development

```bash
git submodule update --init  # fetch warp/ schemas
uv sync
uv run warp-server        # start dev server on :8000
uv run pytest              # run tests
```

### Regenerating FlatBuffer bindings

The Python FlatBuffer bindings are generated from the `.fbs` schemas in `warp/`. To regenerate:

```bash
brew install flatbuffers   # if not already installed
flatc --python -o src/warp_server/gen_flatbuffers warp/*.fbs
```

## Bootstrap: Create a User with an API Key

The server uses Bearer token auth via API keys. Use the `warp-ctl` CLI to manage users and keys.

### Quick bootstrap (admin + key in one step)

```bash
uv run warp-ctl bootstrap
# Created admin user id=1 username=admin
# API key: <key>
```

Options: `--email`, `--username` to customize the admin account.

### Managing users

```bash
# create a regular user
uv run warp-ctl user create --email alice@example.com --username alice

# create an admin
uv run warp-ctl user create --email ops@example.com --username ops --role Admin

# list all users
uv run warp-ctl user list

# delete a user
uv run warp-ctl user delete 2
```

### Managing API keys

```bash
# create a key for user id 1
uv run warp-ctl key create --user-id 1 --name dev-key

# list all keys (or filter by --user-id)
uv run warp-ctl key list
uv run warp-ctl key list --user-id 1

# revoke a key
uv run warp-ctl key revoke 3
```

### Managing sources

```bash
# create a source owned by user 1
uv run warp-ctl source create --name my-signatures --user-id 1

# list sources
uv run warp-ctl source list
```

### Using the API key

```bash
# verify auth
curl -H "Authorization: Bearer <key>" http://localhost:8000/api/v1/users/me

# create a source via the API
curl -X POST http://localhost:8000/api/v1/sources \
  -H "Authorization: Bearer <key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-source", "user_ids": []}'
```
