@learncard/cli 1.5.3 → 2.0.1
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/CHANGELOG.md +19 -0
- package/dist/index.js +35 -24
- package/package.json +3 -3
- package/src/index.tsx +37 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @learncard/cli
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`1cafab4`](https://github.com/learningeconomy/LearnCard/commit/1cafab43a6c053914305e0a8b938748ed2a5fd31)]:
|
|
8
|
+
- @learncard/core@8.0.1
|
|
9
|
+
|
|
10
|
+
## 2.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [#130](https://github.com/learningeconomy/LearnCard/pull/130) [`e7cfb63`](https://github.com/learningeconomy/LearnCard/commit/e7cfb636b21cfdd834e3b0cb028036819326a2f9) Thanks [@TaylorBeeston](https://github.com/TaylorBeeston)! - Update to Control Planes
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`e7cfb63`](https://github.com/learningeconomy/LearnCard/commit/e7cfb636b21cfdd834e3b0cb028036819326a2f9), [`e7cfb63`](https://github.com/learningeconomy/LearnCard/commit/e7cfb636b21cfdd834e3b0cb028036819326a2f9), [`e7cfb63`](https://github.com/learningeconomy/LearnCard/commit/e7cfb636b21cfdd834e3b0cb028036819326a2f9)]:
|
|
19
|
+
- @learncard/core@8.0.0
|
|
20
|
+
- @learncard/types@5.0.0
|
|
21
|
+
|
|
3
22
|
## 1.5.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
|
22
22
|
const generateRandomSeed = () => crypto__default["default"].randomBytes(32).toString("hex");
|
|
23
23
|
|
|
24
24
|
var name = "@learncard/cli";
|
|
25
|
-
var version = "
|
|
25
|
+
var version = "2.0.1";
|
|
26
26
|
var description = "Test out learn card!";
|
|
27
27
|
var main = "dist/index.js";
|
|
28
28
|
var bin = "dist/index.js";
|
|
@@ -66,12 +66,13 @@ var packageJson = {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const g = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
learnCard: gradient__default["default"](["cyan", "green"])("learnCard"),
|
|
70
|
+
emptyLearnCard: gradient__default["default"](["cyan", "green"])("emptyLearnCard"),
|
|
71
|
+
learnCardFromKey: gradient__default["default"](["cyan", "green"])("learnCardFromKey"),
|
|
72
72
|
initLearnCard: gradient__default["default"](["cyan", "green"])("initLearnCard"),
|
|
73
73
|
seed: gradient__default["default"](["cyan", "green"])("seed"),
|
|
74
|
-
generateRandomSeed: gradient__default["default"](["cyan", "green"])("generateRandomSeed")
|
|
74
|
+
generateRandomSeed: gradient__default["default"](["cyan", "green"])("generateRandomSeed"),
|
|
75
|
+
types: gradient__default["default"](["cyan", "green"])("types")
|
|
75
76
|
};
|
|
76
77
|
commander.program.version(packageJson.version).argument("[seed]").action(async (_seed = generateRandomSeed()) => {
|
|
77
78
|
console.clear();
|
|
@@ -83,14 +84,15 @@ commander.program.version(packageJson.version).argument("[seed]").action(async (
|
|
|
83
84
|
console.log("Creating wallet...");
|
|
84
85
|
globalThis.seed = seed;
|
|
85
86
|
globalThis.generateRandomSeed = generateRandomSeed;
|
|
86
|
-
globalThis.
|
|
87
|
-
globalThis.
|
|
87
|
+
globalThis.emptyLearnCard = core.emptyLearnCard;
|
|
88
|
+
globalThis.learnCardFromKey = core.learnCardFromKey;
|
|
88
89
|
globalThis.initLearnCard = core.initLearnCard;
|
|
89
|
-
globalThis.
|
|
90
|
+
globalThis.learnCard = await core.initLearnCard({
|
|
90
91
|
seed,
|
|
91
92
|
didkit: fs__default["default"].readFile(require.resolve("@learncard/core/dist/didkit/didkit_wasm_bg.wasm"))
|
|
92
93
|
});
|
|
93
94
|
globalThis.types = types__default["default"];
|
|
95
|
+
globalThis.getTestCache = core.getTestCache;
|
|
94
96
|
process.stdout.moveCursor(0, -1);
|
|
95
97
|
process.stdout.clearLine(1);
|
|
96
98
|
console.log("Wallet created!\n");
|
|
@@ -99,35 +101,44 @@ commander.program.version(packageJson.version).argument("[seed]").action(async (
|
|
|
99
101
|
console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
|
|
100
102
|
console.log("\u2502 Variable \u2502 Description \u2502");
|
|
101
103
|
console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
|
|
102
|
-
console.log(`\u2502
|
|
103
|
-
console.log(`\u2502 ${g.emptyWallet} \u2502 Wallet Instantiation Function \u2502`);
|
|
104
|
-
console.log(`\u2502 ${g.walletFromKey} \u2502 Wallet Instantiation Function \u2502`);
|
|
104
|
+
console.log(`\u2502 ${g.learnCard} \u2502 Learn Card Wallet \u2502`);
|
|
105
105
|
console.log(`\u2502 ${g.initLearnCard} \u2502 Wallet Instantiation Function \u2502`);
|
|
106
106
|
console.log(`\u2502 ${g.seed} \u2502 Seed used to generate wallet \u2502`);
|
|
107
107
|
console.log(`\u2502 ${g.generateRandomSeed} \u2502 Generates a random seed \u2502`);
|
|
108
|
+
console.log(`\u2502 ${g.types} \u2502 Helpful zod validators \u2502`);
|
|
108
109
|
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
109
110
|
console.log("");
|
|
110
111
|
console.log(
|
|
111
112
|
"For help/documentation regarding your wallet, please read the documentation at\n"
|
|
112
113
|
);
|
|
114
|
+
console.log("https://docs.learncard.com/learn-card-sdk/learncard-core/quick-start\n");
|
|
115
|
+
console.log("To get a feel for what's possible, try some of the following commands\n");
|
|
116
|
+
console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
117
|
+
console.log("\u2502 Description \u2502 Command \u2502");
|
|
118
|
+
console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
|
|
113
119
|
console.log(
|
|
114
|
-
|
|
120
|
+
`\u2502 View your did \u2502 ${g.learnCard}.id.did(); \u2502`
|
|
115
121
|
);
|
|
116
|
-
console.log(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
console.log(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
console.log(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.log(
|
|
126
|
-
|
|
122
|
+
console.log(
|
|
123
|
+
`\u2502 Generate an unsigned VC \u2502 ${g.learnCard}.invoke.getTestVc(); \u2502`
|
|
124
|
+
);
|
|
125
|
+
console.log(
|
|
126
|
+
`\u2502 Issue a signed VC \u2502 await ${g.learnCard}.invoke.issueCredential(uvc); \u2502`
|
|
127
|
+
);
|
|
128
|
+
console.log(
|
|
129
|
+
`\u2502 Verify a signed VC \u2502 await ${g.learnCard}.invoke.verifyCredential(vc); \u2502`
|
|
130
|
+
);
|
|
131
|
+
console.log(
|
|
132
|
+
`\u2502 Issue a signed VP \u2502 await ${g.learnCard}.invoke.issuePresentation(vc); \u2502`
|
|
133
|
+
);
|
|
134
|
+
console.log(
|
|
135
|
+
`\u2502 Verify a signed VP \u2502 await ${g.learnCard}.invoke.verifyPresentation(vp); \u2502`
|
|
136
|
+
);
|
|
137
|
+
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
127
138
|
console.log("");
|
|
128
139
|
repl__default["default"].start({
|
|
129
140
|
colorize: (input) => {
|
|
130
|
-
return input.replace("
|
|
141
|
+
return input.replace("emptyLearnCard", g.emptyLearnCard).replace("learnCardFromKey", g.learnCardFromKey).replace("initLearnCard", g.initLearnCard).replace("learnCard", g.learnCard).replace("seed", g.seed).replace("generateRandomSeed", g.generateRandomSeed);
|
|
131
142
|
}
|
|
132
143
|
});
|
|
133
144
|
}).parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Test out learn card!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "dist/index.js",
|
|
7
7
|
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@learncard/core": "
|
|
11
|
-
"@learncard/types": "
|
|
10
|
+
"@learncard/core": "8.0.1",
|
|
11
|
+
"@learncard/types": "5.0.0",
|
|
12
12
|
"@rollup/plugin-json": "^4.1.0",
|
|
13
13
|
"commander": "^9.3.0",
|
|
14
14
|
"figlet": "^1.5.2",
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import repl from 'pretty-repl';
|
|
3
3
|
|
|
4
|
-
import { initLearnCard,
|
|
4
|
+
import { initLearnCard, emptyLearnCard, learnCardFromKey, getTestCache } from '@learncard/core';
|
|
5
5
|
import types from '@learncard/types';
|
|
6
6
|
import gradient from 'gradient-string';
|
|
7
7
|
import figlet from 'figlet';
|
|
@@ -12,12 +12,13 @@ import { generateRandomSeed } from './random';
|
|
|
12
12
|
import packageJson from '../package.json';
|
|
13
13
|
|
|
14
14
|
const g = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
learnCard: gradient(['cyan', 'green'])('learnCard'),
|
|
16
|
+
emptyLearnCard: gradient(['cyan', 'green'])('emptyLearnCard'),
|
|
17
|
+
learnCardFromKey: gradient(['cyan', 'green'])('learnCardFromKey'),
|
|
18
18
|
initLearnCard: gradient(['cyan', 'green'])('initLearnCard'),
|
|
19
19
|
seed: gradient(['cyan', 'green'])('seed'),
|
|
20
20
|
generateRandomSeed: gradient(['cyan', 'green'])('generateRandomSeed'),
|
|
21
|
+
types: gradient(['cyan', 'green'])('types'),
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
program
|
|
@@ -37,14 +38,15 @@ program
|
|
|
37
38
|
|
|
38
39
|
globalThis.seed = seed;
|
|
39
40
|
globalThis.generateRandomSeed = generateRandomSeed;
|
|
40
|
-
globalThis.
|
|
41
|
-
globalThis.
|
|
41
|
+
globalThis.emptyLearnCard = emptyLearnCard;
|
|
42
|
+
globalThis.learnCardFromKey = learnCardFromKey;
|
|
42
43
|
globalThis.initLearnCard = initLearnCard;
|
|
43
|
-
globalThis.
|
|
44
|
+
globalThis.learnCard = await initLearnCard({
|
|
44
45
|
seed,
|
|
45
46
|
didkit: fs.readFile(require.resolve('@learncard/core/dist/didkit/didkit_wasm_bg.wasm')),
|
|
46
47
|
});
|
|
47
48
|
globalThis.types = types;
|
|
49
|
+
globalThis.getTestCache = getTestCache;
|
|
48
50
|
|
|
49
51
|
// delete 'Creating wallet...' message
|
|
50
52
|
process.stdout.moveCursor(0, -1);
|
|
@@ -57,12 +59,11 @@ program
|
|
|
57
59
|
console.log('├────────────────────┬───────────────────────────────┤');
|
|
58
60
|
console.log('│ Variable │ Description │');
|
|
59
61
|
console.log('├────────────────────┼───────────────────────────────┤');
|
|
60
|
-
console.log(`│
|
|
61
|
-
console.log(`│ ${g.emptyWallet} │ Wallet Instantiation Function │`);
|
|
62
|
-
console.log(`│ ${g.walletFromKey} │ Wallet Instantiation Function │`);
|
|
62
|
+
console.log(`│ ${g.learnCard} │ Learn Card Wallet │`);
|
|
63
63
|
console.log(`│ ${g.initLearnCard} │ Wallet Instantiation Function │`);
|
|
64
64
|
console.log(`│ ${g.seed} │ Seed used to generate wallet │`);
|
|
65
65
|
console.log(`│ ${g.generateRandomSeed} │ Generates a random seed │`);
|
|
66
|
+
console.log(`│ ${g.types} │ Helpful zod validators │`);
|
|
66
67
|
console.log('└────────────────────┴───────────────────────────────┘');
|
|
67
68
|
|
|
68
69
|
console.log('');
|
|
@@ -71,32 +72,42 @@ program
|
|
|
71
72
|
'For help/documentation regarding your wallet, please read the documentation at\n'
|
|
72
73
|
);
|
|
73
74
|
|
|
74
|
-
console.log(
|
|
75
|
-
'https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/quick-start\n'
|
|
76
|
-
);
|
|
75
|
+
console.log('https://docs.learncard.com/learn-card-sdk/learncard-core/quick-start\n');
|
|
77
76
|
|
|
78
77
|
console.log("To get a feel for what's possible, try some of the following commands\n");
|
|
79
78
|
|
|
80
|
-
console.log('
|
|
81
|
-
console.log('│ Description │
|
|
82
|
-
console.log('
|
|
83
|
-
console.log(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
console.log(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
console.log(
|
|
79
|
+
console.log('┌─────────────────────────┬────────────────────────────────────────────────┐');
|
|
80
|
+
console.log('│ Description │ Command │');
|
|
81
|
+
console.log('├─────────────────────────┼────────────────────────────────────────────────┤');
|
|
82
|
+
console.log(
|
|
83
|
+
`│ View your did │ ${g.learnCard}.id.did(); │`
|
|
84
|
+
);
|
|
85
|
+
console.log(
|
|
86
|
+
`│ Generate an unsigned VC │ ${g.learnCard}.invoke.getTestVc(); │`
|
|
87
|
+
);
|
|
88
|
+
console.log(
|
|
89
|
+
`│ Issue a signed VC │ await ${g.learnCard}.invoke.issueCredential(uvc); │`
|
|
90
|
+
);
|
|
91
|
+
console.log(
|
|
92
|
+
`│ Verify a signed VC │ await ${g.learnCard}.invoke.verifyCredential(vc); │`
|
|
93
|
+
);
|
|
94
|
+
console.log(
|
|
95
|
+
`│ Issue a signed VP │ await ${g.learnCard}.invoke.issuePresentation(vc); │`
|
|
96
|
+
);
|
|
97
|
+
console.log(
|
|
98
|
+
`│ Verify a signed VP │ await ${g.learnCard}.invoke.verifyPresentation(vp); │`
|
|
99
|
+
);
|
|
100
|
+
console.log('└─────────────────────────┴────────────────────────────────────────────────┘');
|
|
90
101
|
|
|
91
102
|
console.log('');
|
|
92
103
|
|
|
93
104
|
repl.start({
|
|
94
105
|
colorize: (input: string) => {
|
|
95
106
|
return input
|
|
96
|
-
.replace('
|
|
97
|
-
.replace('
|
|
107
|
+
.replace('emptyLearnCard', g.emptyLearnCard)
|
|
108
|
+
.replace('learnCardFromKey', g.learnCardFromKey)
|
|
98
109
|
.replace('initLearnCard', g.initLearnCard)
|
|
99
|
-
.replace('
|
|
110
|
+
.replace('learnCard', g.learnCard)
|
|
100
111
|
.replace('seed', g.seed)
|
|
101
112
|
.replace('generateRandomSeed', g.generateRandomSeed);
|
|
102
113
|
},
|