@twin.org/identity-cli 0.0.1-next.48 → 0.0.1-next.50

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,35 @@ 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
+ const jwk = await web.Jwk.fromEd25519Private(keyPair.privateKey);
1026
+ const kid = await web.Jwk.generateKid(jwk);
1027
+ await cliCore.CLIUtils.writeJsonFile(opts.json, {
1028
+ kid,
1029
+ ...jwk
1030
+ }, opts.mergeJson);
1019
1031
  }
1020
1032
  if (core.Is.stringValue(opts?.env)) {
1021
1033
  await cliCore.CLIUtils.writeEnvFile(opts.env, [
1022
1034
  `DID_VERIFICATION_METHOD_ID="${verificationMethod.id}"`,
1023
- `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKey}"`,
1024
- `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKey}"`
1035
+ `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKeyHex}"`,
1036
+ `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKeyHex}"`
1025
1037
  ], opts.mergeEnv);
1026
1038
  }
1027
1039
  if (opts.connector === IdentityConnectorTypes.Iota) {
@@ -1132,7 +1144,7 @@ class CLI extends cliCore.CLIBase {
1132
1144
  return this.execute({
1133
1145
  title: "TWIN Identity",
1134
1146
  appName: "twin-identity",
1135
- version: "0.0.1-next.48", // x-release-please-version
1147
+ version: "0.0.1-next.50", // x-release-please-version
1136
1148
  icon: "🌍",
1137
1149
  supportsEnvFiles: true,
1138
1150
  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,35 @@ 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
+ const jwk = await Jwk.fromEd25519Private(keyPair.privateKey);
1023
+ const kid = await Jwk.generateKid(jwk);
1024
+ await CLIUtils.writeJsonFile(opts.json, {
1025
+ kid,
1026
+ ...jwk
1027
+ }, opts.mergeJson);
1016
1028
  }
1017
1029
  if (Is.stringValue(opts?.env)) {
1018
1030
  await CLIUtils.writeEnvFile(opts.env, [
1019
1031
  `DID_VERIFICATION_METHOD_ID="${verificationMethod.id}"`,
1020
- `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKey}"`,
1021
- `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKey}"`
1032
+ `DID_VERIFICATION_METHOD_PRIVATE_KEY="${privateKeyHex}"`,
1033
+ `DID_VERIFICATION_METHOD_PUBLIC_KEY="${publicKeyHex}"`
1022
1034
  ], opts.mergeEnv);
1023
1035
  }
1024
1036
  if (opts.connector === IdentityConnectorTypes.Iota) {
@@ -1129,7 +1141,7 @@ class CLI extends CLIBase {
1129
1141
  return this.execute({
1130
1142
  title: "TWIN Identity",
1131
1143
  appName: "twin-identity",
1132
- version: "0.0.1-next.48", // x-release-please-version
1144
+ version: "0.0.1-next.50", // x-release-please-version
1133
1145
  icon: "🌍",
1134
1146
  supportsEnvFiles: true,
1135
1147
  overrideOutputWidth: options?.overrideOutputWidth
@@ -300,7 +300,10 @@
300
300
  "packageObjectError": "Failed to fetch the package object \"{packageId}\"",
301
301
  "valueTransactionFailed": "The value transaction failed",
302
302
  "transactionFailed": "The transaction failed",
303
- "addressNotFound": "The address is missing could not be found from the seed \"{address}\""
303
+ "addressNotFound": "The address is missing could not be found from the seed \"{address}\"",
304
+ "gasStationTransactionFailed": "The gas station transaction failed",
305
+ "gasReservationFailed": "The gas reservation failed",
306
+ "gasStationExecutionFailed": "The gas station execution failed"
304
307
  },
305
308
  "vaultConnectorHelper": {
306
309
  "invalidSignature": "The JSON Web token signature could not be verified"
@@ -619,8 +622,10 @@
619
622
  "labels": {
620
623
  "verificationMethodType": "Verification Method Type",
621
624
  "verificationMethodId": "Verification Method Id",
622
- "privateKey": "Private Key",
623
- "publicKey": "Public Key"
625
+ "privateKeyBase64": "Private Key Base64",
626
+ "publicKeyBase64": "Public Key Base64",
627
+ "privateKeyHex": "Private Key Hex",
628
+ "publicKeyHex": "Public Key Hex"
624
629
  }
625
630
  },
626
631
  "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.50](https://github.com/twinfoundation/identity/compare/identity-cli-v0.0.1-next.49...identity-cli-v0.0.1-next.50) (2025-06-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * use new generateKid method ([f0fe779](https://github.com/twinfoundation/identity/commit/f0fe779323b675575bb9f80aa74f1957dc57a094))
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.49 to 0.0.1-next.50
16
+ * @twin.org/identity-connector-iota bumped from 0.0.1-next.49 to 0.0.1-next.50
17
+
18
+ ## [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)
19
+
20
+
21
+ ### Features
22
+
23
+ * verification method output JWK and hex on CLI ([49db9da](https://github.com/twinfoundation/identity/commit/49db9da2371eafdcd7176ce44303961b9b8b8380))
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.48 to 0.0.1-next.49
31
+ * @twin.org/identity-connector-iota bumped from 0.0.1-next.48 to 0.0.1-next.49
32
+
3
33
  ## [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)
4
34
 
5
35
 
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.48",
3
+ "version": "0.0.1-next.50",
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.48",
25
- "@twin.org/identity-models": "0.0.1-next.48",
24
+ "@twin.org/identity-connector-iota": "0.0.1-next.50",
25
+ "@twin.org/identity-models": "0.0.1-next.50",
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",