@twin.org/crypto-cli 0.0.1-next.3 → 0.0.1-next.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.
@@ -24,7 +24,7 @@ function buildCommandAddress() {
24
24
  .option(core.I18n.formatMessage("commands.address.options.start.param"), core.I18n.formatMessage("commands.address.options.start.description"), "0")
25
25
  .option(core.I18n.formatMessage("commands.address.options.count.param"), core.I18n.formatMessage("commands.address.options.count.description"), "10")
26
26
  .option(core.I18n.formatMessage("commands.address.options.account.param"), core.I18n.formatMessage("commands.address.options.account.description"), "0")
27
- .option(core.I18n.formatMessage("commands.address.options.hrp.param"), core.I18n.formatMessage("commands.address.options.hrp.description"), "iota")
27
+ .option(core.I18n.formatMessage("commands.address.options.hrp.param"), core.I18n.formatMessage("commands.address.options.hrp.description"))
28
28
  .option(core.I18n.formatMessage("commands.address.options.coin.param"), core.I18n.formatMessage("commands.address.options.coin.description"), "4218")
29
29
  .addOption(new commander.Option(core.I18n.formatMessage("commands.address.options.key-type.param"), core.I18n.formatMessage("commands.address.options.key-type.description"))
30
30
  .choices(["Ed25519", "Secp256k1"])
@@ -49,7 +49,7 @@ function buildCommandAddress() {
49
49
  * @param opts.start The start index for the address generation.
50
50
  * @param opts.count The number of addresses to generate.
51
51
  * @param opts.account The account index for the address generation.
52
- * @param opts.hrp The human readable part for the address.
52
+ * @param opts.hrp The human readable part for the addresses if generating bech32 format.
53
53
  * @param opts.coin The coin type for the address.
54
54
  * @param opts.keyType The key type for the address.
55
55
  * @param opts.keyFormat The output format of the key.
@@ -67,7 +67,9 @@ async function actionCommandAddress(opts) {
67
67
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.start"), start);
68
68
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.count"), count);
69
69
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.account"), account);
70
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.hrp"), hrp);
70
+ if (core.Is.stringValue(hrp)) {
71
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.hrp"), hrp);
72
+ }
71
73
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.coin"), coin);
72
74
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.key-type"), keyType);
73
75
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.key-format"), keyFormat);
@@ -76,9 +78,15 @@ async function actionCommandAddress(opts) {
76
78
  cliCore.CLIDisplay.break();
77
79
  const addressDictionary = {};
78
80
  for (let i = start; i < start + count; i++) {
79
- const addressKeyPair = crypto.Bip44.addressBech32(seed, keyType === "Ed25519" ? crypto.KeyType.Ed25519 : crypto.KeyType.Secp256k1, hrp, coin, account, false, i);
81
+ let addressKeyPair;
82
+ if (core.Is.stringValue(hrp)) {
83
+ addressKeyPair = crypto.Bip44.addressBech32(seed, keyType === "Ed25519" ? crypto.KeyType.Ed25519 : crypto.KeyType.Secp256k1, hrp, coin, account, false, i);
84
+ }
85
+ else {
86
+ addressKeyPair = crypto.Bip44.address(seed, keyType === "Ed25519" ? crypto.KeyType.Ed25519 : crypto.KeyType.Secp256k1, coin, account, false, i);
87
+ }
80
88
  addressDictionary[i] = {
81
- bech32: addressKeyPair.address,
89
+ address: addressKeyPair.address,
82
90
  privateKey: keyFormat === "hex"
83
91
  ? core.Converter.bytesToHex(addressKeyPair.privateKey, true)
84
92
  : core.Converter.bytesToBase64(addressKeyPair.privateKey),
@@ -88,7 +96,7 @@ async function actionCommandAddress(opts) {
88
96
  };
89
97
  if (opts.console) {
90
98
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.index"), i);
91
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].bech32);
99
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].address);
92
100
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.private-key"), addressDictionary[i].privateKey);
93
101
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.public-key"), addressDictionary[i].publicKey);
94
102
  cliCore.CLIDisplay.break();
@@ -100,7 +108,7 @@ async function actionCommandAddress(opts) {
100
108
  if (core.Is.stringValue(opts?.env)) {
101
109
  const output = [];
102
110
  for (const addressIndex in addressDictionary) {
103
- output.push(`ADDRESS_${addressIndex}_BECH32="${addressDictionary[addressIndex].bech32}"`);
111
+ output.push(`ADDRESS_${addressIndex}="${addressDictionary[addressIndex].address}"`);
104
112
  output.push(`ADDRESS_${addressIndex}_PRIVATE_KEY="${addressDictionary[addressIndex].privateKey}"`);
105
113
  output.push(`ADDRESS_${addressIndex}_PUBLIC_KEY="${addressDictionary[addressIndex].publicKey}"`);
106
114
  }
@@ -126,7 +134,8 @@ function buildCommandMnemonic() {
126
134
  .default("256"))
127
135
  .addOption(new commander.Option(core.I18n.formatMessage("commands.mnemonic.options.seed-format.param"), core.I18n.formatMessage("commands.mnemonic.options.seed-format.description"))
128
136
  .choices(["hex", "base64"])
129
- .default("hex"));
137
+ .default("hex"))
138
+ .addOption(new commander.Option(core.I18n.formatMessage("commands.mnemonic.options.env-prefix.param"), core.I18n.formatMessage("commands.mnemonic.options.env-prefix.description")));
130
139
  cliCore.CLIOptions.output(command, {
131
140
  noConsole: true,
132
141
  json: true,
@@ -147,17 +156,21 @@ async function actionCommandMnemonic(opts) {
147
156
  const strength = cliCore.CLIParam.integer("strength", opts.strength, false, 128, 256);
148
157
  const mnemonic = crypto.Bip39.randomMnemonic(strength);
149
158
  const seed = crypto.Bip39.mnemonicToSeed(mnemonic);
159
+ const envPrefix = core.Is.stringValue(opts.envPrefix) ? opts.envPrefix : "";
150
160
  const seedFormatted = opts.seedFormat === "hex" ? core.Converter.bytesToHex(seed, true) : core.Converter.bytesToBase64(seed);
151
161
  if (opts.console) {
152
162
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.mnemonic.labels.mnemonic"), mnemonic);
153
163
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.mnemonic.labels.seed"), seedFormatted);
164
+ if (core.Is.stringValue(opts.envPrefix)) {
165
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.mnemonic.labels.envPrefix"), envPrefix);
166
+ }
154
167
  cliCore.CLIDisplay.break();
155
168
  }
156
169
  if (core.Is.stringValue(opts?.json)) {
157
170
  await cliCore.CLIUtils.writeJsonFile(opts.json, { mnemonic, seed: seedFormatted }, opts.mergeJson);
158
171
  }
159
172
  if (core.Is.stringValue(opts?.env)) {
160
- await cliCore.CLIUtils.writeEnvFile(opts.env, [`MNEMONIC="${mnemonic}"`, `SEED="${seedFormatted}"`], opts.mergeEnv);
173
+ await cliCore.CLIUtils.writeEnvFile(opts.env, [`${envPrefix}MNEMONIC="${mnemonic}"`, `${envPrefix}SEED="${seedFormatted}"`], opts.mergeEnv);
161
174
  }
162
175
  cliCore.CLIDisplay.done();
163
176
  }
@@ -172,16 +185,19 @@ class CLI extends cliCore.CLIBase {
172
185
  * Run the app.
173
186
  * @param argv The process arguments.
174
187
  * @param localesDirectory The directory for the locales, default to relative to the script.
188
+ * @param options Additional options.
189
+ * @param options.overrideOutputWidth Override the output width.
175
190
  * @returns The exit code.
176
191
  */
177
- async run(argv, localesDirectory) {
192
+ async run(argv, localesDirectory, options) {
178
193
  return this.execute({
179
194
  title: "TWIN Crypto",
180
195
  appName: "twin-crypto",
181
- version: "0.0.1-next.3",
196
+ version: "0.0.1-next.31",
182
197
  icon: "🌍",
183
- supportsEnvFiles: true
184
- }, localesDirectory ?? path.join(path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), "../locales"), argv);
198
+ supportsEnvFiles: true,
199
+ overrideOutputWidth: options?.overrideOutputWidth
200
+ }, localesDirectory ?? path.join(path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), "../locales"), argv);
185
201
  }
186
202
  /**
187
203
  * Get the commands for the CLI.
@@ -21,7 +21,7 @@ function buildCommandAddress() {
21
21
  .option(I18n.formatMessage("commands.address.options.start.param"), I18n.formatMessage("commands.address.options.start.description"), "0")
22
22
  .option(I18n.formatMessage("commands.address.options.count.param"), I18n.formatMessage("commands.address.options.count.description"), "10")
23
23
  .option(I18n.formatMessage("commands.address.options.account.param"), I18n.formatMessage("commands.address.options.account.description"), "0")
24
- .option(I18n.formatMessage("commands.address.options.hrp.param"), I18n.formatMessage("commands.address.options.hrp.description"), "iota")
24
+ .option(I18n.formatMessage("commands.address.options.hrp.param"), I18n.formatMessage("commands.address.options.hrp.description"))
25
25
  .option(I18n.formatMessage("commands.address.options.coin.param"), I18n.formatMessage("commands.address.options.coin.description"), "4218")
26
26
  .addOption(new Option(I18n.formatMessage("commands.address.options.key-type.param"), I18n.formatMessage("commands.address.options.key-type.description"))
27
27
  .choices(["Ed25519", "Secp256k1"])
@@ -46,7 +46,7 @@ function buildCommandAddress() {
46
46
  * @param opts.start The start index for the address generation.
47
47
  * @param opts.count The number of addresses to generate.
48
48
  * @param opts.account The account index for the address generation.
49
- * @param opts.hrp The human readable part for the address.
49
+ * @param opts.hrp The human readable part for the addresses if generating bech32 format.
50
50
  * @param opts.coin The coin type for the address.
51
51
  * @param opts.keyType The key type for the address.
52
52
  * @param opts.keyFormat The output format of the key.
@@ -64,7 +64,9 @@ async function actionCommandAddress(opts) {
64
64
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.start"), start);
65
65
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.count"), count);
66
66
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.account"), account);
67
- CLIDisplay.value(I18n.formatMessage("commands.address.labels.hrp"), hrp);
67
+ if (Is.stringValue(hrp)) {
68
+ CLIDisplay.value(I18n.formatMessage("commands.address.labels.hrp"), hrp);
69
+ }
68
70
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.coin"), coin);
69
71
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.key-type"), keyType);
70
72
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.key-format"), keyFormat);
@@ -73,9 +75,15 @@ async function actionCommandAddress(opts) {
73
75
  CLIDisplay.break();
74
76
  const addressDictionary = {};
75
77
  for (let i = start; i < start + count; i++) {
76
- const addressKeyPair = Bip44.addressBech32(seed, keyType === "Ed25519" ? KeyType.Ed25519 : KeyType.Secp256k1, hrp, coin, account, false, i);
78
+ let addressKeyPair;
79
+ if (Is.stringValue(hrp)) {
80
+ addressKeyPair = Bip44.addressBech32(seed, keyType === "Ed25519" ? KeyType.Ed25519 : KeyType.Secp256k1, hrp, coin, account, false, i);
81
+ }
82
+ else {
83
+ addressKeyPair = Bip44.address(seed, keyType === "Ed25519" ? KeyType.Ed25519 : KeyType.Secp256k1, coin, account, false, i);
84
+ }
77
85
  addressDictionary[i] = {
78
- bech32: addressKeyPair.address,
86
+ address: addressKeyPair.address,
79
87
  privateKey: keyFormat === "hex"
80
88
  ? Converter.bytesToHex(addressKeyPair.privateKey, true)
81
89
  : Converter.bytesToBase64(addressKeyPair.privateKey),
@@ -85,7 +93,7 @@ async function actionCommandAddress(opts) {
85
93
  };
86
94
  if (opts.console) {
87
95
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.index"), i);
88
- CLIDisplay.value(I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].bech32);
96
+ CLIDisplay.value(I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].address);
89
97
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.private-key"), addressDictionary[i].privateKey);
90
98
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.public-key"), addressDictionary[i].publicKey);
91
99
  CLIDisplay.break();
@@ -97,7 +105,7 @@ async function actionCommandAddress(opts) {
97
105
  if (Is.stringValue(opts?.env)) {
98
106
  const output = [];
99
107
  for (const addressIndex in addressDictionary) {
100
- output.push(`ADDRESS_${addressIndex}_BECH32="${addressDictionary[addressIndex].bech32}"`);
108
+ output.push(`ADDRESS_${addressIndex}="${addressDictionary[addressIndex].address}"`);
101
109
  output.push(`ADDRESS_${addressIndex}_PRIVATE_KEY="${addressDictionary[addressIndex].privateKey}"`);
102
110
  output.push(`ADDRESS_${addressIndex}_PUBLIC_KEY="${addressDictionary[addressIndex].publicKey}"`);
103
111
  }
@@ -123,7 +131,8 @@ function buildCommandMnemonic() {
123
131
  .default("256"))
124
132
  .addOption(new Option(I18n.formatMessage("commands.mnemonic.options.seed-format.param"), I18n.formatMessage("commands.mnemonic.options.seed-format.description"))
125
133
  .choices(["hex", "base64"])
126
- .default("hex"));
134
+ .default("hex"))
135
+ .addOption(new Option(I18n.formatMessage("commands.mnemonic.options.env-prefix.param"), I18n.formatMessage("commands.mnemonic.options.env-prefix.description")));
127
136
  CLIOptions.output(command, {
128
137
  noConsole: true,
129
138
  json: true,
@@ -144,17 +153,21 @@ async function actionCommandMnemonic(opts) {
144
153
  const strength = CLIParam.integer("strength", opts.strength, false, 128, 256);
145
154
  const mnemonic = Bip39.randomMnemonic(strength);
146
155
  const seed = Bip39.mnemonicToSeed(mnemonic);
156
+ const envPrefix = Is.stringValue(opts.envPrefix) ? opts.envPrefix : "";
147
157
  const seedFormatted = opts.seedFormat === "hex" ? Converter.bytesToHex(seed, true) : Converter.bytesToBase64(seed);
148
158
  if (opts.console) {
149
159
  CLIDisplay.value(I18n.formatMessage("commands.mnemonic.labels.mnemonic"), mnemonic);
150
160
  CLIDisplay.value(I18n.formatMessage("commands.mnemonic.labels.seed"), seedFormatted);
161
+ if (Is.stringValue(opts.envPrefix)) {
162
+ CLIDisplay.value(I18n.formatMessage("commands.mnemonic.labels.envPrefix"), envPrefix);
163
+ }
151
164
  CLIDisplay.break();
152
165
  }
153
166
  if (Is.stringValue(opts?.json)) {
154
167
  await CLIUtils.writeJsonFile(opts.json, { mnemonic, seed: seedFormatted }, opts.mergeJson);
155
168
  }
156
169
  if (Is.stringValue(opts?.env)) {
157
- await CLIUtils.writeEnvFile(opts.env, [`MNEMONIC="${mnemonic}"`, `SEED="${seedFormatted}"`], opts.mergeEnv);
170
+ await CLIUtils.writeEnvFile(opts.env, [`${envPrefix}MNEMONIC="${mnemonic}"`, `${envPrefix}SEED="${seedFormatted}"`], opts.mergeEnv);
158
171
  }
159
172
  CLIDisplay.done();
160
173
  }
@@ -169,15 +182,18 @@ class CLI extends CLIBase {
169
182
  * Run the app.
170
183
  * @param argv The process arguments.
171
184
  * @param localesDirectory The directory for the locales, default to relative to the script.
185
+ * @param options Additional options.
186
+ * @param options.overrideOutputWidth Override the output width.
172
187
  * @returns The exit code.
173
188
  */
174
- async run(argv, localesDirectory) {
189
+ async run(argv, localesDirectory, options) {
175
190
  return this.execute({
176
191
  title: "TWIN Crypto",
177
192
  appName: "twin-crypto",
178
- version: "0.0.1-next.3",
193
+ version: "0.0.1-next.31",
179
194
  icon: "🌍",
180
- supportsEnvFiles: true
195
+ supportsEnvFiles: true,
196
+ overrideOutputWidth: options?.overrideOutputWidth
181
197
  }, localesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), "../locales"), argv);
182
198
  }
183
199
  /**
@@ -1,312 +1,331 @@
1
1
  {
2
- "error": {
3
- "commands": {
4
- "address": {
5
- "seedMissingEnv": "The seed does not appear to be hex or base64, assuming it is an environment variable, but there is no environment variable with the name \"{env}\" set.",
6
- "seedInvalidEnv": "The seed does not appear to be hex or base64, assuming it is an environment variable, but there the environment variable is neither hex or base64. \"{envValue}\"",
7
- "seedInvalidFormat": "The seed does not appear to be hex, base64 or an environment variable. \"{seed}\""
8
- },
9
- "common": {
10
- "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
11
- "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
12
- "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
13
- "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
14
- "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
15
- "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
16
- "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
17
- }
18
- },
19
- "validation": {
20
- "beEmpty": "{fieldName} must be empty",
21
- "beNotEmpty": "{fieldName} must not be empty",
22
- "beText": "{fieldName} must be text",
23
- "beTextValue": "{fieldName} must contain some text",
24
- "beTextMinMax": "{fieldName} must be longer than {minLength} and shorter than {maxLength} characters",
25
- "beTextMin": "{fieldName} must be longer than {minLength} characters",
26
- "beTextMax": "{fieldName} must be shorter than {maxLength} characters",
27
- "beNumber": "{fieldName} must be a number",
28
- "beNumberMinMax": "{fieldName} must be >= {minValue} and <= {maxValue}",
29
- "beNumberMin": "{fieldName} must be >= {minValue}",
30
- "beNumberMax": "{fieldName} must be <= {maxValue}",
31
- "beWholeNumber": "{fieldName} must be a whole number",
32
- "beWholeNumberMinMax": "{fieldName} must be a whole number >= {minValue} and <= {maxValue}",
33
- "beWholeNumberMin": "{fieldName} must be a whole number >= {minValue}",
34
- "beWholeNumberMax": "{fieldName} must be a whole number <= {maxValue}",
35
- "beBigInteger": "{fieldName} must be a bigint",
36
- "beBigIntegerMinMax": "{fieldName} must be a bigint >= {minValue} and <= {maxValue}",
37
- "beBigIntegerMin": "{fieldName} must be a bigint >= {minValue}",
38
- "beBigIntegerMax": "{fieldName} must be a bigint <= {maxValue}",
39
- "beBoolean": "{fieldName} must be true or false",
40
- "beDate": "{fieldName} must be a date",
41
- "beDateTime": "{fieldName} must be a date/time",
42
- "beTime": "{fieldName} must be a time",
43
- "beTimestampMilliseconds": "{fieldName} must be a timestamp in milliseconds",
44
- "beTimestampSeconds": "{fieldName} must be a timestamp in seconds",
45
- "beObject": "{fieldName} must be an object",
46
- "beArray": "{fieldName} must be an array",
47
- "beArrayValue": "{fieldName} must be an array with at least one item",
48
- "beIncluded": "{fieldName} is unrecognised",
49
- "beByteArray": "{fieldName} must be a byte array",
50
- "beUrn": "{fieldName} must be a correctly formatted urn",
51
- "beUrl": "{fieldName} must be a correctly formatted url",
52
- "beJSON": "{fieldName} must be correctly formatted JSON",
53
- "beEmail": "{fieldName} must be a correctly formatted e-mail address",
54
- "failed": "Validation failed",
55
- "failedObject": "Validation of \"{objectName}\" failed"
56
- },
57
- "guard": {
58
- "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
59
- "string": "Property \"{property}\" must be a string, it is \"{value}\"",
60
- "stringEmpty": "Property \"{property}\" must have a value, it is empty",
61
- "stringBase64": "Property \"{property}\" must be a base64 encoded string, it is \"{value}\"",
62
- "stringBase64Url": "Property \"{property}\" must be a base64 url encoded string, it is \"{value}\"",
63
- "stringHex": "Property \"{property}\" must be a hex string, it is \"{value}\"",
64
- "stringHexLength": "Property \"{property}\" must be a hex string of length \"{options}\", it is \"{value}\"",
65
- "number": "Property \"{property}\" must be a number, it is \"{value}\"",
66
- "integer": "Property \"{property}\" must be an integer, it is \"{value}\"",
67
- "bigint": "Property \"{property}\" must be a bigint, it is \"{value}\"",
68
- "boolean": "Property \"{property}\" must be a boolean, it is \"{value}\"",
69
- "date": "Property \"{property}\" must be a date, it is \"{value}\"",
70
- "timestampMilliseconds": "Property \"{property}\" must be a timestamp in milliseconds, it is \"{value}\"",
71
- "timestampSeconds": "Property \"{property}\" must be a timestamp in seconds, it is \"{value}\"",
72
- "objectUndefined": "Property \"{property}\" must be an object, it is \"undefined\"",
73
- "object": "Property \"{property}\" must be an object, it is \"{value}\"",
74
- "objectValue": "Property \"{property}\" must be an object, with at least one property, it is \"{value}\"",
75
- "array": "Property \"{property}\" must be an array, it is \"{value}\"",
76
- "arrayValue": "Property \"{property}\" must be an array with at least one item",
77
- "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
78
- "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
79
- "function": "Property \"{property}\" must be a function, it is \"{value}\"",
80
- "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
81
- "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
82
- "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
83
- "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
84
- "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
85
- "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
86
- "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
87
- },
88
- "objectHelper": {
89
- "failedBytesToJSON": "Failed converting bytes to JSON"
90
- },
91
- "common": {
92
- "notImplementedMethod": "The method \"{method}\" has not been implemented",
93
- "validation": "Validation failed"
94
- },
95
- "factory": {
96
- "noUnregister": "There is no {typeName} registered with the name \"{name}\"",
97
- "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
98
- },
99
- "bitString": {
100
- "outOfRange": "The index should be >= 0 and less than the length of the bit string"
101
- },
102
- "bip39": {
103
- "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
104
- "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
105
- },
106
- "ed25519": {
107
- "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
108
- "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
109
- },
110
- "secp256k1": {
111
- "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
112
- "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
113
- },
114
- "x25519": {
115
- "invalidPublicKey": "Invalid Ed25519 Public Key"
116
- },
117
- "blake2b": {
118
- "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
119
- "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
120
- },
121
- "sha512": {
122
- "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
123
- },
124
- "sha256": {
125
- "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
126
- },
127
- "hmacSha256": {
128
- "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
129
- },
130
- "hmacSha512": {
131
- "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
132
- },
133
- "base32": {
134
- "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
135
- },
136
- "base64": {
137
- "length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
138
- },
139
- "bech32": {
140
- "decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
141
- "invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
142
- "separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
143
- "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
144
- "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
145
- },
146
- "pbkdf2": {
147
- "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
148
- },
149
- "chaCha20Poly1305": {
150
- "noAadWithData": "You can not set the aad when there is already data",
151
- "noAuthTag": "Can not finalise when the auth tag is not set",
152
- "authenticationFailed": "The data could not be authenticated",
153
- "authTagDecrypting": "Can not get the auth tag when decrypting",
154
- "authTagEncrypting": "Can not set the auth tag when encrypting",
155
- "noAuthTagSet": "The auth tag has not been set"
156
- },
157
- "bip44": {
158
- "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
159
- },
160
- "slip0010": {
161
- "invalidSeed": "The seed is invalid \"{seed}\""
162
- }
163
- },
164
- "commands": {
165
- "mnemonic": {
166
- "summary": "Create a mnemonic.",
167
- "description": "Create a mnemonic, will also generate the equivalent seed in hex and base64 format.",
168
- "options": {
169
- "strength": {
170
- "param": "--strength '<'number'>'",
171
- "description": "The number of words in the mnemonic, defaults to 256 which produces 24 words."
172
- },
173
- "seed-format": {
174
- "param": "--seed-format '<'format'>'",
175
- "description": "The format to output the seed."
176
- },
177
- "no-console": {
178
- "param": "--no-console",
179
- "description": "Hides the mnemonic and seed in the console."
180
- },
181
- "json": {
182
- "param": "--json '<'filename'>'",
183
- "description": "Creates a JSON file containing the mnemonic and seed."
184
- },
185
- "env": {
186
- "param": "--env '<'filename'>'",
187
- "description": "Creates an env file containing the mnemonic and seed."
188
- }
189
- },
190
- "progress": {
191
- "writingJsonFile": "Writing JSON file",
192
- "writingEnvFile": "Writing env file"
193
- },
194
- "labels": {
195
- "mnemonic": "Mnemonic",
196
- "seed": "Seed"
197
- }
198
- },
199
- "address": {
200
- "summary": "Create bech32 addresses and keys from the seed.",
201
- "description": "Create a number of bech32 addresses and their associated key pairs from the seed.",
202
- "options": {
203
- "seed": {
204
- "param": "--seed '<'seed'>'",
205
- "description": "The seed to use for generating the addresses, this can be either hex, base64 or an environment variable name. For an environment variable start the value with a !"
206
- },
207
- "start": {
208
- "param": "--start '<'number'>'",
209
- "description": "The index of the first address to create."
210
- },
211
- "count": {
212
- "param": "--count '<'number'>'",
213
- "description": "The number of addresses to create, max 100."
214
- },
215
- "account": {
216
- "param": "--account '<'number'>'",
217
- "description": "The account used to generate the bech32 addresses."
218
- },
219
- "hrp": {
220
- "param": "--hrp '<'hrp'>'",
221
- "description": "The human readable part of the bech32 addresses."
222
- },
223
- "coin": {
224
- "param": "--coin '<'coin'>'",
225
- "description": "The coin type used to generate the bech32 addresses."
226
- },
227
- "key-type": {
228
- "param": "--key-type '<'type'>'",
229
- "description": "The type of key to generate."
230
- },
231
- "key-format": {
232
- "param": "--key-format '<'format'>'",
233
- "description": "The format to output the keys."
234
- }
235
- },
236
- "progress": {
237
- "generatingAddresses": "Generating addresses"
238
- },
239
- "labels": {
240
- "seed": "Seed",
241
- "start": "Start",
242
- "count": "Count",
243
- "account": "Account",
244
- "hrp": "HRP",
245
- "coin": "Coin",
246
- "key-type": "Key Type",
247
- "key-format": "Key Format",
248
- "index": "Index",
249
- "address": "Address",
250
- "public-key": "Public Key",
251
- "private-key": "Private Key"
252
- }
253
- }
254
- },
255
- "cli": {
256
- "progress": {
257
- "done": "Done.",
258
- "error": "Error",
259
- "loadingEnvFiles": "Loading env files",
260
- "pleaseWait": "Please wait...",
261
- "writingJsonFile": "Writing JSON file",
262
- "writingEnvFile": "Writing env file",
263
- "readingJsonFile": "Reading JSON file",
264
- "readingEnvFile": "Reading env file"
265
- },
266
- "options": {
267
- "lang": {
268
- "param": "--lang '<'lang'>'",
269
- "description": "The language to display the output in."
270
- },
271
- "load-env": {
272
- "param": "--load-env [env...]",
273
- "description": "Load the env files to initialise any environment variables."
274
- },
275
- "no-console": {
276
- "param": "--no-console",
277
- "description": "Hides the output in the console."
278
- },
279
- "json": {
280
- "param": "--json '<'filename'>'",
281
- "description": "Creates a JSON file containing the output."
282
- },
283
- "env": {
284
- "param": "--env '<'filename'>'",
285
- "description": "Creates an env file containing the output."
286
- },
287
- "merge-json": {
288
- "param": "--merge-json",
289
- "description": "If the JSON file already exists merge the data instead of overwriting."
290
- },
291
- "merge-env": {
292
- "param": "--merge-env",
293
- "description": "If the env file already exists merge the data instead of overwriting."
294
- }
295
- }
296
- },
297
- "errorNames": {
298
- "error": "Error",
299
- "generalError": "General",
300
- "guardError": "Guard",
301
- "conflictError": "Conflict",
302
- "notFoundError": "Not Found",
303
- "notSupportedError": "Not Supported",
304
- "alreadyExistsError": "Already Exists",
305
- "notImplementedError": "Not Implemented",
306
- "validationError": "Validation",
307
- "unprocessableError": "Unprocessable"
308
- },
309
- "validation": {
310
- "defaultFieldName": "The field"
311
- }
312
- }
2
+ "error": {
3
+ "commands": {
4
+ "common": {
5
+ "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
6
+ "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
7
+ "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
8
+ "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
9
+ "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
10
+ "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
11
+ "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
12
+ },
13
+ "address": {
14
+ "seedMissingEnv": "The seed does not appear to be hex or base64, assuming it is an environment variable, but there is no environment variable with the name \"{env}\" set.",
15
+ "seedInvalidEnv": "The seed does not appear to be hex or base64, assuming it is an environment variable, but there the environment variable is neither hex or base64. \"{envValue}\"",
16
+ "seedInvalidFormat": "The seed does not appear to be hex, base64 or an environment variable. \"{seed}\""
17
+ }
18
+ },
19
+ "validation": {
20
+ "beEmpty": "{fieldName} must be empty",
21
+ "beNotEmpty": "{fieldName} must not be empty",
22
+ "beText": "{fieldName} must be text",
23
+ "beTextValue": "{fieldName} must contain some text",
24
+ "beTextMinMax": "{fieldName} must be longer than {minLength} and shorter than {maxLength} characters",
25
+ "beTextMin": "{fieldName} must be longer than {minLength} characters",
26
+ "beTextMax": "{fieldName} must be shorter than {maxLength} characters",
27
+ "beTextBase58": "{fieldName} must be text formatted using Base58 characters",
28
+ "beTextBase64": "{fieldName} must be text formatted using Base64 characters",
29
+ "beTextHex": "{fieldName} must be text formatted using Hex characters",
30
+ "beTextRegExp": "{fieldName} must be text formatted using the matching pattern {format}",
31
+ "beNumber": "{fieldName} must be a number",
32
+ "beNumberMinMax": "{fieldName} must be >= {minValue} and <= {maxValue}",
33
+ "beNumberMin": "{fieldName} must be >= {minValue}",
34
+ "beNumberMax": "{fieldName} must be <= {maxValue}",
35
+ "beWholeNumber": "{fieldName} must be a whole number",
36
+ "beWholeNumberMinMax": "{fieldName} must be a whole number >= {minValue} and <= {maxValue}",
37
+ "beWholeNumberMin": "{fieldName} must be a whole number >= {minValue}",
38
+ "beWholeNumberMax": "{fieldName} must be a whole number <= {maxValue}",
39
+ "beBigInteger": "{fieldName} must be a bigint",
40
+ "beBigIntegerMinMax": "{fieldName} must be a bigint >= {minValue} and <= {maxValue}",
41
+ "beBigIntegerMin": "{fieldName} must be a bigint >= {minValue}",
42
+ "beBigIntegerMax": "{fieldName} must be a bigint <= {maxValue}",
43
+ "beBoolean": "{fieldName} must be true or false",
44
+ "beDate": "{fieldName} must be a date",
45
+ "beDateTime": "{fieldName} must be a date/time",
46
+ "beTime": "{fieldName} must be a time",
47
+ "beTimestampMilliseconds": "{fieldName} must be a timestamp in milliseconds",
48
+ "beTimestampSeconds": "{fieldName} must be a timestamp in seconds",
49
+ "beObject": "{fieldName} must be an object",
50
+ "beArray": "{fieldName} must be an array",
51
+ "beArrayValue": "{fieldName} must be an array with at least one item",
52
+ "beIncluded": "{fieldName} is unrecognised",
53
+ "beByteArray": "{fieldName} must be a byte array",
54
+ "beUrn": "{fieldName} must be a correctly formatted urn",
55
+ "beUrl": "{fieldName} must be a correctly formatted url",
56
+ "beJSON": "{fieldName} must be correctly formatted JSON",
57
+ "beEmail": "{fieldName} must be a correctly formatted e-mail address",
58
+ "failed": "Validation failed",
59
+ "failedObject": "Validation of \"{objectName}\" failed"
60
+ },
61
+ "guard": {
62
+ "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
63
+ "string": "Property \"{property}\" must be a string, it is \"{value}\"",
64
+ "stringEmpty": "Property \"{property}\" must have a value, it is empty",
65
+ "stringBase64": "Property \"{property}\" must be a base64 encoded string, it is \"{value}\"",
66
+ "stringBase64Url": "Property \"{property}\" must be a base64 url encoded string, it is \"{value}\"",
67
+ "stringBase58": "Property \"{property}\" must be a base58 encoded string, it is \"{value}\"",
68
+ "stringHex": "Property \"{property}\" must be a hex string, it is \"{value}\"",
69
+ "stringHexLength": "Property \"{property}\" must be a hex string of length \"{options}\", it is \"{value}\"",
70
+ "stringJson": "Property \"{property}\" must be a JSON string",
71
+ "number": "Property \"{property}\" must be a number, it is \"{value}\"",
72
+ "integer": "Property \"{property}\" must be an integer, it is \"{value}\"",
73
+ "bigint": "Property \"{property}\" must be a bigint, it is \"{value}\"",
74
+ "boolean": "Property \"{property}\" must be a boolean, it is \"{value}\"",
75
+ "date": "Property \"{property}\" must be a date, it is \"{value}\"",
76
+ "timestampMilliseconds": "Property \"{property}\" must be a timestamp in milliseconds, it is \"{value}\"",
77
+ "timestampSeconds": "Property \"{property}\" must be a timestamp in seconds, it is \"{value}\"",
78
+ "objectUndefined": "Property \"{property}\" must be an object, it is \"undefined\"",
79
+ "object": "Property \"{property}\" must be an object, it is \"{value}\"",
80
+ "objectValue": "Property \"{property}\" must be an object, with at least one property, it is \"{value}\"",
81
+ "array": "Property \"{property}\" must be an array, it is \"{value}\"",
82
+ "arrayValue": "Property \"{property}\" must be an array with at least one item",
83
+ "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
84
+ "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
85
+ "function": "Property \"{property}\" must be a function, it is \"{value}\"",
86
+ "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
87
+ "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
88
+ "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
89
+ "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
90
+ "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
91
+ "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
92
+ "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
93
+ },
94
+ "objectHelper": {
95
+ "failedBytesToJSON": "Failed converting bytes to JSON",
96
+ "cannotSetArrayIndex": "Cannot set property \"{property}\" using index \"{index}\" as it is not an array",
97
+ "cannotSetProperty": "Cannot set property \"{property}\" when the target is not an object"
98
+ },
99
+ "common": {
100
+ "notImplementedMethod": "The method \"{method}\" has not been implemented",
101
+ "validation": "Validation failed"
102
+ },
103
+ "factory": {
104
+ "noUnregister": "There is no {typeName} registered with the name \"{name}\"",
105
+ "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
106
+ },
107
+ "bitString": {
108
+ "outOfRange": "The index should be >= 0 and less than the length of the bit string"
109
+ },
110
+ "base32": {
111
+ "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
112
+ },
113
+ "base64": {
114
+ "length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
115
+ },
116
+ "base58": {
117
+ "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
118
+ },
119
+ "bip39": {
120
+ "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
121
+ "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
122
+ },
123
+ "ed25519": {
124
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
125
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
126
+ },
127
+ "secp256k1": {
128
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
129
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
130
+ },
131
+ "x25519": {
132
+ "invalidPublicKey": "Invalid Ed25519 Public Key"
133
+ },
134
+ "blake2b": {
135
+ "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
136
+ "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
137
+ },
138
+ "sha512": {
139
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
140
+ },
141
+ "sha256": {
142
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
143
+ },
144
+ "sha3": {
145
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
146
+ },
147
+ "hmacSha256": {
148
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
149
+ },
150
+ "hmacSha512": {
151
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
152
+ },
153
+ "bech32": {
154
+ "decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
155
+ "invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
156
+ "separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
157
+ "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
158
+ "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
159
+ },
160
+ "pbkdf2": {
161
+ "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
162
+ },
163
+ "chaCha20Poly1305": {
164
+ "noAadWithData": "You can not set the aad when there is already data",
165
+ "noAuthTag": "Can not finalise when the auth tag is not set",
166
+ "authenticationFailed": "The data could not be authenticated",
167
+ "authTagDecrypting": "Can not get the auth tag when decrypting",
168
+ "authTagEncrypting": "Can not set the auth tag when encrypting",
169
+ "noAuthTagSet": "The auth tag has not been set"
170
+ },
171
+ "bip44": {
172
+ "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
173
+ },
174
+ "slip0010": {
175
+ "invalidSeed": "The seed is invalid \"{seed}\""
176
+ }
177
+ },
178
+ "cli": {
179
+ "progress": {
180
+ "done": "Done.",
181
+ "error": "Error",
182
+ "loadingEnvFiles": "Loading env files",
183
+ "pleaseWait": "Please wait...",
184
+ "writingJsonFile": "Writing JSON file",
185
+ "writingEnvFile": "Writing env file",
186
+ "readingJsonFile": "Reading JSON file",
187
+ "readingEnvFile": "Reading env file"
188
+ },
189
+ "options": {
190
+ "lang": {
191
+ "param": "--lang '<'lang'>'",
192
+ "description": "The language to display the output in."
193
+ },
194
+ "load-env": {
195
+ "param": "--load-env [env...]",
196
+ "description": "Load the env files to initialise any environment variables."
197
+ },
198
+ "no-console": {
199
+ "param": "--no-console",
200
+ "description": "Hides the output in the console."
201
+ },
202
+ "json": {
203
+ "param": "--json '<'filename'>'",
204
+ "description": "Creates a JSON file containing the output."
205
+ },
206
+ "env": {
207
+ "param": "--env '<'filename'>'",
208
+ "description": "Creates an env file containing the output."
209
+ },
210
+ "merge-json": {
211
+ "param": "--merge-json",
212
+ "description": "If the JSON file already exists merge the data instead of overwriting."
213
+ },
214
+ "merge-env": {
215
+ "param": "--merge-env",
216
+ "description": "If the env file already exists merge the data instead of overwriting."
217
+ }
218
+ }
219
+ },
220
+ "errorNames": {
221
+ "error": "Error",
222
+ "generalError": "General",
223
+ "guardError": "Guard",
224
+ "conflictError": "Conflict",
225
+ "notFoundError": "Not Found",
226
+ "notSupportedError": "Not Supported",
227
+ "alreadyExistsError": "Already Exists",
228
+ "notImplementedError": "Not Implemented",
229
+ "validationError": "Validation",
230
+ "unprocessableError": "Unprocessable"
231
+ },
232
+ "validation": {
233
+ "defaultFieldName": "The field"
234
+ },
235
+ "commands": {
236
+ "mnemonic": {
237
+ "summary": "Create a mnemonic.",
238
+ "description": "Create a mnemonic, will also generate the equivalent seed in hex and base64 format.",
239
+ "options": {
240
+ "strength": {
241
+ "param": "--strength '<'number'>'",
242
+ "description": "The number of words in the mnemonic, defaults to 256 which produces 24 words."
243
+ },
244
+ "seed-format": {
245
+ "param": "--seed-format '<'format'>'",
246
+ "description": "The format to output the seed."
247
+ },
248
+ "no-console": {
249
+ "param": "--no-console",
250
+ "description": "Hides the mnemonic and seed in the console."
251
+ },
252
+ "json": {
253
+ "param": "--json '<'filename'>'",
254
+ "description": "Creates a JSON file containing the mnemonic and seed."
255
+ },
256
+ "env": {
257
+ "param": "--env '<'filename'>'",
258
+ "description": "Creates an env file containing the mnemonic and seed."
259
+ },
260
+ "env-prefix": {
261
+ "param": "--env-prefix '<'prefix'>'",
262
+ "description": "Prefixes the env variables with the value."
263
+ }
264
+ },
265
+ "progress": {
266
+ "writingJsonFile": "Writing JSON file",
267
+ "writingEnvFile": "Writing env file"
268
+ },
269
+ "labels": {
270
+ "mnemonic": "Mnemonic",
271
+ "seed": "Seed",
272
+ "envPrefix": "Env Prefix"
273
+ }
274
+ },
275
+ "address": {
276
+ "summary": "Create addresses and keys from the seed.",
277
+ "description": "Create a number of addresses and their associated key pairs from the seed.",
278
+ "options": {
279
+ "seed": {
280
+ "param": "--seed '<'seed'>'",
281
+ "description": "The seed to use for generating the addresses, this can be either hex, base64 or an environment variable name. For an environment variable start the value with a !"
282
+ },
283
+ "start": {
284
+ "param": "--start '<'number'>'",
285
+ "description": "The index of the first address to create."
286
+ },
287
+ "count": {
288
+ "param": "--count '<'number'>'",
289
+ "description": "The number of addresses to create, max 100."
290
+ },
291
+ "account": {
292
+ "param": "--account '<'number'>'",
293
+ "description": "The account used to generate the addresses."
294
+ },
295
+ "hrp": {
296
+ "param": "--hrp '<'hrp'>'",
297
+ "description": "The human readable part for the addresses if generating bech32 format."
298
+ },
299
+ "coin": {
300
+ "param": "--coin '<'coin'>'",
301
+ "description": "The coin type used to generate the addresses."
302
+ },
303
+ "key-type": {
304
+ "param": "--key-type '<'type'>'",
305
+ "description": "The type of key to generate."
306
+ },
307
+ "key-format": {
308
+ "param": "--key-format '<'format'>'",
309
+ "description": "The format to output the keys."
310
+ }
311
+ },
312
+ "progress": {
313
+ "generatingAddresses": "Generating addresses"
314
+ },
315
+ "labels": {
316
+ "seed": "Seed",
317
+ "start": "Start",
318
+ "count": "Count",
319
+ "account": "Account",
320
+ "hrp": "HRP",
321
+ "coin": "Coin",
322
+ "key-type": "Key Type",
323
+ "key-format": "Key Format",
324
+ "index": "Index",
325
+ "address": "Address",
326
+ "public-key": "Public Key",
327
+ "private-key": "Private Key"
328
+ }
329
+ }
330
+ }
331
+ }
@@ -7,7 +7,11 @@ export declare class CLI extends CLIBase {
7
7
  * Run the app.
8
8
  * @param argv The process arguments.
9
9
  * @param localesDirectory The directory for the locales, default to relative to the script.
10
+ * @param options Additional options.
11
+ * @param options.overrideOutputWidth Override the output width.
10
12
  * @returns The exit code.
11
13
  */
12
- run(argv: string[], localesDirectory?: string): Promise<number>;
14
+ run(argv: string[], localesDirectory?: string, options?: {
15
+ overrideOutputWidth?: number;
16
+ }): Promise<number>;
13
17
  }
@@ -12,7 +12,7 @@ export declare function buildCommandAddress(): Command;
12
12
  * @param opts.start The start index for the address generation.
13
13
  * @param opts.count The number of addresses to generate.
14
14
  * @param opts.account The account index for the address generation.
15
- * @param opts.hrp The human readable part for the address.
15
+ * @param opts.hrp The human readable part for the addresses if generating bech32 format.
16
16
  * @param opts.coin The coin type for the address.
17
17
  * @param opts.keyType The key type for the address.
18
18
  * @param opts.keyFormat The output format of the key.
@@ -22,7 +22,7 @@ export declare function actionCommandAddress(opts: {
22
22
  start: string;
23
23
  count: string;
24
24
  account: string;
25
- hrp: string;
25
+ hrp?: string;
26
26
  coin: string;
27
27
  keyType: "Ed25519" | "Secp256k1";
28
28
  keyFormat: "hex" | "base64";
@@ -14,4 +14,5 @@ export declare function buildCommandMnemonic(): Command;
14
14
  export declare function actionCommandMnemonic(opts: {
15
15
  strength: string;
16
16
  seedFormat: "hex" | "base64";
17
+ envPrefix?: string;
17
18
  } & CliOutputOptions): Promise<void>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/crypto-cli - Changelog
2
2
 
3
- ## 0.0.1-next.3
3
+ ## 0.0.1-next.31
4
4
 
5
5
  - Initial Release
package/docs/examples.md CHANGED
@@ -1,22 +1,21 @@
1
1
  # @twin.org/crypto-cli - Examples
2
2
 
3
- ## Command Line Tool
3
+ ## Running
4
4
 
5
- First install the tool with the following script.
5
+ To install and run the CLI locally use the following commands:
6
6
 
7
7
  ```shell
8
- npm install @twin.org/crypto-cli
8
+ npm install @twin.org/crypto-cli -g
9
+ twin-crypto
9
10
  ```
10
11
 
11
- ## Running
12
-
13
- If you run the tool with no command line options:
12
+ or run directly using NPX:
14
13
 
15
14
  ```shell
16
- twin-crypto
15
+ npx "@twin.org/crypto-cli"
17
16
  ```
18
17
 
19
- You should see output similar to the following
18
+ You should see output similar to the following:
20
19
 
21
20
  ```shell
22
21
  🌍 TWIN Crypto v1.0.0
@@ -230,10 +229,10 @@ twin-crypto address --load-env my.env --seed !SEED --env address.env --merge-env
230
229
  The output of this command would produce address.env
231
230
 
232
231
  ```shell
233
- ADDRESS_0_BECH32="iota1qqcpqyrnqtzteu7k26dgjvjp3x76tts526prtwrjq99v50pyv6l9xysdcg8"
232
+ ADDRESS_0="iota1qqcpqyrnqtzteu7k26dgjvjp3x76tts526prtwrjq99v50pyv6l9xysdcg8"
234
233
  ADDRESS_0_PRIVATE_KEY="0x3b2863db878ce156a46d2142c72baa7807a40a990684604ff86456821228d978"
235
234
  ADDRESS_0_PUBLIC_KEY="0x6b6eb9e54b44bfbc65c4a02c6489609fbc9588e640ca44bfdfdb1af4e5874905"
236
- ADDRESS_1_BECH32="iota1qrqyyyuhfzgrp7ducjapg8pta3w877nu0u5jpe50cxx39qjs08kczw7uj4v"
235
+ ADDRESS_1="iota1qrqyyyuhfzgrp7ducjapg8pta3w877nu0u5jpe50cxx39qjs08kczw7uj4v"
237
236
  ADDRESS_1_PRIVATE_KEY="0xc5038b4c0b1dc46769687e77555a7be176e22de4262cf5aabf11290ab7c8d856"
238
237
  ADDRESS_1_PUBLIC_KEY="0x603d9b2d25341d142524867536e3ee94d3e02a45fe498ec4c3473b0449446d77"
239
238
  ....
@@ -22,75 +22,35 @@ The main entry point for the CLI.
22
22
 
23
23
  ## Methods
24
24
 
25
- ### execute()
25
+ ### run()
26
26
 
27
- > **execute**(`options`, `localesDirectory`, `argv`): `Promise`\<`number`\>
27
+ > **run**(`argv`, `localesDirectory`?, `options`?): `Promise`\<`number`\>
28
28
 
29
- Execute the command line processing.
29
+ Run the app.
30
30
 
31
31
  #### Parameters
32
32
 
33
- **options**: `ICliOptions`
34
-
35
- The options for the CLI.
36
-
37
- • **localesDirectory**: `string`
38
-
39
- The path to load the locales from.
33
+ ##### argv
40
34
 
41
- • **argv**: `string`[]
35
+ `string`[]
42
36
 
43
37
  The process arguments.
44
38
 
45
- #### Returns
46
-
47
- `Promise`\<`number`\>
48
-
49
- The exit code.
50
-
51
- #### Inherited from
52
-
53
- `CLIBase.execute`
54
-
55
- ***
39
+ ##### localesDirectory?
56
40
 
57
- ### configureRoot()
58
-
59
- > `protected` **configureRoot**(`program`): `void`
60
-
61
- Configure any options or actions at the root program level.
62
-
63
- #### Parameters
41
+ `string`
64
42
 
65
- **program**: `Command`
66
-
67
- The root program command.
68
-
69
- #### Returns
70
-
71
- `void`
72
-
73
- #### Inherited from
74
-
75
- `CLIBase.configureRoot`
76
-
77
- ***
78
-
79
- ### run()
80
-
81
- > **run**(`argv`, `localesDirectory`?): `Promise`\<`number`\>
82
-
83
- Run the app.
43
+ The directory for the locales, default to relative to the script.
84
44
 
85
- #### Parameters
45
+ ##### options?
86
46
 
87
- **argv**: `string`[]
47
+ Additional options.
88
48
 
89
- The process arguments.
49
+ ###### overrideOutputWidth
90
50
 
91
- • **localesDirectory?**: `string`
51
+ `number`
92
52
 
93
- The directory for the locales, default to relative to the script.
53
+ Override the output width.
94
54
 
95
55
  #### Returns
96
56
 
@@ -6,7 +6,9 @@ Action the address command.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
9
+ ### opts
10
+
11
+ `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
10
12
 
11
13
  The options for the command.
12
14
 
@@ -6,7 +6,9 @@ Action the mnemonic command.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
9
+ ### opts
10
+
11
+ `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
10
12
 
11
13
  The options for the command.
12
14
 
package/locales/en.json CHANGED
@@ -32,6 +32,10 @@
32
32
  "env": {
33
33
  "param": "--env '<'filename'>'",
34
34
  "description": "Creates an env file containing the mnemonic and seed."
35
+ },
36
+ "env-prefix": {
37
+ "param": "--env-prefix '<'prefix'>'",
38
+ "description": "Prefixes the env variables with the value."
35
39
  }
36
40
  },
37
41
  "progress": {
@@ -40,12 +44,13 @@
40
44
  },
41
45
  "labels": {
42
46
  "mnemonic": "Mnemonic",
43
- "seed": "Seed"
47
+ "seed": "Seed",
48
+ "envPrefix": "Env Prefix"
44
49
  }
45
50
  },
46
51
  "address": {
47
- "summary": "Create bech32 addresses and keys from the seed.",
48
- "description": "Create a number of bech32 addresses and their associated key pairs from the seed.",
52
+ "summary": "Create addresses and keys from the seed.",
53
+ "description": "Create a number of addresses and their associated key pairs from the seed.",
49
54
  "options": {
50
55
  "seed": {
51
56
  "param": "--seed '<'seed'>'",
@@ -61,15 +66,15 @@
61
66
  },
62
67
  "account": {
63
68
  "param": "--account '<'number'>'",
64
- "description": "The account used to generate the bech32 addresses."
69
+ "description": "The account used to generate the addresses."
65
70
  },
66
71
  "hrp": {
67
72
  "param": "--hrp '<'hrp'>'",
68
- "description": "The human readable part of the bech32 addresses."
73
+ "description": "The human readable part for the addresses if generating bech32 format."
69
74
  },
70
75
  "coin": {
71
76
  "param": "--coin '<'coin'>'",
72
- "description": "The coin type used to generate the bech32 addresses."
77
+ "description": "The coin type used to generate the addresses."
73
78
  },
74
79
  "key-type": {
75
80
  "param": "--key-type '<'type'>'",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@twin.org/crypto-cli",
3
- "version": "0.0.1-next.3",
3
+ "version": "0.0.1-next.31",
4
4
  "description": "A command line interface for interacting with the crypto tools",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/framework.git",
8
- "directory": "packages/crypto-cli"
8
+ "directory": "apps/crypto-cli"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
11
11
  "license": "Apache-2.0",
@@ -13,50 +13,21 @@
13
13
  "engines": {
14
14
  "node": ">=20.0.0"
15
15
  },
16
- "scripts": {
17
- "clean": "rimraf dist coverage",
18
- "build": "tspc",
19
- "merge-locales": "merge-locales",
20
- "test": "vitest --run --config ./vitest.config.ts --no-cache",
21
- "coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
22
- "bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
23
- "bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
24
- "bundle": "npm run bundle:esm && npm run bundle:cjs",
25
- "docs:clean": "rimraf docs/reference",
26
- "docs:generate": "typedoc",
27
- "docs": "npm run docs:clean && npm run docs:generate",
28
- "dist": "npm run clean && npm run build && npm run merge-locales && npm run test && npm run bundle && npm run docs"
29
- },
30
16
  "dependencies": {
31
- "@twin.org/cli-core": "0.0.1-next.3",
32
- "@twin.org/core": "0.0.1-next.3",
33
- "@twin.org/crypto": "0.0.1-next.3",
17
+ "@twin.org/cli-core": "0.0.1-next.31",
18
+ "@twin.org/core": "0.0.1-next.31",
19
+ "@twin.org/crypto": "0.0.1-next.31",
34
20
  "@twin.org/nameof": "next",
35
- "commander": "12.1.0"
36
- },
37
- "devDependencies": {
38
- "@twin.org/merge-locales": "next",
39
- "@twin.org/nameof-transformer": "next",
40
- "@types/node": "22.5.5",
41
- "@vitest/coverage-v8": "2.1.1",
42
- "copyfiles": "2.4.1",
43
- "rimraf": "6.0.1",
44
- "rollup": "4.21.3",
45
- "rollup-plugin-typescript2": "0.36.0",
46
- "ts-patch": "3.2.1",
47
- "typedoc": "0.26.7",
48
- "typedoc-plugin-markdown": "4.2.7",
49
- "typescript": "5.6.2",
50
- "vitest": "2.1.1"
21
+ "commander": "13.1.0"
51
22
  },
52
23
  "main": "./dist/cjs/index.cjs",
53
24
  "module": "./dist/esm/index.mjs",
54
25
  "types": "./dist/types/index.d.ts",
55
26
  "exports": {
56
27
  ".": {
28
+ "types": "./dist/types/index.d.ts",
57
29
  "require": "./dist/cjs/index.cjs",
58
- "import": "./dist/esm/index.mjs",
59
- "types": "./dist/types/index.d.ts"
30
+ "import": "./dist/esm/index.mjs"
60
31
  }
61
32
  },
62
33
  "files": [