3.6 KiB
3.6 KiB
Hermes ProtonMail Plugin — Implementierungsplan
Ziel: Ein natives Hermes-Plugin für ProtonMail — direkte REST/gPRC API, kein Bridge, kein GUI. Headless auf Debian VPS. End-to-End-Verschlüsselung in Python, vollständig in Hermes integriert.
Zeithorizont: Langfristig, iterativ. Keine Eile, aber saubere Fundamente.
Architektur
┌─────────────────────────────────────────┐
│ Hermes Gateway (Agent Core) │
│ └── Platform Adapter: ProtonMail │
│ ├── Auth Manager (SRP-6a) │
│ ├── Crypto Engine (OpenPGP) │
│ ├── Sync Engine (Mail-Sync) │
│ └── Notifier (Push → Hermes) │
└─────────────────────────────────────────┘
│
▼ HTTPS
┌─────────────────────────────────────────┐
│ ProtonMail API (mail.proton.me) │
│ ├── REST: Auth, Messages, Labels │
│ ├── gRPC: Events (neue Mail-Push) │
│ └── Key Server: Public Key Discovery │
└─────────────────────────────────────────┘
Phase 1: Auth POC — "Kann ich mich anmelden?"
- Setup —
python3-venv, dependencies (bcrypt,python-gnupg,requests) - SRP-Auth —
proton-python-clientoderproton-srp, Login mit Credentials - Erste API-Calls —
GET /core/v4/users,GET /mail/v4/messages
Erfolg: Script auf VPS meldet sich an, API antwortet.
Phase 2: Crypto — "Kann ich lesen?"
- Private Key Export — Via Web/Bridge einmalig exportieren
- PGPy Integration — Key laden, mit Passphrase entsperren
- Entschlüsselung — Mail-Body + Attachments testen
Erfolg: Verschlüsselte Mail wird lesbar entschlüsselt.
Phase 3: Sync Engine — "Wie Gmail-API, aber für Proton"
- SQLite-Index — Schema:
conversations,messages,attachments,labels - Message Sync — Inkrementell mit
last_sync_time - Composer — Draft erstellen, verschlüsseln, senden via
POST /mail/v4/messages - Push/Poll — gRPC Events oder intelligentes Polling (2-Min-Intervall)
Erfolg: Hermes kann Mails lesen und schreiben.
Phase 4: Hermes Plugin — "Der Agent sieht Proton"
- Plugin-Struktur —
plugin.yaml,__init__.py,adapter.py - Gateway-Integration —
BasePlatformAdapterimplementieren - Daemon/Cron —
systemd --userService + Hermes-interner Cronjob
Erfolg: ProtonMail erscheint als aktive Plattform in Hermes.
Phase 5: Produktion — "Läuft monatelang"
- Resilienz — Token-Refresh, Retry, Backoff
- State Management — Persistent in
~/.local/share/hermes-proton/ - Security — Private Key nur im RAM, Memory-Clear
- Logging — JSON nach
~/.hermes/logs/proton.log
Erfolg: 30 Tage Dauerbetrieb ohne manuellen Eingriff.
Risiken
| Risiko | Mitigation |
|---|---|
| Proton ändert API | Version-Pinning der Client-Lib |
| PGPy unterstützt Key-Format nicht | Fallback auf python-gnupg + gpg |
| Rate-Limits | Backoff, Batching, Business-Tarif |
| Kein gRPC Events | Polling-Fallback (Rocket.Chat-Muster) |
| 2FA TOTP headless | Einmal-Setup, RefreshToken ist langlebig |
Plan erstellt am 2026-05-05. Nächste Aktualisierung nach Abschluss Phase 1.