fluffychat/.github/instructions/matrix-auth.instructions.md
wcjord 473ffbaf24
docs: writing assistance redesign design spec (#5655) (#5696)
* "docs: writing assistance redesign design spec (#5655)

Add comprehensive design doc for the WA redesign:
- AssistanceRing replaces StartIGCButton (segmented ring around Pangea icon)
- Background highlights with category colors (not red/orange error tones)
- Simplified match lifecycle: open → viewed → accepted (no ignore)
- Persistent span card with smooth transitions between matches
- Send always available, no gate on unresolved matches

Remove superseded design docs (SPAN_CARD_REDESIGN_FINALIZED.md,
SPAN_CARD_REDESIGN_Q_AND_A.md, choreographer.instructions.md)."

* feat: replace ignored status with viewed status, initial updates to span card

* resolve merge conflicts

* rebuild input bar on active match update to fix span hightlighting

* cleanup

* allow opening span cards for closed matches

* no gate on sending, update underline colors

* animate span card transitions

* initial updates to add segmented IGC progress ring

* update segment colors / opacities based on match statuses

* use same widget for igc loading and fetched

* more segment animation changes

* fix scrolling and wrap in span card

* better disabled color

* close span card on assistance state change

* remove print statements

* update design doc

* cleanup

---------

Co-authored-by: ggurdin <ggurdin@gmail.com>
2026-02-25 13:07:53 -05:00

79 lines
2.7 KiB
Markdown

---
applyTo: "**/.env,**/assets/.env*"
---
# Matrix Auth — Staging Test Tokens
How to obtain a Matrix access token for staging API testing (choreo endpoints, Synapse admin API, Playwright login, etc.).
## Credentials
Staging test credentials live in `client/.env`:
- `STAGING_TEST_EMAIL` — email address
- `STAGING_TEST_USER` — full Matrix user ID (e.g. `@wykuji:staging.pangea.chat`)
- `STAGING_TEST_PASSWORD` — password
Read these values from the file at runtime. **Never hardcode credentials in skills, scripts, or chat output.**
## Get a Matrix Access Token
```sh
curl -s -X POST 'https://matrix.staging.pangea.chat/_matrix/client/v3/login' \
-H 'Content-Type: application/json' \
-d '{
"type": "m.login.password",
"identifier": {"type": "m.id.user", "user": "<USERNAME_WITHOUT_@_OR_DOMAIN>"},
"password": "<STAGING_TEST_PASSWORD>"
}' | python3 -m json.tool
```
The response contains `access_token`, `user_id`, `device_id`, and `home_server`.
### Extracting the token programmatically
```sh
# Read creds from client/.env
STAGING_USER=$(grep STAGING_TEST_USER client/.env | sed 's/.*= *"//;s/".*//' | sed 's/@//;s/:.*//')
STAGING_PASS=$(grep STAGING_TEST_PASSWORD client/.env | sed 's/.*= *"//;s/".*//')
# Login and extract token
MATRIX_TOKEN=$(curl -s -X POST 'https://matrix.staging.pangea.chat/_matrix/client/v3/login' \
-H 'Content-Type: application/json' \
-d "{\"type\":\"m.login.password\",\"identifier\":{\"type\":\"m.id.user\",\"user\":\"$STAGING_USER\"},\"password\":\"$STAGING_PASS\"}" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
echo "$MATRIX_TOKEN"
```
## Use the Token
### Choreo API
Choreo requires **both** the Matrix token and the API key (from `CHOREO_API_KEY` in `client/.env`):
```sh
curl -s 'https://api.staging.pangea.chat/choreo/<endpoint>' \
-H "Authorization: Bearer $MATRIX_TOKEN" \
-H 'api-key: <CHOREO_API_KEY>'
```
### Synapse Client-Server API
```sh
curl -s 'https://matrix.staging.pangea.chat/_matrix/client/v3/joined_rooms' \
-H "Authorization: Bearer $MATRIX_TOKEN"
```
### Synapse Admin API
The test account is **not** a server admin. For admin endpoints, use the bot account or a real admin token.
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| `M_FORBIDDEN` | Token expired or invalidated | Re-run the login curl to get a fresh token |
| `M_UNKNOWN_TOKEN` | Token from a different homeserver or old session | Confirm you're hitting `matrix.staging.pangea.chat` |
| `Could not validate Matrix token` from choreo | Missing `api-key` header | Add both `Authorization` and `api-key` headers |
| `M_USER_DEACTIVATED` | Test account was deactivated | Re-register or use a different test account |