Permissions
Every permission a Lightair package can declare, which kinds of package may use each, optional permissions asked for at run time, and network hosts for widgets.
In short
- A package declares what its code or pages may reach in
permissions; the install screen lists each in plain words. - Widgets and templates may only declare
network:hosts. Shaders declare none. Only helpers may ask forfull-access. - Put what's needed only for some features in
optional_permissionsand ask withpermissions.requestwhen the feature is turned on. - People can take any permission back in the Packages panel; a call that needs it is then refused.
A package reaches nothing outside its own folder unless it declares a permission. Lightair shows every declared permission on the install screen, checks each call against what the package holds at that moment, and records each use in its activity list.
Declare permissions
Section titled “Declare permissions”List them in lightair-package.json:
{ "permissions": ["chat.read", "network:api.example.com"], "optional_permissions": ["chat.write"]}Lightair refuses a manifest with a permission it doesn’t know, saying why. Permissions a package’s tier can’t have are refused too:
- Data packages may declare only
network:hosts, and only when they hold a widget or a template (the hosts their web pages reach). - Shader packages may declare none.
- Scripts and helpers may declare the rest. Only a helper may declare
full-access.
Every permission
Section titled “Every permission”| Permission | What it allows (as the install screen says it) | Used by |
|---|---|---|
network:<host> |
Connect to that host. network:*.example.com covers example.com and its subdomains. |
Widget and template pages, scripts’ fetch, helpers |
network:* |
Connect to any website | Widget and template pages, scripts’ fetch, helpers |
network:localhost:<port> |
Talk to an app on this computer, on that port | Scripts’ fetch, helpers |
network.lan |
Talk to devices on your home network (private addresses, .local names) |
Scripts’ fetch, helpers |
network.lan.discovery |
Find devices on your home network (Bonjour/mDNS) | Helpers |
network.listen:<port> |
Accept connections on that port | Helpers |
network.listen:any |
Accept connections from other apps, on a free port Lightair picks | Helpers |
ipc:<name> |
Talk to another app through one local socket or named pipe | Helpers |
automation:<app id> |
Control that app (Apple Events, on macOS) | Helpers |
fs.read:picked |
Read files and folders the person picks | Scripts, helpers |
fs.write:picked |
Change files and folders the person picks | Helpers |
device.hid:<vendor id> |
Use control devices from that USB vendor (four hex digits, 0fd9) |
Helpers |
device.usb:<vendor id> |
Use USB devices from that vendor | Helpers |
device.midi |
Use MIDI devices | Helpers |
device.serial |
Use serial devices | Helpers |
device.bluetooth |
Use Bluetooth devices | Helpers |
screen.capture |
See your screen, through Lightair | Scripts (preview frames and scene thumbnails), helpers (screenshots, on macOS) |
chat.read |
Read your stream’s chat | Scripts, helpers |
chat.write |
Send messages to your stream’s chat | Scripts, helpers |
project.read |
Read your show | Scripts |
project.write |
Change your show | Scripts |
outputs.control |
Start and stop streaming and recording | Scripts |
notifications |
Show notifications | Scripts, helpers |
audio.levels |
See sound levels | Scripts, helpers |
hotkeys |
Use keyboard shortcuts | Scripts |
api.call |
Control Lightair (scenes, sources, outputs) through the Remote API’s methods | Helpers |
secrets |
Keep its own keys in the system’s keychain | Helpers |
full-access |
Run like any installed app, outside Lightair’s sandbox | Helpers |
full-access:<platform> |
The same on one platform only: macos, windows or linux |
Helpers |
Files are only ever the ones the person picks: fs.read and fs.write with anything other than
picked are refused. A host is a name such as api.example.com; write
network:localhost:<port> rather than network:localhost.
Which method of the Remote API a script may call with which permission is on Script plugins. How a helper’s permissions open its sandbox is on Native helpers.
Ask at run time
Section titled “Ask at run time”Permissions that only some features need go in optional_permissions. Nothing in it is granted at
install; the install screen lists them under “May ask later for”. When the person turns on a
feature that needs one, ask for it:
- A script calls
lightair.permissions.request(list, reason). It returns the optional permissions the package holds afterwards.lightair.permissions.release(list)gives some back, andlightair.permissions.has(permission)says whether it holds one. - A helper sends
permissions.requestwithpermissionsandreason, and gets backgranted.permissions.releasegives some back.
const held = lightair.permissions.request( ["chat.write"], "To thank new followers in chat");if (held.includes("chat.write")) { lightair.call("chat.send", { text: "Thanks for the follow!" });}Lightair shows the person a second screen with your reason, in your words, and only the permissions asked for. Rules:
- Only permissions in
optional_permissionscan be asked for; asking for another is an error. - Permissions it already holds aren’t asked again.
full-accesscan’t be optional: declare it inpermissionsor not at all.- Only scripts and helpers may have optional permissions.
- A request the person doesn’t answer within 10 minutes counts as a no.
Taking permissions back
Section titled “Taking permissions back”A package’s page in the Packages panel lists its permissions, each with a switch. Turning one off takes it back at once: calls that need it are refused with “This plugin doesn’t have the permission …”, and a running script or helper is restarted with what it holds now. Optional permissions show “Asks when needed” until granted. Removing every version of a package forgets what it was granted.
When a new version declares a permission the installed one didn’t, the install screen marks it “(new)”.
Network hosts for widgets
Section titled “Network hosts for widgets”A widget’s or template’s web page from a package may reach:
- its own page and its own files, served by Lightair;
- the hosts of the package’s granted
network:permissions (network:*: any).
Everything else the page asks for is refused, including network:localhost:<port> hosts. A
package with no network: permission gets no internet at all, so bundle fonts and pictures in the
widget’s folder instead of loading them from a CDN.
{ "contents": [{ "kind": "widget", "path": "widgets/weather" }], "permissions": ["network:api.open-meteo.com"]}A package the catalog withdraws reaches nothing, whatever it declared.