LearnCard Developer Docs
  • 🚀Get Started
    • 👋Welcome
    • ⭐Who are you?
      • Learners & Employees
      • Traditional Educator
      • Non-Traditional Educator
      • Assessment Provider
      • Employer
      • App Developer & EdTech
      • DAO & Communities
      • Content Creators
      • Research Institutions
      • NGOs & Governments
      • Plugfest Partner
        • Guide for Interop Issuers
          • 🤽Creating an Interop Issuer
        • Guide for Interop Wallets
    • Protocol Overview
      • The Internet of Education
      • The Learning Economy
      • Learner & Employee Privacy
      • 22nd Century Education
      • The Open Credential Network
      • PVCs
  • 🔰LearnCard SDK
    • What is LearnCard?
      • Why a Universal Wallet?
      • Architectural Patterns
      • Production Deployment Guide
      • Troubleshooting Guide
    • LearnCard Core
      • Quick Start
        • Create New Credentials
          • Creating Verifiable Credentials for LearnCard
          • Achievement Types and Categories
          • Custom Types
          • Understanding Boosts
          • Creating Boost Credentials
        • Sign & Send Credentials
        • Accept & Verify Credentials
        • Share & Present Credentials
      • Construction
        • Managing Seed Phrases
        • initLearnCard
        • DIDKit
        • learnCardFromSeed
        • emptyLearnCard
        • IDX Config
      • Control Planes
        • ID
        • Read
        • Store
        • Index
        • Cache
        • Context
      • Plugins
        • Adding Plugins
        • Official Plugins
          • Dynamic Loader
          • Crypto
          • DIDKit
          • DID Key
          • VC
            • Expiration Sub-Plugin
          • VC Resolution
          • VC-Templates
          • VC-API
          • Ceramic
          • IDX
          • VPQR
          • Ethereum
          • CHAPI
          • LearnCard Network
          • LearnCloud
          • LearnCard
          • Claimable Boosts
        • Writing Plugins
          • The Simplest Plugin
          • The Plugin Type
          • The LearnCard Type
          • Implementing Control Planes
          • Implementing Methods
          • The Implicit LearnCard
          • Depending on Plugins
          • Private Fields
          • Publishing a Plugin to NPM
      • URIs
      • CHAPI
        • ⭐CHAPI Wallet Setup Guide
        • ↔️Translating to CHAPI documentation
        • 🖥️Demo Application
        • 🔰Using LearnCard to Interact with a CHAPI Wallet
        • 📝Cheat Sheets
          • Issuers
          • Wallets
      • LearnCard UX
        • Quick Start
        • Components
          • Verifiable Credentials
            • VC Thumbnail
            • VC Thumbnail, Mini
          • LearnCards
            • LearnCard Front
            • LearnCard Back
        • API
      • LearnCard Bridge
      • API
      • Migration Guide
    • LearnCard Network
      • LearnCard Network API
        • Authentication
        • Auth Grants and API Tokens
        • Profile
        • Credentials
        • Boosts
        • Presentations
        • Storage
        • Signing Authorities
        • Notifications
        • API Docs
        • Launch Your Own Network
      • 🔌Connect Your Application
    • ConsentFlow
      • Setting Up ConsentFlow with an Independent Network
    • GameFlow
      • Sending xAPI Statements
        • xAPI URIs
      • Reading xAPI Statements
        • Advanced xAPI Statement Queries
      • Consentful "Claim Later" Flow
  • 🚀Applications
    • LearnCard
    • SuperSkills!
      • SuperSkills! SDK
        • Digital Wallets
        • Issuing into SuperSkills!
        • 🦸Creating a SuperSkills! Issuer
    • Metaversity
    • Admin Dashboard
  • 🔗Resources
    • Github
    • Community
    • 💅Custom Development
    • Contact Our Team
    • Learning Economy
  • 🤖LearnCard Services
    • LearnCard CLI
    • Discord Bot
    • Metamask Snap
  • 💸LearnBank SDK
    • Why LearnBank?
  • 📊LearnGraph SDK
    • Why LearnGraph?
