clio/clio-android/.claude/CLAUDE.md

88 lines
2.5 KiB
Markdown
Raw Normal View History

2026-05-19 19:48:13 -04:00
# Phone Recorder Server
Encrypted audio recording server with transcript viewing capabilities.
## Quick Start
```bash
cd server
nix develop # or activate venv
uv run python main.py
```
Server runs on port 8000 by default.
## Project Structure
```
.
├── app/ # Android app (Kotlin, Android Studio)
├── server/ # FastAPI server (Python)
│ ├── main.py # API endpoints
│ ├── crypto.py # PyNaCl decryption, keypair management
│ ├── database.py # SQLite for recordings metadata
│ ├── importer.py # Import transcriptions from batch processing
│ ├── cli.py # CLI tools
│ ├── config.py # Paths, ports
│ ├── keys/ # Server keypair (auto-generated)
│ └── recordings/ # Decrypted audio files
└── test_recordings/ # Test data
```
## Key Commands
```bash
# Run server
cd server && uv run python main.py
# Run tests
cd server && python test_crypto.py
cd server && python test_integration.py
# CLI tools
cd server && uv run python cli.py --help
```
## API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/health` | GET | Health check |
| `/api/v1/public-key` | GET | Get server public key (Base64) |
| `/api/v1/recordings/upload` | POST | Upload encrypted file from phone |
| `/api/v1/recordings` | GET | List recordings with transcripts |
| `/api/v1/recordings/{id}` | GET | Get recording details |
| `/api/v1/recordings/{id}/audio` | GET | Stream audio file |
| `/api/v1/import/transcription` | POST | Import transcription JSON |
| `/api/v1/highlights` | GET/POST | Manage highlights |
## Security Model
- Phone encrypts with server's public key (sealed box / X25519 + XSalsa20-Poly1305)
- Server decrypts with private key on upload
- Phone never stores unencrypted audio
- Files use SREC format (chunked encryption for large files)
## Frontend
The frontend is a separate static React app in `/work/projects/view_recordings/designer_export/`:
```bash
cd /work/projects/view_recordings/designer_export
python -m http.server 3000
# Open http://localhost:3000/RecordingsViewer.html
```
## Dependencies
- Python 3.x with uv
- PyNaCl (libsodium bindings)
- FastAPI + uvicorn
- SQLite (via database.py)
## Important Files
- `description.md` - Detailed architecture documentation
- `todo.md` - Future features and known limitations
- `server/keys/` - Contains server keypair (do not commit private key)