### Start Example App Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/1-basic-launchpad-app/README.md Navigate to the example app directory, copy and edit the .env file, then start the development server. ```bash cd examples/app-store-apps/1-basic-launchpad-app cp .env.example .env # edit with your values pnpm dev ``` -------------------------------- ### Run the Chapi Example App Source: https://github.com/learningeconomy/learncard/blob/main/examples/chapi-example/README.md Navigate to the example directory and start the development server. ```bash cd examples/chapi-example pnpm dev ``` -------------------------------- ### Install Dependencies and Run Example Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/1-basic-launchpad-app/SDK-MIGRATION.md These bash commands show how to install project dependencies using pnpm and run the example application's development server. ```bash # Install dependencies pnpm install # Run the dev server pnpm --filter @learncard/app-store-demo-basic-launchpad dev ``` -------------------------------- ### Install Dependencies and Start Dev Server Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/1-basic-launchpad-app/README.md Standard commands for a standalone application to install dependencies and start the development server. ```bash # Install dependencies pnpm install # Start the dev server pnpm dev ``` -------------------------------- ### Run Example Dapp Dev Server Source: https://github.com/learningeconomy/learncard/blob/main/examples/snap-example-dapp/README.md Start the development server for the example dapp in the second terminal. ```bash cd examples/snap-example-dapp pnpm dev ``` -------------------------------- ### Install and Build Dependencies (Bash) Source: https://github.com/learningeconomy/learncard/blob/main/examples/embed-example/README.md Commands to install dependencies, build the embed-sdk package, navigate to the example directory, and start the local development server. ```bash pnpm i pnpm --filter @learncard/embed-sdk build cd examples/embed-example pnpm dev ``` -------------------------------- ### Install and Run Test App Source: https://github.com/learningeconomy/learncard/blob/main/examples/consent-flow-test/README.md Navigate to the test app directory, install dependencies, and start the server. Access the app via http://localhost:8899. ```bash cd examples/consent-flow-test pnpm install node server.js ``` -------------------------------- ### Install @learncard/core Source: https://github.com/learningeconomy/learncard/blob/main/packages/learn-card-init/README.md Install the LearnCard Core library using pnpm. This is the initial setup step for using the library. ```bash pnpm i @learncard/core ``` -------------------------------- ### Local Development Setup Steps Source: https://github.com/learningeconomy/learncard/blob/main/examples/consent-flow-test/README.md Steps for setting up a local development environment, including starting LearnCard, brain-service, and the test app, followed by browser configuration. ```bash node server.js ``` -------------------------------- ### Clone and Setup Signing Service Source: https://github.com/learningeconomy/learncard/blob/main/docs/how-to-guides/deploy-infrastructure/signing-authority.md Clone the LearnCard repository and install dependencies for the simple-signing-service. ```bash git clone https://github.com/learningeconomy/LearnCard.git cd services/learn-card-network/simple-signing-service pnpm install ``` -------------------------------- ### Local Development Setup and Run Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/AGENTS.md Steps to set up the local environment for development. This includes copying environment variables, installing dependencies, and running the application using pnpm filters. ```bash # 1. Set up environment cp .env.example .env # Edit .env with your values # 2. Install dependencies (from repo root) pnpm install # 3. Run the app pnpm --filter @learncard/app-store-demo-your-app dev ``` -------------------------------- ### Initialize LearnCard CLI and Create Service Profile Source: https://github.com/learningeconomy/learncard/blob/main/docs/how-to-guides/deploy-infrastructure/connect-to-independent-network.md Install and start the LearnCard CLI, then initialize it with your independent network endpoint and secure key. Define and register your application's service profile. ```javascript // Install and start LearnCard CLI // pnpm dlx @learncard/cli // Initialize LearnCard with your Independent Network const networkLearnCard = await initLearnCard({ seed: '[your secure key]', network: 'https://network.independent.example.org/trpc' // Point to your Independent Network }) // Create a service profile const serviceProfile = { displayName: 'Your App Name', profileId: 'your-app-unique-id', image: 'https://example.com/your-app-logo.jpg', }; // Register the service profile await networkLearnCard.invoke.createServiceProfile(serviceProfile); ``` -------------------------------- ### Install @learncard/did-web-plugin Source: https://github.com/learningeconomy/learncard/blob/main/packages/plugins/did-web-plugin/README.md Install the @learncard/did-web-plugin and @learncard/init packages using pnpm. ```bash pnpm i @learncard/init @learncard/did-web-plugin ``` -------------------------------- ### Install @learncard/helpers Source: https://github.com/learningeconomy/learncard/blob/main/packages/learn-card-helpers/README.md Install the @learncard/helpers package using pnpm. ```bash pnpm install @learncard/helpers ``` -------------------------------- ### Example Usage of initLearnCard Source: https://github.com/learningeconomy/learncard/blob/main/docs/sdks/learncard-core/construction.md Demonstrates various ways to initialize a LearnCard instance with different configurations, including empty wallets, deterministic seeds, network connections, guardian approvals, VC-API connections, and custom setups. ```typescript import { initLearnCard } from '@learncard/init'; // Constructs an empty LearnCard without key material (can not sign VCs). // Useful for Verifying Credentials only in a light-weight form. const emptyLearncard = await initLearnCard(); // Constructs a LearnCard from a deterministic seed. const learncard = await initLearnCard({ seed: 'abc123' }); // Constructs a LearnCard default connected to LearnCard Network hosted at https://network.learncard.com const networkLearnCard = await initLearnCard({ seed: 'abc123', network: true }); // If you are calling guardian-gated Network routes from a managed/child profile, // you can optionally provide a function that returns a guardian approval token (JWT VP). // The Network client will attach it as an `x-guardian-approval` header when present. const networkLearnCardWithGuardianApproval = await initLearnCard({ seed: 'abc123', network: true, guardianApprovalGetter: async () => { return undefined; }, }); // Constructs a LearnCard default connected to VC-API at https://bridge.learncard.com for handling signing const defaultApi = await initLearnCard({ vcApi: true }); // Constructs a LearnCard connected to a custom VC-API, with Issuer DID specified. const customApi = await initLearnCard({ vcApi: 'vc-api.com', did: 'did:key:123' }); // Constructs a LearnCard connected to a custom VC-API that implements /did discovery endpoint. const customApiWithDIDDiscovery = await initLearnCard({ vcApi: 'https://bridge.learncard.com' }); // Constructs a LearnCard with no plugins. Useful for building your own bespoke LearnCard const customLearnCard = await initLearnCard({ custom: true }); ``` -------------------------------- ### Install @learncard/react Source: https://github.com/learningeconomy/learncard/blob/main/packages/react-learn-card/README.md Install the @learncard/react package using pnpm. ```bash pnpm install @learncard/react ``` -------------------------------- ### Install Dependencies Source: https://github.com/learningeconomy/learncard/blob/main/reference/README.md Run this command to install all required project dependencies. ```bash $ pnpm install ``` -------------------------------- ### Install DID Key Plugin Source: https://github.com/learningeconomy/learncard/blob/main/docs/sdks/official-plugins/did-key.md Install the package using pnpm. ```bash pnpm i @learncard/didkey-plugin ``` -------------------------------- ### Complete Integration Example Source: https://github.com/learningeconomy/learncard/blob/main/docs/how-to-guides/connect-systems/embed-a-claim-button.md A full HTML implementation demonstrating the SDK initialization and success handling. ```html Course Complete

