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

Was this helpful?

  1. SDKs & API Reference
  2. Plugins

LearnCard Network

Using the LearnCard Network Plugin

The LearnCard Network Plugin (@learncard/network-plugin) simplifies the process of interacting with the LearnCard Network API by providing a set of convenient methods for managing profiles, connections, credentials, presentations, and boosts. This guide will help you understand how to use this plugin in your application.

Installation

pnpm install @learncard/network-plugin

Initialization

import { initLearnCard } from '@learncard/init'
import didkit from '@learncard/didkit-plugin/dist/didkit/didkit_wasm_bg.wasm?url';

const networkLearnCard = await initLearnCard({
    seed,
    network: true,
    didkit,
});

Accessing Plugin Methods

Once you've initialized the LearnCard Network Plugin, you can access the methods by calling learnCard.invoke.<LearnCardNetworkPluginMethods>. For example, to get a user's profile with a profileId of johnsmith you can call:

await networkLearnCard.invoke.getProfile('johnsmith');

Here's a brief overview of the available methods in the LearnCardNetworkPluginMethods:

  1. Profile Management: Create, update, delete, and retrieve user profiles.

  2. Connections: Manage connections between users, including sending and accepting connection requests, and fetching connection information.

  3. Credentials: Send, accept, retrieve, and delete credentials between users.

  4. Presentations: Send, accept, retrieve, and delete presentations between users.

  5. Boosts: Create, send, update, delete, and claim boosts for users on the network.

  6. Storage: Resolve a URI to a credential or presentation.

  7. Signing Authorities: Register and retrieve signing authorities for the LearnCard Network.

Examples

Here are a few examples of how to use the LearnCard Network Plugin in your application:

Create a Profile

const profile = {
  profileId: 'johnsmith',
  displayName: 'John Smith',
  image: 'https://example.com/avatar.jpg',
};

await networkLearnCard.invoke.createProfile(profile);

Connect with Another Profile

const profileId = 'janesmith';

await networkLearnCard.invoke.connectWith(profileId);

Send a Credential

const profileId = 'janesmith';
const vc = await networkLearnCard.invoke.issueCredential(networkLearnCard.invoke.newCredential())
const encrypt = true;

await networkLearnCard.invoke.sendCredential(profileId, vc, encrypt);

Claim a Boost

const boostUri = 'https://example.com/boost-uri';
const challenge = 'example-challenge';

await networkLearnCard.invoke.claimBoostWithLink(boostUri, challenge);

These examples demonstrate some of the ways you can interact with the LearnCard Network API using the @learncard/network-plugin.

PreviousCHAPINextLearnCloud

Last updated 23 days ago

Was this helpful?

For detailed information on the method signatures and their parameters, refer to the provided in the .

🛠️
type definitions
@learncard/network-plugin package