You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KILT Extension API is a JavaScript/TypeScript library that provides helper functions for interacting with KILT enabled extensions.
7
-
It facilitates seamless communication between your application and KILT extensions.
6
+
import TsJsBlock from '@site/src/components/TsJsBlock';
7
+
import Tabs from '@theme/Tabs';
8
+
import TabItem from '@theme/TabItem';
8
9
9
-
## Getting Started
10
+
The KILT Extension API is a JavaScript and TypeScript library that provides helper functions for interacting with KILT extensions.
11
+
It facilitates communication between your application and KILT extensions.
10
12
11
-
Before you can communicate with KILT extensions, you must call the `initializeKiltExtensionAPI()` function to signal the API versions supported by your application.
12
-
This is crucial for the extension to inject the appropriate scripts into the website.
13
+
<!-- TODO: Possible to test code as it's browser-based? -->
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.
This library also aids in setting 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).
160
+
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).
68
161
69
162
### Using the CLI Tool
70
163
71
-
A CLI tool is included in this library to create a [DID Configuration Resource](https://identity.foundation/.well-known/resources/did-configuration/#did-configuration-resource) as specified in the above documentation. This resource is necessary to establish a secure, end-to-end encrypted communication channel between a conforming browser extension and the application backend.
164
+
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.
165
+
166
+
:::warning KILT Account
72
167
73
-
To start using this tool, you can add this package to your application using `yarn add --dev kilt-extension-api` or install it globally if needed (`yarn global add kilt-extension-api`).
168
+
The `createDidConfig` CLI tool **only** works if you installed the package with Yarn.
74
169
75
-
You can run the CLI tool using Yarn as follows:
170
+
:::
171
+
172
+
Run the CLI tool using Yarn as follows:
76
173
77
174
```bash
78
175
yarn createDidConfig --did <your DID> --origin <your domain> --assertionMethod <id of your DID's assertionMethod key> --seed <seed or mnemonic of the assertionMethod key>
79
176
```
80
177
81
-
For additional commands and configuration options, refer to the CLI tool's helper:
178
+
:::info
179
+
180
+
- `did`: DID of the issuer (and subject) of the Domain Linkage Credential. If omitted, the tool attempts to infer this from the `assertionMethod`.
181
+
- `seed`: Mnemonic or seed for the `assertionMethod` key used for issuing a new credential.
182
+
- `origin`: Domain of the application that will be using the DID Configuration Resource.
183
+
- `assertionMethod`: ID of the `assertionMethod` key used for issuing a new credential.
184
+
:::
185
+
186
+
Use the tool's `--help` flag to see all available options:
82
187
83
188
```bash
84
189
yarn createDidConfig --help
85
190
```
86
191
87
-
### Integration into Your App
192
+
### Integration into an App
88
193
89
-
Similar functionality to the CLI tool is available forimport into your Node.js scripts using the subpath `kilt-extension-api/wellKnownDidConfiguration`:
194
+
Similar functionality to the CLI tool is available forusein application code using the `@kiltprotocol/extension-api/wellKnownDidConfiguration` subpath:
90
195
91
196
```ts
92
-
import { createCredential, didConfigResourceFromCredential } from './wellKnownDidConfiguration/index.js'
197
+
import { createCredential, didConfigResourceFromCredential } from '@kiltprotocol/extension-api/wellKnownDidConfiguration'
0 commit comments