LearnCard Documentation
GithubStatusSupportLaunch App
  • 🚀Introduction
    • What is LearnCard?
    • Use Cases & Possibilities
    • Ecosystem Architecture
  • ⚡Quick Start
    • Setup & Prerequisites
    • Your First Integration
  • 📚Tutorials
    • Create a Credential
    • Create a Boost
    • Create a ConsentFlow
    • Create a Connected Website
    • Send xAPI Statements
    • Listen to Webhooks
  • ✅How-To Guides
    • Verify My Issuer
    • Connect Systems
      • Connect a Website
      • Connect a Game
    • Implement Flows
      • Claim Data after Guardian Consent
      • Connect via CHAPI
        • ⭐CHAPI Wallet Setup Guide
        • ↔️Translating to CHAPI documentation
        • 🖥️Demo Application
        • 🔰Using LearnCard to Interact with a CHAPI Wallet
        • 📝Cheat Sheets
          • Issuers
          • Wallets
    • Deploy Infrastructure
      • Remote Key Management
      • Generate API Tokens
      • Signing Authority
      • Connect to Independent Network
      • Build a Plugin
  • 🛠️SDKs & API Reference
    • LearnCard Wallet SDK
      • Authentication
      • Usage Examples
      • SDK Reference
      • Plugin API Reference
      • Integration Strategies
      • Deployment
      • Troubleshooting
      • Changelog
    • LearnCloud Network API
      • Authentication
      • Usage Examples
      • Architecture
      • Notifications & Webhooks
      • Profiles
      • Profile Managers
      • Credentials
      • Boosts
      • Presentations
      • Storage
      • Contracts
      • DID Metadata
      • Claim Hooks
      • Auth Grants
      • Utilities
      • Models
      • OpenAPI
    • LearnCloud Storage API
      • Authentication
      • Usage Examples
      • Architecture
      • Storage
      • Index
      • User
      • Custom Storage
      • Utilities
      • Models
      • xAPI Reference
    • Plugins
      • Crypto
      • DIDKit
      • DID Key
      • Dynamic Loader
      • VC
        • Expiration Sub-Plugin
      • VC-Templates
      • VC-API
      • Ceramic
      • IDX
      • VPQR
      • Ethereum
      • CHAPI
      • LearnCard Network
      • LearnCloud
      • LearnCard
      • Simple Signing
      • Claimable Boosts
    • LearnCard CLI
  • 🧠Core Concepts
    • Identities & Keys
      • Decentralized Identifiers (DIDs)
      • Seed Phrases
      • Network Profiles
      • Signing Authorities
      • Trust Registries
    • Credentials & Data
      • Verifiable Credentials (VCs)
      • Credential Lifecycle
      • Schemas, Types, & Categories
      • Building Verifiable Credentials
      • Boost Credentials
      • Getting Started with Boosts
      • Credential URIs
      • xAPI Data
      • General Best Practices & Troubleshooting
    • Consent & Permissions
      • ConsentFlow Overview
      • Consent Contracts
      • User Consent & Terms
      • Consent Transactions
      • Auto-Boosts
      • Writing Consented Data
      • Accessing Consented Data
      • GameFlow Overview
    • Network & Interactions
      • Network Vision & Principles
      • Key Network Procedures
      • Core Interaction Workflows
    • Architecture & Principles
      • Control Planes
      • Plugin System
      • Auth Grants and API Tokens
  • 🔗Development
    • Contributing
Powered by GitBook
On this page
  • Install
  • Basic Credential
  • Achievement Credential:
  • Other Types

Was this helpful?

  1. SDKs & API Reference
  2. Plugins

VC-Templates

Plugin for creating new credentials from basic templates

This is a plugin for simplifying useful, meaningful credentials with minimal input. Additionally, this plugin can be used as reference for creating your own plugin to add simple templates for creating new credentials.

Install

pnpm i @learncard/vc-templates-plugin

Basic Credential

The credential of type basic is the most simple credential, following the minimum information required by the Verifiable Credential specification.

LearnCard CLI
// Basic Credential: with default, 'basic' template
learnCard.invoke.newCredential();
learnCard.invoke.newCredential({ type: 'basic' });
/**
{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  id: 'http://example.org/credentials/3731',
  type: [ 'VerifiableCredential' ],
  issuer: 'did:key:z6MkmF9iYcGTRiHFavPPYurDNuDfYMJQR66oGrSGnfnNpPzc',
  issuanceDate: '2020-08-19T21:41:50Z',
  credentialSubject: { id: 'did:example:d23dd687a7dc6787646f2eb98d0' }
}
**/

// Basic Credential: with did, subject, and issuanceDate overloads
learnCard.invoke.newCredential({ 
  type: 'basic', 
  did:'did:example:123', 
  subject: 'did:example:456', 
  issuanceDate: '2020-08-19T21:41:50Z' 
});
/**
{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  id: 'http://example.org/credentials/3731',
  type: [ 'VerifiableCredential' ],
  issuer: 'did:example:123',
  issuanceDate: '2020-08-19T21:41:50Z',
  credentialSubject: { id: 'did:example:456' }
}
**/

Achievement Credential:

LearnCard CLI
// Achievement Credential: with default, 'achievement' template
learnCard.invoke.newCredential({ type: 'achievement' });
/**
{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://imsglobal.github.io/openbadges-specification/context.json'
  ],
  id: 'http://example.com/credentials/3527',
  type: [ 'VerifiableCredential', 'OpenBadgeCredential' ],
  issuer: 'did:key:z6MkmF9iYcGTRiHFavPPYurDNuDfYMJQR66oGrSGnfnNpPzc',
  issuanceDate: '2020-08-19T21:41:50Z',
  name: 'Teamwork Badge',
  credentialSubject: {
    id: 'did:example:d23dd687a7dc6787646f2eb98d0',
    type: [ 'AchievementSubject' ],
    achievement: {
      id: 'https://example.com/achievements/21st-century-skills/teamwork',
      type: [Array],
      criteria: [Object],
      description: 'This badge recognizes the development of the capacity to collaborate within a group environment.',
      name: 'Teamwork'
    }
  }
}
**/

// Achievement Credential: with overloads
learnCard.invoke.newCredential({ 
  type: 'achievement', 
  did:'did:example:123', 
  subject: 'did:example:456', 
  name: 'Singing Badge',
  achievementName: 'Beautiful Singing',
  description: 'This badge recognizes beautiful singing.',
  criteriaNarrative: 'Group members earn this badge when they sing a beautiful song at Karaoke night.',
  issuanceDate: '2020-08-19T21:41:50Z' 
});
/**
{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://imsglobal.github.io/openbadges-specification/context.json'
  ],
  id: 'http://example.com/credentials/3527',
  type: [ 'VerifiableCredential', 'OpenBadgeCredential' ],
  issuer: 'did:example:123',
  issuanceDate: '2020-08-19T21:41:50Z',
  name: 'Singing Badge',
  credentialSubject: {
    id: 'did:example:456',
    type: [ 'AchievementSubject' ],
    achievement: {
      id: 'https://example.com/achievements/21st-century-skills/teamwork',
      type: [Array],
      criteria: [Object],
      description: 'This badge recognizes beautiful singing.',
      name: 'Beautiful Singing'
    }
  }
}
**/

Other Types

More credential types are coming soon! Have a particular credential type you'd like to turn into a template? Start a conversation in our Github Discussions:

  • Post a Credential Template Request 💡

  • Ask for Help 💖

PreviousExpiration Sub-PluginNextVC-API

Last updated 2 months ago

Was this helpful?

🛠️