Powered by GitBook
On this page
  • How to use the Plugin Type
  • Complex Example Plugin
  • Arg 1: Name
  • Arg 2: Planes Implemented
  • Arg 3: Methods Implemented
  • Arg 4: Dependent Planes
  • Arg 5: Dependent Methods

Was this helpful?

  1. LearnCard SDK
  2. LearnCard Core
  3. Plugins
  4. Writing Plugins

The Plugin Type

What is a plugin?

PreviousThe Simplest PluginNextThe LearnCard Type

Last updated 2 years ago

Was this helpful?

If you're creating a plugin, it is highly recommended you use TypeScript and take advantage of the Plugin type.

How to use the Plugin Type

Complex Example Plugin

The Plugin type is a type, taking in up to five total generic parameters. A Plugin using all five parameters would look like this:

Complex Plugin
import { Plugin } from '@learncard/core';

type Methods = { foo: () => 'bar' }';
type DependentMethods = { bar: () => 'baz' };

type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;

This type describes a plugin named 'Complex' that implements the , as well as the method foo. This plugin is also on plugins that implement the Control Plane, as well as the method bar.

Let's break down what each of these arguments are doing one at a time.

Arg 1: Name

//                          VVVVVVVVV
type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;
//                          ^^^^^^^^^

This argument simply names a plugin. It is a required string, and is used by some Control Planes.

Specifying a name will force objects that have been set to this type to use that name!

Arg 2: Planes Implemented

//                                     VVVVVVV
type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;
//                                     ^^^^^^^
  • any or never, which specifies that this plugin does not implement any Control Planes

  • A single string (such as used in the example above), which specifies that this plugin implements a single Control Plane

This argument defaults to any, specifying that this plugin does not implement any Control Planes.

Specifying one or more Control Planes implemented will force objects that have been set to this type to implement those planes!

Arg 3: Methods Implemented

//                                              VVVVVVV
type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;
//                                              ^^^^^^^

This argument defaults to Record<never, never>, specifying that this plugin does not implement any methods.

Specifying methods implemented will force objects that have been set to this type to implement those methods!

Arg 4: Dependent Planes

//                                                       VVVV
type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;
//                                                       ^^^^
  • any or never, which specifies that this plugin does not depend on any Control Planes

  • A single string (such as used in the example above), which specifies that this plugin depends on a single Control Plane

This argument defaults to never, specifying that this plugin does not depend on any Control Planes.

Arg 5: Dependent Methods

//                                                             VVVVVVVVVVVVVVVV
type ComplexPlugin = Plugin<'Complex', 'store', Methods, 'id', DependentMethods>;
//                                                             ^^^^^^^^^^^^^^^^

This argument defaults to Record<never, never>, specifying that this plugin does not depend on any methods.

This argument specifies which the plugin implements. It can be:

A of strings (e.g. 'store' | 'read'), which specifies that this plugin implements multiple Control Planes

This argument specifies which the plugin implements. It is an object whose values are functions.

This argument specifies which the plugin depends on. It can be:

A of strings (e.g. 'store' | 'read'), which specifies that this plugin depends on multiple Control Planes

Specifying one or more Dependent Control Planes will add those planes to the passed into each plugin method!

Specifying Dependent Planes here will not force LearnCards to implement those planes when adding this plugin! Please see for more information.

This argument specifies which the plugin depends on. It is an object whose values are functions.

Specifying dependent methods will add those methods to the passed into each plugin method!

Specifying Dependent Methods here will not force LearnCards to implement those methods when adding this plugin! Please see for more information.

🔰
generic
Store
Control Plane
dependent
ID
Control Planes
union
methods
Control Planes
union
implicit LearnCard
Depending on Plugins
methods
implicit LearnCard
Depending on Plugins