Extensions
Driftleaf extensions are local JavaScript files that run in isolated windows and use a small, read-only API to access vault information. Installed extension source and permissions are stored in the encrypted vault manifest.
Install and run an extension
- Open Extensions from the sidebar and choose Install JavaScript extension.
- Select a
.jsfile smaller than 512 KB. - Review the source and grant only the access it needs. All permissions start disabled.
- Choose Run to open the extension in its own window.
Removing an extension closes its open windows. Permission changes take effect on the next API request.
Extension API
Extensions receive a dedicated window.driftleafExtension object through a restricted preload bridge. Calls are asynchronous:
const notes = await window.driftleafExtension.listNotes();
const content = await window.driftleafExtension.readNote(notes[0].id);
const graph = await window.driftleafExtension.graph();
const databases = await window.driftleafExtension.listDatabases();
const data = await window.driftleafExtension.readDatabase(databases[0].id);
listNotes()returns note IDs, titles, folder paths, and update timestamps.readNote(id)returns the decrypted Markdown content for a note.graph()returns note metadata, resolved links, and mentions.listDatabases()returns databases explicitly selected for the extension.readDatabase(id)returns properties and rows for an explicitly selected database. Relation properties and dependent rollups are omitted unless their related database is selected too.
listNotes() and readNote() require the Read note titles, folders, and contents permission. graph() requires Read note graph and links. Database calls require Read selected databases and a separate grant for each database. Calls without permission fail with an error.
The API is read-only. Extensions cannot write notes or databases, access application settings or filesystem paths, or call arbitrary IPC.
Isolation and trust
Extension windows use Electron sandboxing, context isolation, no Node integration, a unique non-persistent session, and a restrictive content security policy. Network connections, external resources, popups, and navigation are disabled. The extension renderer does not receive Driftleaf's regular application preload or unrestricted vault API; the main process checks each request against the extension's current encrypted permissions.
Extensions are still executable code. Review source before installing, and grant only the capabilities required. A malicious extension with note access can read and process data covered by that permission while it is running. Isolation does not protect against vulnerabilities in Electron or the operating system.
Community extensions
The optional community gallery lists stable public releases from Driftleaf-Extensions. It previews JavaScript source before installation; installed community extensions begin with no permissions. See Community Gallery for extension releases, templates, and network details.