Add token auto-refresh, device persistence, and cross-signing

Following gogobee's auth pattern: if MATRIX_BOT_PASSWORD is set, the bot
persists device credentials to device.json, validates tokens on startup,
re-logs in automatically when tokens expire, and bootstraps cross-signing
so the device shows as verified without manual emoji verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-03-17 18:35:23 -07:00
parent 0cfed504a1
commit d6c8d4f599
6 changed files with 682 additions and 31 deletions

View File

@@ -2,6 +2,8 @@
MATRIX_HOMESERVER_URL=https://matrix.example.com
MATRIX_BOT_USER_ID=@dealsbot:example.com
MATRIX_BOT_ACCESS_TOKEN=syt_...
# Optional: enables token auto-refresh, cross-signing, and device persistence
# MATRIX_BOT_PASSWORD=
MATRIX_DEALS_ROOM_ID=!roomid:example.com
# IsThereAnyDeal API key (optional — enables historical low detection and ITAD deals)
@@ -46,5 +48,5 @@ MAX_PRICE=20
# Send an intro message to the room on startup (true/false)
SEND_INTRO_MESSAGE=false
# Database path (inside the container, mount a volume for persistence)
DATABASE_PATH=/data/deals.db
# Database path
DATABASE_PATH=deals.db