reference/link-handler-spec.md
/link Handler Spec
Status: implemented in apps/web.
Goal
Support zero-manual onboarding from setup links generated by the server.
Examples:
- relay mode:
https://mino.ink/link?relayCode=...&relayUrl=... - direct mode:
https://mino.ink/link?serverUrl=...&apiKey=... - local built-in UI:
http://localhost:3000/link?... - local web dev:
http://localhost:5173/link?...
Required Params
- direct mode:
serverUrl,apiKey - relay mode:
relayCode, optionalrelayUrl
Required Flow
- Parse query params
- If relay mode, exchange code at relay (
POST /api/v1/pair/exchange) - Validate resolved
serverUrlandapiKey - Normalize
serverUrl - Verify key (
POST {serverUrl}/api/v1/auth/verify) - Mark setup complete (
POST {serverUrl}/api/v1/auth/link) - Persist linked profile locally
- Redirect to workspace
Security Requirements
- never log raw
apiKey - redact sensitive values in diagnostics
- strip
apiKey,relayCode, andrelayUrlfrom browser URL
Acceptance Criteria
- valid relay/direct links complete onboarding without manual input
POST /api/v1/auth/linkruns exactly once on successful first link- invalid links fail safely with manual fallback