> For the complete documentation index, see [llms.txt](https://docs.learncard.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.learncard.com/reference/official-plugins/learncard-network.md).

# 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

```bash
bun add @learncard/network-plugin
```

#### Initialization

```javascript
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:

```javascript
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.
8. **Skills**: Manage frameworks/skills and run semantic skill search with `learnCard.invoke.semanticSearchSkills(...)`.

For detailed information on the method signatures and their parameters, refer to the [type definitions](https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/learn-card-network/src/types.ts) provided in the [`@learncard/network-plugin` package](https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/learn-card-network/README.md).

#### Examples

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

**Create a Profile**

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

await networkLearnCard.invoke.createProfile(profile);
```

**Connect with Another Profile**

```javascript
const profileId = 'janesmith';

await networkLearnCard.invoke.connectWith(profileId);
```

**Send a Credential**

```javascript
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**

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

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

**Semantic Skill Search**

```javascript
const result = await networkLearnCard.invoke.semanticSearchSkills({
    text: 'project-based learning and collaboration',
    frameworkId: 'my-framework-id', // optional
    limit: 50, // optional, defaults to 50
});

// result.records => [{ id, statement, description, frameworkId, score, ... }]
```

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.learncard.com/reference/official-plugins/learncard-network.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
