@twin.org/crypto-cli 0.0.1-next.9 → 0.0.2-next.3

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,6 @@ 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")
28
27
  .option(core.I18n.formatMessage("commands.address.options.coin.param"), core.I18n.formatMessage("commands.address.options.coin.description"), "4218")
29
28
  .addOption(new commander.Option(core.I18n.formatMessage("commands.address.options.key-type.param"), core.I18n.formatMessage("commands.address.options.key-type.description"))
30
29
  .choices(["Ed25519", "Secp256k1"])
@@ -49,7 +48,6 @@ function buildCommandAddress() {
49
48
  * @param opts.start The start index for the address generation.
50
49
  * @param opts.count The number of addresses to generate.
51
50
  * @param opts.account The account index for the address generation.
52
- * @param opts.hrp The human readable part for the address.
53
51
  * @param opts.coin The coin type for the address.
54
52
  * @param opts.keyType The key type for the address.
55
53
  * @param opts.keyFormat The output format of the key.
@@ -59,7 +57,6 @@ async function actionCommandAddress(opts) {
59
57
  const start = cliCore.CLIParam.integer("start", opts.start, false);
60
58
  const count = cliCore.CLIParam.integer("count", opts.count, false, 1, 100);
61
59
  const account = cliCore.CLIParam.integer("account", opts.account, false);
62
- const hrp = opts.hrp;
63
60
  const coin = cliCore.CLIParam.integer("coin", opts.coin, false);
64
61
  const keyType = opts.keyType;
65
62
  const keyFormat = opts.keyFormat;
@@ -67,7 +64,6 @@ async function actionCommandAddress(opts) {
67
64
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.start"), start);
68
65
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.count"), count);
69
66
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.account"), account);
70
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.hrp"), hrp);
71
67
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.coin"), coin);
72
68
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.key-type"), keyType);
73
69
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.key-format"), keyFormat);
@@ -76,9 +72,9 @@ async function actionCommandAddress(opts) {
76
72
  cliCore.CLIDisplay.break();
77
73
  const addressDictionary = {};
78
74
  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);
75
+ const addressKeyPair = crypto.Bip44.address(seed, keyType === "Ed25519" ? crypto.KeyType.Ed25519 : crypto.KeyType.Secp256k1, coin, account, false, i);
80
76
  addressDictionary[i] = {
81
- bech32: addressKeyPair.address,
77
+ address: addressKeyPair.address,
82
78
  privateKey: keyFormat === "hex"
83
79
  ? core.Converter.bytesToHex(addressKeyPair.privateKey, true)
84
80
  : core.Converter.bytesToBase64(addressKeyPair.privateKey),
@@ -88,19 +84,19 @@ async function actionCommandAddress(opts) {
88
84
  };
89
85
  if (opts.console) {
90
86
  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);
87
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].address);
92
88
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.private-key"), addressDictionary[i].privateKey);
93
89
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.address.labels.public-key"), addressDictionary[i].publicKey);
94
90
  cliCore.CLIDisplay.break();
95
91
  }
96
92
  }
97
93
  if (core.Is.stringValue(opts?.json)) {
98
- await cliCore.CLIUtils.writeJsonFile(opts.json, addressDictionary, opts.mergeJson);
94
+ await cliCore.CLIUtils.writeJsonFile(opts.json, { addresses: addressDictionary }, opts.mergeJson);
99
95
  }
100
96
  if (core.Is.stringValue(opts?.env)) {
101
97
  const output = [];
102
98
  for (const addressIndex in addressDictionary) {
103
- output.push(`ADDRESS_${addressIndex}_BECH32="${addressDictionary[addressIndex].bech32}"`);
99
+ output.push(`ADDRESS_${addressIndex}="${addressDictionary[addressIndex].address}"`);
104
100
  output.push(`ADDRESS_${addressIndex}_PRIVATE_KEY="${addressDictionary[addressIndex].privateKey}"`);
105
101
  output.push(`ADDRESS_${addressIndex}_PUBLIC_KEY="${addressDictionary[addressIndex].publicKey}"`);
106
102
  }
@@ -185,7 +181,7 @@ class CLI extends cliCore.CLIBase {
185
181
  return this.execute({
186
182
  title: "TWIN Crypto",
187
183
  appName: "twin-crypto",
188
- version: "0.0.1-next.9",
184
+ version: "0.0.2-next.3", // x-release-please-version
189
185
  icon: "🌍",
190
186
  supportsEnvFiles: true,
191
187
  overrideOutputWidth: options?.overrideOutputWidth
@@ -21,7 +21,6 @@ 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")
25
24
  .option(I18n.formatMessage("commands.address.options.coin.param"), I18n.formatMessage("commands.address.options.coin.description"), "4218")
26
25
  .addOption(new Option(I18n.formatMessage("commands.address.options.key-type.param"), I18n.formatMessage("commands.address.options.key-type.description"))
27
26
  .choices(["Ed25519", "Secp256k1"])
@@ -46,7 +45,6 @@ function buildCommandAddress() {
46
45
  * @param opts.start The start index for the address generation.
47
46
  * @param opts.count The number of addresses to generate.
48
47
  * @param opts.account The account index for the address generation.
49
- * @param opts.hrp The human readable part for the address.
50
48
  * @param opts.coin The coin type for the address.
51
49
  * @param opts.keyType The key type for the address.
52
50
  * @param opts.keyFormat The output format of the key.
@@ -56,7 +54,6 @@ async function actionCommandAddress(opts) {
56
54
  const start = CLIParam.integer("start", opts.start, false);
57
55
  const count = CLIParam.integer("count", opts.count, false, 1, 100);
58
56
  const account = CLIParam.integer("account", opts.account, false);
59
- const hrp = opts.hrp;
60
57
  const coin = CLIParam.integer("coin", opts.coin, false);
61
58
  const keyType = opts.keyType;
62
59
  const keyFormat = opts.keyFormat;
@@ -64,7 +61,6 @@ async function actionCommandAddress(opts) {
64
61
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.start"), start);
65
62
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.count"), count);
66
63
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.account"), account);
67
- CLIDisplay.value(I18n.formatMessage("commands.address.labels.hrp"), hrp);
68
64
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.coin"), coin);
69
65
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.key-type"), keyType);
70
66
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.key-format"), keyFormat);
@@ -73,9 +69,9 @@ async function actionCommandAddress(opts) {
73
69
  CLIDisplay.break();
74
70
  const addressDictionary = {};
75
71
  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);
72
+ const addressKeyPair = Bip44.address(seed, keyType === "Ed25519" ? KeyType.Ed25519 : KeyType.Secp256k1, coin, account, false, i);
77
73
  addressDictionary[i] = {
78
- bech32: addressKeyPair.address,
74
+ address: addressKeyPair.address,
79
75
  privateKey: keyFormat === "hex"
80
76
  ? Converter.bytesToHex(addressKeyPair.privateKey, true)
81
77
  : Converter.bytesToBase64(addressKeyPair.privateKey),
@@ -85,19 +81,19 @@ async function actionCommandAddress(opts) {
85
81
  };
86
82
  if (opts.console) {
87
83
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.index"), i);
88
- CLIDisplay.value(I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].bech32);
84
+ CLIDisplay.value(I18n.formatMessage("commands.address.labels.address"), addressDictionary[i].address);
89
85
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.private-key"), addressDictionary[i].privateKey);
90
86
  CLIDisplay.value(I18n.formatMessage("commands.address.labels.public-key"), addressDictionary[i].publicKey);
91
87
  CLIDisplay.break();
92
88
  }
93
89
  }
94
90
  if (Is.stringValue(opts?.json)) {
95
- await CLIUtils.writeJsonFile(opts.json, addressDictionary, opts.mergeJson);
91
+ await CLIUtils.writeJsonFile(opts.json, { addresses: addressDictionary }, opts.mergeJson);
96
92
  }
97
93
  if (Is.stringValue(opts?.env)) {
98
94
  const output = [];
99
95
  for (const addressIndex in addressDictionary) {
100
- output.push(`ADDRESS_${addressIndex}_BECH32="${addressDictionary[addressIndex].bech32}"`);
96
+ output.push(`ADDRESS_${addressIndex}="${addressDictionary[addressIndex].address}"`);
101
97
  output.push(`ADDRESS_${addressIndex}_PRIVATE_KEY="${addressDictionary[addressIndex].privateKey}"`);
102
98
  output.push(`ADDRESS_${addressIndex}_PUBLIC_KEY="${addressDictionary[addressIndex].publicKey}"`);
103
99
  }
@@ -182,7 +178,7 @@ class CLI extends CLIBase {
182
178
  return this.execute({
183
179
  title: "TWIN Crypto",
184
180
  appName: "twin-crypto",
185
- version: "0.0.1-next.9",
181
+ version: "0.0.2-next.3", // x-release-please-version
186
182
  icon: "🌍",
187
183
  supportsEnvFiles: true,
188
184
  overrideOutputWidth: options?.overrideOutputWidth