Custom Plugin
This is a basic guide to getting started creating Veramo plugins. More in-depth tutorials to follow.
Start by using the veramo-plugin-template repo on Github. Click the Use this template
button to copy the repo to your account. Clone the repo locally and rename the package name in package.json
.
From the plugin directory:
Run the plugin template
Before customizing your plugin, ensure the project run correctly:
In the logs you will be presented development URLS. You should have access to the Open API documentation of this agent.
Verify
To make sure your plugin is working correctly, let's create a new DID using its API:
note
You will need the API key which you can get from the agent.yml file.
Replace the NGROK_URL
and API_KEY
with your own and run:
A new identifier should be printed in your console.
Customization
- Rename instances of
MyAgentPlugin
with your plugin name - Define your plugin interfaces in
IMyAgentPlugin.ts
- Extend your plugin context by importing other types from Veramo for example if you want to issue credentials from your plugin, import the
ICredentialIssuer
type. - Replace sample arguments with your own
- Every time you update the types of your plugin, make sure you run:
- The file
my-agent-plugin.ts
holds the implementation of your agent. It uses the interfaces defined in thesrc/types
folder to define each method implementation. Again, review all the JSDOCS and add your plugin implementation.