@twin.org/node-core 0.0.3-next.34 â 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/builders/engineEnvBuilder.js +132 -10
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +18 -2
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/commands/bootstrapLegacy.js +28 -23
- package/dist/es/commands/bootstrapLegacy.js.map +1 -1
- package/dist/es/commands/identityCreate.js +11 -1
- package/dist/es/commands/identityCreate.js.map +1 -1
- package/dist/es/commands/identityVerificationMethodImport.js +1 -1
- package/dist/es/commands/identityVerificationMethodImport.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/node.js +6 -2
- package/dist/es/node.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +56 -0
- package/dist/types/builders/engineServerEnvBuilder.d.ts +7 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +26 -27
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/docs/changelog.md +18 -2
- package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
- package/docs/reference/functions/isAutomationRequired.md +20 -0
- package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
- package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
- package/docs/reference/functions/isImmutableProofRequired.md +20 -0
- package/docs/reference/functions/isRightsManagementRequired.md +20 -0
- package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
- package/docs/reference/functions/isTrustRequired.md +20 -0
- package/docs/reference/functions/isUrlTransformerRequired.md +20 -0
- package/docs/reference/index.md +9 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +43 -52
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +68 -77
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +72 -77
- package/package.json +5 -4
|
@@ -11,6 +11,7 @@ import { tenantCreate } from "./tenantCreate.js";
|
|
|
11
11
|
import { userCreate } from "./userCreate.js";
|
|
12
12
|
import { vaultKeyCreate } from "./vaultKeyCreate.js";
|
|
13
13
|
import { vaultKeyImport } from "./vaultKeyImport.js";
|
|
14
|
+
import { isTrustRequired, isUrlTransformerRequired } from "../builders/engineEnvBuilder.js";
|
|
14
15
|
const COMMAND_NAME = "bootstrap-legacy";
|
|
15
16
|
/**
|
|
16
17
|
* Get the command definition parameters.
|
|
@@ -75,7 +76,7 @@ export async function bootstrapLegacy(engineCore, envVars, params) {
|
|
|
75
76
|
keyId: envVars.authSigningKeyId,
|
|
76
77
|
overwriteMode: "skip"
|
|
77
78
|
});
|
|
78
|
-
if (
|
|
79
|
+
if (isTrustRequired(envVars)) {
|
|
79
80
|
CLIDisplay.break();
|
|
80
81
|
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.trustVerificationMethodCreate"));
|
|
81
82
|
await identityVerificationMethodCreate(engineCore, envVars, {
|
|
@@ -96,35 +97,39 @@ export async function bootstrapLegacy(engineCore, envVars, params) {
|
|
|
96
97
|
privateKeyHex: Converter.bytesToHex(Converter.base64ToBytes(envVars.synchronisedStorageBlobStorageKey))
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
if (isUrlTransformerRequired(envVars)) {
|
|
101
|
+
CLIDisplay.break();
|
|
102
|
+
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.urlTransformParamKeyAdd"));
|
|
103
|
+
await vaultKeyCreate(engineCore, envVars, {
|
|
104
|
+
identity: nodeIdentity.did,
|
|
105
|
+
keyType: "ChaCha20Poly1305",
|
|
106
|
+
keyId: envVars.urlTransformerEncryptionKeyId
|
|
107
|
+
});
|
|
108
|
+
}
|
|
106
109
|
CLIDisplay.break();
|
|
107
110
|
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.nodeIdentitySet"));
|
|
108
111
|
await nodeSetIdentity(engineCore, envVars, {
|
|
109
112
|
identity: nodeId
|
|
110
113
|
});
|
|
111
114
|
const tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;
|
|
112
|
-
if (tenantEnabled
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
if (tenantEnabled) {
|
|
116
|
+
if (Is.empty(tenantId)) {
|
|
117
|
+
await ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {
|
|
118
|
+
CLIDisplay.break();
|
|
119
|
+
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.nodeTenantCreate"));
|
|
120
|
+
const tenantDetails = await tenantCreate(engineCore, envVars, {
|
|
121
|
+
tenantId: envVars.tenantId,
|
|
122
|
+
apiKey: envVars.tenantApiKey,
|
|
123
|
+
label: "Node"
|
|
124
|
+
});
|
|
125
|
+
CLIDisplay.break();
|
|
126
|
+
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.nodeTenantSet"));
|
|
127
|
+
await nodeSetTenant(engineCore, envVars, {
|
|
128
|
+
tenantId: tenantDetails.tenantId
|
|
129
|
+
});
|
|
130
|
+
tenantId = tenantDetails.tenantId;
|
|
120
131
|
});
|
|
121
|
-
|
|
122
|
-
CLIDisplay.section(I18n.formatMessage("node.cli.commands.bootstrap-legacy.labels.nodeTenantSet"));
|
|
123
|
-
await nodeSetTenant(engineCore, envVars, {
|
|
124
|
-
tenantId: tenantDetails.tenantId
|
|
125
|
-
});
|
|
126
|
-
tenantId = tenantDetails.tenantId;
|
|
127
|
-
});
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
if (features.includes("node-admin-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DAA+D,CAAC,CACnF,CAAC;YACF,MAAM,iBAAiB,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE;gBACnE,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,UAAU,EAAE,YAAY,CAAC,GAAG;aAC5B,CAAC,CAAC;YAEH,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,UAAU,CAAC,OAAO,CACjB,IAAI,CAAC,aAAa,CAAC,2DAA2D,CAAC,CAC/E,CAAC;YACF,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE;gBACrC,YAAY,EAAE,iBAAiB,CAAC,GAAG;gBACnC,oBAAoB,EAAE,YAAY,CAAC,GAAG;gBACtC,KAAK,EAAE,OAAO,CAAC,aAAa,IAAI,YAAY;gBAC5C,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,KAAK,EAAE,cAAc;gBACrB,SAAS,EAAE,MAAM;gBACjB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,MAAM;aACrB,CAAC,CAAC;QACJ,CAAC,CACD,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, Converter, GeneralError, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { identityCreate } from \"./identityCreate.js\";\nimport { identityVerificationMethodCreate } from \"./identityVerificationMethodCreate.js\";\nimport { nodeSetIdentity } from \"./nodeSetIdentity.js\";\nimport { nodeSetTenant } from \"./nodeSetTenant.js\";\nimport { tenantCreate } from \"./tenantCreate.js\";\nimport { userCreate } from \"./userCreate.js\";\nimport { vaultKeyCreate } from \"./vaultKeyCreate.js\";\nimport { vaultKeyImport } from \"./vaultKeyImport.js\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"bootstrap-legacy\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionBootstrapLegacy(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.bootstrap-legacy.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.bootstrap-legacy.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => bootstrapLegacy(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for legacy bootstrap.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n */\nexport async function bootstrapLegacy(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables & {\n\t\t/**\n\t\t * The features that are enabled on the node.\n\t\t * @default []\n\t\t */\n\t\tfeatures?: string;\n\n\t\t/**\n\t\t * The identity of the node which, if empty and node-identity feature is enabled it will be generated.\n\t\t */\n\t\tnodeIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the identity, if empty and node-identity feature is enabled it will be randomly generated.\n\t\t */\n\t\tnodeMnemonic?: string;\n\n\t\t/**\n\t\t * A tenant id to use as a default for the node.\n\t\t */\n\t\ttenantId?: string;\n\n\t\t/**\n\t\t * A tenant api key to use as a default for the node.\n\t\t */\n\t\ttenantApiKey?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the organization of the user, if one is not provided it will be generated\n\t\t */\n\t\torganizationIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the organization, if empty and node-admin-user feature is enabled it will be randomly generated.\n\t\t */\n\t\torganizationMnemonic?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the identity of the user, if one is not provided it will be generated\n\t\t */\n\t\tadminUserIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the admin user, if empty and node-admin-user feature is enabled it will be randomly generated.\n\t\t */\n\t\tadminUserMnemonic?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the name of the user.\n\t\t * @default admin@node\n\t\t */\n\t\tadminUserName?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the password of the user, if empty it will be randomly generated.\n\t\t */\n\t\tadminUserPassword?: string;\n\t},\n\tparams: {}\n): Promise<void> {\n\tconst features = (envVars.features ?? \"\")\n\t\t.split(\",\")\n\t\t.map(f => f.trim())\n\t\t.filter(f => f.length > 0);\n\n\tconst state = engineCore.getState();\n\tconst requireWallet = features.includes(\"node-wallet\");\n\tlet tenantId = state.nodeTenantId;\n\tlet nodeId = state.nodeId;\n\n\tif (features.length === 0) {\n\t\tthrow new GeneralError(\"bootstrapLegacy\", \"noFeaturesEnabled\");\n\t}\n\n\tif (features.includes(\"node-identity\") && Is.empty(nodeId)) {\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeIdentityCreate\")\n\t\t);\n\n\t\tconst nodeIdentity = await identityCreate(engineCore, envVars, {\n\t\t\tidentity: envVars.nodeIdentity,\n\t\t\tmnemonic: envVars.nodeMnemonic,\n\t\t\tfundWallet: requireWallet\n\t\t});\n\n\t\tnodeId = nodeIdentity.did;\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeAuthKeyCreate\")\n\t\t);\n\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\tidentity: nodeIdentity.did,\n\t\t\tkeyType: \"Ed25519\",\n\t\t\tkeyId: envVars.authSigningKeyId,\n\t\t\toverwriteMode: \"skip\"\n\t\t});\n\n\t\tif (Coerce.boolean(envVars.trustEnabled) ?? false) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.labels.trustVerificationMethodCreate\"\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: nodeIdentity.did,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.trustVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\t(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) &&\n\t\t\tIs.stringBase64(envVars.synchronisedStorageBlobStorageKey)\n\t\t) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.synchronisedStorageKeyAdd\")\n\t\t\t);\n\t\t\tawait vaultKeyImport(engineCore, envVars, {\n\t\t\t\tidentity: nodeIdentity.did,\n\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\tkeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId,\n\t\t\t\tprivateKeyHex: Converter.bytesToHex(\n\t\t\t\t\tConverter.base64ToBytes(envVars.synchronisedStorageBlobStorageKey)\n\t\t\t\t)\n\t\t\t});\n\t\t}\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.urlTransformParamKeyAdd\")\n\t\t);\n\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\tidentity: nodeIdentity.did,\n\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\tkeyId: envVars.urlTransformerEncryptionKeyId\n\t\t});\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeIdentitySet\")\n\t\t);\n\t\tawait nodeSetIdentity(engineCore, envVars, {\n\t\t\tidentity: nodeId\n\t\t});\n\n\t\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\t\tif (tenantEnabled && Is.empty(tenantId)) {\n\t\t\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeTenantCreate\")\n\t\t\t\t);\n\t\t\t\tconst tenantDetails = await tenantCreate(engineCore, envVars, {\n\t\t\t\t\ttenantId: envVars.tenantId,\n\t\t\t\t\tapiKey: envVars.tenantApiKey,\n\t\t\t\t\tlabel: \"Node\"\n\t\t\t\t});\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeTenantSet\")\n\t\t\t\t);\n\t\t\t\tawait nodeSetTenant(engineCore, envVars, {\n\t\t\t\t\ttenantId: tenantDetails.tenantId\n\t\t\t\t});\n\n\t\t\t\ttenantId = tenantDetails.tenantId;\n\t\t\t});\n\t\t}\n\t}\n\n\tif (features.includes(\"node-admin-user\")) {\n\t\tawait ContextIdStore.run(\n\t\t\t{ [ContextIdKeys.Node]: nodeId, [ContextIdKeys.Tenant]: tenantId },\n\t\t\tasync () => {\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.organisationCreate\")\n\t\t\t\t);\n\t\t\t\tconst organisation = await identityCreate(engineCore, envVars, {\n\t\t\t\t\tidentity: envVars.organizationIdentity,\n\t\t\t\t\tmnemonic: envVars.organizationMnemonic,\n\t\t\t\t\tfundWallet: requireWallet\n\t\t\t\t});\n\n\t\t\t\tif (Coerce.boolean(envVars.blobStorageEnableEncryption) ?? false) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.blobStorageKeyCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\t\t\tkeyId: envVars.blobStorageEncryptionKeyId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst defaultAttestationConnectorType =\n\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"attestationConnector\");\n\t\t\t\tif (!Is.empty(defaultAttestationConnectorType)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.attestationMethodCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst defaultImmutableProofComponentType =\n\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"immutableProofComponent\");\n\n\t\t\t\tif (!Is.empty(defaultImmutableProofComponentType)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\n\t\t\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.labels.immutableProofMethodCreate\"\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.adminIdentityCreate\")\n\t\t\t\t);\n\t\t\t\tconst adminUserIdentity = await identityCreate(engineCore, envVars, {\n\t\t\t\t\tidentity: envVars.adminUserIdentity,\n\t\t\t\t\tmnemonic: envVars.adminUserMnemonic,\n\t\t\t\t\tcontroller: organisation.did\n\t\t\t\t});\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.adminUserCreate\")\n\t\t\t\t);\n\t\t\t\tawait userCreate(engineCore, envVars, {\n\t\t\t\t\tuserIdentity: adminUserIdentity.did,\n\t\t\t\t\torganizationIdentity: organisation.did,\n\t\t\t\t\temail: envVars.adminUserName ?? \"admin@node\",\n\t\t\t\t\tpassword: envVars.adminUserPassword,\n\t\t\t\t\tscope: \"tenant-admin\",\n\t\t\t\t\tgivenName: \"Node\",\n\t\t\t\t\tfamilyName: \"Admin\",\n\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrapLegacy.js","sourceRoot":"","sources":["../../../src/commands/bootstrapLegacy.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAM5F,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAAC,kBAEnD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,gDAAgD,CAAC;QACjF,OAAO,EAAE,IAAI,CAAC,aAAa,CAA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AAO,EAAE;oBAC3D,QAAQ,EAAE,YAAY,CAAC,GAAG;oBAC1B,sBAAsB,EAAE,iBAAiB;oBACzC,oBAAoB,EAAE,OAAO,CAAC,kCAAkC;oBAChE,aAAa,EAAE,MAAM;iBACrB,CAAC,CAAC;YACJ,CAAC;YAED,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,UAAU,CAAC,OAAO,CACjB,IAAI,CAAC,aAAa,CAAC,+DAA+D,CAAC,CACnF,CAAC;YACF,MAAM,iBAAiB,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE;gBACnE,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,UAAU,EAAE,YAAY,CAAC,GAAG;aAC5B,CAAC,CAAC;YAEH,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,UAAU,CAAC,OAAO,CACjB,IAAI,CAAC,aAAa,CAAC,2DAA2D,CAAC,CAC/E,CAAC;YACF,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE;gBACrC,YAAY,EAAE,iBAAiB,CAAC,GAAG;gBACnC,oBAAoB,EAAE,YAAY,CAAC,GAAG;gBACtC,KAAK,EAAE,OAAO,CAAC,aAAa,IAAI,YAAY;gBAC5C,QAAQ,EAAE,OAAO,CAAC,iBAAiB;gBACnC,KAAK,EAAE,cAAc;gBACrB,SAAS,EAAE,MAAM;gBACjB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,MAAM;aACrB,CAAC,CAAC;QACJ,CAAC,CACD,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, Converter, GeneralError, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { identityCreate } from \"./identityCreate.js\";\nimport { identityVerificationMethodCreate } from \"./identityVerificationMethodCreate.js\";\nimport { nodeSetIdentity } from \"./nodeSetIdentity.js\";\nimport { nodeSetTenant } from \"./nodeSetTenant.js\";\nimport { tenantCreate } from \"./tenantCreate.js\";\nimport { userCreate } from \"./userCreate.js\";\nimport { vaultKeyCreate } from \"./vaultKeyCreate.js\";\nimport { vaultKeyImport } from \"./vaultKeyImport.js\";\nimport { isTrustRequired, isUrlTransformerRequired } from \"../builders/engineEnvBuilder.js\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"bootstrap-legacy\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionBootstrapLegacy(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.bootstrap-legacy.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.bootstrap-legacy.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => bootstrapLegacy(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for legacy bootstrap.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n */\nexport async function bootstrapLegacy(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables & {\n\t\t/**\n\t\t * The features that are enabled on the node.\n\t\t * @default []\n\t\t */\n\t\tfeatures?: string;\n\n\t\t/**\n\t\t * The identity of the node which, if empty and node-identity feature is enabled it will be generated.\n\t\t */\n\t\tnodeIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the identity, if empty and node-identity feature is enabled it will be randomly generated.\n\t\t */\n\t\tnodeMnemonic?: string;\n\n\t\t/**\n\t\t * A tenant id to use as a default for the node.\n\t\t */\n\t\ttenantId?: string;\n\n\t\t/**\n\t\t * A tenant api key to use as a default for the node.\n\t\t */\n\t\ttenantApiKey?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the organization of the user, if one is not provided it will be generated\n\t\t */\n\t\torganizationIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the organization, if empty and node-admin-user feature is enabled it will be randomly generated.\n\t\t */\n\t\torganizationMnemonic?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the identity of the user, if one is not provided it will be generated\n\t\t */\n\t\tadminUserIdentity?: string;\n\n\t\t/**\n\t\t * The mnemonic for the admin user, if empty and node-admin-user feature is enabled it will be randomly generated.\n\t\t */\n\t\tadminUserMnemonic?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the name of the user.\n\t\t * @default admin@node\n\t\t */\n\t\tadminUserName?: string;\n\n\t\t/**\n\t\t * If the node-admin-user feature is enabled, this will be the password of the user, if empty it will be randomly generated.\n\t\t */\n\t\tadminUserPassword?: string;\n\t},\n\tparams: {}\n): Promise<void> {\n\tconst features = (envVars.features ?? \"\")\n\t\t.split(\",\")\n\t\t.map(f => f.trim())\n\t\t.filter(f => f.length > 0);\n\n\tconst state = engineCore.getState();\n\tconst requireWallet = features.includes(\"node-wallet\");\n\tlet tenantId = state.nodeTenantId;\n\tlet nodeId = state.nodeId;\n\n\tif (features.length === 0) {\n\t\tthrow new GeneralError(\"bootstrapLegacy\", \"noFeaturesEnabled\");\n\t}\n\n\tif (features.includes(\"node-identity\") && Is.empty(nodeId)) {\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeIdentityCreate\")\n\t\t);\n\n\t\tconst nodeIdentity = await identityCreate(engineCore, envVars, {\n\t\t\tidentity: envVars.nodeIdentity,\n\t\t\tmnemonic: envVars.nodeMnemonic,\n\t\t\tfundWallet: requireWallet\n\t\t});\n\n\t\tnodeId = nodeIdentity.did;\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeAuthKeyCreate\")\n\t\t);\n\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\tidentity: nodeIdentity.did,\n\t\t\tkeyType: \"Ed25519\",\n\t\t\tkeyId: envVars.authSigningKeyId,\n\t\t\toverwriteMode: \"skip\"\n\t\t});\n\n\t\tif (isTrustRequired(envVars)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.labels.trustVerificationMethodCreate\"\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: nodeIdentity.did,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.trustVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\t(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) &&\n\t\t\tIs.stringBase64(envVars.synchronisedStorageBlobStorageKey)\n\t\t) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.synchronisedStorageKeyAdd\")\n\t\t\t);\n\t\t\tawait vaultKeyImport(engineCore, envVars, {\n\t\t\t\tidentity: nodeIdentity.did,\n\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\tkeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId,\n\t\t\t\tprivateKeyHex: Converter.bytesToHex(\n\t\t\t\t\tConverter.base64ToBytes(envVars.synchronisedStorageBlobStorageKey)\n\t\t\t\t)\n\t\t\t});\n\t\t}\n\n\t\tif (isUrlTransformerRequired(envVars)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.urlTransformParamKeyAdd\")\n\t\t\t);\n\t\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\t\tidentity: nodeIdentity.did,\n\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\tkeyId: envVars.urlTransformerEncryptionKeyId\n\t\t\t});\n\t\t}\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeIdentitySet\")\n\t\t);\n\t\tawait nodeSetIdentity(engineCore, envVars, {\n\t\t\tidentity: nodeId\n\t\t});\n\n\t\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\t\tif (tenantEnabled) {\n\t\t\tif (Is.empty(tenantId)) {\n\t\t\t\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeTenantCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tconst tenantDetails = await tenantCreate(engineCore, envVars, {\n\t\t\t\t\t\ttenantId: envVars.tenantId,\n\t\t\t\t\t\tapiKey: envVars.tenantApiKey,\n\t\t\t\t\t\tlabel: \"Node\"\n\t\t\t\t\t});\n\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.nodeTenantSet\")\n\t\t\t\t\t);\n\t\t\t\t\tawait nodeSetTenant(engineCore, envVars, {\n\t\t\t\t\t\ttenantId: tenantDetails.tenantId\n\t\t\t\t\t});\n\n\t\t\t\t\ttenantId = tenantDetails.tenantId;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tif (features.includes(\"node-admin-user\")) {\n\t\tawait ContextIdStore.run(\n\t\t\t{ [ContextIdKeys.Node]: nodeId, [ContextIdKeys.Tenant]: tenantId },\n\t\t\tasync () => {\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.organisationCreate\")\n\t\t\t\t);\n\t\t\t\tconst organisation = await identityCreate(engineCore, envVars, {\n\t\t\t\t\tidentity: envVars.organizationIdentity,\n\t\t\t\t\tmnemonic: envVars.organizationMnemonic,\n\t\t\t\t\tfundWallet: requireWallet\n\t\t\t\t});\n\n\t\t\t\tif (Coerce.boolean(envVars.blobStorageEnableEncryption) ?? false) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.blobStorageKeyCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\t\t\tkeyId: envVars.blobStorageEncryptionKeyId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst defaultAttestationConnectorType =\n\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"attestationConnector\");\n\t\t\t\tif (!Is.empty(defaultAttestationConnectorType)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.attestationMethodCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst defaultImmutableProofComponentType =\n\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"immutableProofComponent\");\n\n\t\t\t\tif (!Is.empty(defaultImmutableProofComponentType)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\n\t\t\t\t\t\t\t\"node.cli.commands.bootstrap-legacy.labels.immutableProofMethodCreate\"\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: organisation.did,\n\t\t\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.adminIdentityCreate\")\n\t\t\t\t);\n\t\t\t\tconst adminUserIdentity = await identityCreate(engineCore, envVars, {\n\t\t\t\t\tidentity: envVars.adminUserIdentity,\n\t\t\t\t\tmnemonic: envVars.adminUserMnemonic,\n\t\t\t\t\tcontroller: organisation.did\n\t\t\t\t});\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-legacy.labels.adminUserCreate\")\n\t\t\t\t);\n\t\t\t\tawait userCreate(engineCore, envVars, {\n\t\t\t\t\tuserIdentity: adminUserIdentity.did,\n\t\t\t\t\torganizationIdentity: organisation.did,\n\t\t\t\t\temail: envVars.adminUserName ?? \"admin@node\",\n\t\t\t\t\tpassword: envVars.adminUserPassword,\n\t\t\t\t\tscope: \"tenant-admin\",\n\t\t\t\t\tgivenName: \"Node\",\n\t\t\t\t\tfamilyName: \"Admin\",\n\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
|
|
@@ -170,7 +170,7 @@ async function mnemonicCreate(vaultConnector, identity, providedMnemonic) {
|
|
|
170
170
|
throw new GeneralError("identityCreate", "invalidMnemonic");
|
|
171
171
|
}
|
|
172
172
|
let mnemonic = providedMnemonic;
|
|
173
|
-
let storeMnemonic
|
|
173
|
+
let storeMnemonic;
|
|
174
174
|
CLIDisplay.section(I18n.formatMessage("node.cli.commands.identity-create.labels.processingMnemonic"));
|
|
175
175
|
const mnemonicKey = `${identity}/mnemonic`;
|
|
176
176
|
try {
|
|
@@ -219,6 +219,12 @@ async function mnemonicFinalise(vaultConnector, tempIdentity, identity) {
|
|
|
219
219
|
if (tempIdentity !== identity) {
|
|
220
220
|
const mnemonic = await vaultConnector.getSecret(`${tempIdentity}/mnemonic`);
|
|
221
221
|
await vaultConnector.setSecret(`${identity}/mnemonic`, mnemonic);
|
|
222
|
+
try {
|
|
223
|
+
// not all accounts have account entries in the vault, so wrap this in a try catch
|
|
224
|
+
const accountChunk = await vaultConnector.getSecret(`${tempIdentity}/account/0/0/0`);
|
|
225
|
+
await vaultConnector.setSecret(`${identity}/account/0/0/0`, accountChunk);
|
|
226
|
+
}
|
|
227
|
+
catch { }
|
|
222
228
|
}
|
|
223
229
|
}
|
|
224
230
|
/**
|
|
@@ -232,6 +238,10 @@ async function mnemonicRemove(vaultConnector, identity) {
|
|
|
232
238
|
await vaultConnector.removeSecret(`${identity}/mnemonic`);
|
|
233
239
|
}
|
|
234
240
|
catch { }
|
|
241
|
+
try {
|
|
242
|
+
await vaultConnector.removeSecret(`${identity}/account/0/0/0`);
|
|
243
|
+
}
|
|
244
|
+
catch { }
|
|
235
245
|
}
|
|
236
246
|
/**
|
|
237
247
|
* Generate an identity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityCreate.js","sourceRoot":"","sources":["../../../src/commands/identityCreate.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,GAAG,EACH,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAwB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAMjE,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,kBAElD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,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SAAS,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAC5B,UAAuB,EACvB,QAAgB,EAChB,OAAgB;IAEhB,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,0BAA0B,GAAG,UAAU,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;QAE3F,6EAA6E;QAC7E,mCAAmC;QACnC,IAAI,0BAA0B,CAAC,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,CAAC;YAC9E,MAAM,aAAa,GAClB,6BAA6B,CAAC,GAAG,kBAEhC,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACzB,MAAM,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { Coerce, GeneralError, I18n, Is, RandomHelper, StringHelper } from \"@twin.org/core\";\nimport { Bip39 } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { WalletConnectorType } from \"@twin.org/engine-types\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport {\n\tDid,\n\tIdentityConnectorFactory,\n\tIdentityResolverConnectorFactory\n} from \"@twin.org/identity-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { type IVaultConnector, VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport type { WalletAddress } from \"@twin.org/wallet-connector-entity-storage\";\nimport { WalletConnectorFactory } from \"@twin.org/wallet-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"identity-create\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionIdentityCreate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.identity-create.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.identity-create.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"mnemonic\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.mnemonic.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"24 words\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.identity.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"controller\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.controller.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"fund-wallet\",\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.fund-wallet.description\"\n\t\t\t\t),\n\t\t\t\trequired: false,\n\t\t\t\tdefaultValue: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-json\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-json.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => identityCreate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating an identity.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.mnemonic The mnemonic to use for the identity.\n * @param params.identity The DID of the identity to create.\n * @param params.controller The controller DID for the identity.\n * @param params.fundWallet Whether to fund the wallet associated with the identity from a faucet.\n * @param params.outputJson The output .json file to store the command output.\n * @param params.outputEnv The output .env file to store the command output.\n * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.\n * @returns The identity details.\n */\nexport async function identityCreate(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables,\n\tparams: {\n\t\tmnemonic?: string;\n\t\tidentity?: string;\n\t\tcontroller?: string;\n\t\tfundWallet?: boolean;\n\t\toutputJson?: string;\n\t\toutputEnv?: string;\n\t\toutputEnvPrefix?: string;\n\t}\n): Promise<{ mnemonic: string; did: string; walletAddress?: string }> {\n\tlet workingIdentity = params?.identity;\n\tlet tempIdentity;\n\tif (!Is.stringValue(workingIdentity)) {\n\t\ttempIdentity = `did:temp:${RandomHelper.generateUuidV7()}`;\n\t\tworkingIdentity = tempIdentity;\n\t}\n\tlet mnemonicStored = false;\n\n\tconst defaultVaultConnectorType = engineCore.getRegisteredInstanceType(\"vaultConnector\");\n\tconst vaultConnector = VaultConnectorFactory.get(defaultVaultConnectorType);\n\n\ttry {\n\t\tconst mnemonicResult = await mnemonicCreate(vaultConnector, workingIdentity, params.mnemonic);\n\t\tmnemonicStored = mnemonicResult.stored;\n\n\t\tconst fundWallet = params.fundWallet ?? false;\n\t\tlet walletAddress;\n\t\tif (fundWallet) {\n\t\t\twalletAddress = await generateWallet(\n\t\t\t\tengineCore,\n\t\t\t\tworkingIdentity,\n\t\t\t\tCoerce.integer(envVars.identityWalletAddressIndex) ?? 0\n\t\t\t);\n\t\t}\n\n\t\tconst workingController = params?.controller ?? workingIdentity;\n\t\tworkingIdentity = await identityGenerate(engineCore, workingController, workingIdentity);\n\n\t\tif (Is.stringValue(tempIdentity)) {\n\t\t\t// If we were using a temporary identity store the mnemonic using\n\t\t\t// the final identity\n\t\t\tawait mnemonicFinalise(vaultConnector, tempIdentity, workingIdentity);\n\n\t\t\tawait walletFinalise(engineCore, workingIdentity, walletAddress);\n\t\t}\n\n\t\tCLIDisplay.break();\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.mnemonic\"),\n\t\t\tmnemonicResult.mnemonic\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.did\"),\n\t\t\tworkingIdentity\n\t\t);\n\t\tif (Is.stringValue(envVars.iotaExplorerEndpoint)) {\n\t\t\tconst idParts = Did.parse(workingIdentity);\n\t\t\tif (Is.stringValue(walletAddress)) {\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.walletAddress\"),\n\t\t\t\t\t`${StringHelper.trimTrailingSlashes(envVars.iotaExplorerEndpoint)}/address/${walletAddress}?network=${idParts.network ?? envVars.iotaNetwork}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.explorer\"),\n\t\t\t\t`${StringHelper.trimTrailingSlashes(envVars.iotaExplorerEndpoint)}/object/${idParts.id}?network=${idParts.network ?? envVars.iotaNetwork}`\n\t\t\t);\n\t\t}\n\t\tCLIDisplay.break();\n\n\t\tconst json = { mnemonic: mnemonicResult.mnemonic, did: workingIdentity, walletAddress };\n\t\tif (Is.stringValue(params.outputJson)) {\n\t\t\tawait CLIUtils.writeJsonFile(\n\t\t\t\tparams.outputJson,\n\t\t\t\t{ mnemonic: mnemonicResult.mnemonic, did: workingIdentity, walletAddress },\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tif (Is.stringValue(params.outputEnv)) {\n\t\t\tconst output = [\n\t\t\t\t`${params.outputEnvPrefix}MNEMONIC=\"${mnemonicResult.mnemonic}\"`,\n\t\t\t\t`${params.outputEnvPrefix}DID=\"${workingIdentity}\"`\n\t\t\t];\n\t\t\tif (Is.stringValue(walletAddress)) {\n\t\t\t\toutput.push(`${params.outputEnvPrefix}WALLET_ADDRESS=\"${walletAddress}\"`);\n\t\t\t}\n\t\t\tawait CLIUtils.writeEnvFile(params.outputEnv, output, false);\n\t\t}\n\n\t\tCLIDisplay.done();\n\n\t\treturn json;\n\t} finally {\n\t\t// Always remove temporary identity mnemonic if created\n\t\tif (Is.stringValue(tempIdentity) && mnemonicStored) {\n\t\t\tawait mnemonicRemove(vaultConnector, tempIdentity);\n\t\t}\n\t}\n}\n\n/**\n * Handle the mnemonic generation or retrieval.\n * @param vaultConnector The vault connector.\n * @param identity The working identity.\n * @param providedMnemonic The mnemonic provided by the user.\n * @returns The mnemonic and the flag to determine if the mnemonic was stored.\n */\nasync function mnemonicCreate(\n\tvaultConnector: IVaultConnector,\n\tidentity: string,\n\tprovidedMnemonic?: string\n): Promise<{\n\tstored: boolean;\n\tmnemonic: string;\n}> {\n\tif (Is.stringValue(providedMnemonic) && !Bip39.validateMnemonic(providedMnemonic)) {\n\t\tthrow new GeneralError(\"identityCreate\", \"invalidMnemonic\");\n\t}\n\tlet mnemonic = providedMnemonic;\n\tlet storeMnemonic = false;\n\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.processingMnemonic\")\n\t);\n\n\tconst mnemonicKey = `${identity}/mnemonic`;\n\n\ttry {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.readingMnemonic\"));\n\t\tconst storedMnemonic = await vaultConnector.getSecret<string>(mnemonicKey);\n\t\tif (Is.stringValue(storedMnemonic)) {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.existingMnemonic\")\n\t\t\t);\n\t\t\tstoreMnemonic = storedMnemonic !== mnemonic && !Is.empty(mnemonic);\n\t\t\tmnemonic = storedMnemonic;\n\t\t} else {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.noExistingMnemonic\")\n\t\t\t);\n\t\t\tstoreMnemonic = true;\n\t\t}\n\t} catch {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.noExistingMnemonic\")\n\t\t);\n\t\tstoreMnemonic = true;\n\t}\n\n\t// If there is no mnemonic then we need to generate one\n\tif (Is.empty(mnemonic)) {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.generatingMnemonic\")\n\t\t);\n\t\tmnemonic = Bip39.randomMnemonic();\n\t\tstoreMnemonic = true;\n\t}\n\n\t// If there is no mnemonic stored in the vault then we need to store it\n\tif (storeMnemonic) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.storingMnemonic\"));\n\t\tawait vaultConnector.setSecret(mnemonicKey, mnemonic);\n\t}\n\tCLIDisplay.break();\n\n\treturn {\n\t\tstored: storeMnemonic,\n\t\tmnemonic\n\t};\n}\n\n/**\n * Finalise the mnemonic for the node identity.\n * @param vaultConnector The vault connector to use.\n * @param tempIdentity The identity of the node.\n * @param identity The final identity for the node.\n */\nasync function mnemonicFinalise(\n\tvaultConnector: IVaultConnector,\n\ttempIdentity: string,\n\tidentity: string\n): Promise<void> {\n\t// Now that we have an identity we can remove the temporary one\n\t// and store the mnemonic with the new identity\n\tif (tempIdentity !== identity) {\n\t\tconst mnemonic = await vaultConnector.getSecret(`${tempIdentity}/mnemonic`);\n\t\tawait vaultConnector.setSecret(`${identity}/mnemonic`, mnemonic);\n\t}\n}\n\n/**\n * Remove the mnemonic.\n * @param vaultConnector The vault connector.\n * @param identity The working identity.\n * @returns Nothing.\n */\nasync function mnemonicRemove(vaultConnector: IVaultConnector, identity: string): Promise<void> {\n\ttry {\n\t\tawait vaultConnector.removeSecret(`${identity}/mnemonic`);\n\t} catch {}\n}\n\n/**\n * Generate an identity.\n * @param engineCore The engine core for the node.\n * @param controller The controller for the identity.\n * @param providedIdentity The existing identity if there is one.\n * @returns The addresses for the wallet.\n */\nasync function identityGenerate(\n\tengineCore: IEngineCore,\n\tcontroller: string,\n\tprovidedIdentity?: string\n): Promise<string> {\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.processingIdentity\")\n\t);\n\n\tconst defaultIdentityConnectorType = engineCore.getRegisteredInstanceType(\"identityConnector\");\n\tconst identityConnector = IdentityConnectorFactory.get(defaultIdentityConnectorType);\n\n\tlet identityDocument;\n\n\ttry {\n\t\tif (Is.stringValue(providedIdentity)) {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.resolvingIdentity\")\n\t\t\t);\n\t\t\tconst defaultIdentityResolverConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\t\t\"identityResolverConnector\"\n\t\t\t);\n\n\t\t\tconst identityResolverConnector = IdentityResolverConnectorFactory.get(\n\t\t\t\tdefaultIdentityResolverConnectorType\n\t\t\t);\n\t\t\tidentityDocument = await identityResolverConnector.resolveDocument(providedIdentity);\n\t\t\tif (Is.objectValue(identityDocument)) {\n\t\t\t\tCLIDisplay.task(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.existingIdentity\")\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch {}\n\n\tif (Is.empty(identityDocument)) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.noIdentityFound\"));\n\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.creatingIdentity\")\n\t\t);\n\n\t\tCLIDisplay.spinnerStart();\n\t\tidentityDocument = await identityConnector.createDocument(controller);\n\t\tCLIDisplay.spinnerStop();\n\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.createdIdentity\"));\n\t}\n\n\treturn identityDocument.id;\n}\n\n/**\n * Bootstrap the wallet for the node.\n * @param engineCore The engine core for the node.\n * @param identity The identity to create the wallet for.\n * @param walletAddressIndex The index of the wallet address to use.\n * @returns The addresses for the wallet.\n */\nasync function generateWallet(\n\tengineCore: IEngineCore,\n\tidentity: string,\n\twalletAddressIndex: number\n): Promise<string> {\n\tCLIDisplay.section(I18n.formatMessage(\"node.cli.commands.identity-create.labels.fundingWallet\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.addressIndex\"),\n\t\twalletAddressIndex.toString()\n\t);\n\n\tconst defaultWalletConnectorType = engineCore.getRegisteredInstanceType(\"walletConnector\");\n\n\tconst walletConnector = WalletConnectorFactory.get(defaultWalletConnectorType);\n\tconst addresses = await walletConnector.getAddresses(identity, 0, walletAddressIndex, 5);\n\n\tif (defaultWalletConnectorType.startsWith(WalletConnectorType.Iota)) {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.addingTokens\", {\n\t\t\t\taddress: addresses[0]\n\t\t\t})\n\t\t);\n\t\tCLIDisplay.break();\n\n\t\tCLIDisplay.spinnerStart();\n\n\t\t// Add some funds to the wallet from the faucet\n\t\tawait walletConnector.ensureBalance(identity, addresses[0], 1000000000n);\n\n\t\tCLIDisplay.spinnerStop();\n\t}\n\n\treturn addresses[0];\n}\n\n/**\n * Bootstrap the identity for the node.\n * @param engineCore The engine core for the node.\n * @param identity The identity of the node.\n * @param address The address for the wallet.\n */\nasync function walletFinalise(\n\tengineCore: IEngineCore,\n\tidentity: string,\n\taddress?: string\n): Promise<void> {\n\tif (Is.stringValue(address)) {\n\t\tconst defaultWalletConnectorType = engineCore.getRegisteredInstanceType(\"walletConnector\");\n\n\t\t// If we are using entity storage for wallet the identity associated with the\n\t\t// address will be wrong, so fix it\n\t\tif (defaultWalletConnectorType.startsWith(WalletConnectorType.EntityStorage)) {\n\t\t\tconst walletAddress =\n\t\t\t\tEntityStorageConnectorFactory.get<IEntityStorageConnector<WalletAddress>>(\n\t\t\t\t\tnameofKebabCase<WalletAddress>()\n\t\t\t\t);\n\t\t\tconst addr = await walletAddress.get(address);\n\t\t\tif (!Is.empty(addr)) {\n\t\t\t\taddr.identity = identity;\n\t\t\t\tawait walletAddress.set(addr);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"identityCreate.js","sourceRoot":"","sources":["../../../src/commands/identityCreate.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,GAAG,EACH,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAwB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAMjE,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,kBAElD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,+CAA+C,CAAC;QAChF,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,2CAA2C,CAAC;QACxE,oBAAoB,EAAE,KAAK;QAC3B,gBAAgB,EAAE,KAAK;QACvB,MAAM,EAAE;YACP;gBACC,GAAG,EAAE,YAAY;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,IAAI,CAAC,aAAa,CAC9B,iEAAiE,CACjE;gBACD,QAAQ,EAAE,KAAK;aACf;YACD;gBACC,GAAG,EAAE,UAAU;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW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;GAKG;AACH,KAAK,UAAU,cAAc,CAC5B,UAAuB,EACvB,QAAgB,EAChB,OAAgB;IAEhB,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,0BAA0B,GAAG,UAAU,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;QAE3F,6EAA6E;QAC7E,mCAAmC;QACnC,IAAI,0BAA0B,CAAC,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,CAAC;YAC9E,MAAM,aAAa,GAClB,6BAA6B,CAAC,GAAG,kBAEhC,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACzB,MAAM,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { Coerce, GeneralError, I18n, Is, RandomHelper, StringHelper } from \"@twin.org/core\";\nimport { Bip39 } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { WalletConnectorType } from \"@twin.org/engine-types\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport {\n\tDid,\n\tIdentityConnectorFactory,\n\tIdentityResolverConnectorFactory\n} from \"@twin.org/identity-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport { type IVaultConnector, VaultConnectorFactory } from \"@twin.org/vault-models\";\nimport type { WalletAddress } from \"@twin.org/wallet-connector-entity-storage\";\nimport { WalletConnectorFactory } from \"@twin.org/wallet-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"identity-create\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionIdentityCreate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.identity-create.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.identity-create.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"mnemonic\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.mnemonic.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"24 words\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.identity.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"controller\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.controller.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"fund-wallet\",\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.fund-wallet.description\"\n\t\t\t\t),\n\t\t\t\trequired: false,\n\t\t\t\tdefaultValue: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-json\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-json.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-create.params.output-env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => identityCreate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating an identity.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.mnemonic The mnemonic to use for the identity.\n * @param params.identity The DID of the identity to create.\n * @param params.controller The controller DID for the identity.\n * @param params.fundWallet Whether to fund the wallet associated with the identity from a faucet.\n * @param params.outputJson The output .json file to store the command output.\n * @param params.outputEnv The output .env file to store the command output.\n * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.\n * @returns The identity details.\n */\nexport async function identityCreate(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables,\n\tparams: {\n\t\tmnemonic?: string;\n\t\tidentity?: string;\n\t\tcontroller?: string;\n\t\tfundWallet?: boolean;\n\t\toutputJson?: string;\n\t\toutputEnv?: string;\n\t\toutputEnvPrefix?: string;\n\t}\n): Promise<{ mnemonic: string; did: string; walletAddress?: string }> {\n\tlet workingIdentity = params?.identity;\n\tlet tempIdentity;\n\tif (!Is.stringValue(workingIdentity)) {\n\t\ttempIdentity = `did:temp:${RandomHelper.generateUuidV7()}`;\n\t\tworkingIdentity = tempIdentity;\n\t}\n\tlet mnemonicStored = false;\n\n\tconst defaultVaultConnectorType = engineCore.getRegisteredInstanceType(\"vaultConnector\");\n\tconst vaultConnector = VaultConnectorFactory.get(defaultVaultConnectorType);\n\n\ttry {\n\t\tconst mnemonicResult = await mnemonicCreate(vaultConnector, workingIdentity, params.mnemonic);\n\t\tmnemonicStored = mnemonicResult.stored;\n\n\t\tconst fundWallet = params.fundWallet ?? false;\n\t\tlet walletAddress;\n\t\tif (fundWallet) {\n\t\t\twalletAddress = await generateWallet(\n\t\t\t\tengineCore,\n\t\t\t\tworkingIdentity,\n\t\t\t\tCoerce.integer(envVars.identityWalletAddressIndex) ?? 0\n\t\t\t);\n\t\t}\n\n\t\tconst workingController = params?.controller ?? workingIdentity;\n\t\tworkingIdentity = await identityGenerate(engineCore, workingController, workingIdentity);\n\n\t\tif (Is.stringValue(tempIdentity)) {\n\t\t\t// If we were using a temporary identity store the mnemonic using\n\t\t\t// the final identity\n\t\t\tawait mnemonicFinalise(vaultConnector, tempIdentity, workingIdentity);\n\n\t\t\tawait walletFinalise(engineCore, workingIdentity, walletAddress);\n\t\t}\n\n\t\tCLIDisplay.break();\n\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.mnemonic\"),\n\t\t\tmnemonicResult.mnemonic\n\t\t);\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.did\"),\n\t\t\tworkingIdentity\n\t\t);\n\t\tif (Is.stringValue(envVars.iotaExplorerEndpoint)) {\n\t\t\tconst idParts = Did.parse(workingIdentity);\n\t\t\tif (Is.stringValue(walletAddress)) {\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.walletAddress\"),\n\t\t\t\t\t`${StringHelper.trimTrailingSlashes(envVars.iotaExplorerEndpoint)}/address/${walletAddress}?network=${idParts.network ?? envVars.iotaNetwork}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tCLIDisplay.value(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.explorer\"),\n\t\t\t\t`${StringHelper.trimTrailingSlashes(envVars.iotaExplorerEndpoint)}/object/${idParts.id}?network=${idParts.network ?? envVars.iotaNetwork}`\n\t\t\t);\n\t\t}\n\t\tCLIDisplay.break();\n\n\t\tconst json = { mnemonic: mnemonicResult.mnemonic, did: workingIdentity, walletAddress };\n\t\tif (Is.stringValue(params.outputJson)) {\n\t\t\tawait CLIUtils.writeJsonFile(\n\t\t\t\tparams.outputJson,\n\t\t\t\t{ mnemonic: mnemonicResult.mnemonic, did: workingIdentity, walletAddress },\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tif (Is.stringValue(params.outputEnv)) {\n\t\t\tconst output = [\n\t\t\t\t`${params.outputEnvPrefix}MNEMONIC=\"${mnemonicResult.mnemonic}\"`,\n\t\t\t\t`${params.outputEnvPrefix}DID=\"${workingIdentity}\"`\n\t\t\t];\n\t\t\tif (Is.stringValue(walletAddress)) {\n\t\t\t\toutput.push(`${params.outputEnvPrefix}WALLET_ADDRESS=\"${walletAddress}\"`);\n\t\t\t}\n\t\t\tawait CLIUtils.writeEnvFile(params.outputEnv, output, false);\n\t\t}\n\n\t\tCLIDisplay.done();\n\n\t\treturn json;\n\t} finally {\n\t\t// Always remove temporary identity mnemonic if created\n\t\tif (Is.stringValue(tempIdentity) && mnemonicStored) {\n\t\t\tawait mnemonicRemove(vaultConnector, tempIdentity);\n\t\t}\n\t}\n}\n\n/**\n * Handle the mnemonic generation or retrieval.\n * @param vaultConnector The vault connector.\n * @param identity The working identity.\n * @param providedMnemonic The mnemonic provided by the user.\n * @returns The mnemonic and the flag to determine if the mnemonic was stored.\n */\nasync function mnemonicCreate(\n\tvaultConnector: IVaultConnector,\n\tidentity: string,\n\tprovidedMnemonic?: string\n): Promise<{\n\tstored: boolean;\n\tmnemonic: string;\n}> {\n\tif (Is.stringValue(providedMnemonic) && !Bip39.validateMnemonic(providedMnemonic)) {\n\t\tthrow new GeneralError(\"identityCreate\", \"invalidMnemonic\");\n\t}\n\tlet mnemonic = providedMnemonic;\n\tlet storeMnemonic;\n\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.processingMnemonic\")\n\t);\n\n\tconst mnemonicKey = `${identity}/mnemonic`;\n\n\ttry {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.readingMnemonic\"));\n\t\tconst storedMnemonic = await vaultConnector.getSecret<string>(mnemonicKey);\n\t\tif (Is.stringValue(storedMnemonic)) {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.existingMnemonic\")\n\t\t\t);\n\t\t\tstoreMnemonic = storedMnemonic !== mnemonic && !Is.empty(mnemonic);\n\t\t\tmnemonic = storedMnemonic;\n\t\t} else {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.noExistingMnemonic\")\n\t\t\t);\n\t\t\tstoreMnemonic = true;\n\t\t}\n\t} catch {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.noExistingMnemonic\")\n\t\t);\n\t\tstoreMnemonic = true;\n\t}\n\n\t// If there is no mnemonic then we need to generate one\n\tif (Is.empty(mnemonic)) {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.generatingMnemonic\")\n\t\t);\n\t\tmnemonic = Bip39.randomMnemonic();\n\t\tstoreMnemonic = true;\n\t}\n\n\t// If there is no mnemonic stored in the vault then we need to store it\n\tif (storeMnemonic) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.storingMnemonic\"));\n\t\tawait vaultConnector.setSecret(mnemonicKey, mnemonic);\n\t}\n\tCLIDisplay.break();\n\n\treturn {\n\t\tstored: storeMnemonic,\n\t\tmnemonic\n\t};\n}\n\n/**\n * Finalise the mnemonic for the node identity.\n * @param vaultConnector The vault connector to use.\n * @param tempIdentity The identity of the node.\n * @param identity The final identity for the node.\n */\nasync function mnemonicFinalise(\n\tvaultConnector: IVaultConnector,\n\ttempIdentity: string,\n\tidentity: string\n): Promise<void> {\n\t// Now that we have an identity we can remove the temporary one\n\t// and store the mnemonic with the new identity\n\tif (tempIdentity !== identity) {\n\t\tconst mnemonic = await vaultConnector.getSecret(`${tempIdentity}/mnemonic`);\n\t\tawait vaultConnector.setSecret(`${identity}/mnemonic`, mnemonic);\n\n\t\ttry {\n\t\t\t// not all accounts have account entries in the vault, so wrap this in a try catch\n\t\t\tconst accountChunk = await vaultConnector.getSecret(`${tempIdentity}/account/0/0/0`);\n\t\t\tawait vaultConnector.setSecret(`${identity}/account/0/0/0`, accountChunk);\n\t\t} catch {}\n\t}\n}\n\n/**\n * Remove the mnemonic.\n * @param vaultConnector The vault connector.\n * @param identity The working identity.\n * @returns Nothing.\n */\nasync function mnemonicRemove(vaultConnector: IVaultConnector, identity: string): Promise<void> {\n\ttry {\n\t\tawait vaultConnector.removeSecret(`${identity}/mnemonic`);\n\t} catch {}\n\n\ttry {\n\t\tawait vaultConnector.removeSecret(`${identity}/account/0/0/0`);\n\t} catch {}\n}\n\n/**\n * Generate an identity.\n * @param engineCore The engine core for the node.\n * @param controller The controller for the identity.\n * @param providedIdentity The existing identity if there is one.\n * @returns The addresses for the wallet.\n */\nasync function identityGenerate(\n\tengineCore: IEngineCore,\n\tcontroller: string,\n\tprovidedIdentity?: string\n): Promise<string> {\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.processingIdentity\")\n\t);\n\n\tconst defaultIdentityConnectorType = engineCore.getRegisteredInstanceType(\"identityConnector\");\n\tconst identityConnector = IdentityConnectorFactory.get(defaultIdentityConnectorType);\n\n\tlet identityDocument;\n\n\ttry {\n\t\tif (Is.stringValue(providedIdentity)) {\n\t\t\tCLIDisplay.task(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.resolvingIdentity\")\n\t\t\t);\n\t\t\tconst defaultIdentityResolverConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\t\t\"identityResolverConnector\"\n\t\t\t);\n\n\t\t\tconst identityResolverConnector = IdentityResolverConnectorFactory.get(\n\t\t\t\tdefaultIdentityResolverConnectorType\n\t\t\t);\n\t\t\tidentityDocument = await identityResolverConnector.resolveDocument(providedIdentity);\n\t\t\tif (Is.objectValue(identityDocument)) {\n\t\t\t\tCLIDisplay.task(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.existingIdentity\")\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch {}\n\n\tif (Is.empty(identityDocument)) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.noIdentityFound\"));\n\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.creatingIdentity\")\n\t\t);\n\n\t\tCLIDisplay.spinnerStart();\n\t\tidentityDocument = await identityConnector.createDocument(controller);\n\t\tCLIDisplay.spinnerStop();\n\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.identity-create.labels.createdIdentity\"));\n\t}\n\n\treturn identityDocument.id;\n}\n\n/**\n * Bootstrap the wallet for the node.\n * @param engineCore The engine core for the node.\n * @param identity The identity to create the wallet for.\n * @param walletAddressIndex The index of the wallet address to use.\n * @returns The addresses for the wallet.\n */\nasync function generateWallet(\n\tengineCore: IEngineCore,\n\tidentity: string,\n\twalletAddressIndex: number\n): Promise<string> {\n\tCLIDisplay.section(I18n.formatMessage(\"node.cli.commands.identity-create.labels.fundingWallet\"));\n\tCLIDisplay.value(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.addressIndex\"),\n\t\twalletAddressIndex.toString()\n\t);\n\n\tconst defaultWalletConnectorType = engineCore.getRegisteredInstanceType(\"walletConnector\");\n\n\tconst walletConnector = WalletConnectorFactory.get(defaultWalletConnectorType);\n\tconst addresses = await walletConnector.getAddresses(identity, 0, walletAddressIndex, 5);\n\n\tif (defaultWalletConnectorType.startsWith(WalletConnectorType.Iota)) {\n\t\tCLIDisplay.task(\n\t\t\tI18n.formatMessage(\"node.cli.commands.identity-create.labels.addingTokens\", {\n\t\t\t\taddress: addresses[0]\n\t\t\t})\n\t\t);\n\t\tCLIDisplay.break();\n\n\t\tCLIDisplay.spinnerStart();\n\n\t\t// Add some funds to the wallet from the faucet\n\t\tawait walletConnector.ensureBalance(identity, addresses[0], 1000000000n);\n\n\t\tCLIDisplay.spinnerStop();\n\t}\n\n\treturn addresses[0];\n}\n\n/**\n * Bootstrap the identity for the node.\n * @param engineCore The engine core for the node.\n * @param identity The identity of the node.\n * @param address The address for the wallet.\n */\nasync function walletFinalise(\n\tengineCore: IEngineCore,\n\tidentity: string,\n\taddress?: string\n): Promise<void> {\n\tif (Is.stringValue(address)) {\n\t\tconst defaultWalletConnectorType = engineCore.getRegisteredInstanceType(\"walletConnector\");\n\n\t\t// If we are using entity storage for wallet the identity associated with the\n\t\t// address will be wrong, so fix it\n\t\tif (defaultWalletConnectorType.startsWith(WalletConnectorType.EntityStorage)) {\n\t\t\tconst walletAddress =\n\t\t\t\tEntityStorageConnectorFactory.get<IEntityStorageConnector<WalletAddress>>(\n\t\t\t\t\tnameofKebabCase<WalletAddress>()\n\t\t\t\t);\n\t\t\tconst addr = await walletAddress.get(address);\n\t\t\tif (!Is.empty(addr)) {\n\t\t\t\taddr.identity = identity;\n\t\t\t\tawait walletAddress.set(addr);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -115,7 +115,7 @@ export async function identityVerificationMethodImport(engineCore, envVars, para
|
|
|
115
115
|
if (Is.empty(vaultKey)) {
|
|
116
116
|
const privateKeyBytes = Converter.hexToBytes(HexHelper.stripPrefix(params.privateKeyHex));
|
|
117
117
|
const publicKeyBytes = Ed25519.publicKeyFromPrivateKey(privateKeyBytes);
|
|
118
|
-
|
|
118
|
+
await vaultConnector.addKey(vaultKeyId, VaultKeyType.Ed25519, privateKeyBytes, publicKeyBytes);
|
|
119
119
|
}
|
|
120
120
|
await identityConnector.addVerificationMethod(params.controller ?? params.identity, params.identity, params.verificationMethodType, verificationMethodId);
|
|
121
121
|
CLIDisplay.spinnerStop();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityVerificationMethodImport.js","sourceRoot":"","sources":["../../../src/commands/identityVerificationMethodImport.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EACN,GAAG,EACH,cAAc,EACd,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA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S,CAAC,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;QACxE,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CACrC,UAAU,EACV,YAAY,CAAC,OAAO,EACpB,eAAe,EACf,cAAc,CACd,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,CAAC,qBAAqB,CAC5C,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EACpC,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,sBAAmD,EAC1D,oBAAoB,CACpB,CAAC;IAEF,UAAU,CAAC,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,IAAI,CACd,IAAI,CAAC,aAAa,CAAC,uEAAuE,CAAC,CAC3F,CAAC;IACF,UAAU,CAAC,KAAK,EAAE,CAAC;IAEnB,UAAU,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { Converter, GeneralError, Guards, HexHelper, I18n, Is } from \"@twin.org/core\";\nimport { Ed25519 } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport {\n\tDid,\n\tDocumentHelper,\n\tIdentityConnectorFactory,\n\tIdentityResolverConnectorFactory\n} from \"@twin.org/identity-models\";\nimport { DidVerificationMethodType } from \"@twin.org/standards-w3c-did\";\nimport { VaultConnectorFactory, VaultKeyType } from \"@twin.org/vault-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"identity-verification-method-import\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionIdentityVerificationMethodImport(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\n\t\t\t\"node.cli.commands.identity-verification-method-import.description\"\n\t\t),\n\t\texample: I18n.formatMessage(\"node.cli.commands.identity-verification-method-import.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.identity.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"controller\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.controller.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"verification-method-type\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.verification-method-type.description\"\n\t\t\t\t),\n\t\t\t\toptions: Object.values(DidVerificationMethodType),\n\t\t\t\trequired: true,\n\t\t\t\tdefaultValue: \"assertionMethod\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"verification-method-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.verification-method-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"private-key-hex\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.private-key-hex.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) =>\n\t\t\tidentityVerificationMethodImport(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating an identity verification method.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.identity The DID of the identity to create.\n * @param params.verificationMethodType The type of verification method to create.\n * @param params.verificationMethodId The ID of the verification method to create.\n * @param params.controller The controller DID for the identity.\n * @param params.privateKeyHex The private key in hex format.\n */\nexport async function identityVerificationMethodImport(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables,\n\tparams: {\n\t\tidentity?: string;\n\t\tverificationMethodType?: DidVerificationMethodType;\n\t\tverificationMethodId?: string;\n\t\tcontroller?: string;\n\t\tprivateKeyHex?: string;\n\t}\n): Promise<void> {\n\tDid.guard(\"identityVerificationMethodImport\", \"identity\", params.identity);\n\tGuards.arrayOneOf(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"verification-method-type\",\n\t\tparams.verificationMethodType,\n\t\tObject.values(DidVerificationMethodType)\n\t);\n\tGuards.stringValue(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"verification-method-id\",\n\t\tparams.verificationMethodId\n\t);\n\tGuards.stringHex(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"private-key-hex\",\n\t\tparams.privateKeyHex,\n\t\ttrue\n\t);\n\tconst defaultIdentityConnectorType = engineCore.getRegisteredInstanceType(\"identityConnector\");\n\tconst identityConnector = IdentityConnectorFactory.get(defaultIdentityConnectorType);\n\n\tconst defaultIdentityResolverConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityResolverConnector\"\n\t);\n\n\tconst identityResolverConnector = IdentityResolverConnectorFactory.get(\n\t\tdefaultIdentityResolverConnectorType\n\t);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\n\t\t\t\"node.cli.commands.identity-verification-method-import.labels.resolvingIdentity\"\n\t\t)\n\t);\n\tconst identityDocument = await identityResolverConnector.resolveDocument(params.identity);\n\n\tif (Is.empty(identityDocument)) {\n\t\tthrow new GeneralError(\"identityImport\", \"identityNotFound\", {\n\t\t\tidentity: params.identity\n\t\t});\n\t}\n\n\tconst defaultVaultConnectorType = engineCore.getRegisteredInstanceType(\"vaultConnector\");\n\tconst vaultConnector = VaultConnectorFactory.get(defaultVaultConnectorType);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-verification-method-import.labels.importing\")\n\t);\n\tCLIDisplay.spinnerStart();\n\n\tlet verificationMethodId = params.verificationMethodId;\n\tif (verificationMethodId.includes(\"#\")) {\n\t\tconst parts = DocumentHelper.parseId(verificationMethodId);\n\t\tif (Is.stringValue(parts.fragment)) {\n\t\t\tverificationMethodId = parts.fragment;\n\t\t}\n\t}\n\n\tlet vaultKey;\n\tconst vaultKeyId = `${params.identity}/${verificationMethodId}`;\n\n\ttry {\n\t\tvaultKey = await vaultConnector.getKey(vaultKeyId);\n\t} catch {}\n\n\tif (Is.empty(vaultKey)) {\n\t\tconst privateKeyBytes = Converter.hexToBytes(HexHelper.stripPrefix(params.privateKeyHex));\n\t\tconst publicKeyBytes = Ed25519.publicKeyFromPrivateKey(privateKeyBytes);\n\t\tvaultKey = await vaultConnector.addKey(\n\t\t\tvaultKeyId,\n\t\t\tVaultKeyType.Ed25519,\n\t\t\tprivateKeyBytes,\n\t\t\tpublicKeyBytes\n\t\t);\n\t}\n\n\tawait identityConnector.addVerificationMethod(\n\t\tparams.controller ?? params.identity,\n\t\tparams.identity,\n\t\tparams.verificationMethodType as DidVerificationMethodType,\n\t\tverificationMethodId\n\t);\n\n\tCLIDisplay.spinnerStop();\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-verification-method-import.labels.imported\")\n\t);\n\tCLIDisplay.break();\n\n\tCLIDisplay.done();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"identityVerificationMethodImport.js","sourceRoot":"","sources":["../../../src/commands/identityVerificationMethodImport.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EACN,GAAG,EACH,cAAc,EACd,wBAAwB,EACxB,gCAAgC,EAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM7E,MAAM,YAAY,GAAG,qCAAqC,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,oDAAoD,CAAC,kBAEpE;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAC9B,mEAAmE,CACnE;QACD,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,+DAA+D,CAAC;QAC5F,oBAA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AiB,CAAC,qBAAqB,CAC5C,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EACpC,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,sBAAmD,EAC1D,oBAAoB,CACpB,CAAC;IAEF,UAAU,CAAC,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,IAAI,CACd,IAAI,CAAC,aAAa,CAAC,uEAAuE,CAAC,CAC3F,CAAC;IACF,UAAU,CAAC,KAAK,EAAE,CAAC;IAEnB,UAAU,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { Converter, GeneralError, Guards, HexHelper, I18n, Is } from \"@twin.org/core\";\nimport { Ed25519 } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport {\n\tDid,\n\tDocumentHelper,\n\tIdentityConnectorFactory,\n\tIdentityResolverConnectorFactory\n} from \"@twin.org/identity-models\";\nimport { DidVerificationMethodType } from \"@twin.org/standards-w3c-did\";\nimport { VaultConnectorFactory, VaultKeyType } from \"@twin.org/vault-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"identity-verification-method-import\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionIdentityVerificationMethodImport(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\n\t\t\t\"node.cli.commands.identity-verification-method-import.description\"\n\t\t),\n\t\texample: I18n.formatMessage(\"node.cli.commands.identity-verification-method-import.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresTenantId: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.identity.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"controller\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.controller.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"verification-method-type\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.verification-method-type.description\"\n\t\t\t\t),\n\t\t\t\toptions: Object.values(DidVerificationMethodType),\n\t\t\t\trequired: true,\n\t\t\t\tdefaultValue: \"assertionMethod\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"verification-method-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.verification-method-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"private-key-hex\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.private-key-hex.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.identity-verification-method-import.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) =>\n\t\t\tidentityVerificationMethodImport(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating an identity verification method.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.identity The DID of the identity to create.\n * @param params.verificationMethodType The type of verification method to create.\n * @param params.verificationMethodId The ID of the verification method to create.\n * @param params.controller The controller DID for the identity.\n * @param params.privateKeyHex The private key in hex format.\n */\nexport async function identityVerificationMethodImport(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: INodeEnvironmentVariables,\n\tparams: {\n\t\tidentity?: string;\n\t\tverificationMethodType?: DidVerificationMethodType;\n\t\tverificationMethodId?: string;\n\t\tcontroller?: string;\n\t\tprivateKeyHex?: string;\n\t}\n): Promise<void> {\n\tDid.guard(\"identityVerificationMethodImport\", \"identity\", params.identity);\n\tGuards.arrayOneOf(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"verification-method-type\",\n\t\tparams.verificationMethodType,\n\t\tObject.values(DidVerificationMethodType)\n\t);\n\tGuards.stringValue(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"verification-method-id\",\n\t\tparams.verificationMethodId\n\t);\n\tGuards.stringHex(\n\t\t\"identityVerificationMethodImport\",\n\t\t\"private-key-hex\",\n\t\tparams.privateKeyHex,\n\t\ttrue\n\t);\n\tconst defaultIdentityConnectorType = engineCore.getRegisteredInstanceType(\"identityConnector\");\n\tconst identityConnector = IdentityConnectorFactory.get(defaultIdentityConnectorType);\n\n\tconst defaultIdentityResolverConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityResolverConnector\"\n\t);\n\n\tconst identityResolverConnector = IdentityResolverConnectorFactory.get(\n\t\tdefaultIdentityResolverConnectorType\n\t);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\n\t\t\t\"node.cli.commands.identity-verification-method-import.labels.resolvingIdentity\"\n\t\t)\n\t);\n\tconst identityDocument = await identityResolverConnector.resolveDocument(params.identity);\n\n\tif (Is.empty(identityDocument)) {\n\t\tthrow new GeneralError(\"identityImport\", \"identityNotFound\", {\n\t\t\tidentity: params.identity\n\t\t});\n\t}\n\n\tconst defaultVaultConnectorType = engineCore.getRegisteredInstanceType(\"vaultConnector\");\n\tconst vaultConnector = VaultConnectorFactory.get(defaultVaultConnectorType);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-verification-method-import.labels.importing\")\n\t);\n\tCLIDisplay.spinnerStart();\n\n\tlet verificationMethodId = params.verificationMethodId;\n\tif (verificationMethodId.includes(\"#\")) {\n\t\tconst parts = DocumentHelper.parseId(verificationMethodId);\n\t\tif (Is.stringValue(parts.fragment)) {\n\t\t\tverificationMethodId = parts.fragment;\n\t\t}\n\t}\n\n\tlet vaultKey;\n\tconst vaultKeyId = `${params.identity}/${verificationMethodId}`;\n\n\ttry {\n\t\tvaultKey = await vaultConnector.getKey(vaultKeyId);\n\t} catch {}\n\n\tif (Is.empty(vaultKey)) {\n\t\tconst privateKeyBytes = Converter.hexToBytes(HexHelper.stripPrefix(params.privateKeyHex));\n\t\tconst publicKeyBytes = Ed25519.publicKeyFromPrivateKey(privateKeyBytes);\n\t\tawait vaultConnector.addKey(vaultKeyId, VaultKeyType.Ed25519, privateKeyBytes, publicKeyBytes);\n\t}\n\n\tawait identityConnector.addVerificationMethod(\n\t\tparams.controller ?? params.identity,\n\t\tparams.identity,\n\t\tparams.verificationMethodType as DidVerificationMethodType,\n\t\tverificationMethodId\n\t);\n\n\tCLIDisplay.spinnerStop();\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"node.cli.commands.identity-verification-method-import.labels.imported\")\n\t);\n\tCLIDisplay.break();\n\n\tCLIDisplay.done();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Does the node have a unique ID, defaults to true.\n\t */\n\tnodeIdentityEnabled?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout.\n\t */\n\tawsDynamodbConnectionTimeoutMs?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreApiEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: number;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: number;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: number;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Blog storage connector which has public access.\n\t */\n\tblobStorageConnectorPublic?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector: entity-storage.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * The type of verifiable storage connector: entity-storage, iota.\n\t */\n\tverifiableStorageConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Is the synchronised storage enabled, defaults to false.\n\t */\n\tsynchronisedStorageEnabled?: string;\n\n\t/**\n\t * Url which points to the api for a trusted synchronised storage node, not required if this is a trusted node.\n\t */\n\tsynchronisedStorageTrustedUrl?: string;\n\n\t/**\n\t * The key for the smart contract which contains the verifiable storage pointer store for synchronised storage.\n\t * This only required if using a custom verifiable storage item, otherwise it will default to the network name.\n\t */\n\tsynchronisedStorageVerifiableStorageKeyId?: string;\n\n\t/**\n\t * The key from the vault which is used to encrypt the synchronised storage blobs.\n\t * Only required for trusted nodes, as regular nodes will request from the trusted nodes.\n\t * Defaults to synchronised-storage-blob-encryption\n\t */\n\tsynchronisedStorageBlobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.\n\t * Only required for trusted nodes, as regular nodes will not write encrypted data.\n\t */\n\tsynchronisedStorageBlobStorageKey?: string;\n\n\t/**\n\t * How often to check for entity updates in minutes.\n\t * @default 5\n\t */\n\tsynchronisedStorageEntityUpdateIntervalMinutes?: string;\n\n\t/**\n\t * Interval to perform consolidation of changesets, only used if this is a trusted node.\n\t * @default 60\n\t */\n\tsynchronisedStorageConsolidationIntervalMinutes?: string;\n\n\t/**\n\t * The number of entities to process in a single consolidation batch, only used if this is a trusted node.\n\t * @default 1000\n\t */\n\tsynchronisedStorageConsolidationBatchSize?: string;\n\n\t/**\n\t * The maximum number of consolidations to keep in storage, only used if this is a trusted node.\n\t * @default 5\n\t */\n\tsynchronisedStorageMaxConsolidations?: string;\n\n\t/**\n\t * Is the federated catalogue enabled, defaults to false.\n\t */\n\tfederatedCatalogueEnabled?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * Is the trust management enabled, defaults to false.\n\t */\n\ttrustEnabled?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtlSeconds?: string;\n\n\t/**\n\t * Is the rights management enabled, defaults to false.\n\t */\n\trightsManagementEnabled?: string;\n\n\t/**\n\t * What is the callback path for rights management negotiations, will be combined with hosting public url e.g. /callback.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Are background tasks enabled, defaults to false.\n\t */\n\tbackgroundTasksEnabled?: string;\n\n\t/**\n\t * Is the task scheduler enabled, defaults to false.\n\t */\n\ttaskSchedulerEnabled?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in minutes, set to -1 to keep forever.\n\t * @default 10\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval for cleaning up the activity logs.\n\t * @default 60\n\t */\n\tdataspaceActivityLogsCleanUpInterval?: string;\n\n\t/**\n\t * The data plane path for PULL transfers (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * Required if PULL transfers should be supported.\n\t * Example: \"dataspace/entities\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Are the automation components enabled, defaults to false.\n\t */\n\tautomationEnabled?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * Is the url transformer enabled, defaults to false.\n\t */\n\turlTransformerEnabled?: string;\n\n\t/**\n\t * The id of the key in the vault to use for encrypting parameters in url transformer.\n\t */\n\turlTransformerEncryptionKeyId?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Does the node have a unique ID, defaults to true.\n\t */\n\tnodeIdentityEnabled?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout.\n\t */\n\tawsDynamodbConnectionTimeoutMs?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreApiEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: number;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: number;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: number;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Blog storage connector which has public access.\n\t */\n\tblobStorageConnectorPublic?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector: entity-storage.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry meter to use, only required if using open-telemetry as telemetry connector, defaults to twin-node.\n\t */\n\topenTelemetryMeterName?: string;\n\n\t/**\n\t * The version of the Open Telemetry metrics specification to use, only required if using open-telemetry as telemetry connector, defaults to 1.0.0.\n\t */\n\topenTelemetryMeterVersion?: string;\n\n\t/**\n\t * The type of Open Telemetry metric reader to use, only required if using open-telemetry as telemetry connector, values: prometheus.\n\t */\n\topenTelemetryReader?: string;\n\n\t/**\n\t * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.\n\t */\n\topenTelemetryPrometheusPort?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * The type of verifiable storage connector: entity-storage, iota.\n\t */\n\tverifiableStorageConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Is the synchronised storage enabled, defaults to false.\n\t */\n\tsynchronisedStorageEnabled?: string;\n\n\t/**\n\t * Url which points to the api for a trusted synchronised storage node, not required if this is a trusted node.\n\t */\n\tsynchronisedStorageTrustedUrl?: string;\n\n\t/**\n\t * The key for the smart contract which contains the verifiable storage pointer store for synchronised storage.\n\t * This only required if using a custom verifiable storage item, otherwise it will default to the network name.\n\t */\n\tsynchronisedStorageVerifiableStorageKeyId?: string;\n\n\t/**\n\t * The key from the vault which is used to encrypt the synchronised storage blobs.\n\t * Only required for trusted nodes, as regular nodes will request from the trusted nodes.\n\t * Defaults to synchronised-storage-blob-encryption\n\t */\n\tsynchronisedStorageBlobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.\n\t * Only required for trusted nodes, as regular nodes will not write encrypted data.\n\t */\n\tsynchronisedStorageBlobStorageKey?: string;\n\n\t/**\n\t * How often to check for entity updates in minutes.\n\t * @default 5\n\t */\n\tsynchronisedStorageEntityUpdateIntervalMinutes?: string;\n\n\t/**\n\t * Interval to perform consolidation of changesets, only used if this is a trusted node.\n\t * @default 60\n\t */\n\tsynchronisedStorageConsolidationIntervalMinutes?: string;\n\n\t/**\n\t * The number of entities to process in a single consolidation batch, only used if this is a trusted node.\n\t * @default 1000\n\t */\n\tsynchronisedStorageConsolidationBatchSize?: string;\n\n\t/**\n\t * The maximum number of consolidations to keep in storage, only used if this is a trusted node.\n\t * @default 5\n\t */\n\tsynchronisedStorageMaxConsolidations?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtlSeconds?: string;\n\n\t/**\n\t * Path under which the rights management service is mounted (single source\n\t * of truth). The same value drives:\n\t * - the server route mount (via engine config)\n\t * - the PNP service's callback URL builder (`buildCallbackUrl`)\n\t * - the PNP rest-client's pathPrefix (consumer side)\n\t * Defaults to `rights-management`. Set when deploying behind a reverse proxy\n\t * with path rewriting, K8s ingress with path-based routing, or any custom\n\t * mount point.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in minutes, set to -1 to keep forever.\n\t * @default 10\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval for cleaning up the activity logs.\n\t * @default 60\n\t */\n\tdataspaceActivityLogsCleanUpInterval?: string;\n\n\t/**\n\t * The data plane path for PULL transfers (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * Required if PULL transfers should be supported.\n\t * Example: \"dataspace/entities\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks, defaults to 60.\n\t */\n\thealthIntervalSeconds?: string;\n\n\t/**\n\t * The id of the key in the vault to use for encrypting parameters in url transformer.\n\t */\n\turlTransformerEncryptionKeyId?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineEnvironmentVariables } from \"./IEngineEnvironmentVariables.js\";\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables extends IEngineEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineEnvironmentVariables } from \"./IEngineEnvironmentVariables.js\";\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables extends IEngineEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * The id of the key in the vault to use for encrypting hosting parameters in auth operations.\n\t */\n\thostingParamEncryptionKeyId?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n}\n"]}
|
package/dist/es/node.js
CHANGED
|
@@ -28,7 +28,7 @@ export async function run(nodeOptions, args) {
|
|
|
28
28
|
nodeOptions ??= {};
|
|
29
29
|
const serverInfo = {
|
|
30
30
|
name: nodeOptions?.serverName ?? "TWIN Node",
|
|
31
|
-
version: nodeOptions?.serverVersion ?? "0.0.3-next.
|
|
31
|
+
version: nodeOptions?.serverVersion ?? "0.0.3-next.36" // x-release-please-version
|
|
32
32
|
};
|
|
33
33
|
CLIDisplay.header(serverInfo.name, serverInfo.version, "đŠī¸ ");
|
|
34
34
|
if (!Is.stringValue(nodeOptions?.executionDirectory)) {
|
|
@@ -160,7 +160,11 @@ export async function buildConfiguration(processEnv, options, serverInfo) {
|
|
|
160
160
|
throw output.error;
|
|
161
161
|
}
|
|
162
162
|
if (Is.objectValue(output.parsed)) {
|
|
163
|
-
Object.
|
|
163
|
+
for (const [key, value] of Object.entries(output.parsed)) {
|
|
164
|
+
// Only set environment variables that are not already set in
|
|
165
|
+
// the process environment or provided via options.envVars
|
|
166
|
+
processEnv[key] ??= value;
|
|
167
|
+
}
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
const envVars = EnvHelper.envToJson(processEnv, options.envPrefix ?? "");
|