Manifest and permissions
A plugin consists of two parts: a manifest, which says what the plugin is and what it is allowed to do, and the code that implements it. This page describes both, and explains the permissions in detail. The page Your first plugin shows them in use, and is the better place to begin.
The manifest
Section titled “The manifest”The manifest is a JSON file. The following example is the manifest of the plugin that Your first plugin builds:
{ "id": "com.example.hello", "name": "Hello", "version": "1.0.0", "minCoreVersion": "1.0.0", "description": "Shows a message when the app starts.", "author": "Your name", "permissions": ["ui"], "platforms": ["web"], "entry": "index.ts"}The fields have the following meaning.
| Field | Meaning |
|---|---|
id |
The unique name of the plugin. It is written like a web address in reverse order, for example com.example.protect-tagged, and may contain lowercase letters, digits, dots and dashes, up to 80 characters. |
name |
The name that Settings displays, from 1 to 60 characters. |
version |
The version of the plugin, written as three numbers, for example 1.0.0. |
minCoreVersion |
The oldest version of the core, the engine of the app, that the plugin supports. When the app is older, the plugin stays turned off and Settings tells the person which version is required. |
description |
A short description of the plugin, up to 500 characters. |
author |
The name of the author or of the company. |
permissions |
The actions that the plugin asks permission to perform, up to 32. See “Permissions” below. |
platforms |
Where the plugin runs: web, ios, or both. The web platform covers the browser and the Mac app. |
entry |
The file in which the code of the plugin starts. |
publisher |
Optional. A public key that identifies who made the plugin. See “Signing a plugin” below. |
The code
Section titled “The code”The smallest possible plugin looks like this:
import { definePlugin, type PluginContext } from '@tessera/plugin-sdk';
export default definePlugin({ onload(ctx: PluginContext) { // everything registered through ctx is released when the plugin is disabled }, onunload() {},});definePlugin receives an object with an onload function. The app calls onload once, when the plugin is turned on, and passes it the ctx object. Everything that the plugin registers through ctx, such as hooks and commands, is removed automatically when the plugin is turned off, so the plugin does not need to remove it.
The onunload function is optional. The app calls it just before turning the plugin off, which makes it a suitable place to release resources that the plugin created without using ctx.
A plugin runs in an isolated environment. It cannot access the page, the file system or the network, except through ctx.
Permissions
Section titled “Permissions”A plugin may only perform the actions that its manifest declares. When the person installs the plugin, the app displays the list of permissions and asks for approval. If a later version of the plugin requests additional permissions, the app asks again.
When the code calls something that requires a permission the plugin does not hold, the call throws an error named PermissionDenied. A plugin can catch this error, and the app also records it in the diagnostics of the plugin.
| Permission | What it allows |
|---|---|
read |
Reading the library (ctx.state and ctx.query), registering hooks (ctx.hooks and ctx.editing), watching values (ctx.observe) and listening to events (ctx.notifications.subscribe). |
write:rows |
Changing rows, with ctx.dispatch, with the changes that hooks request afterwards, and with commands that change rows. |
write:outlines |
The same for outlines, areas and saved searches. |
write:settings |
Changing the settings of the library. |
amend:outside |
Replacing a proposed change that affects things which do not belong to the plugin. Without this permission, such a call throws PermissionDenied. |
notifications |
Sending events with ctx.notifications.post. The name of an event must begin with the id of the plugin. |
assets:read, assets:write |
Reading and writing attachments, such as images. |
ui |
Asking the person questions and adding elements to the screen: confirm, prompt, pick, password, notice, alert, panel, statusItem, sidebarEntry, outlineIcon, outlineType and decorate. |
jobs |
Running work in the background with ctx.jobs. |
crypto |
Locking and unlocking text with a key made from a password, or with a random key that can be cut in parts that are all needed (ctx.crypto). |
crypto:friends |
Locking text for the devices of the person or for friends, and signing text with this device (ctx.crypto.sealTo, open, sign and verify). The plugin names the recipients and never handles a key. The manifest must declare a publisher, unless the plugin ships with the app. |
audit |
Reading the signed record of the changes made to an outline (ctx.audit). |
audit:grant |
Recording that the key of a shared outline was given to certain devices. Only a fingerprint of the key is recorded, never the key itself. |
audit:write |
Writing a note in the signed record of an outline (ctx.audit.record). The app writes the name of the plugin in the note, so a plugin writes only in its own name. |
net:<domain> |
Fetching from a single website over https (ctx.net.fetch). The domain follows net:, for example net:api.example.com. |
Signing a plugin
Section titled “Signing a plugin”A manifest may contain a publisher: a public key of 43 characters, made of letters, digits, - and _. When a publisher is present, the plugin file carries the publisher’s signature of the manifest and of the code, and the app refuses any file whose signature does not match.
A plugin that requests crypto:friends must declare a publisher. The id of a plugin is only a claim that the plugin makes about itself, and anyone can copy it, whereas a signature made with a private key cannot be produced by anyone else.
There is one exception: a plugin that ships with the app. The app installs it itself, and tells the core so, which no plugin file is able to do. It needs no publisher and no signature, and what it locks and signs belongs to the app and to that id: no plugin from a publisher, even with the same id, opens or forges it.
