Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/develop/01_sdk/04_integrate/03_distillery.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: how-to-integrate-distillery
id: howto-integrate-distillery
title: KILT Distillery
---

Expand Down
78 changes: 46 additions & 32 deletions docs/develop/01_sdk/04_integrate/04_extension_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,14 @@ It facilitates communication between your application and KILT extensions.

Add the package:

<Tabs groupId="ts-js-choice">
<TabItem value='ts' label='Typescript' default>

```bash
yarn add @kiltprotocol/kilt-extension-api
```

</TabItem>
<TabItem value='js' label='Javascript'>

```bash
npm install --save @kiltprotocol/kilt-extension-api
```

</TabItem>
</Tabs>
```bash npm2yarn
npm install --save @kiltprotocol/kilt-extension-api
```

## Initialize Extension API

Before your application can communicate with KILT extensions, call the `initializeKiltExtensionAPI()` method to signal the API versions supported by your application so the extension can inject the appropriate scripts.
Comment thread
ChrisChinchilla marked this conversation as resolved.
This should happen at the earliest point possible on page load, or it won't inject the scripts.

<Tabs groupId="ts-js-choice">
<TabItem value='ts' label='Typescript' default>
Expand Down Expand Up @@ -151,43 +139,69 @@ The following is an example of how you can use this method in a React applicatio
</TabItem>
</Tabs>

## Well-Known DID Configuration
## DID Configuration

You need [an existing DID configuration](../../01_sdk/02_cookbook/01_dids/00_generate_keys.md) setup for your application to communicate with KILT extensions.
Comment thread
ChrisChinchilla marked this conversation as resolved.
Outdated

This library helps set up the [Well-Known DID Configuration](https://identity.foundation/.well-known/resources/did-configuration/) as required by the [KILT Credential API specification](https://github.com/KILTprotocol/spec-ext-credential-api).

### Using the CLI Tool

This library includes a CLI tool to create a [DID Configuration Resource](https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource). This resource is necessary to establish a secure, end-to-end encrypted communication channel between a conforming browser extension and the application backend.
This library includes a CLI tool to create a [DID Configuration Resource](https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource).
This resource is necessary to establish a secure, end-to-end encrypted communication channel between a conforming browser extension and the application backend.

:::warning KILT Account
Run the CLI tool using Yarn as follows:

The `createDidConfig` CLI tool **only** works if you installed the package with Yarn.
<Tabs groupId="yarn-node-choice">
<TabItem value='yarn' label='Yarn' default>

:::
```bash
yarn createDidConfig --did <your DID> \
Comment thread
ChrisChinchilla marked this conversation as resolved.
--origin <your domain> \
--assertionMethod <id of your DID's assertionMethod key> \
--seed <seed or mnemonic of the assertionMethod key>
```

Run the CLI tool using Yarn as follows:
</TabItem>
<TabItem value='node' label='Node'>

```bash
yarn createDidConfig --did <your DID> \
--origin <your domain> \
--assertionMethod <id of your DID's assertionMethod key> \
--seed <seed or mnemonic of the assertionMethod key>
```
```bash
npx @kiltprotocol/kilt-extension-api createDidConfig --did <your DID> \
--origin <your domain> \
--assertionMethod <id of your DID's assertionMethod key> \
--seed <seed or mnemonic of the assertionMethod key>
```

</TabItem>
</Tabs>

:::info

- `did`: DID of the issuer (and subject) of the Domain Linkage Credential. If omitted, the tool attempts to infer this from the `assertionMethod`.
- `seed`: Mnemonic or seed for the `assertionMethod` key used for issuing a new credential.
- `origin`: The domain for which you are creating the credential. [Read MDN docs for more details](https://developer.mozilla.org/en-US/docs/Glossary/Origin]) for details.
- `origin`: The [HTTP origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) or URL of the web application for which you are creating the credential. Note that this must be an https:// URL with an empty path component. The resulting credential is valid for all paths under this origin.
- `assertionMethod`: ID of the `assertionMethod` key used for issuing a new credential.

:::

Use the tool's `--help` flag to see all available options:

```bash
yarn createDidConfig --help
```
<Tabs groupId="yarn-node-choice">
<TabItem value='yarn' label='Yarn' default>

```bash
yarn createDidConfig --help
```

</TabItem>
<TabItem value='node' label='Node'>

```bash
npx @kiltprotocol/kilt-extension-api createDidConfig --help
```

</TabItem>
</Tabs>

### Integration into an App

Expand Down