Skip to content

Apps

Manage app permissions, identity grants, and contact visibility. Used primarily by the Wish Dashboard.

App lifecycle

app.list (void): App[]

List all registered apps with their permissions.

app.remove (wsid: Buffer): bool

Remove an app and all its permissions.

Identity grants

Apps are sandboxed — they only see identities explicitly granted to them.

app.grantIdentity (wsid: Buffer, uid: Buffer): bool

Grant an identity to an app. The app will see this identity in identity.list and can receive peers for it.

app.revokeIdentity (wsid: Buffer, uid: Buffer): bool

Revoke an identity from an app.

Contact visibility

By default, apps cannot see any contacts. Contact visibility must be configured per app, per identity.

app.setContacts (wsid: Buffer, uid: Buffer, settings: { mode, contacts? }): bool

Set contact visibility for an app.

Modes:

  • 'none' — no contacts visible (default)
  • 'all' — all contacts visible
  • 'allow' — only listed contacts visible
  • 'deny' — all contacts except listed ones
typescript
await app.request('app.setContacts', [wsid, uid, { mode: 'all' }]);

// Only specific contacts
await app.request('app.setContacts', [wsid, uid, {
    mode: 'allow',
    contacts: [bobUid, carolUid]
}]);

WARNING

Contact visibility changes only take effect on new connections. Existing connections won't see updated permissions until reconnected.

app.getContacts (wsid: Buffer, uid: Buffer): { mode, contacts }

Get contact visibility settings for an app.

Admin privileges

app.setAdmin (wsid: Buffer, admin: bool): bool

Set admin privileges for an app.

Peer inspection

app.peers (wsid: Buffer): Peer[]

List peers currently visible to an app.

Admin request routing

admin.response (id: int, success: bool, message?: string): bool

Respond to an admin request from a regular app. See admin.request for the app-facing side.