Migrate Matrix auth to appservice (MAS-durable)

Replace password login + password-UIA cross-signing with appservice
as_token auth and MSC4190 device creation, so the bot survives the
Matrix Authentication Service (MAS) migration that removes m.login.password
and UIA.

- internal/bot/client.go: NewClient uses AS_TOKEN, SetAppServiceUserID,
  whoami validation, cryptohelper MSC4190 device create; drop device.json
  (crypto store persists device id); cross-signing best-effort/soft-fail.
- main.go: Config.Password -> ASToken (reads AS_TOKEN).
- internal/util/auth.go: deleted (password login dead in a MAS world).
- Bump mautrix-go v0.28.0 -> v0.28.1.
- registration.yaml.example + README/.env.example: appservice setup docs.
This commit is contained in:
prosolis
2026-07-03 15:12:47 -07:00
parent c07d228be6
commit 48330be3d5
8 changed files with 177 additions and 229 deletions

View File

@@ -91,7 +91,14 @@ Everything is configured through environment variables or a `.env` file.
|----------|-------------|
| `HOMESERVER_URL` | Matrix homeserver URL, e.g. `https://matrix.org` |
| `BOT_USER_ID` | Bot's Matrix user ID, e.g. `@gogobee:matrix.org` |
| `BOT_PASSWORD` | Bot's Matrix password |
| `AS_TOKEN` | Appservice `as_token` from `registration.yaml` (see below) |
GogoBee authenticates as a Matrix **application service** rather than with a
password. The `as_token` is a homeserver-level credential that never expires and
is unaffected by Matrix Authentication Service (MAS) removing password login and
UIA. Device E2EE keys are created via MSC4190. See
[`registration.yaml.example`](registration.yaml.example) for the homeserver-side
setup (register the appservice, enable `msc4190_enabled`, then set `AS_TOKEN`).
### Core (optional)