Expand description
Mini App Permissions System
This module handles optional permissions that Mini Apps can request. Permissions are declared when publishing an app and must be explicitly granted by users before they take effect.
§Security Model
By default, ALL sensitive permissions are denied via the Permissions-Policy header. Apps can request specific permissions in their metadata, but users must:
- Be prompted on first launch (if any permissions are requested)
- Explicitly grant each permission
- Have the ability to toggle permissions at any time in App Details
§Available Permissions
microphone- Access to microphone for voice chat, recording, etc.camera- Access to camera for video calls, photos, etc.geolocation- Access to device locationclipboard-read- Read from clipboardclipboard-write- Write to clipboardfullscreen- Allow fullscreen modeautoplay- Allow media autoplaydisplay-capture- Screen capture via getDisplayMedia()midi- Web MIDI API for musical instrumentspicture-in-picture- Picture-in-Picture video modescreen-wake-lock- Prevent screen from sleepingspeaker-selection- Select audio output deviceaccelerometer- Device acceleration sensorgyroscope- Device orientation/rotation sensormagnetometer- Compass/magnetic field sensorambient-light-sensor- Ambient light level sensorbluetooth- Web Bluetooth API
§Nostr Event Tag Format
Permissions are stored as a tag in the marketplace event:
["permissions", "microphone,camera,fullscreen"]The value is a comma-separated list of permission names.
Structs§
- Permission
Info - Permission info for frontend display
Enums§
- Mini
AppPermission - Available permissions that Mini Apps can request
Functions§
- build_
isolated_ permissions_ policy - Permissions-Policy for an app served cross-origin isolated: the user’s
grants plus
cross-origin-isolated=(self). Chromium honours()and would switch isolation (and with it SharedArrayBuffer) back off. - build_
permissions_ policy - Build a dynamic Permissions-Policy header based on granted permissions
- get_
all_ permission_ info - Get all available permissions as PermissionInfo for frontend display
- parse_
permissions - Parse a comma-separated string of permissions into a set