Guides

Permissions

Allow the plugin's commands in a Tauri capability.

Tauri denies plugin commands until a capability allows them. Every command has an allow-<command> and a deny-<command> permission; default allows all of them.

src-tauri/capabilities/default.json
{
  "identifier": "default",
  "windows": ["main"],
  "permissions": ["core:default", "centrifugo:default"]
}

A window that only reads:

src-tauri/capabilities/viewer.json
{
  "identifier": "viewer",
  "windows": ["viewer"],
  "permissions": [
    "core:default",
    "centrifugo:allow-is-connected",
    "centrifugo:allow-get-connection-state",
    "centrifugo:allow-get-subscriptions",
    "centrifugo:allow-history",
    "centrifugo:allow-presence"
  ]
}

Events (centrifugo:*) are emitted to all windows and need no permission; a window needs core:event:default (part of core:default) to listen.

If you use the token bridge, keep allow-provide-token (and allow-sub-refresh for subscription tokens) in the window that answers need_token. In 0.2.0 centrifugo:default misses allow-provide-token, allow-add-subscription-with-options and allow-remove-all-subscriptions; on that version add them by hand.

The full list with descriptions: Permissions reference. Background: Tauri capabilities.