@learncard/idx-plugin 1.1.24 → 1.1.26
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 +12 -7
- package/dist/idx-plugin.cjs.development.cjs +3982 -2307
- package/dist/idx-plugin.cjs.development.cjs.map +4 -4
- package/dist/idx-plugin.cjs.production.min.cjs +64 -36
- package/dist/idx-plugin.cjs.production.min.cjs.map +4 -4
- package/dist/idx-plugin.esm.js +3982 -2307
- package/dist/idx-plugin.esm.js.map +4 -4
- package/package.json +62 -60
- package/src/defaults.ts +18 -0
- package/src/idx.ts +260 -0
- package/src/index.ts +5 -0
- package/src/types.ts +88 -0
package/README.md
CHANGED
|
@@ -11,25 +11,26 @@
|
|
|
11
11
|
The IDX Plugin provides Ceramic's Identity Index (IDX) integration for LearnCard, allowing for decentralized index storage of credential references.
|
|
12
12
|
|
|
13
13
|
## Documentation
|
|
14
|
+
|
|
14
15
|
All LearnCard documentation can be found at:
|
|
15
16
|
https://docs.learncard.com
|
|
16
17
|
|
|
17
18
|
## Install
|
|
18
19
|
|
|
19
20
|
```bash
|
|
20
|
-
|
|
21
|
+
bun add @learncard/core
|
|
21
22
|
```
|
|
22
23
|
|
|
23
24
|
## Usage
|
|
24
25
|
|
|
25
26
|
### Instantiation
|
|
26
27
|
|
|
27
|
-
Instantiate a wallet using `initLearnCard`. This method accepts a unique identifier string that is
|
|
28
|
+
Instantiate a wallet using `initLearnCard`. This method accepts a unique identifier string that is
|
|
28
29
|
up to 64 characters long. If it is less than 64 characters, `initLearnCard` will pad the start of
|
|
29
30
|
the string with 0's until it is 64 characters long.
|
|
30
31
|
|
|
31
32
|
```js
|
|
32
|
-
import { initLearnCard } from
|
|
33
|
+
import { initLearnCard } from '@learncard/core';
|
|
33
34
|
|
|
34
35
|
const wallet = await initLearnCard({ seed: 'a'.repeat(64) });
|
|
35
36
|
```
|
|
@@ -37,6 +38,7 @@ const wallet = await initLearnCard({ seed: 'a'.repeat(64) });
|
|
|
37
38
|
### Issuing/Verifying Credentials and Presentations
|
|
38
39
|
|
|
39
40
|
#### Issue a credential
|
|
41
|
+
|
|
40
42
|
```js
|
|
41
43
|
// Grab a test VC, or create your own!
|
|
42
44
|
const unsignedVc = await wallet.invoke.getTestVc();
|
|
@@ -45,6 +47,7 @@ const vc = await wallet.invoke.issueCredential(unsignedVc);
|
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
#### Verify a credential
|
|
50
|
+
|
|
48
51
|
```js
|
|
49
52
|
const result = await wallet.invoke.verifyCredential(vc, {}, true);
|
|
50
53
|
|
|
@@ -55,11 +58,13 @@ else console.log('This credential is valid!');
|
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
#### Issue a presentation
|
|
61
|
+
|
|
58
62
|
```js
|
|
59
63
|
const vp = await wallet.invoke.issuePresentation(vc);
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
#### Verify a presentation
|
|
67
|
+
|
|
63
68
|
```js
|
|
64
69
|
const result = await wallet.invoke.verifyPresentation(vp);
|
|
65
70
|
|
|
@@ -76,14 +81,14 @@ else console.log('This presentation is valid!');
|
|
|
76
81
|
To maintain co-ownership of credentials, it is best to store credentials in a public place, and then
|
|
77
82
|
store references to that public place. While this is not the only way to store credentials (and is
|
|
78
83
|
also definitely not a silver bullet! E.g. credentials containing private data), it is the opinion of
|
|
79
|
-
this library that it should be used by default. As a result, instantiating a wallet, will
|
|
80
|
-
automatically connect you to WeLibrary's ceramic node, and allow you to publish and retrieve
|
|
84
|
+
this library that it should be used by default. As a result, instantiating a wallet, will
|
|
85
|
+
automatically connect you to WeLibrary's ceramic node, and allow you to publish and retrieve
|
|
81
86
|
credentials there using IDX.
|
|
82
87
|
|
|
83
88
|
#### Publish Credential
|
|
84
89
|
|
|
85
90
|
After signing a VC, you may choose to publish that credential to Ceramic. Doing so will return a
|
|
86
|
-
stream ID, which you may share to the recipient. That stream ID can then be used to resolve the
|
|
91
|
+
stream ID, which you may share to the recipient. That stream ID can then be used to resolve the
|
|
87
92
|
issued credential. This means both the issuer and recipient may store the _stream ID_ instead of the
|
|
88
93
|
credential itself.
|
|
89
94
|
|
|
@@ -128,6 +133,7 @@ const vcs = await Promise.all(uris.map(async uri => wallet.read.get(uri)));
|
|
|
128
133
|
```
|
|
129
134
|
|
|
130
135
|
## Contributing
|
|
136
|
+
|
|
131
137
|
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
|
132
138
|
|
|
133
139
|
Please make sure to update tests as appropriate.
|
|
@@ -136,7 +142,6 @@ Please make sure to update tests as appropriate.
|
|
|
136
142
|
|
|
137
143
|
**[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:
|
|
138
144
|
|
|
139
|
-
|
|
140
145
|
## License
|
|
141
146
|
|
|
142
147
|
MIT © [Learning Economy Foundation](https://github.com/Learning-Economy-Foundation)
|