bastion/mobile-connect
Skill8 starsChanged 4 months agoMITView on GitHub
Generates one-time connection tokens for the Bastion mobile app, manages device JWT lifecycle, and handles device revocation.
In this repository17 other files it gives its agents.
- bastion/agentskills-installSkill
- bastion/agentskills-publishSkill
- bastion/calendarSkill
- bastion-pet-packSkill
- bastion/channel-scaffoldSkill
- bastion/crisis-modeSkill
- bastion/life-logSkill
- mcporterSkill
- bastion/mesh-connectSkill
- bastion/onboardingSkill
- bastion/output-validatorSkill
- bastion/persona-engineSkill
- bastion/proactive-engineSkill
- bastion/self-improvingSkill
- bastion/skill-writerSkill
- bastion/weekly-reviewSkill
- bastion/weight-systemSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 78
If the user types /connect-app multiple times, each call generates a new independent token
- Very specific: line 79
If the token expires before the user enters it, they must run /connect-app again
- Distinctive: line 80
If a device name is already connected, exchanging a new token with the same name overwrites the previous entry
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
bastion/mobile-connect
Connects the Bastion mobile app (iOS/Android) to the user's self-hosted Bastion instance using a secure one-time token exchange flow.
Triggers
| Trigger | Action |
/connect-app | Generate a one-time token (BAST-XXXX-XXXX) valid for 5 minutes and display it (plus QR code) for the user to enter in the mobile app |
/devices | List all currently connected devices with name and connection timestamp |
/revoke {device_name} | Immediately revoke the JWT for the specified device |
Flow: /connect-app
1. User types /connect-app in Telegram/WhatsApp
2. Bastion calls generateConnectToken() → BAST-XXXX-XXXX
3. Token is stored in pendingTokens with 5-minute TTL
4. Bastion displays the token as text + QR code
5. User opens the mobile app and enters the token
6. App sends POST /auth/exchange { token, device_name }
7. Bastion validates TTL, deletes token immediately (one-time use)
8. Bastion generates JWT (exp: 90 days) and returns it
9. App stores JWT in keychain (iOS) / keystore (Android)
10. Connection established — app uses JWT for all subsequent requestsFlow: /devices
1. User types /devices
2. Bastion calls GET /devices
3. Returns list of connected (non-revoked) devices with name and connected_at
4. Bastion formats and displays the list to the userFlow: /revoke {device_name}
1. User types /revoke my-iphone
2. Bastion calls DELETE /devices/my-iphone
3. Device is added to the in-memory revocation blocklist immediately
4. Any subsequent request using that device's JWT is rejected with 401
5. Bastion confirms revocation to the userSecurity Notes
- Tokens are one-time use: deleted immediately upon successful exchange
- Token TTL is 5 minutes — expired tokens are rejected
- JWT_SECRET is read from environment variable, never hardcoded
- JWTs expire after 90 days; users must reconnect after expiry
- Revocation is immediate and in-memory (survives until process restart)
- The mobile app must store the JWT in the platform secure storage (keychain/keystore)
API Endpoints
| Method | Path | Description |
POST | /auth/exchange | Exchange one-time token for JWT |
GET | /devices | List connected devices |
DELETE | /devices/:device | Revoke a device |
Edge Cases
- If the user types
/connect-appmultiple times, each call generates a new independent token - If the token expires before the user enters it, they must run
/connect-appagain - If a device name is already connected, exchanging a new token with the same name overwrites the previous entry
- Revocation persists only in memory — a process restart clears the blocklist (production deployments should use Redis)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

