@learncard/did-web-plugin 1.1.23 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,13 +9,14 @@
9
9
  The LearnCard DID Web Plugin is a plugin for adding did-web support to a LearnCard agent for signing VCs.
10
10
 
11
11
  ## Documentation
12
+
12
13
  All LearnCard documentation can be found at:
13
14
  https://docs.learncard.com
14
15
 
15
16
  ## Install
16
17
 
17
18
  ```bash
18
- pnpm i @learncard/init @learncard/did-web-plugin
19
+ bun add @learncard/init @learncard/did-web-plugin
19
20
  ```
20
21
 
21
22
  ## Usage
@@ -29,6 +30,7 @@ const customLearnCard = await emptyLearnCard.addPlugin(getDidWebPlugin());
29
30
  ```
30
31
 
31
32
  ## Contributing
33
+
32
34
  Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
33
35
 
34
36
  Please make sure to update tests as appropriate.
@@ -37,7 +39,6 @@ Please make sure to update tests as appropriate.
37
39
 
38
40
  **[Learning Economy Foundation (LEF)](https://www.learningeconomy.io)** is a 501(c)(3) non-profit organization leveraging global standards and web3 protocols to bring quality skills and equal opportunity to every human on earth, and address the persistent inequities that exist around the globe in education and employment. We help you build the future of education and work with:
39
41
 
40
-
41
42
  ## License
42
43
 
43
44
  MIT © [Learning Economy Foundation](https://github.com/Learning-Economy-Foundation)
package/package.json CHANGED
@@ -1,57 +1,59 @@
1
1
  {
2
- "name": "@learncard/did-web-plugin",
3
- "version": "1.1.23",
4
- "description": "",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/did-web-plugin.esm.js",
8
- "exports": {
9
- ".": {
10
- "import": {
11
- "types": "./dist/index.d.ts",
12
- "default": "./dist/did-web-plugin.esm.js"
13
- },
14
- "require": {
15
- "types": "./dist/index.d.cts",
16
- "default": "./dist/index.cjs"
17
- }
18
- }
19
- },
20
- "files": [
21
- "dist"
22
- ],
23
- "author": "Learning Economy Foundation (www.learningeconomy.io)",
24
- "license": "MIT",
25
- "homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/did-web-plugin/README.md",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/learningeconomy/LearnCard"
29
- },
30
- "bugs": {
31
- "url": "https://github.com/learningeconomy/LearnCard/issues"
32
- },
33
- "devDependencies": {
34
- "@types/jest": "^29.2.2",
35
- "@types/node": "^17.0.31",
36
- "aqu": "0.4.3",
37
- "dids": "^3.2.0",
38
- "esbuild": "^0.27.1",
39
- "esbuild-jest": "^0.5.0",
40
- "esbuild-plugin-copy": "^1.3.0",
41
- "jest": "^29.3.0",
42
- "shx": "^0.3.4",
43
- "ts-jest": "^29.0.3",
44
- "@learncard/types": "5.17.3"
45
- },
46
- "types": "./dist/index.d.ts",
47
- "dependencies": {
48
- "@learncard/core": "9.4.23"
49
- },
50
- "sideEffects": false,
51
- "scripts": {
52
- "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
53
- "test": "jest --passWithNoTests",
54
- "test:watch": "jest --watch",
55
- "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
56
- }
57
- }
2
+ "name": "@learncard/did-web-plugin",
3
+ "version": "1.1.25",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/did-web-plugin.esm.js",
8
+ "exports": {
9
+ ".": {
10
+ "development": "./src/index.ts",
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/did-web-plugin.esm.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
25
+ "scripts": {
26
+ "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
27
+ "test": "jest --passWithNoTests",
28
+ "test:watch": "jest --watch",
29
+ "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
30
+ },
31
+ "author": "Learning Economy Foundation (www.learningeconomy.io)",
32
+ "license": "MIT",
33
+ "homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/did-web-plugin/README.md",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/learningeconomy/LearnCard"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/learningeconomy/LearnCard/issues"
40
+ },
41
+ "devDependencies": {
42
+ "@learncard/types": "workspace:*",
43
+ "@types/jest": "^29.2.2",
44
+ "@types/node": "^17.0.31",
45
+ "aqu": "0.4.3",
46
+ "dids": "^3.2.0",
47
+ "esbuild": "^0.27.1",
48
+ "esbuild-jest": "^0.5.0",
49
+ "esbuild-plugin-copy": "^1.3.0",
50
+ "jest": "^29.3.0",
51
+ "shx": "^0.3.4",
52
+ "ts-jest": "^29.0.3"
53
+ },
54
+ "types": "./dist/index.d.ts",
55
+ "dependencies": {
56
+ "@learncard/core": "workspace:*"
57
+ },
58
+ "sideEffects": false
59
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './plugin';
package/src/plugin.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { LearnCard } from '@learncard/core';
2
+
3
+ import { DidWebPluginDependentMethods, DidWebPlugin } from './types';
4
+ export * from './types';
5
+
6
+ /**
7
+ * @group Plugins
8
+ */
9
+ export const getDidWebPlugin = async (
10
+ learnCard: LearnCard<any, 'id', DidWebPluginDependentMethods>,
11
+ didWeb: string
12
+ ): Promise<DidWebPlugin> => {
13
+ learnCard?.debug?.('Adding DID Web Plugin');
14
+ if (!didWeb.includes('did:web:')) {
15
+ throw new Error('Must provide a valid did:web DID into constructor.');
16
+ }
17
+
18
+ return {
19
+ name: 'DID Web',
20
+ displayName: 'DID Web',
21
+ description:
22
+ 'The LearnCard DID Web Plugin is a plugin for adding did-web support to a LearnCard agent for signing VCs.',
23
+ id: {
24
+ did: (_learnCard, method) => {
25
+ if (!method || method === 'web') return didWeb;
26
+
27
+ return learnCard.id.did(method);
28
+ },
29
+ keypair: (_learnCard, algorithm) => learnCard.id.keypair(algorithm),
30
+ },
31
+ methods: {},
32
+ };
33
+ };
package/src/types.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Plugin } from '@learncard/core';
2
+
3
+ /** @group DID Web Plugin */
4
+ export type DidWebPluginDependentMethods = {};
5
+
6
+ /** @group DID Web Plugin */
7
+ export type DidWebPluginMethods = {};
8
+
9
+ /** @group DID Web Plugin */
10
+ export type DidWebPlugin = Plugin<'DID Web', 'id'>;