@learncard/did-web-plugin 1.1.24 → 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 +3 -2
- package/package.json +58 -56
- package/src/index.ts +2 -0
- package/src/plugin.ts +33 -0
- package/src/types.ts +10 -0
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
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
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'>;
|