Plugin Development for the TLSNotary Browser Extension
This repository contains the boilerplate code for developing a plugin for the TLSNotary browser extension. Currently, the template includes a TypeScript-based plugin example that proves ownership of a Twitter profile.
TLSNotary's plugin system uses Extism, which enables plugins in different programming languages. For more documentation, check Extism's documentation.
Installation of Extism-js
-
Download and Install Extism-js: Begin by setting up
extism-js, which enables you to compile and manage your plugins. Run these commands to download and install it:curl -O https://raw.githubusercontent.com/extism/js-pdk/main/install.sh bash install.shThis script installs the Extism JavaScript Plugin Development Kit from its GitHub repository, preparing your environment for plugin compilation.
Building the Twitter Profile Plugin
To build the plugin, run:
npm i
npm run build
This will output the wasm binary in dist/index.wasm.
Running the Twitter Plugin Example
- Build the
twitter_profileplugin as explained above. - Build and install the
tlsn-extensionas documented in the main README.md. - Run a local notary server.
- Run
npm run serve-demo - Open http://localhost:8080
- Click accept. This action opens the Twitter webpage along with a TLSNotary sidebar.
- Follow the steps in the TLSNotary sidebar.
- Access the TLSNotary results by clicking the History button in the TLSNotary extension.
Customize the Template
You are now ready to develop your own plugins.
Notarization requests take more time than regular requests, so we recommend testing the HTTPS request in Postman or Curl first. This allows you to figure out faster which cookies and headers are required.
When you add or rename steps, make sure to update the index.d.ts file.
Custom Icon
To use a custom icon, replace icon.png in the ./assets folder. Make sure it is 320x320 pixels. You can use the following command:
convert icon_source.png -resize 320x320! assets/icon.png
More Examples
Check the examples folder for more examples.