Plugin System
What is a plugin?
Last updated
Was this helpful?
What is a plugin?
Last updated
Was this helpful?
The LearnCard Plugin System is the modular foundation that enables extensibility of the LearnCard Core through encapsulated units of functionality. This document explains how plugins are structured, loaded, and used within the LearnCard ecosystem.
Core bundles of execution.
Have no hard requirements they must conform to.
Atomic.
Not categorical.
Typically fall into larger execution workflows. See .
Plugins can implement arbitrary functionality, or optionally choose to implement any number of Control Planes. Via a common instantiation pattern, it is also easily possible for plugins to depend on other plugins via their exposed interfaces, as well as to happily hold private and public fields.
The LearnCard Core is designed with minimal base functionality, which is extended through plugins that provide specific capabilities. The plugin system enables developers to include only the features they need, resulting in more lightweight and focused implementations.
Additionally, because plugins and plugin hierarchies work entirely through interfaces rather than explicit dependencies, any plugin can be easily hotswapped by another plugin that implements the same interface, and plugins implementing Control Planes can easily be stacked on top of each other to further enhance the functionality of that Control Plane for the wallet.
A LearnCard plugin follows a standard interface structure which includes:
name: A unique identifier string
displayName: A human-readable name for UI display
description: A description of the plugin's functionality
methods: An object containing the functions provided by the plugin
The type system uses generics to track which plugins are added to a LearnCard instance, ensuring type safety when accessing plugin methods.
In order to create a fully functioning LearnCard, you will need to add some plugins. Specifically, you will (probably) want to add at least one plugin that implements each Control Plane.
In code, constructing a LearnCard completely from scratch looks like this:
However, you don't have to start from scratch! Each instantiation function is completely able to add bespoke plugins to it:
Let's examine how the Expiration Plugin is implemented to understand a typical plugin structure:
The Expiration Plugin extends the credential verification process to check expiration dates:
It depends on the VC Plugin's verifyCredential
method
It calls the original method to perform base verification
It adds additional checks for credential expiration
It returns an enhanced verification result
This demonstrates how plugins can build upon each other's functionality in a composable manner.
After initialization, applications interact with plugins through the LearnCard instance's invoke
property. The method calls follow this pattern:
This unified interface allows applications to access all plugin functionality through a single entry point, abstracting away the details of which plugin provides which method.
Plugins often work with specific data types, particularly for credential operations. The core types used across plugins include:
UnsignedVC
Unsigned Verifiable Credential data structure
VC
Signed Verifiable Credential with proof
UnsignedVP
Unsigned Verifiable Presentation
VP
Signed Verifiable Presentation with proof
Proof
Cryptographic proof structure
Profile
Entity profile information
These types are defined in the @learncard/types
package and used consistently across all plugins to ensure interoperability.
To learn more about , as well as find recommended Plugins for each Control Plane, click !