From 08985e32f127790e75cd07f6b287cbda197055bf Mon Sep 17 00:00:00 2001 From: Raphael Flechtner Date: Tue, 19 Dec 2023 14:19:00 +0100 Subject: [PATCH 1/7] chore: set alpha version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a0af933..8edb256 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kiltprotocol/kilt-extension-api", - "version": "0.1.0", + "version": "0.1.0-alpha.1", "main": "./index.js", "types": "./index.d.ts", "type": "commonjs", From 0e7c6678a77830511ac6d240e1a9854e7ddb4253 Mon Sep 17 00:00:00 2001 From: Skedley <48058984+Dudleyneedham@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:36:19 +0100 Subject: [PATCH 2/7] feat: Moving README to official Docs (#26) ## fixes https://github.com/KILTprotocol/ticket/issues/2822 Moving the README to official docs with the examples of Vue and React ## How to test: No testing ## Checklist: - [x] I have verified that the code works - [ ] I have verified that the code is easy to understand - [ ] If not, I have left a well-balanced amount of inline comments - [x] I have [left the code in a better state](https://deviq.com/principles/boy-scout-rule) - [ ] I have documented the changes (where applicable) * Either PR or Ticket to update [the Docs](https://github.com/KILTprotocol/docs) * Link the PR/Ticket here --- README.md | 114 +----------------------------------------------------- 1 file changed, 1 insertion(+), 113 deletions(-) diff --git a/README.md b/README.md index 86a741a..ddd014a 100644 --- a/README.md +++ b/README.md @@ -3,116 +3,4 @@ KILT Extension API is a JavaScript/TypeScript library that provides helper functions for interacting with KILT enabled extensions. It facilitates seamless communication between your application and KILT extensions. -## Getting Started - -Before you can communicate with KILT extensions, you must call the `initializeKiltExtensionAPI()` function to signal the API versions supported by your application. -This is crucial for the extension to inject the appropriate scripts into the website. - -```ts -import { initializeKiltExtensionAPI } from 'kilt-extension-api' - -initializeKiltExtensionAPI() -``` - -## Get Extensions - -The `getExtensions()` function returns a list of extensions currently injected into the website. - -```ts -import { getExtensions } from 'kilt-extension-api' - -const extensions = getExtensions() -``` - -## Watch Extensions - -Extensions may take longer to load than the website. -Therefore, the first call to `getExtensions()` might not return all available extensions. -To receive updates on additional extensions as they load, you can use `watchExtensions`. - -Here's an example of how you can use this function in a React application: - -```ts -import { watchExtensions, Types } from 'kilt-extension-api' - -export default function Home(): JSX.Element { - const [extensions, setExtensions] = useState< - Types.InjectedWindowProvider[] - >([]) - - useEffect(() => { - watchExtensions((extensions) => { - setExtensions(extensions) - }) - }, []) - - return ( - <> -

Extensions

