API Reference
postMessage Protocol
Communication protocol between Universe Shell and modules via window.postMessage.
postMessage Protocol
Modules communicate with the Universe Shell via the browser's window.postMessage API. This is the bridge between the parent window (Shell) and the iframe (your module).
Message Types
Module → Shell
| Message Type | Description | Payload |
|---|---|---|
REQUEST_AUTH_SESSION | Request JWT tokens from Shell | none |
navigate | Navigate Shell to a path | { path: string } |
Shell → Module
| Message Type | Description | Payload |
|---|---|---|
AUTH_SESSION | JWT tokens for Supabase | { access_token, refresh_token } |
Flow: Authentication
Flow: Navigation
URL Parameters
The Shell passes context via iframe URL query parameters:
| Parameter | Type | Description |
|---|---|---|
org_id | UUID | Organization ID for the current tenant |
Example iframe URL:
Security Notes
- Messages use
'*'as target origin in the current implementation - For enhanced security, validate
event.originagainst trusted Shell domains - Never trust message data without validation
- JWT tokens are short-lived; Supabase handles refresh automatically