mIRC_mint_channel_token
Exchange the hub key (MOSADD_API_KEY) for a short-lived (5min), channel-scoped JWT. Returns { token, expires_in, channel_id, scope }. The token is safe to hand to a browser to open a WS via Sec-WebSocket-Protocol: mosadd.v1, bearer.<token>. The hub key NEVER leaves the server. Use this from any server-side route (Next.js /api/chat-token, Express, etc.) before showing chat in a browser. Required by LINEAR-2675/E6 to avoid leaking the hub key into CDN access logs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | No | Optional end-user id. Stamped onto messages as 'from'. Useful when one hub key fronts many end-users (relay topology). | |
| channel_id | Yes | Channel id — the JWT will be scoped to this channel only. Must match the WS upgrade path. |