- - - ) -} -``` - -## Well-Known DID Configuration - -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). - -### Using the CLI Tool - -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. - -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`). - -You can run the CLI tool using Yarn as follows: - -```bash -yarn createDidConfig --did --origin --assertionMethod --seed -``` - -For additional commands and configuration options, refer to the CLI tool's helper: - -```bash -yarn createDidConfig --help -``` - -### Integration into Your App - -Similar functionality to the CLI tool is available for import into your Node.js scripts using the subpath `kilt-extension-api/wellKnownDidConfiguration`: - -```ts -import { createCredential, didConfigResourceFromCredential } from './wellKnownDidConfiguration/index.js' - -const credential = await createCredential( - ({ data }) => { - //...DID signing logic - }, - 'https://example.com', - 'did:kilt:4pnfkRn5UurBJTW92d9TaVLR2CqJdY4z5HPjrEbpGyBykare' -) - -const didConfigResource = didConfigResourceFromCredential(credential) -``` - -This module also assists in verifying a DID configuration resource within an extension context: - -```ts -import { verifyDidConfigResource } from './wellKnownDidConfiguration/index.js' - -// load didConfigResource from https://example.com/.well-known/did-configuration.json - -const didLinkedToOrigin = await verifyDidConfigResource(didConfigResource, 'https://example.com') - -// or, if a specific DID is expected: - -await verifyDidConfigResource( - didConfigResource, - 'https://example.com', - 'did:kilt:4pnfkRn5UurBJTW92d9TaVLR2CqJdY4z5HPjrEbpGyBykare' -) -``` +For more information about [KILT Extension APIs](https://docs.kilt.io/docs/develop/sdk/integrate/kilt-extension-api), please visit our official documentation. From a15aa5d120eaf0234188480d9bfc6ce240ba4f12 Mon Sep 17 00:00:00 2001 From: Skedley <48058984+Dudleyneedham@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:04:18 +0100 Subject: [PATCH 3/7] feat: exporting types (#30) ## fixes N/A Exporting different Types ## How to test: Please provide a brief step-by-step instruction. If necessary provide information about dependencies (specific configuration, branches, database dumps, etc.) - Step 1 - Step 2 - etc. ## Checklist: - [ ] I have verified that the code works - [ ] I have verified that the code is easy to understand - [ ] If not, I have left a well-balanced amount of inline comments - [ ] I have [left the code in a better state](https://deviq.com/principles/boy-scout-rule) - [ ] I have documented the changes (where applicable) * Either PR or Ticket to update [the Docs](https://github.com/KILTprotocol/docs) * Link the PR/Ticket here --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index fafd5a9..beb9374 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,3 +6,4 @@ */ export { getExtensions, watchExtensions, initializeKiltExtensionAPI } from './getExtension/index.js' +export { InjectedWindowProvider, IEncryptedMessageV1, PubSubSessionV1, PubSubSessionV2, ApiWindow } from './types' From 1796aea18b89b12daa012d78a902226031dc0a79 Mon Sep 17 00:00:00 2001 From: dudleyneedham Date: Thu, 4 Jan 2024 10:14:32 +0100 Subject: [PATCH 4/7] chore: set new alpha version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8edb256..403c88e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kiltprotocol/kilt-extension-api", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "main": "./index.js", "types": "./index.d.ts", "type": "commonjs", @@ -87,4 +87,4 @@ "bin": { "createDidConfig": "./cli/createDidConfig.js" } -} +} \ No newline at end of file From 005fea74ab3d7df51a0703a49c618e08d8c74756 Mon Sep 17 00:00:00 2001 From: dudleyneedham Date: Thu, 4 Jan 2024 10:39:26 +0100 Subject: [PATCH 5/7] fix: export --- package.json | 2 +- src/index.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 403c88e..2be7fbb 100644 --- a/package.json +++ b/package.json @@ -87,4 +87,4 @@ "bin": { "createDidConfig": "./cli/createDidConfig.js" } -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index beb9374..2131e32 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,4 +6,10 @@ */ export { getExtensions, watchExtensions, initializeKiltExtensionAPI } from './getExtension/index.js' -export { InjectedWindowProvider, IEncryptedMessageV1, PubSubSessionV1, PubSubSessionV2, ApiWindow } from './types' +export { + InjectedWindowProvider, + IEncryptedMessageV1, + PubSubSessionV1, + PubSubSessionV2, + ApiWindow, +} from './types/index.js' From b5cced230105150da59363e657d64645c0e24af6 Mon Sep 17 00:00:00 2001 From: dudleyneedham Date: Thu, 4 Jan 2024 10:39:58 +0100 Subject: [PATCH 6/7] chore: set new alpha version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2be7fbb..7618ace 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kiltprotocol/kilt-extension-api", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "main": "./index.js", "types": "./index.d.ts", "type": "commonjs", From d12e5e0f5cb037afcceef8515ae9714556558e72 Mon Sep 17 00:00:00 2001 From: dudleyneedham Date: Fri, 16 Feb 2024 13:07:43 +0100 Subject: [PATCH 7/7] fix: removal of link to docs and placeholder added --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddd014a..c8213b7 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ KILT Extension API is a JavaScript/TypeScript library that provides helper functions for interacting with KILT enabled extensions. It facilitates seamless communication between your application and KILT extensions. -For more information about [KILT Extension APIs](https://docs.kilt.io/docs/develop/sdk/integrate/kilt-extension-api), please visit our official documentation. +The KILT Extension library documentation is currently under-development.