@twin.org/identity-cli 0.0.3-next.35 → 0.0.3-next.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/cli.js CHANGED
@@ -37,7 +37,7 @@ export class CLI extends CLIBase {
37
37
  return this.execute({
38
38
  title: "TWIN Identity",
39
39
  appName: "twin-identity",
40
- version: "0.0.3-next.35", // x-release-please-version
40
+ version: "0.0.3-next.36", // x-release-please-version
41
41
  icon: "🌍",
42
42
  supportsEnvFiles: true,
43
43
  overrideOutputWidth: options?.overrideOutputWidth,
@@ -47,6 +47,7 @@ export class CLI extends CLIBase {
47
47
  /**
48
48
  * Get the commands for the CLI.
49
49
  * @param program The main program to add the commands to.
50
+ * @returns The list of commands.
50
51
  * @internal
51
52
  */
52
53
  getCommands(program) {
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EA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,EAAE;YAC7B,iCAAiC,EAAE;YACnC,oCAAoC,EAAE;YACtC,sBAAsB,EAAE;YACxB,yBAAyB,EAAE;YAC3B,0BAA0B,EAAE;YAC5B,6BAA6B,EAAE;YAC/B,sCAAsC,EAAE;YACxC,wCAAwC,EAAE;YAC1C,wCAAwC,EAAE;YAC1C,sCAAsC,EAAE;YACxC,sCAAsC,EAAE;YACxC,wCAAwC,EAAE;YAC1C,uBAAuB,EAAE;YACzB,uBAAuB,EAAE;SACzB,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport { buildCommandAddress, buildCommandMnemonic } from \"@twin.org/crypto-cli\";\nimport { buildCommandFaucet, buildCommandTransfer } from \"@twin.org/wallet-cli\";\nimport type { Command } from \"commander\";\nimport { buildCommandAlsoKnownAsAdd } from \"./commands/alsoKnownAsAdd.js\";\nimport { buildCommandAlsoKnownAsRemove } from \"./commands/alsoKnownAsRemove.js\";\nimport { buildCommandIdentityCreate } from \"./commands/identityCreate.js\";\nimport { buildCommandIdentityResolve } from \"./commands/identityResolve.js\";\nimport { buildCommandProofCreate } from \"./commands/proofCreate.js\";\nimport { buildCommandProofVerify } from \"./commands/proofVerify.js\";\nimport { buildCommandServiceAdd } from \"./commands/serviceAdd.js\";\nimport { buildCommandServiceRemove } from \"./commands/serviceRemove.js\";\nimport { buildCommandVerifiableCredentialCreate } from \"./commands/verifiableCredentialCreate.js\";\nimport { buildCommandVerifiableCredentialRevoke } from \"./commands/verifiableCredentialRevoke.js\";\nimport { buildCommandVerifiableCredentialUnrevoke } from \"./commands/verifiableCredentialUnrevoke.js\";\nimport { buildCommandVerifiableCredentialVerify } from \"./commands/verifiableCredentialVerify.js\";\nimport { buildCommandVerifiablePresentationCreate } from \"./commands/verifiablePresentationCreate.js\";\nimport { buildCommandVerifiablePresentationVerify } from \"./commands/verifiablePresentationVerify.js\";\nimport { buildCommandVerificationMethodAdd } from \"./commands/verificationMethodAdd.js\";\nimport { buildCommandVerificationMethodRemove } from \"./commands/verificationMethodRemove.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options for the CLI.\n\t * @param options.overrideOutputWidth The override output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Identity\",\n\t\t\t\tappName: \"twin-identity\",\n\t\t\t\tversion: \"0.0.3-next.35\", // x-release-please-version\n\t\t\t\ticon: \"🌍\",\n\t\t\t\tsupportsEnvFiles: true,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth,\n\t\t\t\tshowDevToolWarning: true\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Get the commands for the CLI.\n\t * @param program The main program to add the commands to.\n\t * @internal\n\t */\n\tprotected getCommands(program: Command): Command[] {\n\t\treturn [\n\t\t\tbuildCommandMnemonic(),\n\t\t\tbuildCommandAddress(),\n\t\t\tbuildCommandFaucet(),\n\t\t\tbuildCommandTransfer(),\n\t\t\tbuildCommandIdentityCreate(),\n\t\t\tbuildCommandIdentityResolve(),\n\t\t\tbuildCommandVerificationMethodAdd(),\n\t\t\tbuildCommandVerificationMethodRemove(),\n\t\t\tbuildCommandServiceAdd(),\n\t\t\tbuildCommandServiceRemove(),\n\t\t\tbuildCommandAlsoKnownAsAdd(),\n\t\t\tbuildCommandAlsoKnownAsRemove(),\n\t\t\tbuildCommandVerifiableCredentialCreate(),\n\t\t\tbuildCommandVerifiablePresentationCreate(),\n\t\t\tbuildCommandVerifiablePresentationVerify(),\n\t\t\tbuildCommandVerifiableCredentialVerify(),\n\t\t\tbuildCommandVerifiableCredentialRevoke(),\n\t\t\tbuildCommandVerifiableCredentialUnrevoke(),\n\t\t\tbuildCommandProofCreate(),\n\t\t\tbuildCommandProofVerify()\n\t\t];\n\t}\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AACtG,OAAO,EAAE,sCAAsC,EAAE,MAAM,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uBAAuB,EAAE;SACzB,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport { buildCommandAddress, buildCommandMnemonic } from \"@twin.org/crypto-cli\";\nimport { buildCommandFaucet, buildCommandTransfer } from \"@twin.org/wallet-cli\";\nimport type { Command } from \"commander\";\nimport { buildCommandAlsoKnownAsAdd } from \"./commands/alsoKnownAsAdd.js\";\nimport { buildCommandAlsoKnownAsRemove } from \"./commands/alsoKnownAsRemove.js\";\nimport { buildCommandIdentityCreate } from \"./commands/identityCreate.js\";\nimport { buildCommandIdentityResolve } from \"./commands/identityResolve.js\";\nimport { buildCommandProofCreate } from \"./commands/proofCreate.js\";\nimport { buildCommandProofVerify } from \"./commands/proofVerify.js\";\nimport { buildCommandServiceAdd } from \"./commands/serviceAdd.js\";\nimport { buildCommandServiceRemove } from \"./commands/serviceRemove.js\";\nimport { buildCommandVerifiableCredentialCreate } from \"./commands/verifiableCredentialCreate.js\";\nimport { buildCommandVerifiableCredentialRevoke } from \"./commands/verifiableCredentialRevoke.js\";\nimport { buildCommandVerifiableCredentialUnrevoke } from \"./commands/verifiableCredentialUnrevoke.js\";\nimport { buildCommandVerifiableCredentialVerify } from \"./commands/verifiableCredentialVerify.js\";\nimport { buildCommandVerifiablePresentationCreate } from \"./commands/verifiablePresentationCreate.js\";\nimport { buildCommandVerifiablePresentationVerify } from \"./commands/verifiablePresentationVerify.js\";\nimport { buildCommandVerificationMethodAdd } from \"./commands/verificationMethodAdd.js\";\nimport { buildCommandVerificationMethodRemove } from \"./commands/verificationMethodRemove.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options for the CLI.\n\t * @param options.overrideOutputWidth The override output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Identity\",\n\t\t\t\tappName: \"twin-identity\",\n\t\t\t\tversion: \"0.0.3-next.36\", // x-release-please-version\n\t\t\t\ticon: \"🌍\",\n\t\t\t\tsupportsEnvFiles: true,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth,\n\t\t\t\tshowDevToolWarning: true\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Get the commands for the CLI.\n\t * @param program The main program to add the commands to.\n\t * @returns The list of commands.\n\t * @internal\n\t */\n\tprotected getCommands(program: Command): Command[] {\n\t\treturn [\n\t\t\tbuildCommandMnemonic(),\n\t\t\tbuildCommandAddress(),\n\t\t\tbuildCommandFaucet(),\n\t\t\tbuildCommandTransfer(),\n\t\t\tbuildCommandIdentityCreate(),\n\t\t\tbuildCommandIdentityResolve(),\n\t\t\tbuildCommandVerificationMethodAdd(),\n\t\t\tbuildCommandVerificationMethodRemove(),\n\t\t\tbuildCommandServiceAdd(),\n\t\t\tbuildCommandServiceRemove(),\n\t\t\tbuildCommandAlsoKnownAsAdd(),\n\t\t\tbuildCommandAlsoKnownAsRemove(),\n\t\t\tbuildCommandVerifiableCredentialCreate(),\n\t\t\tbuildCommandVerifiablePresentationCreate(),\n\t\t\tbuildCommandVerifiablePresentationVerify(),\n\t\t\tbuildCommandVerifiableCredentialVerify(),\n\t\t\tbuildCommandVerifiableCredentialRevoke(),\n\t\t\tbuildCommandVerifiableCredentialUnrevoke(),\n\t\t\tbuildCommandProofCreate(),\n\t\t\tbuildCommandProofVerify()\n\t\t];\n\t}\n}\n"]}
@@ -11,10 +11,12 @@ import { VaultConnectorFactory } from "@twin.org/vault-models";
11
11
  export function setupVault() {
12
12
  initSchema();
13
13
  EntityStorageConnectorFactory.register("vault-key", () => new MemoryEntityStorageConnector({
14
- entitySchema: "VaultKey"
14
+ entitySchema: "VaultKey",
15
+ config: { storageKey: "vault-key" }
15
16
  }));
16
17
  EntityStorageConnectorFactory.register("vault-secret", () => new MemoryEntityStorageConnector({
17
- entitySchema: "VaultSecret"
18
+ entitySchema: "VaultSecret",
19
+ config: { storageKey: "vault-secret" }
18
20
  }));
19
21
  const vaultConnector = new EntityStorageVaultConnector();
20
22
  VaultConnectorFactory.register("vault", () => vaultConnector);
@@ -1 +1 @@
1
- {"version":3,"file":"setupCommands.js","sourceRoot":"","sources":["../../../src/commands/setupCommands.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACN,2BAA2B,EAG3B,UAAU,EACV,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAI/D;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,UAAU,EAAE,CAAC;IAEb,6BAA6B,CAAC,QAAQ,CACrC,WAAW,EACX,GAAG,EAAE,CACJ,IAAI,4BAA4B,CAAW;QAC1C,YAAY,YAAoB;KAChC,CAAC,CACH,CAAC;IACF,6BAA6B,CAAC,QAAQ,CACrC,cAAc,EACd,GAAG,EAAE,CACJ,IAAI,4BAA4B,CAAc;QAC7C,YAAY,eAAuB;KACnC,CAAC,CACH,CAAC;IAEF,MAAM,cAAc,GAAG,IAAI,2BAA2B,EAAE,CAAC;IACzD,qBAAqB,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CACrC,OAAgG,EAChG,SAAkC;IAElC,OAAO,IAAI,qBAAqB,CAAC;QAChC,MAAM,EAAE;YACP,aAAa,EAAE;gBACd,GAAG,EAAE,OAAO,CAAC,YAAY;aACzB;YACD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,kBAAkB,EAAE,OAAO,CAAC,YAAY;SACxC;KACD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC7C,OAAmD,EACnD,SAA0C;IAE1C,OAAO,IAAI,6BAA6B,CAAC;QACxC,MAAM,EAAE;YACP,aAAa,EAAE;gBACd,GAAG,EAAE,OAAO,CAAC,YAAY;aACzB;YACD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;SAC9B;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { MemoryEntityStorageConnector } from \"@twin.org/entity-storage-connector-memory\";\nimport { EntityStorageConnectorFactory } from \"@twin.org/entity-storage-models\";\nimport {\n\tIotaIdentityConnector,\n\tIotaIdentityResolverConnector\n} from \"@twin.org/identity-connector-iota\";\nimport type { IIdentityConnector, IIdentityResolverConnector } from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tEntityStorageVaultConnector,\n\ttype VaultKey,\n\ttype VaultSecret,\n\tinitSchema\n} from \"@twin.org/vault-connector-entity-storage\";\nimport { VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport type { IdentityConnectorTypes } from \"../models/identityConnectorTypes.js\";\nimport type { IdentityResolverConnectorTypes } from \"../models/identityResolverConnectorTypes.js\";\n\n/**\n * Setup the vault for use in the CLI commands.\n */\nexport function setupVault(): void {\n\tinitSchema();\n\n\tEntityStorageConnectorFactory.register(\n\t\t\"vault-key\",\n\t\t() =>\n\t\t\tnew MemoryEntityStorageConnector<VaultKey>({\n\t\t\t\tentitySchema: nameof<VaultKey>()\n\t\t\t})\n\t);\n\tEntityStorageConnectorFactory.register(\n\t\t\"vault-secret\",\n\t\t() =>\n\t\t\tnew MemoryEntityStorageConnector<VaultSecret>({\n\t\t\t\tentitySchema: nameof<VaultSecret>()\n\t\t\t})\n\t);\n\n\tconst vaultConnector = new EntityStorageVaultConnector();\n\tVaultConnectorFactory.register(\"vault\", () => vaultConnector);\n}\n\n/**\n * Setup the identity connector for use in the CLI commands.\n * @param options The options for the identity connector.\n * @param options.nodeEndpoint The node endpoint.\n * @param options.network The network.\n * @param options.addressIndex The wallet index.\n * @param options.vaultSeedId The vault seed ID.\n * @param connector The connector to use.\n * @returns The identity connector.\n */\nexport function setupIdentityConnector(\n\toptions: { nodeEndpoint: string; network?: string; addressIndex?: number; vaultSeedId?: string },\n\tconnector?: IdentityConnectorTypes\n): IIdentityConnector {\n\treturn new IotaIdentityConnector({\n\t\tconfig: {\n\t\t\tclientOptions: {\n\t\t\t\turl: options.nodeEndpoint\n\t\t\t},\n\t\t\tnetwork: options.network ?? \"\",\n\t\t\tvaultSeedId: options.vaultSeedId,\n\t\t\twalletAddressIndex: options.addressIndex\n\t\t}\n\t});\n}\n\n/**\n * Setup the identity resolver connector for use in the CLI commands.\n * @param options The options for the identity connector.\n * @param options.nodeEndpoint The node endpoint.\n * @param options.network The network.\n * @param connector The connector to use.\n * @returns The identity connector.\n */\nexport function setupIdentityResolverConnector(\n\toptions: { nodeEndpoint: string; network?: string },\n\tconnector?: IdentityResolverConnectorTypes\n): IIdentityResolverConnector {\n\treturn new IotaIdentityResolverConnector({\n\t\tconfig: {\n\t\t\tclientOptions: {\n\t\t\t\turl: options.nodeEndpoint\n\t\t\t},\n\t\t\tnetwork: options.network ?? \"\"\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"setupCommands.js","sourceRoot":"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AC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC7C,OAAmD,EACnD,SAA0C;IAE1C,OAAO,IAAI,6BAA6B,CAAC;QACxC,MAAM,EAAE;YACP,aAAa,EAAE;gBACd,GAAG,EAAE,OAAO,CAAC,YAAY;aACzB;YACD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;SAC9B;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { MemoryEntityStorageConnector } from \"@twin.org/entity-storage-connector-memory\";\nimport { EntityStorageConnectorFactory } from \"@twin.org/entity-storage-models\";\nimport {\n\tIotaIdentityConnector,\n\tIotaIdentityResolverConnector\n} from \"@twin.org/identity-connector-iota\";\nimport type { IIdentityConnector, IIdentityResolverConnector } from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tEntityStorageVaultConnector,\n\ttype VaultKey,\n\ttype VaultSecret,\n\tinitSchema\n} from \"@twin.org/vault-connector-entity-storage\";\nimport { VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport type { IdentityConnectorTypes } from \"../models/identityConnectorTypes.js\";\nimport type { IdentityResolverConnectorTypes } from \"../models/identityResolverConnectorTypes.js\";\n\n/**\n * Setup the vault for use in the CLI commands.\n */\nexport function setupVault(): void {\n\tinitSchema();\n\n\tEntityStorageConnectorFactory.register(\n\t\t\"vault-key\",\n\t\t() =>\n\t\t\tnew MemoryEntityStorageConnector<VaultKey>({\n\t\t\t\tentitySchema: nameof<VaultKey>(),\n\t\t\t\tconfig: { storageKey: \"vault-key\" }\n\t\t\t})\n\t);\n\tEntityStorageConnectorFactory.register(\n\t\t\"vault-secret\",\n\t\t() =>\n\t\t\tnew MemoryEntityStorageConnector<VaultSecret>({\n\t\t\t\tentitySchema: nameof<VaultSecret>(),\n\t\t\t\tconfig: { storageKey: \"vault-secret\" }\n\t\t\t})\n\t);\n\n\tconst vaultConnector = new EntityStorageVaultConnector();\n\tVaultConnectorFactory.register(\"vault\", () => vaultConnector);\n}\n\n/**\n * Setup the identity connector for use in the CLI commands.\n * @param options The options for the identity connector.\n * @param options.nodeEndpoint The node endpoint.\n * @param options.network The network.\n * @param options.addressIndex The wallet index.\n * @param options.vaultSeedId The vault seed ID.\n * @param connector The connector to use.\n * @returns The identity connector.\n */\nexport function setupIdentityConnector(\n\toptions: { nodeEndpoint: string; network?: string; addressIndex?: number; vaultSeedId?: string },\n\tconnector?: IdentityConnectorTypes\n): IIdentityConnector {\n\treturn new IotaIdentityConnector({\n\t\tconfig: {\n\t\t\tclientOptions: {\n\t\t\t\turl: options.nodeEndpoint\n\t\t\t},\n\t\t\tnetwork: options.network ?? \"\",\n\t\t\tvaultSeedId: options.vaultSeedId,\n\t\t\twalletAddressIndex: options.addressIndex\n\t\t}\n\t});\n}\n\n/**\n * Setup the identity resolver connector for use in the CLI commands.\n * @param options The options for the identity connector.\n * @param options.nodeEndpoint The node endpoint.\n * @param options.network The network.\n * @param connector The connector to use.\n * @returns The identity connector.\n */\nexport function setupIdentityResolverConnector(\n\toptions: { nodeEndpoint: string; network?: string },\n\tconnector?: IdentityResolverConnectorTypes\n): IIdentityResolverConnector {\n\treturn new IotaIdentityResolverConnector({\n\t\tconfig: {\n\t\t\tclientOptions: {\n\t\t\t\turl: options.nodeEndpoint\n\t\t\t},\n\t\t\tnetwork: options.network ?? \"\"\n\t\t}\n\t});\n}\n"]}
@@ -95,19 +95,19 @@ export async function actionCommandVerificationMethodAdd(opts) {
95
95
  CLIDisplay.spinnerStop();
96
96
  const keyParts = DocumentHelper.parseId(verificationMethod.id);
97
97
  const keyPair = await vaultConnector.getKey(`${vmParts.id}/${keyParts.fragment}`);
98
- const privateKeyBase64Url = Converter.bytesToBase64Url(keyPair.privateKey);
98
+ const privateKeyBase64Url = Converter.bytesToBase64Url(keyPair?.privateKey ?? new Uint8Array());
99
99
  const publicKeyBase64Url = Is.uint8Array(keyPair.publicKey)
100
100
  ? Converter.bytesToBase64Url(keyPair.publicKey)
101
101
  : "";
102
- const privateKeyBase64 = Converter.bytesToBase64(keyPair.privateKey);
102
+ const privateKeyBase64 = Converter.bytesToBase64(keyPair?.privateKey ?? new Uint8Array());
103
103
  const publicKeyBase64 = Is.uint8Array(keyPair.publicKey)
104
104
  ? Converter.bytesToBase64(keyPair.publicKey)
105
105
  : "";
106
- const privateKeyHex = Converter.bytesToHex(keyPair.privateKey, true);
106
+ const privateKeyHex = Converter.bytesToHex(keyPair?.privateKey ?? new Uint8Array(), true);
107
107
  const publicKeyHex = Is.uint8Array(keyPair.publicKey)
108
108
  ? Converter.bytesToHex(keyPair.publicKey, true)
109
109
  : "";
110
- const jwk = await Jwk.fromEd25519Private(keyPair.privateKey);
110
+ const jwk = await Jwk.fromEd25519Private(keyPair?.privateKey ?? new Uint8Array());
111
111
  const kid = await Jwk.generateKid(jwk);
112
112
  if (opts.console) {
113
113
  CLIDisplay.value(I18n.formatMessage("commands.verification-method-add.labels.verificationMethodId"), verificationMethod.id);
@@ -1 +1 @@
1
- {"version":3,"file":"verificationMethodAdd.js","sourceRoot":"","sources":["../../../src/commands/verificationMethodAdd.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EAER,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,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,CAAC,GAAG;YAC1C,kCAAkC,GAAG,CAAC,CAAC,GAAG;YAC1C,4CAA4C,aAAa,GAAG;YAC5D,2CAA2C,YAAY,GAAG;YAC1D,+CAA+C,gBAAgB,GAAG;YAClE,8CAA8C,eAAe,GAAG;SAChE,EACD,IAAI,CAAC,QAAQ,CACb,CAAC;IACH,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,KAAK,sBAAsB,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/C,UAAU,CAAC,KAAK,CACf,IAAI,CAAC,aAAa,CAAC,gCAAgC,CAAC,EACpD,GAAG,YAAY,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,WAAW,QAAQ,YAAY,OAAO,EAAE,CAC7F,CAAC;IACH,CAAC;IAED,UAAU,CAAC,KAAK,EAAE,CAAC;IAEnB,UAAU,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tCLIDisplay,\n\tCLIOptions,\n\tCLIParam,\n\tCLIUtils,\n\ttype CliOutputOptions\n} from \"@twin.org/cli-core\";\nimport { Converter, I18n, Is, StringHelper, Urn } from \"@twin.org/core\";\nimport { DocumentHelper } from \"@twin.org/identity-models\";\nimport { DidVerificationMethodType } from \"@twin.org/standards-w3c-did\";\nimport { VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport { setupWalletConnector } from \"@twin.org/wallet-cli\";\nimport { WalletConnectorFactory } from \"@twin.org/wallet-models\";\nimport { Jwk } from \"@twin.org/web\";\nimport { Command, Option } from \"commander\";\nimport { setupIdentityConnector, setupVault } from \"./setupCommands.js\";\nimport { IdentityConnectorTypes } from \"../models/identityConnectorTypes.js\";\n\n/**\n * Build the verification method add command for the CLI.\n * @returns The command.\n */\nexport function buildCommandVerificationMethodAdd(): Command {\n\tconst command = new Command();\n\tcommand\n\t\t.name(\"verification-method-add\")\n\t\t.summary(I18n.formatMessage(\"commands.verification-method-add.summary\"))\n\t\t.description(I18n.formatMessage(\"commands.verification-method-add.description\"))\n\t\t.requiredOption(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.seed.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.seed.description\")\n\t\t)\n\t\t.requiredOption(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.did.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.did.description\")\n\t\t)\n\t\t.addOption(\n\t\t\tnew Option(\n\t\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.type.param\"),\n\t\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.type.description\")\n\t\t\t)\n\t\t\t\t.choices(Object.values(DidVerificationMethodType))\n\t\t\t\t.makeOptionMandatory()\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.id.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.id.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.addressIndex.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.addressIndex.description\"),\n\t\t\t\"0\"\n\t\t);\n\tCLIOptions.output(command, {\n\t\tnoConsole: true,\n\t\tjson: true,\n\t\tenv: true,\n\t\tmergeJson: true,\n\t\tmergeEnv: true\n\t});\n\n\tcommand\n\t\t.addOption(\n\t\t\tnew Option(\n\t\t\t\tI18n.formatMessage(\"commands.common.options.connector.param\"),\n\t\t\t\tI18n.formatMessage(\"commands.common.options.connector.description\")\n\t\t\t)\n\t\t\t\t.choices(Object.values(IdentityConnectorTypes))\n\t\t\t\t.default(IdentityConnectorTypes.Iota)\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.node.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.node.description\"),\n\t\t\t\"!NODE_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.network.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.network.description\"),\n\t\t\t\"!NETWORK\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.explorer.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.explorer.description\"),\n\t\t\t\"!EXPLORER_URL\"\n\t\t)\n\t\t.action(actionCommandVerificationMethodAdd);\n\n\treturn command;\n}\n\n/**\n * Action the verification method add command.\n * @param opts The options for the command.\n * @param opts.seed The private key for the controller.\n * @param opts.did The identity of the document to add to.\n * @param opts.type The type of the verification method to add.\n * @param opts.id The id of the verification method to add.\n * @param opts.connector The connector to perform the operations with.\n * @param opts.node The node URL.\n * @param opts.explorer The explorer URL.\n * @param opts.network The network to use for connector.\n * @param opts.addressIndex The address index to use for key derivation (if applicable).\n */\nexport async function actionCommandVerificationMethodAdd(\n\topts: {\n\t\tseed: string;\n\t\tdid: string;\n\t\ttype: DidVerificationMethodType;\n\t\tid?: string;\n\t\taddressIndex?: string;\n\t\tconnector?: IdentityConnectorTypes;\n\t\tnode: string;\n\t\tnetwork?: string;\n\t\texplorer: string;\n\t} & CliOutputOptions\n): Promise<void> {\n\tconst seed: Uint8Array = CLIParam.hexBase64(\"seed\", opts.seed);\n\tconst did: string = CLIParam.stringValue(\"did\", opts.did);\n\tconst type: DidVerificationMethodType = CLIParam.stringValue(\n\t\t\"type\",\n\t\topts.type\n\t) as DidVerificationMethodType;\n\tconst addressIndex: number = CLIParam.integer(\"addressIndex\", opts.addressIndex ?? \"0\", false, 0);\n\tconst nodeEndpoint: string = CLIParam.url(\"node\", opts.node);\n\tconst network: string | undefined =\n\t\topts.connector === IdentityConnectorTypes.Iota\n\t\t\t? CLIParam.stringValue(\"network\", opts.network)\n\t\t\t: undefined;\n\tconst explorerEndpoint: string = CLIParam.url(\"explorer\", opts.explorer);\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.did\"), did);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodType\"),\n\t\ttype\n\t);\n\tif (Is.stringValue(opts.id)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodId\"),\n\t\t\topts?.id\n\t\t);\n\t}\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.verification-method-add.labels.addressIndex\"),\n\t\taddressIndex\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.node\"), nodeEndpoint);\n\tif (Is.stringValue(network)) {\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.network\"), network);\n\t}\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.explorer\"), explorerEndpoint);\n\tCLIDisplay.break();\n\n\tsetupVault();\n\n\tconst vaultSeedId = \"local-seed\";\n\n\tconst vmParts = DocumentHelper.parseId(did);\n\n\tconst vaultConnector = VaultConnectorFactory.get(\"vault\");\n\tawait vaultConnector.setSecret(`${vmParts.id}/${vaultSeedId}`, Converter.bytesToBase64(seed));\n\n\tconst walletConnector = setupWalletConnector(\n\t\t{ nodeEndpoint, vaultSeedId, network },\n\t\topts.connector\n\t);\n\tWalletConnectorFactory.register(\"wallet\", () => walletConnector);\n\n\tconst identityConnector = setupIdentityConnector(\n\t\t{ nodeEndpoint, network, addressIndex, vaultSeedId },\n\t\topts.connector\n\t);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.verification-method-add.progress.addingVerificationMethod\")\n\t);\n\tCLIDisplay.break();\n\n\tCLIDisplay.spinnerStart();\n\n\tconst verificationMethod = await identityConnector.addVerificationMethod(\n\t\tvmParts.id,\n\t\tdid,\n\t\ttype,\n\t\topts?.id\n\t);\n\n\tCLIDisplay.spinnerStop();\n\n\tconst keyParts = DocumentHelper.parseId(verificationMethod.id);\n\n\tconst keyPair = await vaultConnector.getKey(`${vmParts.id}/${keyParts.fragment}`);\n\tconst privateKeyBase64Url = Converter.bytesToBase64Url(keyPair.privateKey);\n\tconst publicKeyBase64Url = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToBase64Url(keyPair.publicKey)\n\t\t: \"\";\n\n\tconst privateKeyBase64 = Converter.bytesToBase64(keyPair.privateKey);\n\tconst publicKeyBase64 = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToBase64(keyPair.publicKey)\n\t\t: \"\";\n\n\tconst privateKeyHex = Converter.bytesToHex(keyPair.privateKey, true);\n\tconst publicKeyHex = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToHex(keyPair.publicKey, true)\n\t\t: \"\";\n\n\tconst jwk = await Jwk.fromEd25519Private(keyPair.privateKey);\n\tconst kid = await Jwk.generateKid(jwk);\n\n\tif (opts.console) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodId\"),\n\t\t\tverificationMethod.id\n\t\t);\n\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.verification-method-add.labels.kid\"), kid);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyBase64Url\"),\n\t\t\tprivateKeyBase64Url\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyBase64Url\"),\n\t\t\tpublicKeyBase64Url\n\t\t);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyBase64\"),\n\t\t\tprivateKeyBase64\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyBase64\"),\n\t\t\tpublicKeyBase64\n\t\t);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyHex\"),\n\t\t\tprivateKeyHex\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyHex\"),\n\t\t\tpublicKeyHex\n\t\t);\n\n\t\tCLIDisplay.break();\n\t}\n\n\tif (Is.stringValue(opts?.json)) {\n\t\tawait CLIUtils.writeJsonFile(\n\t\t\topts.json,\n\t\t\t{\n\t\t\t\tverificationMethodId: verificationMethod.id,\n\t\t\t\tprivateKeyJwk: {\n\t\t\t\t\tkid,\n\t\t\t\t\t...jwk\n\t\t\t\t},\n\t\t\t\tprivateKeyHex,\n\t\t\t\tpublicKeyHex,\n\t\t\t\tprivateKeyBase64,\n\t\t\t\tpublicKeyBase64\n\t\t\t},\n\t\t\topts.mergeJson\n\t\t);\n\t}\n\tif (Is.stringValue(opts?.env)) {\n\t\tawait CLIUtils.writeEnvFile(\n\t\t\topts.env,\n\t\t\t[\n\t\t\t\t`DID_VERIFICATION_METHOD_ID=\"${verificationMethod.id}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_KID=\"${kid}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_KTY=\"${jwk.kty}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_USE=\"${jwk.use}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_ALG=\"${jwk.alg}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_CRV=\"${jwk.crv}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_X=\"${jwk.x}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_D=\"${jwk.d}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PRIVATE_KEY_HEX=\"${privateKeyHex}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PUBLIC_KEY_HEX=\"${publicKeyHex}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PRIVATE_KEY_BASE64=\"${privateKeyBase64}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PUBLIC_KEY_BASE64=\"${publicKeyBase64}\"`\n\t\t\t],\n\t\t\topts.mergeEnv\n\t\t);\n\t}\n\n\tif (opts.connector === IdentityConnectorTypes.Iota) {\n\t\tconst didUrn = Urn.fromValidString(did);\n\t\tconst didParts = didUrn.parts();\n\t\tconst objectId = didParts[didParts.length - 1];\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.common.labels.explore\"),\n\t\t\t`${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`\n\t\t);\n\t}\n\n\tCLIDisplay.break();\n\n\tCLIDisplay.done();\n}\n"]}
1
+ {"version":3,"file":"verificationMethodAdd.js","sourceRoot":"","sources":["../../../src/commands/verificationMethodAdd.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EAER,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCA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AG;YAClE,8CAA8C,eAAe,GAAG;SAChE,EACD,IAAI,CAAC,QAAQ,CACb,CAAC;IACH,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,KAAK,sBAAsB,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/C,UAAU,CAAC,KAAK,CACf,IAAI,CAAC,aAAa,CAAC,gCAAgC,CAAC,EACpD,GAAG,YAAY,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,WAAW,QAAQ,YAAY,OAAO,EAAE,CAC7F,CAAC;IACH,CAAC;IAED,UAAU,CAAC,KAAK,EAAE,CAAC;IAEnB,UAAU,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tCLIDisplay,\n\tCLIOptions,\n\tCLIParam,\n\tCLIUtils,\n\ttype CliOutputOptions\n} from \"@twin.org/cli-core\";\nimport { Converter, I18n, Is, StringHelper, Urn } from \"@twin.org/core\";\nimport { DocumentHelper } from \"@twin.org/identity-models\";\nimport { DidVerificationMethodType } from \"@twin.org/standards-w3c-did\";\nimport { VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport { setupWalletConnector } from \"@twin.org/wallet-cli\";\nimport { WalletConnectorFactory } from \"@twin.org/wallet-models\";\nimport { Jwk } from \"@twin.org/web\";\nimport { Command, Option } from \"commander\";\nimport { setupIdentityConnector, setupVault } from \"./setupCommands.js\";\nimport { IdentityConnectorTypes } from \"../models/identityConnectorTypes.js\";\n\n/**\n * Build the verification method add command for the CLI.\n * @returns The command.\n */\nexport function buildCommandVerificationMethodAdd(): Command {\n\tconst command = new Command();\n\tcommand\n\t\t.name(\"verification-method-add\")\n\t\t.summary(I18n.formatMessage(\"commands.verification-method-add.summary\"))\n\t\t.description(I18n.formatMessage(\"commands.verification-method-add.description\"))\n\t\t.requiredOption(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.seed.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.seed.description\")\n\t\t)\n\t\t.requiredOption(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.did.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.did.description\")\n\t\t)\n\t\t.addOption(\n\t\t\tnew Option(\n\t\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.type.param\"),\n\t\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.type.description\")\n\t\t\t)\n\t\t\t\t.choices(Object.values(DidVerificationMethodType))\n\t\t\t\t.makeOptionMandatory()\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.id.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.id.description\")\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.addressIndex.param\"),\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.options.addressIndex.description\"),\n\t\t\t\"0\"\n\t\t);\n\tCLIOptions.output(command, {\n\t\tnoConsole: true,\n\t\tjson: true,\n\t\tenv: true,\n\t\tmergeJson: true,\n\t\tmergeEnv: true\n\t});\n\n\tcommand\n\t\t.addOption(\n\t\t\tnew Option(\n\t\t\t\tI18n.formatMessage(\"commands.common.options.connector.param\"),\n\t\t\t\tI18n.formatMessage(\"commands.common.options.connector.description\")\n\t\t\t)\n\t\t\t\t.choices(Object.values(IdentityConnectorTypes))\n\t\t\t\t.default(IdentityConnectorTypes.Iota)\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.node.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.node.description\"),\n\t\t\t\"!NODE_URL\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.network.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.network.description\"),\n\t\t\t\"!NETWORK\"\n\t\t)\n\t\t.option(\n\t\t\tI18n.formatMessage(\"commands.common.options.explorer.param\"),\n\t\t\tI18n.formatMessage(\"commands.common.options.explorer.description\"),\n\t\t\t\"!EXPLORER_URL\"\n\t\t)\n\t\t.action(actionCommandVerificationMethodAdd);\n\n\treturn command;\n}\n\n/**\n * Action the verification method add command.\n * @param opts The options for the command.\n * @param opts.seed The private key for the controller.\n * @param opts.did The identity of the document to add to.\n * @param opts.type The type of the verification method to add.\n * @param opts.id The id of the verification method to add.\n * @param opts.connector The connector to perform the operations with.\n * @param opts.node The node URL.\n * @param opts.explorer The explorer URL.\n * @param opts.network The network to use for connector.\n * @param opts.addressIndex The address index to use for key derivation (if applicable).\n */\nexport async function actionCommandVerificationMethodAdd(\n\topts: {\n\t\tseed: string;\n\t\tdid: string;\n\t\ttype: DidVerificationMethodType;\n\t\tid?: string;\n\t\taddressIndex?: string;\n\t\tconnector?: IdentityConnectorTypes;\n\t\tnode: string;\n\t\tnetwork?: string;\n\t\texplorer: string;\n\t} & CliOutputOptions\n): Promise<void> {\n\tconst seed: Uint8Array = CLIParam.hexBase64(\"seed\", opts.seed);\n\tconst did: string = CLIParam.stringValue(\"did\", opts.did);\n\tconst type: DidVerificationMethodType = CLIParam.stringValue(\n\t\t\"type\",\n\t\topts.type\n\t) as DidVerificationMethodType;\n\tconst addressIndex: number = CLIParam.integer(\"addressIndex\", opts.addressIndex ?? \"0\", false, 0);\n\tconst nodeEndpoint: string = CLIParam.url(\"node\", opts.node);\n\tconst network: string | undefined =\n\t\topts.connector === IdentityConnectorTypes.Iota\n\t\t\t? CLIParam.stringValue(\"network\", opts.network)\n\t\t\t: undefined;\n\tconst explorerEndpoint: string = CLIParam.url(\"explorer\", opts.explorer);\n\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.did\"), did);\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodType\"),\n\t\ttype\n\t);\n\tif (Is.stringValue(opts.id)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodId\"),\n\t\t\topts?.id\n\t\t);\n\t}\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"commands.verification-method-add.labels.addressIndex\"),\n\t\taddressIndex\n\t);\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.node\"), nodeEndpoint);\n\tif (Is.stringValue(network)) {\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.network\"), network);\n\t}\n\tCLIDisplay.value(I18n.formatMessage(\"commands.common.labels.explorer\"), explorerEndpoint);\n\tCLIDisplay.break();\n\n\tsetupVault();\n\n\tconst vaultSeedId = \"local-seed\";\n\n\tconst vmParts = DocumentHelper.parseId(did);\n\n\tconst vaultConnector = VaultConnectorFactory.get(\"vault\");\n\tawait vaultConnector.setSecret(`${vmParts.id}/${vaultSeedId}`, Converter.bytesToBase64(seed));\n\n\tconst walletConnector = setupWalletConnector(\n\t\t{ nodeEndpoint, vaultSeedId, network },\n\t\topts.connector\n\t);\n\tWalletConnectorFactory.register(\"wallet\", () => walletConnector);\n\n\tconst identityConnector = setupIdentityConnector(\n\t\t{ nodeEndpoint, network, addressIndex, vaultSeedId },\n\t\topts.connector\n\t);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"commands.verification-method-add.progress.addingVerificationMethod\")\n\t);\n\tCLIDisplay.break();\n\n\tCLIDisplay.spinnerStart();\n\n\tconst verificationMethod = await identityConnector.addVerificationMethod(\n\t\tvmParts.id,\n\t\tdid,\n\t\ttype,\n\t\topts?.id\n\t);\n\n\tCLIDisplay.spinnerStop();\n\n\tconst keyParts = DocumentHelper.parseId(verificationMethod.id);\n\n\tconst keyPair = await vaultConnector.getKey(`${vmParts.id}/${keyParts.fragment}`);\n\tconst privateKeyBase64Url = Converter.bytesToBase64Url(keyPair?.privateKey ?? new Uint8Array());\n\tconst publicKeyBase64Url = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToBase64Url(keyPair.publicKey)\n\t\t: \"\";\n\n\tconst privateKeyBase64 = Converter.bytesToBase64(keyPair?.privateKey ?? new Uint8Array());\n\tconst publicKeyBase64 = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToBase64(keyPair.publicKey)\n\t\t: \"\";\n\n\tconst privateKeyHex = Converter.bytesToHex(keyPair?.privateKey ?? new Uint8Array(), true);\n\tconst publicKeyHex = Is.uint8Array(keyPair.publicKey)\n\t\t? Converter.bytesToHex(keyPair.publicKey, true)\n\t\t: \"\";\n\n\tconst jwk = await Jwk.fromEd25519Private(keyPair?.privateKey ?? new Uint8Array());\n\tconst kid = await Jwk.generateKid(jwk);\n\n\tif (opts.console) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.verificationMethodId\"),\n\t\t\tverificationMethod.id\n\t\t);\n\n\t\tCLIDisplay.value(I18n.formatMessage(\"commands.verification-method-add.labels.kid\"), kid);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyBase64Url\"),\n\t\t\tprivateKeyBase64Url\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyBase64Url\"),\n\t\t\tpublicKeyBase64Url\n\t\t);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyBase64\"),\n\t\t\tprivateKeyBase64\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyBase64\"),\n\t\t\tpublicKeyBase64\n\t\t);\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.privateKeyHex\"),\n\t\t\tprivateKeyHex\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.verification-method-add.labels.publicKeyHex\"),\n\t\t\tpublicKeyHex\n\t\t);\n\n\t\tCLIDisplay.break();\n\t}\n\n\tif (Is.stringValue(opts?.json)) {\n\t\tawait CLIUtils.writeJsonFile(\n\t\t\topts.json,\n\t\t\t{\n\t\t\t\tverificationMethodId: verificationMethod.id,\n\t\t\t\tprivateKeyJwk: {\n\t\t\t\t\tkid,\n\t\t\t\t\t...jwk\n\t\t\t\t},\n\t\t\t\tprivateKeyHex,\n\t\t\t\tpublicKeyHex,\n\t\t\t\tprivateKeyBase64,\n\t\t\t\tpublicKeyBase64\n\t\t\t},\n\t\t\topts.mergeJson\n\t\t);\n\t}\n\tif (Is.stringValue(opts?.env)) {\n\t\tawait CLIUtils.writeEnvFile(\n\t\t\topts.env,\n\t\t\t[\n\t\t\t\t`DID_VERIFICATION_METHOD_ID=\"${verificationMethod.id}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_KID=\"${kid}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_KTY=\"${jwk.kty}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_USE=\"${jwk.use}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_ALG=\"${jwk.alg}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_CRV=\"${jwk.crv}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_X=\"${jwk.x}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_JWK_D=\"${jwk.d}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PRIVATE_KEY_HEX=\"${privateKeyHex}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PUBLIC_KEY_HEX=\"${publicKeyHex}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PRIVATE_KEY_BASE64=\"${privateKeyBase64}\"`,\n\t\t\t\t`DID_VERIFICATION_METHOD_PUBLIC_KEY_BASE64=\"${publicKeyBase64}\"`\n\t\t\t],\n\t\t\topts.mergeEnv\n\t\t);\n\t}\n\n\tif (opts.connector === IdentityConnectorTypes.Iota) {\n\t\tconst didUrn = Urn.fromValidString(did);\n\t\tconst didParts = didUrn.parts();\n\t\tconst objectId = didParts[didParts.length - 1];\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"commands.common.labels.explore\"),\n\t\t\t`${StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`\n\t\t);\n\t}\n\n\tCLIDisplay.break();\n\n\tCLIDisplay.done();\n}\n"]}
@@ -126,6 +126,11 @@
126
126
  "lockTimeout": "Failed to acquire lock for key \"{key}\" within the timeout of {timeout} milliseconds",
127
127
  "bufferFetchFailed": "Failed to retrieve shared buffer for key \"{key}\" from the main thread"
128
128
  },
129
+ "sharedObjectBuffer": {
130
+ "notCreated": "The shared buffer for object \"{objectId}\" has not been created",
131
+ "capacityExceeded": "The payload size of {required} bytes exceeds the maximum capacity of {capacity} bytes for object \"{objectId}\"",
132
+ "bufferFetchFailed": "Failed to retrieve shared buffer for object \"{objectId}\" from the main thread"
133
+ },
129
134
  "ed25519": {
130
135
  "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
131
136
  "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
@@ -214,7 +219,8 @@
214
219
  "invalidEntityProperties": "The schema has no properties defined, but the entity has properties",
215
220
  "invalidEntityProperty": "The entity value of \"{value}\" does not match the type \"{type}\" for property \"{property}\"",
216
221
  "invalidOptional": "The entity property \"{property}\" of type \"{type}\" is not optional, but no value has been provided",
217
- "invalidEntityKeys": "The entity had additional properties that are not in the schema, \"{keys}\""
222
+ "invalidEntityKeys": "The entity had additional properties that are not in the schema, \"{keys}\"",
223
+ "versionMustBeGreaterThanOrEqualZero": "Property \"entitySchema.version\" must be an integer >= 0, but got {version}"
218
224
  },
219
225
  "fetchHelper": {
220
226
  "decodingJSON": "Decoding JSON failed for route \"{url}\"",
@@ -249,8 +255,12 @@
249
255
  "contextIdStore": {
250
256
  "asyncHooksNotAvailable": "Async Hooks are not available in this environment, please ensure you are running in Node.js"
251
257
  },
258
+ "entityStorageHelper": {
259
+ "sortNotIndexed": "The property \"{property}\" is not indexed and cannot be used for sorting",
260
+ "propertyNotInSchema": "The property \"{property}\" does not exist in the schema and cannot be used for projection"
261
+ },
252
262
  "migrationHelper": {
253
- "migrationFailed": "Migration failed.",
263
+ "migrateSchemaFailed": "Migration failed for schema \"{schemaName}\".",
254
264
  "transformRequiredForProperty": "A transformation function is required to migrate property \"{from}\" to \"{to}\" of type \"{type}\"",
255
265
  "coercionProducedUndefined": "Coercion of property \"{property}\" to type \"{type}\" produced undefined but the property is not optional"
256
266
  },
@@ -310,7 +320,6 @@
310
320
  "missingDid": "The full id including DID is required",
311
321
  "privateKeyMissing": "The verification method contains no privateKey \"{keyId}\"",
312
322
  "publicKeyJwkMethodMissing": "The verification method contains no publicKeyJwk in method \"{method}\"",
313
- "publicKeyJwkMissing": "The verification method contains no publicKeyJwk in JWK \"{jwk}\"",
314
323
  "removeAlsoKnownAsFailed": "Removing from the alsoKnownAs property failed",
315
324
  "removeDocumentFailed": "Removing the document failed",
316
325
  "removeServiceFailed": "Removing the service failed",
@@ -335,7 +344,11 @@
335
344
  "gasStationTransactionFailed": "The gas station transaction failed",
336
345
  "dryRunFailed": "The dry run execution failed",
337
346
  "fundingFailed": "Fund the address from faucet failed",
338
- "faucetRateLimit": "Faucet rate limit exceeded"
347
+ "faucetRateLimit": "Faucet rate limit exceeded",
348
+ "missingPublicKey": "The public key is missing for vault key \"{keyName}\""
349
+ },
350
+ "vaultJwkStorage": {
351
+ "generateNotSupported": "Key generation is not supported; keys are managed by the vault"
339
352
  },
340
353
  "iotaIdentityUtils": {
341
354
  "getControllerCapInfoFailed": "Getting the controller capability info for the identity failed",
@@ -368,6 +381,7 @@
368
381
  "keyNotFound": "The key \"{notFoundId}\" was not found in the vault",
369
382
  "secretNotFound": "The secret \"{notFoundId}\" was not found in the vault",
370
383
  "unsupportedKeyType": "The key type \"{keyType}\" is not supported",
384
+ "symmetricKeyHasNoPrivateKey": "The symmetric key \"{name}\" does not have a separate private key component",
371
385
  "keyTypeMismatch": "The key type \"{keyType}\" does not match the requested encryption method \"{encryptionType}\""
372
386
  },
373
387
  "iotaWalletConnector": {
@@ -1065,6 +1079,11 @@
1065
1079
  "storeTearingDown": "Tearing down entity storage",
1066
1080
  "storeTornDown": "Entity storage torn down"
1067
1081
  },
1082
+ "migrationHelper": {
1083
+ "migrateSchemaStarting": "Migrating schema \"{schemaName}\"",
1084
+ "migrateSchemaFinalizing": "Finalizing migration of schema \"{schemaName}\"",
1085
+ "migrateSchemaComplete": "Migration of schema \"{schemaName}\" complete"
1086
+ },
1068
1087
  "iota": {
1069
1088
  "transactionCosts": "Transaction costs for operation \"{operation}\", \"{cost}\""
1070
1089
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.36](https://github.com/iotaledger/twin-identity/compare/identity-cli-v0.0.3-next.35...identity-cli-v0.0.3-next.36) (2026-06-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * add vault signing ([#153](https://github.com/iotaledger/twin-identity/issues/153)) ([9458e4c](https://github.com/iotaledger/twin-identity/commit/9458e4c96ce19e0fc704905dfb3aac04dc6cf237))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use async getStore in tests ([47d361a](https://github.com/iotaledger/twin-identity/commit/47d361ae333fe39885df96b40abcb6cd22c3f67d))
14
+ * use async getStore in tests ([cfc0d87](https://github.com/iotaledger/twin-identity/commit/cfc0d873532e8ab2010f86f05bffaad3bbaf5786))
15
+ * use async getStore in tests ([3424c81](https://github.com/iotaledger/twin-identity/commit/3424c81cf7407ede4a89a026072720d52bf689b2))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * The following workspace dependencies were updated
21
+ * dependencies
22
+ * @twin.org/identity-models bumped from 0.0.3-next.35 to 0.0.3-next.36
23
+ * @twin.org/identity-connector-iota bumped from 0.0.3-next.35 to 0.0.3-next.36
24
+
3
25
  ## [0.0.3-next.35](https://github.com/iotaledger/twin-identity/compare/identity-cli-v0.0.3-next.34...identity-cli-v0.0.3-next.35) (2026-06-01)
4
26
 
5
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-cli",
3
- "version": "0.0.3-next.35",
3
+ "version": "0.0.3-next.36",
4
4
  "description": "Command line tool for running identity workflows in local development and automation pipelines.",
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.3-next.35",
25
- "@twin.org/identity-models": "0.0.3-next.35",
24
+ "@twin.org/identity-connector-iota": "0.0.3-next.36",
25
+ "@twin.org/identity-models": "0.0.3-next.36",
26
26
  "@twin.org/nameof": "next",
27
27
  "@twin.org/standards-w3c-did": "next",
28
28
  "@twin.org/vault-connector-entity-storage": "next",