@learncard/learn-cloud-plugin 2.3.29 → 2.3.31
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 +11 -6
- package/dist/learn-cloud-plugin.cjs.development.cjs +117 -102
- package/dist/learn-cloud-plugin.cjs.development.cjs.map +3 -3
- package/dist/learn-cloud-plugin.cjs.production.min.cjs +42 -42
- package/dist/learn-cloud-plugin.cjs.production.min.cjs.map +4 -4
- package/dist/learn-cloud-plugin.esm.js +117 -102
- package/dist/learn-cloud-plugin.esm.js.map +3 -3
- package/package.json +65 -63
- package/src/helpers.ts +87 -0
- package/src/index.ts +2 -0
- package/src/plugin.ts +711 -0
- package/src/test/index.test.ts +84 -0
- package/src/test/mocks/sample-vcs.ts +579 -0
- package/src/types.ts +69 -0
package/README.md
CHANGED
|
@@ -9,25 +9,26 @@
|
|
|
9
9
|
The LearnCard Core is a pluggable, open-source, universal digital wallet to enable any individual or organization to seamlessly **issue, earn, store, share, and spend currency and credentials** built for the future of education and work.
|
|
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/core
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
## Usage
|
|
22
23
|
|
|
23
24
|
### Instantiation
|
|
24
25
|
|
|
25
|
-
Instantiate a wallet using `initLearnCard`. This method accepts a unique identifier string that is
|
|
26
|
+
Instantiate a wallet using `initLearnCard`. This method accepts a unique identifier string that is
|
|
26
27
|
up to 64 characters long. If it is less than 64 characters, `initLearnCard` will pad the start of
|
|
27
28
|
the string with 0's until it is 64 characters long.
|
|
28
29
|
|
|
29
30
|
```js
|
|
30
|
-
import { initLearnCard } from
|
|
31
|
+
import { initLearnCard } from '@learncard/core';
|
|
31
32
|
|
|
32
33
|
const wallet = await initLearnCard({ seed: 'a'.repeat(64) });
|
|
33
34
|
```
|
|
@@ -35,6 +36,7 @@ const wallet = await initLearnCard({ seed: 'a'.repeat(64) });
|
|
|
35
36
|
### Issuing/Verifying Credentials and Presentations
|
|
36
37
|
|
|
37
38
|
#### Issue a credential
|
|
39
|
+
|
|
38
40
|
```js
|
|
39
41
|
// Grab a test VC, or create your own!
|
|
40
42
|
const unsignedVc = await wallet.invoke.getTestVc();
|
|
@@ -43,6 +45,7 @@ const vc = await wallet.invoke.issueCredential(unsignedVc);
|
|
|
43
45
|
```
|
|
44
46
|
|
|
45
47
|
#### Verify a credential
|
|
48
|
+
|
|
46
49
|
```js
|
|
47
50
|
const result = await wallet.invoke.verifyCredential(vc, {}, true);
|
|
48
51
|
|
|
@@ -53,11 +56,13 @@ else console.log('This credential is valid!');
|
|
|
53
56
|
```
|
|
54
57
|
|
|
55
58
|
#### Issue a presentation
|
|
59
|
+
|
|
56
60
|
```js
|
|
57
61
|
const vp = await wallet.invoke.issuePresentation(vc);
|
|
58
62
|
```
|
|
59
63
|
|
|
60
64
|
#### Verify a presentation
|
|
65
|
+
|
|
61
66
|
```js
|
|
62
67
|
const result = await wallet.invoke.verifyPresentation(vp);
|
|
63
68
|
|
|
@@ -74,10 +79,10 @@ store references to that public place. While this is not the only way to store c
|
|
|
74
79
|
also definitely not a silver bullet! E.g. credentials containing private data), it is the opinion of
|
|
75
80
|
this library that it should be used by default.
|
|
76
81
|
|
|
77
|
-
#### Publish Credential
|
|
82
|
+
#### Publish Credential
|
|
78
83
|
|
|
79
84
|
After signing a VC, you may choose to publish that credential to LearnCloud. Doing so will return a
|
|
80
|
-
URI, which you may share to the recipient. That URI can then be used to resolve the
|
|
85
|
+
URI, which you may share to the recipient. That URI can then be used to resolve the
|
|
81
86
|
issued credential. This means both the issuer and recipient may store the _URI_ instead of the
|
|
82
87
|
credential itself.
|
|
83
88
|
|
|
@@ -123,6 +128,7 @@ const vcs = await Promise.all(uris.map(async uri => wallet.read.get(uri)));
|
|
|
123
128
|
```
|
|
124
129
|
|
|
125
130
|
## Contributing
|
|
131
|
+
|
|
126
132
|
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
|
127
133
|
|
|
128
134
|
Please make sure to update tests as appropriate.
|
|
@@ -131,7 +137,6 @@ Please make sure to update tests as appropriate.
|
|
|
131
137
|
|
|
132
138
|
**[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:
|
|
133
139
|
|
|
134
|
-
|
|
135
140
|
## License
|
|
136
141
|
|
|
137
142
|
MIT © [Learning Economy Foundation](https://github.com/Learning-Economy-Foundation)
|