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.
72
165
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`).
166
+
:::warning KILT Account
74
167
75
-
You can run the CLI tool using Yarn as follows:
168
+
The `createDidConfig` CLI tool **only** works if you installed the package with Yarn.
169
+
170
+
:::
171
+
172
+
Run the CLI tool using Yarn as follows:
76
173
77
174
```bash
78
-
yarn createDidConfig --did <your DID> --origin <your domain> --assertionMethod <id of your DID's assertionMethod key> --seed <seed or mnemonic of the assertionMethod key>
175
+
yarn createDidConfig --did <your DID> \
176
+
--origin <your domain> \
177
+
--assertionMethod <id of your DID's assertionMethod key> \
178
+
--seed <seed or mnemonic of the assertionMethod key>
79
179
```
80
180
81
-
For additional commands and configuration options, refer to the CLI tool's helper:
181
+
:::info
182
+
183
+
- `did`: DID of the issuer (and subject) of the Domain Linkage Credential. If omitted, the tool attempts to infer this from the `assertionMethod`.
184
+
- `seed`: Mnemonic or seed for the `assertionMethod` key used for issuing a new credential.
185
+
- `origin`: The domain for which you are creating the credential. See [https://developer.mozilla.org/en-US/docs/Glossary/Origin] for details.
186
+
- `assertionMethod`: ID of the `assertionMethod` key used for issuing a new credential.
187
+
-
188
+
:::
189
+
190
+
Use the tool's `--help` flag to see all available options:
82
191
83
192
```bash
84
193
yarn createDidConfig --help
85
194
```
86
195
87
-
### Integration into Your App
196
+
### Integration into an App
88
197
89
-
Similar functionality to the CLI tool is available forimport into your Node.js scripts using the subpath `kilt-extension-api/wellKnownDidConfiguration`:
198
+
Similar functionality to the CLI tool is available forusein application code using the `@kiltprotocol/extension-api/wellKnownDidConfiguration` subpath:
90
199
91
200
```ts
92
-
import { createCredential, didConfigResourceFromCredential } from './wellKnownDidConfiguration/index.js'
201
+
import { createCredential, didConfigResourceFromCredential } from '@kiltprotocol/extension-api/wellKnownDidConfiguration'
0 commit comments