@twin.org/identity-cli 0.0.1-next.47 → 0.0.1-next.49

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.
@@ -15,6 +15,7 @@ var identityConnectorIota = require('@twin.org/identity-connector-iota');
15
15
  var vaultConnectorEntityStorage = require('@twin.org/vault-connector-entity-storage');
16
16
  var identityModels = require('@twin.org/identity-models');
17
17
  var standardsW3cDid = require('@twin.org/standards-w3c-did');
18
+ var web = require('@twin.org/web');
18
19
 
19
20
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
20
21
  // Copyright 2024 IOTA Stiftung.
@@ -1004,24 +1005,30 @@ async function actionCommandVerificationMethodAdd(opts) {
1004
1005
  cliCore.CLIDisplay.spinnerStop();
1005
1006
  const keyParts = identityModels.DocumentHelper.parseId(verificationMethod.id);
1006
1007
  const keyPair = await vaultConnector.getKey(`${localIdentity}/${keyParts.fragment}`);
1007
- const privateKey = core.Converter.bytesToBase64(keyPair.privateKey);
1008
- const publicKey = core.Is.uint8Array(keyPair.publicKey)
1009
- ? core.Converter.bytesToBase64(keyPair.publicKey)
1008
+ const privateKeyBase64 = core.Converter.bytesToBase64Url(keyPair.privateKey);
1009
+ const publicKeyBase64 = core.Is.uint8Array(keyPair.publicKey)
1010
+ ? core.Converter.bytesToBase64Url(keyPair.publicKey)
1011
+ : "";
1012
+ const privateKeyHex = core.Converter.bytesToHex(keyPair.privateKey, true);
1013
+ const publicKeyHex = core.Is.uint8Array(keyPair.publicKey)
1014
+ ? core.Converter.bytesToHex(keyPair.publicKey, true)
1010
1015
  : "";
1011
1016
  if (opts.console) {
1012
1017
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.verificationMethodId"), verificationMethod.id);
1013
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.privateKey"), privateKey);
1014
- cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.publicKey"), publicKey);
1018
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.privateKeyBase64"), privateKeyBase64);
1019
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.publicKeyBase64"), publicKeyBase64);
1020
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.privateKeyHex"), privateKeyHex);
1021
+ cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.publicKeyHex"), publicKeyHex);
1015
1022
  cliCore.CLIDisplay.break();
1016
1023
  }
1017
1024
  if (core.Is.stringValue(opts?.json)) {
1018
- await cliCore.CLIUtils.writeJsonFile(opts.json, { verificationMethodId: verificationMethod.id, privateKey, publicKey }, opts.mergeJson);
1025
+ await cliCore.CLIUtils.writeJsonFile(opts.json, await web.Jwk.fromEd25519Private(keyPair.privateKey), opts.mergeJson);
1019
1026
  }
1020
1027
  if (core.Is.stringValue(opts?.env)) {
1021
1028
  await cliCore.CLIUtils.writeEnvFile(opts.env, [
1022
1029
  `DID_VERIFICATION_METHOD_ID="${verificationMethod.id}"`,
1023
- `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKey}"`,
1024
- `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKey}"`
1030
+ `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKeyHex}"`,
1031
+ `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKeyHex}"`
1025
1032
  ], opts.mergeEnv);
1026
1033
  }
1027
1034
  if (opts.connector === IdentityConnectorTypes.Iota) {
@@ -1132,7 +1139,7 @@ class CLI extends cliCore.CLIBase {
1132
1139
  return this.execute({
1133
1140
  title: "TWIN Identity",
1134
1141
  appName: "twin-identity",
1135
- version: "0.0.1-next.47", // x-release-please-version
1142
+ version: "0.0.1-next.49", // x-release-please-version
1136
1143
  icon: "🌍",
1137
1144
  supportsEnvFiles: true,
1138
1145
  overrideOutputWidth: options?.overrideOutputWidth
@@ -13,6 +13,7 @@ import { IotaIdentityConnector, IotaIdentityResolverConnector } from '@twin.org/
13
13
  import { initSchema, EntityStorageVaultConnector } from '@twin.org/vault-connector-entity-storage';
14
14
  import { DocumentHelper } from '@twin.org/identity-models';
15
15
  import { ProofTypes, DidVerificationMethodType } from '@twin.org/standards-w3c-did';
16
+ import { Jwk } from '@twin.org/web';
16
17
 
17
18
  // Copyright 2024 IOTA Stiftung.
18
19
  // SPDX-License-Identifier: Apache-2.0.
@@ -1001,24 +1002,30 @@ async function actionCommandVerificationMethodAdd(opts) {
1001
1002
  CLIDisplay.spinnerStop();
1002
1003
  const keyParts = DocumentHelper.parseId(verificationMethod.id);
1003
1004
  const keyPair = await vaultConnector.getKey(`${localIdentity}/${keyParts.fragment}`);
1004
- const privateKey = Converter.bytesToBase64(keyPair.privateKey);
1005
- const publicKey = Is.uint8Array(keyPair.publicKey)
1006
- ? Converter.bytesToBase64(keyPair.publicKey)
1005
+ const privateKeyBase64 = Converter.bytesToBase64Url(keyPair.privateKey);
1006
+ const publicKeyBase64 = Is.uint8Array(keyPair.publicKey)
1007
+ ? Converter.bytesToBase64Url(keyPair.publicKey)
1008
+ : "";
1009
+ const privateKeyHex = Converter.bytesToHex(keyPair.privateKey, true);
1010
+ const publicKeyHex = Is.uint8Array(keyPair.publicKey)
1011
+ ? Converter.bytesToHex(keyPair.publicKey, true)
1007
1012
  : "";
1008
1013
  if (opts.console) {
1009
1014
  CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.verificationMethodId"), verificationMethod.id);
1010
- CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.privateKey"), privateKey);
1011
- CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.publicKey"), publicKey);
1015
+ CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.privateKeyBase64"), privateKeyBase64);
1016
+ CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.publicKeyBase64"), publicKeyBase64);
1017
+ CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.privateKeyHex"), privateKeyHex);
1018
+ CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.publicKeyHex"), publicKeyHex);
1012
1019
  CLIDisplay.break();
1013
1020
  }
1014
1021
  if (Is.stringValue(opts?.json)) {
1015
- await CLIUtils.writeJsonFile(opts.json, { verificationMethodId: verificationMethod.id, privateKey, publicKey }, opts.mergeJson);
1022
+ await CLIUtils.writeJsonFile(opts.json, await Jwk.fromEd25519Private(keyPair.privateKey), opts.mergeJson);
1016
1023
  }
1017
1024
  if (Is.stringValue(opts?.env)) {
1018
1025
  await CLIUtils.writeEnvFile(opts.env, [
1019
1026
  `DID_VERIFICATION_METHOD_ID="${verificationMethod.id}"`,
1020
- `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKey}"`,
1021
- `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKey}"`
1027
+ `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKeyHex}"`,
1028
+ `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKeyHex}"`
1022
1029
  ], opts.mergeEnv);
1023
1030
  }
1024
1031
  if (opts.connector === IdentityConnectorTypes.Iota) {
@@ -1129,7 +1136,7 @@ class CLI extends CLIBase {
1129
1136
  return this.execute({
1130
1137
  title: "TWIN Identity",
1131
1138
  appName: "twin-identity",
1132
- version: "0.0.1-next.47", // x-release-please-version
1139
+ version: "0.0.1-next.49", // x-release-please-version
1133
1140
  icon: "🌍",
1134
1141
  supportsEnvFiles: true,
1135
1142
  overrideOutputWidth: options?.overrideOutputWidth
@@ -619,8 +619,10 @@
619
619
  "labels": {
620
620
  "verificationMethodType": "Verification Method Type",
621
621
  "verificationMethodId": "Verification Method Id",
622
- "privateKey": "Private Key",
623
- "publicKey": "Public Key"
622
+ "privateKeyBase64": "Private Key Base64",
623
+ "publicKeyBase64": "Public Key Base64",
624
+ "privateKeyHex": "Private Key Hex",
625
+ "publicKeyHex": "Public Key Hex"
624
626
  }
625
627
  },
626
628
  "verification-method-remove": {
package/docs/changelog.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @twin.org/identity-cli - Changelog
2
2
 
3
+ ## [0.0.1-next.49](https://github.com/twinfoundation/identity/compare/identity-cli-v0.0.1-next.48...identity-cli-v0.0.1-next.49) (2025-06-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * verification method output JWK and hex on CLI ([49db9da](https://github.com/twinfoundation/identity/commit/49db9da2371eafdcd7176ce44303961b9b8b8380))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/identity-models bumped from 0.0.1-next.48 to 0.0.1-next.49
16
+ * @twin.org/identity-connector-iota bumped from 0.0.1-next.48 to 0.0.1-next.49
17
+
18
+ ## [0.0.1-next.48](https://github.com/twinfoundation/identity/compare/identity-cli-v0.0.1-next.47...identity-cli-v0.0.1-next.48) (2025-06-17)
19
+
20
+
21
+ ### Features
22
+
23
+ * add mainnet support ([af56a38](https://github.com/twinfoundation/identity/commit/af56a382837896cd4e13d5814c0924c46658b99c))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @twin.org/identity-models bumped from 0.0.1-next.47 to 0.0.1-next.48
31
+ * @twin.org/identity-connector-iota bumped from 0.0.1-next.47 to 0.0.1-next.48
32
+
3
33
  ## [0.0.1-next.47](https://github.com/twinfoundation/identity/compare/identity-cli-v0.0.1-next.46...identity-cli-v0.0.1-next.47) (2025-06-12)
4
34
 
5
35
 
package/docs/examples.md CHANGED
@@ -97,7 +97,7 @@ NODE_URL="https://api.devnet.iota.cafe"
97
97
  FAUCET_URL="https://faucet.devnet.iota.cafe"
98
98
  COIN_TYPE="4218"
99
99
  NETWORK="devnet"
100
- EXPLORER_URL="https://explorer.rebased.iota.org/"
100
+ EXPLORER_URL="https://explorer.iota.org/"
101
101
  ```
102
102
 
103
103
  To then request some funds and generate the identity you can issue the following commands:
package/locales/en.json CHANGED
@@ -75,8 +75,10 @@
75
75
  "labels": {
76
76
  "verificationMethodType": "Verification Method Type",
77
77
  "verificationMethodId": "Verification Method Id",
78
- "privateKey": "Private Key",
79
- "publicKey": "Public Key"
78
+ "privateKeyBase64": "Private Key Base64",
79
+ "publicKeyBase64": "Public Key Base64",
80
+ "privateKeyHex": "Private Key Hex",
81
+ "publicKeyHex": "Public Key Hex"
80
82
  }
81
83
  },
82
84
  "verification-method-remove": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-cli",
3
- "version": "0.0.1-next.47",
3
+ "version": "0.0.1-next.49",
4
4
  "description": "A command line interface for interacting with the identity connectors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "@twin.org/data-json-ld": "next",
22
22
  "@twin.org/entity": "next",
23
23
  "@twin.org/entity-storage-connector-memory": "next",
24
- "@twin.org/identity-connector-iota": "0.0.1-next.47",
25
- "@twin.org/identity-models": "0.0.1-next.47",
24
+ "@twin.org/identity-connector-iota": "0.0.1-next.49",
25
+ "@twin.org/identity-models": "0.0.1-next.49",
26
26
  "@twin.org/nameof": "next",
27
27
  "@twin.org/standards-w3c-did": "next",
28
28
  "@twin.org/vault-connector-entity-storage": "next",
@@ -30,6 +30,7 @@
30
30
  "@twin.org/wallet-cli": "next",
31
31
  "@twin.org/wallet-connector-iota": "next",
32
32
  "@twin.org/wallet-models": "next",
33
+ "@twin.org/web": "next",
33
34
  "commander": "14.0.0"
34
35
  },
35
36
  "main": "./dist/cjs/index.cjs",