@agrozyme/eckey 0.0.4 → 0.0.6
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 +49 -19
- package/dist/commands/pair.d.ts +12 -0
- package/dist/commands/pair.js +26 -0
- package/dist/types.d.ts +1 -1
- package/oclif.manifest.json +95 -12
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ $ npm install -g @agrozyme/eckey
|
|
|
13
13
|
$ eckey COMMAND
|
|
14
14
|
running command...
|
|
15
15
|
$ eckey (--version)
|
|
16
|
-
@agrozyme/eckey/0.0.
|
|
16
|
+
@agrozyme/eckey/0.0.6 win32-x64 node-v24.14.1
|
|
17
17
|
$ eckey --help [COMMAND]
|
|
18
18
|
USAGE
|
|
19
19
|
$ eckey COMMAND
|
|
@@ -27,6 +27,7 @@ USAGE
|
|
|
27
27
|
* [`eckey convert`](#eckey-convert)
|
|
28
28
|
* [`eckey help [COMMAND]`](#eckey-help-command)
|
|
29
29
|
* [`eckey make`](#eckey-make)
|
|
30
|
+
* [`eckey pair`](#eckey-pair)
|
|
30
31
|
|
|
31
32
|
## `eckey convert`
|
|
32
33
|
|
|
@@ -35,18 +36,18 @@ convert string to other format
|
|
|
35
36
|
```
|
|
36
37
|
USAGE
|
|
37
38
|
$ eckey convert --data <value> [--from
|
|
38
|
-
base16|base32|base32crockford|base32hex|base58|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|base64url|base64urlnopad|hex|
|
|
40
|
+
utf8|base58check] [--to base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|base6
|
|
41
|
+
4url|base64urlnopad|hex|utf8|base58check]
|
|
41
42
|
|
|
42
43
|
FLAGS
|
|
43
44
|
--data=<value> (required)
|
|
44
45
|
--from=<option> [default: hex]
|
|
45
|
-
<options: base16|base32|base32crockford|base32hex|base58|
|
|
46
|
-
|
|
|
46
|
+
<options: base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|base
|
|
47
|
+
64url|base64urlnopad|hex|utf8|base58check>
|
|
47
48
|
--to=<option> [default: hex]
|
|
48
|
-
<options: base16|base32|base32crockford|base32hex|base58|
|
|
49
|
-
|
|
|
49
|
+
<options: base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|base
|
|
50
|
+
64url|base64urlnopad|hex|utf8|base58check>
|
|
50
51
|
|
|
51
52
|
DESCRIPTION
|
|
52
53
|
convert string to other format
|
|
@@ -55,7 +56,7 @@ EXAMPLES
|
|
|
55
56
|
$ eckey convert
|
|
56
57
|
```
|
|
57
58
|
|
|
58
|
-
_See code: [src/commands/convert.ts](https://gitlab.com/agrozyme-package/TypeScript/eckey/blob/v0.0.
|
|
59
|
+
_See code: [src/commands/convert.ts](https://gitlab.com/agrozyme-package/TypeScript/eckey/blob/v0.0.6/src/commands/convert.ts)_
|
|
59
60
|
|
|
60
61
|
## `eckey help [COMMAND]`
|
|
61
62
|
|
|
@@ -66,7 +67,7 @@ USAGE
|
|
|
66
67
|
$ eckey help [COMMAND...] [-n]
|
|
67
68
|
|
|
68
69
|
ARGUMENTS
|
|
69
|
-
COMMAND... Command to show help for.
|
|
70
|
+
[COMMAND...] Command to show help for.
|
|
70
71
|
|
|
71
72
|
FLAGS
|
|
72
73
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -75,7 +76,7 @@ DESCRIPTION
|
|
|
75
76
|
Display help for eckey.
|
|
76
77
|
```
|
|
77
78
|
|
|
78
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/
|
|
79
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.43/src/commands/help.ts)_
|
|
79
80
|
|
|
80
81
|
## `eckey make`
|
|
81
82
|
|
|
@@ -84,18 +85,18 @@ make elliptic curve key pair
|
|
|
84
85
|
```
|
|
85
86
|
USAGE
|
|
86
87
|
$ eckey make --curve
|
|
87
|
-
bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|p256|p384|p521|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|babyjubjub|p256|secp256r1|p384|secp384r1|p521|secp
|
|
89
|
+
521r1|pallas|vesta|schnorr|secp256k1 [--format base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr
|
|
90
|
+
|base58xrp|base64|base64url|base64urlnopad|hex|utf8|base58check] [--count <value>]
|
|
90
91
|
|
|
91
92
|
FLAGS
|
|
92
93
|
--count=<value> [default: 1]
|
|
93
94
|
--curve=<option> (required)
|
|
94
|
-
<options: bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|p256|
|
|
95
|
-
|
|
95
|
+
<options: bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|babyjubjub|p256|secp256
|
|
96
|
+
r1|p384|secp384r1|p521|secp521r1|pallas|vesta|schnorr|secp256k1>
|
|
96
97
|
--format=<option> [default: hex]
|
|
97
|
-
<options: base16|base32|base32crockford|base32hex|base58|
|
|
98
|
-
|
|
98
|
+
<options: base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|ba
|
|
99
|
+
se64url|base64urlnopad|hex|utf8|base58check>
|
|
99
100
|
|
|
100
101
|
DESCRIPTION
|
|
101
102
|
make elliptic curve key pair
|
|
@@ -104,5 +105,34 @@ EXAMPLES
|
|
|
104
105
|
$ eckey make
|
|
105
106
|
```
|
|
106
107
|
|
|
107
|
-
_See code: [src/commands/make.ts](https://gitlab.com/agrozyme-package/TypeScript/eckey/blob/v0.0.
|
|
108
|
+
_See code: [src/commands/make.ts](https://gitlab.com/agrozyme-package/TypeScript/eckey/blob/v0.0.6/src/commands/make.ts)_
|
|
109
|
+
|
|
110
|
+
## `eckey pair`
|
|
111
|
+
|
|
112
|
+
convert key pair to other format
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
USAGE
|
|
116
|
+
$ eckey pair --data <value> --curve
|
|
117
|
+
bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|babyjubjub|p256|secp256r1|p384|secp384r1|p521|secp
|
|
118
|
+
521r1|pallas|vesta|schnorr|secp256k1 [--format base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr
|
|
119
|
+
|base58xrp|base64|base64url|base64urlnopad|hex|utf8|base58check]
|
|
120
|
+
|
|
121
|
+
FLAGS
|
|
122
|
+
--curve=<option> (required)
|
|
123
|
+
<options: bls12_381|bn254|ed448|ed448ph|ed25519|ed25519ctx|ed25519ph|jubjub|babyjubjub|p256|secp256
|
|
124
|
+
r1|p384|secp384r1|p521|secp521r1|pallas|vesta|schnorr|secp256k1>
|
|
125
|
+
--data=<value> (required)
|
|
126
|
+
--format=<option> [default: hex]
|
|
127
|
+
<options: base16|base32|base32crockford|base32hex|base58|base58flickr|base58xmr|base58xrp|base64|ba
|
|
128
|
+
se64url|base64urlnopad|hex|utf8|base58check>
|
|
129
|
+
|
|
130
|
+
DESCRIPTION
|
|
131
|
+
convert key pair to other format
|
|
132
|
+
|
|
133
|
+
EXAMPLES
|
|
134
|
+
$ eckey pair
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
_See code: [src/commands/pair.ts](https://gitlab.com/agrozyme-package/TypeScript/eckey/blob/v0.0.6/src/commands/pair.ts)_
|
|
108
138
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Pair extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
data: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
curve: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static args: {};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const crypto_1 = require("@agrozyme/crypto");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
class Pair extends core_1.Command {
|
|
7
|
+
static description = 'convert key pair to other format';
|
|
8
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
9
|
+
static flags = {
|
|
10
|
+
data: core_1.Flags.string({ required: true }),
|
|
11
|
+
curve: core_1.Flags.string({ required: true, options: types_1.curveKeys }),
|
|
12
|
+
format: core_1.Flags.string({ options: types_1.bytesCoderKeys, default: 'hex' }),
|
|
13
|
+
};
|
|
14
|
+
static args = {};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(Pair);
|
|
17
|
+
const { data, format } = flags;
|
|
18
|
+
const curve = crypto_1.curveMap[flags.curve];
|
|
19
|
+
const keyConveter = crypto_1.bytesCoderMap[format];
|
|
20
|
+
const privateKey = keyConveter.decode(data);
|
|
21
|
+
const publicKey = curve.getPublicKey(privateKey, true);
|
|
22
|
+
const item = { privateKey: keyConveter.encode(privateKey), publicKey: keyConveter.encode(publicKey) };
|
|
23
|
+
console.dir(item);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = Pair;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const bytesCoderKeys: ("base16" | "base32" | "base32crockford" | "base32hex" | "base58" | "base58flickr" | "base58xmr" | "base58xrp" | "base64" | "base64url" | "base64urlnopad" | "hex" | "utf8" | "base58check")[];
|
|
2
|
-
export declare const curveKeys: ("bls12_381" | "bn254" | "ed448" | "ed448ph" | "ed25519" | "ed25519ctx" | "ed25519ph" | "jubjub" | "p256" | "secp256r1" | "p384" | "secp384r1" | "p521" | "secp521r1" | "pallas" | "vesta" | "schnorr" | "secp256k1")[];
|
|
2
|
+
export declare const curveKeys: ("bls12_381" | "bn254" | "ed448" | "ed448ph" | "ed25519" | "ed25519ctx" | "ed25519ph" | "jubjub" | "babyjubjub" | "p256" | "secp256r1" | "p384" | "secp384r1" | "p521" | "secp521r1" | "pallas" | "vesta" | "schnorr" | "secp256k1")[];
|
package/oclif.manifest.json
CHANGED
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"base32crockford",
|
|
27
27
|
"base32hex",
|
|
28
28
|
"base58",
|
|
29
|
-
"base58check",
|
|
30
29
|
"base58flickr",
|
|
31
30
|
"base58xmr",
|
|
32
31
|
"base58xrp",
|
|
@@ -34,7 +33,8 @@
|
|
|
34
33
|
"base64url",
|
|
35
34
|
"base64urlnopad",
|
|
36
35
|
"hex",
|
|
37
|
-
"utf8"
|
|
36
|
+
"utf8",
|
|
37
|
+
"base58check"
|
|
38
38
|
],
|
|
39
39
|
"type": "option"
|
|
40
40
|
},
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"base32crockford",
|
|
50
50
|
"base32hex",
|
|
51
51
|
"base58",
|
|
52
|
-
"base58check",
|
|
53
52
|
"base58flickr",
|
|
54
53
|
"base58xmr",
|
|
55
54
|
"base58xrp",
|
|
@@ -57,7 +56,8 @@
|
|
|
57
56
|
"base64url",
|
|
58
57
|
"base64urlnopad",
|
|
59
58
|
"hex",
|
|
60
|
-
"utf8"
|
|
59
|
+
"utf8",
|
|
60
|
+
"base58check"
|
|
61
61
|
],
|
|
62
62
|
"type": "option"
|
|
63
63
|
}
|
|
@@ -99,16 +99,17 @@
|
|
|
99
99
|
"ed25519ctx",
|
|
100
100
|
"ed25519ph",
|
|
101
101
|
"jubjub",
|
|
102
|
+
"babyjubjub",
|
|
102
103
|
"p256",
|
|
104
|
+
"secp256r1",
|
|
103
105
|
"p384",
|
|
106
|
+
"secp384r1",
|
|
104
107
|
"p521",
|
|
108
|
+
"secp521r1",
|
|
105
109
|
"pallas",
|
|
110
|
+
"vesta",
|
|
106
111
|
"schnorr",
|
|
107
|
-
"secp256k1"
|
|
108
|
-
"secp256r1",
|
|
109
|
-
"secp384r1",
|
|
110
|
-
"secp521r1",
|
|
111
|
-
"vesta"
|
|
112
|
+
"secp256k1"
|
|
112
113
|
],
|
|
113
114
|
"type": "option"
|
|
114
115
|
},
|
|
@@ -123,7 +124,6 @@
|
|
|
123
124
|
"base32crockford",
|
|
124
125
|
"base32hex",
|
|
125
126
|
"base58",
|
|
126
|
-
"base58check",
|
|
127
127
|
"base58flickr",
|
|
128
128
|
"base58xmr",
|
|
129
129
|
"base58xrp",
|
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
"base64url",
|
|
132
132
|
"base64urlnopad",
|
|
133
133
|
"hex",
|
|
134
|
-
"utf8"
|
|
134
|
+
"utf8",
|
|
135
|
+
"base58check"
|
|
135
136
|
],
|
|
136
137
|
"type": "option"
|
|
137
138
|
},
|
|
@@ -158,6 +159,88 @@
|
|
|
158
159
|
"make.js"
|
|
159
160
|
]
|
|
160
161
|
},
|
|
162
|
+
"pair": {
|
|
163
|
+
"aliases": [],
|
|
164
|
+
"args": {},
|
|
165
|
+
"description": "convert key pair to other format",
|
|
166
|
+
"examples": [
|
|
167
|
+
"<%= config.bin %> <%= command.id %>"
|
|
168
|
+
],
|
|
169
|
+
"flags": {
|
|
170
|
+
"data": {
|
|
171
|
+
"name": "data",
|
|
172
|
+
"required": true,
|
|
173
|
+
"hasDynamicHelp": false,
|
|
174
|
+
"multiple": false,
|
|
175
|
+
"type": "option"
|
|
176
|
+
},
|
|
177
|
+
"curve": {
|
|
178
|
+
"name": "curve",
|
|
179
|
+
"required": true,
|
|
180
|
+
"hasDynamicHelp": false,
|
|
181
|
+
"multiple": false,
|
|
182
|
+
"options": [
|
|
183
|
+
"bls12_381",
|
|
184
|
+
"bn254",
|
|
185
|
+
"ed448",
|
|
186
|
+
"ed448ph",
|
|
187
|
+
"ed25519",
|
|
188
|
+
"ed25519ctx",
|
|
189
|
+
"ed25519ph",
|
|
190
|
+
"jubjub",
|
|
191
|
+
"babyjubjub",
|
|
192
|
+
"p256",
|
|
193
|
+
"secp256r1",
|
|
194
|
+
"p384",
|
|
195
|
+
"secp384r1",
|
|
196
|
+
"p521",
|
|
197
|
+
"secp521r1",
|
|
198
|
+
"pallas",
|
|
199
|
+
"vesta",
|
|
200
|
+
"schnorr",
|
|
201
|
+
"secp256k1"
|
|
202
|
+
],
|
|
203
|
+
"type": "option"
|
|
204
|
+
},
|
|
205
|
+
"format": {
|
|
206
|
+
"name": "format",
|
|
207
|
+
"default": "hex",
|
|
208
|
+
"hasDynamicHelp": false,
|
|
209
|
+
"multiple": false,
|
|
210
|
+
"options": [
|
|
211
|
+
"base16",
|
|
212
|
+
"base32",
|
|
213
|
+
"base32crockford",
|
|
214
|
+
"base32hex",
|
|
215
|
+
"base58",
|
|
216
|
+
"base58flickr",
|
|
217
|
+
"base58xmr",
|
|
218
|
+
"base58xrp",
|
|
219
|
+
"base64",
|
|
220
|
+
"base64url",
|
|
221
|
+
"base64urlnopad",
|
|
222
|
+
"hex",
|
|
223
|
+
"utf8",
|
|
224
|
+
"base58check"
|
|
225
|
+
],
|
|
226
|
+
"type": "option"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"hasDynamicHelp": false,
|
|
230
|
+
"hiddenAliases": [],
|
|
231
|
+
"id": "pair",
|
|
232
|
+
"pluginAlias": "@agrozyme/eckey",
|
|
233
|
+
"pluginName": "@agrozyme/eckey",
|
|
234
|
+
"pluginType": "core",
|
|
235
|
+
"strict": true,
|
|
236
|
+
"enableJsonFlag": false,
|
|
237
|
+
"isESM": false,
|
|
238
|
+
"relativePath": [
|
|
239
|
+
"dist",
|
|
240
|
+
"commands",
|
|
241
|
+
"pair.js"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
161
244
|
"test": {
|
|
162
245
|
"aliases": [],
|
|
163
246
|
"args": {},
|
|
@@ -183,5 +266,5 @@
|
|
|
183
266
|
]
|
|
184
267
|
}
|
|
185
268
|
},
|
|
186
|
-
"version": "0.0.
|
|
269
|
+
"version": "0.0.6"
|
|
187
270
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agrozyme/eckey",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Elliptic Curve Key CLI",
|
|
5
5
|
"author": "",
|
|
6
6
|
"bin": {
|
|
@@ -17,25 +17,24 @@
|
|
|
17
17
|
"/oclif.manifest.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@agrozyme/crypto": "^1.0.
|
|
21
|
-
"@oclif/core": "^4.
|
|
22
|
-
"@oclif/plugin-help": "^6.2.
|
|
23
|
-
"@oclif/plugin-plugins": "^5.4.
|
|
24
|
-
"rambdax": "^11.
|
|
20
|
+
"@agrozyme/crypto": "^1.0.13",
|
|
21
|
+
"@oclif/core": "^4.10.5",
|
|
22
|
+
"@oclif/plugin-help": "^6.2.43",
|
|
23
|
+
"@oclif/plugin-plugins": "^5.4.59",
|
|
24
|
+
"rambdax": "^11.3.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@oclif/test": "^4.
|
|
28
|
-
"@
|
|
29
|
-
"@types/
|
|
30
|
-
"@types/node": "^18.19.
|
|
31
|
-
"chai": "^
|
|
32
|
-
"
|
|
33
|
-
"oclif": "^4.15.5",
|
|
27
|
+
"@oclif/test": "^4.1.18",
|
|
28
|
+
"@rstest/core": "^0.9.6",
|
|
29
|
+
"@types/chai": "^5.2.3",
|
|
30
|
+
"@types/node": "^18.19.130",
|
|
31
|
+
"chai": "^6.2.2",
|
|
32
|
+
"oclif": "^4.23.0",
|
|
34
33
|
"pkg": "^5.8.1",
|
|
35
|
-
"shx": "^0.
|
|
34
|
+
"shx": "^0.4.0",
|
|
36
35
|
"ts-node": "^10.9.2",
|
|
37
|
-
"tslib": "^2.
|
|
38
|
-
"typescript": "^
|
|
36
|
+
"tslib": "^2.8.1",
|
|
37
|
+
"typescript": "^6.0.2",
|
|
39
38
|
"yarpm": "^1.2.0"
|
|
40
39
|
},
|
|
41
40
|
"oclif": {
|
|
@@ -70,7 +69,7 @@
|
|
|
70
69
|
"clean:lock": "shx rm -f package-lock.json yarn.lock pnpm-lock.yaml",
|
|
71
70
|
"clean:all": "yarpm run clean && yarpm run clean:pack && yarpm run clean:lock",
|
|
72
71
|
"build": "yarpm run clean && tsc --build --force && shx cp -R ./src/assets ./dist",
|
|
73
|
-
"test": "
|
|
72
|
+
"test": "rstest",
|
|
74
73
|
"oclif:readme": "yarpm run build && oclif readme",
|
|
75
74
|
"oclif:pack": "yarn generate-lock-entry > yarn.lock && oclif pack",
|
|
76
75
|
"package": "yarpm run build && pkg --no-bytecode --public --public-packages=* --compress=GZip .",
|