Congratulations! You finished the course.

Claim your credential to add it to your LearnCard wallet.

``` -------------------------------- ### Full Workflow for New Tenant Setup Source: https://github.com/learningeconomy/learncard/blob/main/AGENTS.md This sequence of commands outlines the complete process for setting up a new tenant, including creating environment files, generating image assets, preparing the application configuration, and building the app. ```bash # 1. Create environment file # environments/mytenant.json (only overrides) # 2. Generate image assets from a logo pnpm generate-assets mytenant ~/path/to/logo.png --bg "#123456" # 3. Build config + copy assets into Capacitor project pnpm prepare-config mytenant # 4. Build the app pnpm build ``` -------------------------------- ### Local Dev Setup for Northstar Learning Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/5-northstar-learning/README.md Commands to set up the local development environment for the Northstar Learning app. This includes copying the environment file, generating a deterministic issuer seed, installing dependencies, and starting the development server. ```bash # From the monorepo root cp examples/app-store-apps/5-northstar-learning/.env.example \ examples/app-store-apps/5-northstar-learning/.env # Generate a deterministic issuer seed (hex-encoded, 32 bytes) openssl rand -hex 32 # Paste the output as LEARNCARD_ISSUER_SEED in the .env file pnpm install pnpm nx dev @learncard/app-store-demo-northstar-learning ``` -------------------------------- ### Get App Install Count Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves the number of users who have installed a specific app. ```APIDOC ## GET /api/app_store/listing/{listing_id}/install_count ### Description Get the number of users who have installed an app. ### Method GET ### Endpoint /api/app_store/listing/{listing_id}/install_count ### Parameters #### Path Parameters - **listing_id** (str) - Required - The ID of the listing. ### Response #### Success Response (200) - **float** - The number of installs. #### Response Example ```json 12345.0 ``` ### Error Handling - **400**: Invalid input data - **404**: Not found - **500**: Internal server error ``` -------------------------------- ### Get Installed Apps Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves a list of installed applications using the AppStoreApi client. ```python # Enter a context with an instance of the API client with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = openapi_client.AppStoreApi(api_client) app_store_get_listings_for_integration_request = openapi_client.AppStoreGetListingsForIntegrationRequest() # AppStoreGetListingsForIntegrationRequest | (optional) try: # Get Installed Apps api_response = api_instance.app_store_get_installed_apps(app_store_get_listings_for_integration_request=app_store_get_listings_for_integration_request) print("The response of AppStoreApi->app_store_get_installed_apps:\n") pprint(api_response) except Exception as e: print("Exception when calling AppStoreApi->app_store_get_installed_apps: %s\n" % e) ``` -------------------------------- ### Quick Start: Booting Docker and Running Playground Source: https://github.com/learningeconomy/learncard/blob/main/examples/openid4vc-playground/README.md Steps to set up the walt.id Docker stack and run the OID4VC Playground locally. Ensure the Docker stack is running before starting the playground. ```bash cd ../../tests/openid4vc-interop-e2e docker compose up -d # (give walt.id ~10 s to come up; verifier is on :7003, issuer on :7002) cd ../../examples/openid4vc-playground pnpm install pnpm dev # → open http://localhost:5173 ``` -------------------------------- ### Install LearnCard Wallet SDK Source: https://github.com/learningeconomy/learncard/blob/main/docs/quick-start/setup-and-prerequisites.md Install the core initialization module using your preferred package manager. ```bash # Using npm npm install @learncard/init # Using yarn yarn add @learncard/init # Using pnpm pnpm add @learncard/init ``` -------------------------------- ### Get Installed Apps Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves a list of all applications currently installed. Requires appropriate imports for the response models. ```python import openapi_client from openapi_client.models.app_store_get_installed_apps200_response import AppStoreGetInstalledApps200Response from openapi_client.models.app_store_get_listings_for_integration_request import AppStoreGetListingsForIntegrationRequest from openapi_client.rest import ApiException from pprint import pprint ``` -------------------------------- ### Install Infisical CLI Source: https://github.com/learningeconomy/learncard/blob/main/environment-variables.md Install the Infisical CLI on macOS, Linux, or Arch Linux. This is a one-time setup step. ```bash # 1. Install the Infisical CLI (one-time) # macOS: brew install infisical/get-cli/infisical # Linux: curl -1sLf 'https://artifacts.infisical.com/repos/setup.deb.sh' | sudo -E bash && sudo apt-get install infisical # Arch Linux (AUR, e.g. with yay): yay -S infisical-bin ``` -------------------------------- ### Start LearnCard CLI Source: https://github.com/learningeconomy/learncard/blob/main/docs/sdks/learncard-cli.md Run the LearnCard CLI to start a Node.js REPL with a pre-instantiated Learn Card wallet. ```bash npx @learncard/cli ``` -------------------------------- ### Initialize Project Environment Source: https://github.com/learningeconomy/learncard/blob/main/docs/tutorials/create-a-credential.md Commands to set up a new Node.js project with LearnCard dependencies. ```bash # 1. Create a new directory and navigate into it mkdir learncard-tutorial-1 cd learncard-tutorial-1 # 2. Initialize a Node.js project npm init -y # 3. Install LearnCard and the necessary tools for this tutorial npm install @learncard/init @learncard/core @learncard/types dotenv npm install --save-dev typescript tsx @types/node # 4. Create a TypeScript configuration file npx tsc --init --rootDir ./ --outDir ./dist --esModuleInterop --resolveJsonModule --lib es2022 --module esnext --moduleResolution node ``` ```bash # 1. Create a new directory and navigate into it mkdir learncard-tutorial-js-1 cd learncard-tutorial-js-1 # 2. Initialize a Node.js project npm init -y # 3. Install LearnCard and the necessary tools for this tutorial npm install @learncard/init @learncard/core dotenv ``` -------------------------------- ### Get App Install Count using Python Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Use this snippet to retrieve the number of users who have installed a specific app. Ensure the `openapi_client` library is installed and configured with the correct host. ```python import openapi_client from openapi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://network.learncard.com/api # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( host = "https://network.learncard.com/api" ) # Enter a context with an instance of the API client with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = openapi_client.AppStoreApi(api_client) listing_id = 'listing_id_example' # str | try: # Get App Install Count api_response = api_instance.app_store_get_listing_install_count(listing_id) print("The response of AppStoreApi->app_store_get_listing_install_count:\n") pprint(api_response) except Exception as e: print("Exception when calling AppStoreApi->app_store_get_listing_install_count: %s\n" % e) ``` -------------------------------- ### GET /app-store/count-installed Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Count all applications currently installed by the user. ```APIDOC ## GET /app-store/count-installed ### Description Count all apps you have installed. ### Method GET ### Endpoint /app-store/count-installed ### Response #### Success Response (200) - **count** (float) - The total number of installed applications. ``` -------------------------------- ### Copy Environment Example Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/3-mozilla-social-badges-app/README.md Navigate to the example application directory and copy the .env.example file to .env to set up your environment variables. ```bash cd examples/app-store-apps/3-mozilla-social-badges-app cp .env.example .env ``` -------------------------------- ### GET /app-store/installed-apps Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves a list of all applications currently installed by the user. ```APIDOC ## GET /app-store/installed-apps ### Description Retrieves all apps that have been installed by the authenticated user. ### Method GET ### Endpoint /app-store/installed-apps ### Parameters #### Request Body - **app_store_get_listings_for_integration_request** (AppStoreGetListingsForIntegrationRequest) - Optional - Request parameters for filtering installed apps. ### Response #### Success Response (200) - **AppStoreGetInstalledApps200Response** - The list of installed applications. #### Response Example { "installed_apps": [] } ``` -------------------------------- ### GET /app-store/installed/count Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Counts the number of apps installed by the current user. ```APIDOC ## GET /app-store/installed/count ### Description Counts the number of apps installed by the current user. ### Method GET ### Endpoint /app-store/installed/count ### Response #### Success Response (200) - **int** (integer) - The total count of installed apps. #### Response Example ```json { "example": 10 } ``` ``` -------------------------------- ### Example Custom Achievement Type Source: https://github.com/learningeconomy/learncard/blob/main/docs/core-concepts/credentials-and-data/achievement-types-and-categories.md An example of a custom achievement type. Custom types must start with 'ext:LCA_CUSTOM:' followed by a category and a transformed achievement type. ```text ext:LCA_CUSTOM:Learning History:The_Coolest_Dog ``` -------------------------------- ### Activity Statistics Response Example Source: https://github.com/learningeconomy/learncard/blob/main/docs/core-concepts/network-and-interactions/credential-activity.md JSON response structure for the GET /activity/credentials/stats endpoint. ```json { "total": 150, "created": 50, "delivered": 100, "claimed": 75, "expired": 5, "failed": 2, "claimRate": 75.0 } ``` -------------------------------- ### Credential Activities Response Example Source: https://github.com/learningeconomy/learncard/blob/main/docs/core-concepts/network-and-interactions/credential-activity.md JSON response structure for the GET /activity/credentials endpoint. ```json { "records": [ { "id": "abc123", "activityId": "xyz789", "eventType": "DELIVERED", "timestamp": "2024-01-15T10:30:00Z", "recipientType": "profile", "recipientIdentifier": "alice", "boostUri": "lc:network:example.com/trpc:boost:123", "boost": { "id": "123", "name": "Achievement Badge", "category": "Achievement" }, "recipientProfile": { "profileId": "alice", "displayName": "Alice Smith" } } ], "hasMore": true, "cursor": "2024-01-15T10:30:00Z" } ``` -------------------------------- ### Install Python Client via Setuptools Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/README.md Install the Python package using Setuptools. This method is useful for local development or when the package is not hosted on a repository. ```sh python setup.py install --user ``` -------------------------------- ### Define Example Application Directory Structure Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/AGENTS.md Standard directory layout for new LearnCard example applications using Astro and NX. ```text examples/app-store-apps/N-your-app-name/ ├── src/ │ ├── actions/index.ts # Server-side actions │ ├── pages/index.astro # Main page │ └── env.d.ts # Environment types ├── .env.example # Environment template ├── README.md # Setup instructions ├── package.json # Dependencies ├── project.json # NX configuration ├── astro.config.mjs # Astro config └── netlify.toml # Deployment config ``` -------------------------------- ### Initialize LearnCard Embed SDK Source: https://github.com/learningeconomy/learncard/blob/main/packages/learn-card-embed-sdk/README.md Load the SDK from a CDN and initialize it with configuration options. This example demonstrates setting partner name, target element, credential details, publishable key for real OTP flow, and an onSuccess callback. It also shows basic theming and enabling background issuance for consent. ```html
``` -------------------------------- ### App Store Get Installed Apps Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves a list of installed applications within the app store. This endpoint can optionally accept a request body to filter or specify the listings for integration. ```APIDOC ## GET /api/appstore/installed ### Description Retrieves a list of installed applications within the app store. This endpoint can optionally accept a request body to filter or specify the listings for integration. ### Method GET ### Endpoint /api/appstore/installed ### Parameters #### Query Parameters - **app_store_get_listings_for_integration_request** (AppStoreGetListingsForIntegrationRequest) - Optional - Used to filter or specify listings for integration. ### Request Body ```json { "example": "AppStoreGetListingsForIntegrationRequest" } ``` ### Response #### Success Response (200) - **AppStoreGetInstalledApps200Response** - Successful response containing a list of installed apps. #### Response Example ```json { "example": "AppStoreGetInstalledApps200Response" } ``` ### Authorization Bearer Token ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### GET /app-store/listing/{listingId}/is-installed Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Checks if a specific app listing is installed for the current user. ```APIDOC ## GET /app-store/listing/{listingId}/is-installed ### Description Checks if a specific app listing is installed for the current user. ### Method GET ### Endpoint /app-store/listing/{listingId}/is-installed ### Parameters #### Path Parameters - **listingId** (string) - Required - The ID of the listing to check. ### Response #### Success Response (200) - **bool** (boolean) - True if the app is installed, false otherwise. #### Response Example ```json { "example": true } ``` ``` -------------------------------- ### GET /app-store/listing/{listingId}/install-count Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AppStoreApi.md Retrieves the total number of installs for a specific app listing. ```APIDOC ## GET /app-store/listing/{listingId}/install-count ### Description Retrieves the total number of installs for a specific app listing. ### Method GET ### Endpoint /app-store/listing/{listingId}/install-count ### Parameters #### Path Parameters - **listingId** (string) - Required - The ID of the listing to get the install count for. ### Response #### Success Response (200) - **int** (integer) - The total number of installs for the listing. #### Response Example ```json { "example": 100 } ``` ``` -------------------------------- ### Install LearnCard SDK Source: https://github.com/learningeconomy/learncard/blob/main/docs/README.md Use npm to add the core LearnCard initialization package to your project. ```bash npm install @learncard/init ``` -------------------------------- ### Initialize the plugin Source: https://github.com/learningeconomy/learncard/blob/main/packages/plugins/open-badge-v2/README.md Install the VC plugin and the OpenBadge v2 wrapper plugin into the LearnCard instance. ```typescript import { getVCPlugin } from '@learncard/vc-plugin'; import { openBadgeV2Plugin } from '@learncard/open-badge-v2-plugin'; // Ensure VC plugin is installed first (required for signing) await learnCard.addPlugin(getVCPlugin(learnCard)); // Install the OpenBadge v2 wrapper plugin await learnCard.addPlugin(openBadgeV2Plugin(learnCard)); ``` -------------------------------- ### List all invites Source: https://github.com/learningeconomy/learncard/blob/main/services/learn-card-network/brain-service/AGENTS.md Example using curl to GET the invites endpoint. Requires an Authorization header. ```bash curl -H "Authorization: Bearer " \ https:///profile/invites ``` -------------------------------- ### Get Auth Grants using Bearer Authentication Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/AuthGrantsApi.md Retrieve Auth Grants using the AuthGrantsApi. This example demonstrates setting up the API client with Bearer authentication and making a request to get Auth Grants. ```python import openapi_client from openapi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://network.learncard.com/api # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( host = "https://network.learncard.com/api" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: Authorization configuration = openapi_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = openapi_client.AuthGrantsApi(api_client) auth_grants_get_auth_grants_request = openapi_client.AuthGrantsGetAuthGrantsRequest() # AuthGrantsGetAuthGrantsRequest | (optional) try: # Get My AuthGrants api_response = api_instance.auth_grants_get_auth_grants(auth_grants_get_auth_grants_request=auth_grants_get_auth_grants_request) print("The response of AuthGrantsApi->auth_grants_get_auth_grants:\n") pprint(api_response) except Exception as e: print("Exception when calling AuthGrantsApi->auth_grants_get_auth_grants: %s\n" % e) ``` -------------------------------- ### Start Local Development Server Source: https://github.com/learningeconomy/learncard/blob/main/reference/README.md Launches a local development server with live reloading for real-time previewing of changes. ```bash $ pnpm start ``` -------------------------------- ### Sync Credentials to Contract Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/ContractsApi.md Sync credentials to a contract for which the profile has provided consent. This example demonstrates Bearer authentication setup. ```python import openapi_client from openapi_client.models.contracts_sync_credentials_to_contract_request import ContractsSyncCredentialsToContractRequest from openapi_client.rest import ApiException from pprint import pprint configuration = openapi_client.Configuration( host = "https://network.learncard.com/api" ) configuration = openapi_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with openapi_client.ApiClient(configuration) as api_client: api_instance = openapi_client.ContractsApi(api_client) contracts_sync_credentials_to_contract_request = openapi_client.ContractsSyncCredentialsToContractRequest() try: api_response = api_instance.contracts_sync_credentials_to_contract(contracts_sync_credentials_to_contract_request) print("The response of ContractsApi->contracts_sync_credentials_to_contract:\n") pprint(api_response) except Exception as e: print("Exception when calling ContractsApi->contracts_sync_credentials_to_contract: %s\n" % e) ``` -------------------------------- ### Get boost recipient count Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/BoostsApi.md Shows the initial setup for calling the boost recipient count endpoint with Bearer authentication. ```python import openapi_client from openapi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://network.learncard.com/api # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( host = "https://network.learncard.com/api" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that ``` -------------------------------- ### Install Partner Connect SDK Source: https://github.com/learningeconomy/learncard/blob/main/docs/how-to-guides/connect-systems/connect-an-embedded-app.md Install the LearnCard Partner Connect SDK using npm, pnpm, or yarn. ```bash npm install @learncard/partner-connect ``` ```bash pnpm add @learncard/partner-connect ``` ```bash yarn add @learncard/partner-connect ``` -------------------------------- ### Print JSON representation of CredentialSendCredentialRequestCredentialAnyOf Source: https://github.com/learningeconomy/learncard/blob/main/packages/open-api-lcn-clients/python-client/docs/CredentialSendCredentialRequestCredentialAnyOf.md This example demonstrates how to get the JSON string representation of the CredentialSendCredentialRequestCredentialAnyOf model. This is useful for debugging or logging. ```python # print the JSON string representation of the object print(CredentialSendCredentialRequestCredentialAnyOf.to_json()) ``` -------------------------------- ### Complete AI Tutor Example Source: https://github.com/learningeconomy/learncard/blob/main/docs/how-to-guides/connect-systems/connect-an-embedded-app.md This example demonstrates initializing an AI tutor by requesting user consent and learner context, then conducting a session and recording it using the Partner Connect SDK. ```typescript import { createPartnerConnect } from '@learncard/partner-connect'; const learnCard = createPartnerConnect(); class AITutor { async initialize() { // Step 1: Get learner context for personalization const consent = await learnCard.requestConsent(); if (!consent.granted) { throw new Error('User consent required'); } const context = await learnCard.requestLearnerContext({ includeCredentials: true, format: 'prompt', instructions: 'Focus on technical skills and learning gaps', }); // Use context to personalize AI this.systemPrompt = `You are a tutor. ${context.prompt}`; this.userDid = context.did; return context; } async conductSession(userQuestion) { // Get AI response using personalized context const aiResponse = await this.getAIResponse(userQuestion); // Display to user and collect feedback const sessionData = await this.runInteractiveSession(aiResponse); // Record the session await this.recordSession(sessionData); return sessionData; } async recordSession(data) { const session = await learnCard.sendAiSessionCredential({ sessionTitle: data.title, summaryData: { title: data.title, summary: data.summary, learned: data.takeaways, skills: data.demonstratedSkills.map(s => ({ title: s.name, description: s.description, })), nextSteps: data.recommendations, reflections: data.userReflections, }, }); return session; } } // Usage const tutor = new AITutor(); await tutor.initialize(); await tutor.conductSession('How do I learn advanced TypeScript?'); ``` -------------------------------- ### Verify a Valid Credential with LearnCard Source: https://github.com/learningeconomy/learncard/blob/main/docs/sdks/learncard-core/construction.md Use `verifyCredential` to check the validity of a signed Verifiable Credential. This example shows how to get a human-readable output. ```typescript const result = await learnCard.invoke.verifyCredential(signedVc); console.log(result); // { checks: ['proof', 'expiration'], warnings: [], errors: [] } // OR, for a more human readable output: const result = await learnCard.invoke.verifyCredential(signedVc, {}, true); // [ // { status: "Success", check: "proof", message: "Valid" }, // { // status: "Success", // check: "expiration", // message: "Valid • Does Not Expire" // } // ] ``` -------------------------------- ### Initialize LearnCard with Plugins Source: https://github.com/learningeconomy/learncard/blob/main/docs/core-concepts/architecture-and-principles/plugins.md Demonstrates the step-by-step construction of a LearnCard instance by chaining plugin additions. ```typescript const baseLearnCard = await initLearnCard({ custom: true }); const didkitLearnCard = await baseLearnCard.addPlugin(await getDidKitPlugin()); const didkeyLearnCard = await didkitLearnCard.addPlugin(await getDidKeyPlugin(didkitLearnCard, 'a', 'key')); // repeat for any more plugins you'd like to add ``` -------------------------------- ### Run Development Server Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/4-request-learner-context-app/README.md Execute this command from the monorepo root to start the development server for the AI Tutor Context Demo app. ```bash # From monorepo root pnpm exec nx dev 4-request-learner-context-app # Or from app directory pnpm dev ``` -------------------------------- ### Basic Webpack Configuration for Bundle Analysis Source: https://github.com/learningeconomy/learncard/blob/main/apps/learn-card-app/docs/bundle-analysis/bundle-analysis-v4.html This snippet shows a minimal webpack.config.js setup to enable bundle analysis. Ensure you have `webpack-bundle-analyzer` installed. ```javascript const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; module.exports = { plugins: [ new BundleAnalyzerPlugin() ] }; ``` -------------------------------- ### Configure Environment Source: https://github.com/learningeconomy/learncard/blob/main/examples/app-store-apps/2-lore-card-app/README.md Initialize the environment configuration file and define the required LearnCard host and badge template URIs. ```bash cp .env.example .env ``` ```bash # LearnCard Host (required) LEARNCARD_HOST_ORIGIN=https://learncard.app # Badge Template URIs (required) # Replace these with your actual boost/template IDs from LearnCard Network BADGE_TEAMWORK_URI=lc:network:network.learncard.com/trpc:boost:your-teamwork-boost-id BADGE_LEADERSHIP_URI=lc:network:network.learncard.com/trpc:boost:your-leadership-boost-id BADGE_CREATIVITY_URI=lc:network:network.learncard.com/trpc:boost:your-creativity-boost-id BADGE_PROBLEM_SOLVING_URI=lc:network:network.learncard.com/trpc:boost:your-problem-solving-boost-id BADGE_EMPATHY_URI=lc:network:network.learncard.com/trpc:boost:your-empathy-boost-id BADGE_COMMUNICATION_URI=lc:network:network.learncard.com/trpc:boost:your-communication-boost-id BADGE_COURAGE_URI=lc:network:network.learncard.com/trpc:boost:your-courage-boost-id BADGE_WISDOM_URI=lc:network:network.learncard.com/trpc:boost:your-wisdom-boost-id ``` -------------------------------- ### Production Configuration for Partner Connect Source: https://github.com/learningeconomy/learncard/blob/main/docs/sdks/partner-connect.md Configure the Partner Connect SDK for a production environment using a specific host origin. This example shows the basic setup. ```typescript // Production configuration const learnCard = createPartnerConnect({ hostOrigin: 'https://learncard.app', }); // Uses: https://learncard.app // Override: ?lc_host_override=X (not validated, warning logged) ```