@twin.org/node-core 0.0.2-next.9 → 0.0.3-next.10

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.
Files changed (195) hide show
  1. package/README.md +1 -1
  2. package/dist/es/builders/engineEnvBuilder.js +1132 -0
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -0
  4. package/dist/es/builders/engineServerEnvBuilder.js +206 -0
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -0
  6. package/dist/es/builders/extensionsBuilder.js +109 -0
  7. package/dist/es/builders/extensionsBuilder.js.map +1 -0
  8. package/dist/es/cli.js +255 -0
  9. package/dist/es/cli.js.map +1 -0
  10. package/dist/es/commands/bootstrapLegacy.js +175 -0
  11. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  12. package/dist/es/commands/help.js +85 -0
  13. package/dist/es/commands/help.js.map +1 -0
  14. package/dist/es/commands/identityCreate.js +310 -0
  15. package/dist/es/commands/identityCreate.js.map +1 -0
  16. package/dist/es/commands/identityImports.js +76 -0
  17. package/dist/es/commands/identityImports.js.map +1 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js +140 -0
  19. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js +208 -0
  21. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js +120 -0
  23. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  24. package/dist/es/commands/nodeSetIdentity.js +51 -0
  25. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  26. package/dist/es/commands/nodeSetTenant.js +49 -0
  27. package/dist/es/commands/nodeSetTenant.js.map +1 -0
  28. package/dist/es/commands/tenantCreate.js +120 -0
  29. package/dist/es/commands/tenantCreate.js.map +1 -0
  30. package/dist/es/commands/tenantImport.js +78 -0
  31. package/dist/es/commands/tenantImport.js.map +1 -0
  32. package/dist/es/commands/userCreate.js +197 -0
  33. package/dist/es/commands/userCreate.js.map +1 -0
  34. package/dist/es/commands/vaultKeyCreate.js +185 -0
  35. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  36. package/dist/es/commands/vaultKeyImport.js +98 -0
  37. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  38. package/dist/es/defaults.js +28 -0
  39. package/dist/es/defaults.js.map +1 -0
  40. package/dist/es/index.js +27 -0
  41. package/dist/es/index.js.map +1 -0
  42. package/dist/es/models/ICacheMetadata.js +4 -0
  43. package/dist/es/models/ICacheMetadata.js.map +1 -0
  44. package/dist/es/models/ICliArgs.js +4 -0
  45. package/dist/es/models/ICliArgs.js.map +1 -0
  46. package/dist/es/models/ICliCommand.js +2 -0
  47. package/dist/es/models/ICliCommand.js.map +1 -0
  48. package/dist/es/models/ICliCommandDefinition.js +2 -0
  49. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  50. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  51. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  52. package/dist/es/models/IEngineEnvironmentVariables.js +4 -0
  53. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -0
  54. package/dist/es/models/IEngineServerEnvironmentVariables.js +2 -0
  55. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -0
  56. package/dist/es/models/IModuleProtocol.js +2 -0
  57. package/dist/es/models/IModuleProtocol.js.map +1 -0
  58. package/dist/es/models/INodeEngineConfig.js +2 -0
  59. package/dist/es/models/INodeEngineConfig.js.map +1 -0
  60. package/dist/es/models/INodeEngineState.js +2 -0
  61. package/dist/es/models/INodeEngineState.js.map +1 -0
  62. package/dist/es/models/INodeEnvironmentVariables.js +2 -0
  63. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -0
  64. package/dist/es/models/INodeOptions.js +2 -0
  65. package/dist/es/models/INodeOptions.js.map +1 -0
  66. package/dist/es/models/IProtocolHandlerResult.js +4 -0
  67. package/dist/es/models/IProtocolHandlerResult.js.map +1 -0
  68. package/dist/es/models/cliCommandParamType.js +4 -0
  69. package/dist/es/models/cliCommandParamType.js.map +1 -0
  70. package/dist/es/models/moduleProtocol.js +29 -0
  71. package/dist/es/models/moduleProtocol.js.map +1 -0
  72. package/dist/es/models/nodeExtensionMethods.js +2 -0
  73. package/dist/es/models/nodeExtensionMethods.js.map +1 -0
  74. package/dist/es/node.js +285 -0
  75. package/dist/es/node.js.map +1 -0
  76. package/dist/es/start.js +128 -0
  77. package/dist/es/start.js.map +1 -0
  78. package/dist/es/utils.js +397 -0
  79. package/dist/es/utils.js.map +1 -0
  80. package/dist/types/builders/engineEnvBuilder.d.ts +6 -2
  81. package/dist/types/builders/engineServerEnvBuilder.d.ts +7 -3
  82. package/dist/types/builders/extensionsBuilder.d.ts +32 -0
  83. package/dist/types/cli.d.ts +66 -0
  84. package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
  85. package/dist/types/commands/help.d.ts +23 -0
  86. package/dist/types/commands/identityCreate.d.ts +39 -0
  87. package/dist/types/commands/identityImports.d.ts +24 -0
  88. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  89. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  90. package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
  91. package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
  92. package/dist/types/commands/nodeSetTenant.d.ts +22 -0
  93. package/dist/types/commands/tenantCreate.d.ts +35 -0
  94. package/dist/types/commands/tenantImport.d.ts +24 -0
  95. package/dist/types/commands/userCreate.d.ts +46 -0
  96. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  97. package/dist/types/commands/vaultKeyImport.d.ts +28 -0
  98. package/dist/types/defaults.d.ts +16 -0
  99. package/dist/types/index.d.ts +24 -11
  100. package/dist/types/models/ICacheMetadata.d.ts +17 -0
  101. package/dist/types/models/ICliArgs.d.ts +20 -0
  102. package/dist/types/models/ICliCommand.d.ts +17 -0
  103. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  104. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  105. package/dist/types/models/IEngineEnvironmentVariables.d.ts +154 -37
  106. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +12 -3
  107. package/dist/types/models/IModuleProtocol.d.ts +18 -0
  108. package/dist/types/models/INodeEngineConfig.d.ts +6 -0
  109. package/dist/types/models/INodeEngineState.d.ts +14 -0
  110. package/dist/types/models/INodeEnvironmentVariables.d.ts +17 -15
  111. package/dist/types/models/INodeOptions.d.ts +14 -3
  112. package/dist/types/models/IProtocolHandlerResult.d.ts +13 -0
  113. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  114. package/dist/types/models/moduleProtocol.d.ts +29 -0
  115. package/dist/types/models/nodeExtensionMethods.d.ts +27 -0
  116. package/dist/types/node.d.ts +21 -7
  117. package/dist/types/start.d.ts +25 -0
  118. package/dist/types/utils.d.ts +83 -6
  119. package/docs/changelog.md +241 -0
  120. package/docs/detailed-guide.md +129 -0
  121. package/docs/reference/functions/buildConfiguration.md +2 -2
  122. package/docs/reference/functions/buildEngineConfiguration.md +8 -2
  123. package/docs/reference/functions/buildEngineServerConfiguration.md +9 -3
  124. package/docs/reference/functions/constructCliCommand.md +27 -0
  125. package/docs/reference/functions/createModuleImportUrl.md +21 -0
  126. package/docs/reference/functions/directoryExists.md +19 -0
  127. package/docs/reference/functions/executeCommand.md +29 -0
  128. package/docs/reference/functions/extensionsConfiguration.md +25 -0
  129. package/docs/reference/functions/extensionsInitialiseEngine.md +25 -0
  130. package/docs/reference/functions/extensionsInitialiseEngineServer.md +31 -0
  131. package/docs/reference/functions/getEnvDefaults.md +19 -0
  132. package/docs/reference/functions/getExtensionsCacheDir.md +31 -0
  133. package/docs/reference/functions/getFiles.md +19 -0
  134. package/docs/reference/functions/getSubFolders.md +19 -0
  135. package/docs/reference/functions/handleHttpsProtocol.md +49 -0
  136. package/docs/reference/functions/handleNpmProtocol.md +31 -0
  137. package/docs/reference/functions/hashUrl.md +19 -0
  138. package/docs/reference/functions/initCli.md +27 -0
  139. package/docs/reference/functions/isCacheExpired.md +31 -0
  140. package/docs/reference/functions/overrideModuleImport.md +8 -2
  141. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  142. package/docs/reference/functions/parseModuleProtocol.md +19 -0
  143. package/docs/reference/functions/processEnvOptions.md +27 -0
  144. package/docs/reference/functions/registerCommands.md +9 -0
  145. package/docs/reference/functions/resolvePackageEntryPoint.md +32 -0
  146. package/docs/reference/functions/run.md +9 -3
  147. package/docs/reference/functions/shutdownExtensions.md +25 -0
  148. package/docs/reference/functions/start.md +17 -5
  149. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  150. package/docs/reference/index.md +47 -10
  151. package/docs/reference/interfaces/ICacheMetadata.md +27 -0
  152. package/docs/reference/interfaces/ICliArgs.md +35 -0
  153. package/docs/reference/interfaces/ICliCommand.md +23 -0
  154. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  155. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  156. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +303 -60
  157. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +1737 -5
  158. package/docs/reference/interfaces/IModuleProtocol.md +27 -0
  159. package/docs/reference/interfaces/INodeEngineConfig.md +7 -0
  160. package/docs/reference/interfaces/INodeEngineState.md +23 -0
  161. package/docs/reference/interfaces/INodeEnvironmentVariables.md +599 -198
  162. package/docs/reference/interfaces/INodeOptions.md +27 -3
  163. package/docs/reference/interfaces/IProtocolHandlerResult.md +19 -0
  164. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  165. package/docs/reference/type-aliases/ModuleProtocol.md +5 -0
  166. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +18 -0
  167. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +24 -0
  168. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +23 -0
  169. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +10 -0
  170. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +3 -0
  171. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +3 -0
  172. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  173. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +3 -0
  174. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +3 -0
  175. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +3 -0
  176. package/docs/reference/variables/ModuleProtocol.md +37 -0
  177. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  178. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +3 -0
  179. package/locales/en.json +479 -28
  180. package/package.json +29 -9
  181. package/dist/cjs/index.cjs +0 -1910
  182. package/dist/esm/index.mjs +0 -1870
  183. package/dist/types/bootstrap.d.ts +0 -59
  184. package/dist/types/models/nodeFeatures.d.ts +0 -21
  185. package/dist/types/server.d.ts +0 -17
  186. package/docs/reference/functions/bootstrap.md +0 -29
  187. package/docs/reference/functions/bootstrapAuth.md +0 -35
  188. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  189. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  190. package/docs/reference/functions/bootstrapNodeIdentity.md +0 -35
  191. package/docs/reference/functions/bootstrapNodeUser.md +0 -35
  192. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  193. package/docs/reference/functions/getFeatures.md +0 -19
  194. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  195. package/docs/reference/variables/NodeFeatures.md +0 -25
@@ -0,0 +1,23 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
4
+ /**
5
+ * Get the command definition parameters.
6
+ * @param commandDefinitions The registered command definitions.
7
+ */
8
+ export declare function getCommandDefinitionHelp(commandDefinitions: {
9
+ [id: string]: ICliCommandDefinition;
10
+ }): void;
11
+ /**
12
+ * Command for displaying help information.
13
+ * @param engineCore The engine core.
14
+ * @param envVars The environment variables for the node.
15
+ * @param params The command parameters.
16
+ * @param params.command The command to display help for.
17
+ * @param commandDefinitions The registered command definitions.
18
+ */
19
+ export declare function help(engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
20
+ command?: string;
21
+ }, commandDefinitions: {
22
+ [id: string]: ICliCommandDefinition;
23
+ }): Promise<void>;
@@ -0,0 +1,39 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionIdentityCreate(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for creating an identity.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.mnemonic The mnemonic to use for the identity.
19
+ * @param params.identity The DID of the identity to create.
20
+ * @param params.controller The controller DID for the identity.
21
+ * @param params.fundWallet Whether to fund the wallet associated with the identity from a faucet.
22
+ * @param params.outputJson The output .json file to store the command output.
23
+ * @param params.outputEnv The output .env file to store the command output.
24
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
25
+ * @returns The identity details.
26
+ */
27
+ export declare function identityCreate(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
28
+ mnemonic?: string;
29
+ identity?: string;
30
+ controller?: string;
31
+ fundWallet?: boolean;
32
+ outputJson?: string;
33
+ outputEnv?: string;
34
+ outputEnvPrefix?: string;
35
+ }): Promise<{
36
+ mnemonic: string;
37
+ did: string;
38
+ walletAddress?: string;
39
+ }>;
@@ -0,0 +1,24 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionIdentityImport(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for importing an identity.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.identity The DID of the identity to import.
19
+ * @param params.mnemonic The mnemonic to use for the identity.
20
+ */
21
+ export declare function identityImport(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
22
+ identity?: string;
23
+ mnemonic?: string;
24
+ }): Promise<void>;
@@ -0,0 +1,43 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
3
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
4
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
5
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
6
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
7
+ /**
8
+ * Get the command definition parameters.
9
+ * @param commandDefinitions The registered command definitions.
10
+ */
11
+ export declare function getCommandDefinitionIdentityVerifiableCredentialCreate(commandDefinitions: {
12
+ [id: string]: ICliCommandDefinition;
13
+ }): void;
14
+ /**
15
+ * Command for creating an identity verifiable credential.
16
+ * @param engineCore The engine core.
17
+ * @param envVars The environment variables for the node.
18
+ * @param params The parameters for the command.
19
+ * @param params.verificationMethodId The ID of the verification method to create the credential with.
20
+ * @param params.identity The DID of the identity to create the credential for.
21
+ * @param params.controller The controller DID for the identity.
22
+ * @param params.subjectJson The subject JSON file for the verifiable credential.
23
+ * @param params.credentialId The ID of the verifiable credential.
24
+ * @param params.expirationDate The expiration date of the verifiable credential.
25
+ * @param params.outputJson The output .json file to store the command output.
26
+ * @param params.outputEnv The output .env file to store the command output.
27
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
28
+ * @returns The created verifiable credential and JWT.
29
+ */
30
+ export declare function identityVerifiableCredentialCreate(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
31
+ verificationMethodId?: string;
32
+ identity?: string;
33
+ controller?: string;
34
+ subjectJson?: string;
35
+ credentialId?: string;
36
+ expirationDate?: string;
37
+ outputJson?: string;
38
+ outputEnv?: string;
39
+ outputEnvPrefix?: string;
40
+ }): Promise<{
41
+ verifiableCredential: IDidVerifiableCredential;
42
+ jwt: string;
43
+ }>;
@@ -0,0 +1,47 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import { DidVerificationMethodType } from "@twin.org/standards-w3c-did";
3
+ import { type IJwk } from "@twin.org/web";
4
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
5
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
6
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
7
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
8
+ /**
9
+ * Get the command definition parameters.
10
+ * @param commandDefinitions The registered command definitions.
11
+ */
12
+ export declare function getCommandDefinitionIdentityVerificationMethodCreate(commandDefinitions: {
13
+ [id: string]: ICliCommandDefinition;
14
+ }): void;
15
+ /**
16
+ * Command for creating an identity verification method.
17
+ * @param engineCore The engine core.
18
+ * @param envVars The environment variables for the node.
19
+ * @param params The parameters for the command.
20
+ * @param params.identity The DID of the identity to create.
21
+ * @param params.verificationMethodType The type of verification method to create.
22
+ * @param params.verificationMethodId The ID of the verification method to create.
23
+ * @param params.controller The controller DID for the identity.
24
+ * @param params.overwriteMode The mode to use when a verification method with the same ID already exists.
25
+ * @param params.outputJson The output .json file to store the command output.
26
+ * @param params.outputEnv The output .env file to store the command output.
27
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
28
+ * @returns The created verification method details or undefined if skipped.
29
+ */
30
+ export declare function identityVerificationMethodCreate(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
31
+ identity?: string;
32
+ verificationMethodType?: DidVerificationMethodType;
33
+ verificationMethodId?: string;
34
+ controller?: string;
35
+ overwriteMode?: "skip" | "overwrite" | "error";
36
+ outputJson?: string;
37
+ outputEnv?: string;
38
+ outputEnvPrefix?: string;
39
+ }): Promise<{
40
+ verificationMethodId: string;
41
+ verificationMethodType: string;
42
+ privateKeyJwk: IJwk;
43
+ privateKeyHex: string;
44
+ publicKeyHex: string;
45
+ privateKeyBase64: string;
46
+ publicKeyBase64: string;
47
+ } | undefined>;
@@ -0,0 +1,31 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import { DidVerificationMethodType } from "@twin.org/standards-w3c-did";
3
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
4
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
5
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
6
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
7
+ /**
8
+ * Get the command definition parameters.
9
+ * @param commandDefinitions The registered command definitions.
10
+ */
11
+ export declare function getCommandDefinitionIdentityVerificationMethodImport(commandDefinitions: {
12
+ [id: string]: ICliCommandDefinition;
13
+ }): void;
14
+ /**
15
+ * Command for creating an identity verification method.
16
+ * @param engineCore The engine core.
17
+ * @param envVars The environment variables for the node.
18
+ * @param params The parameters for the command.
19
+ * @param params.identity The DID of the identity to create.
20
+ * @param params.verificationMethodType The type of verification method to create.
21
+ * @param params.verificationMethodId The ID of the verification method to create.
22
+ * @param params.controller The controller DID for the identity.
23
+ * @param params.privateKeyHex The private key in hex format.
24
+ */
25
+ export declare function identityVerificationMethodImport(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
26
+ identity?: string;
27
+ verificationMethodType?: DidVerificationMethodType;
28
+ verificationMethodId?: string;
29
+ controller?: string;
30
+ privateKeyHex?: string;
31
+ }): Promise<void>;
@@ -0,0 +1,22 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionNodeSetIdentity(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for setting a node identity.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.identity The DID to set for the node.
19
+ */
20
+ export declare function nodeSetIdentity(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
21
+ identity?: string;
22
+ }): Promise<void>;
@@ -0,0 +1,22 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionNodeSetTenant(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for setting a node tenant.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.tenantId The tenant id to set for the node.
19
+ */
20
+ export declare function nodeSetTenant(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
21
+ tenantId?: string;
22
+ }): Promise<void>;
@@ -0,0 +1,35 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
4
+ /**
5
+ * Get the command definition parameters.
6
+ * @param commandDefinitions The registered command definitions.
7
+ */
8
+ export declare function getCommandDefinitionTenantCreate(commandDefinitions: {
9
+ [id: string]: ICliCommandDefinition;
10
+ }): void;
11
+ /**
12
+ * Command for creating a tenant.
13
+ * @param engineCore The engine core.
14
+ * @param envVars The environment variables for the node.
15
+ * @param params The parameters for the command.
16
+ * @param params.apiKey The api key to add.
17
+ * @param params.tenantId The tenant ID to add the api key to.
18
+ * @param params.label The label for the api key.
19
+ * @param params.outputJson The output .json file to store the command output.
20
+ * @param params.outputEnv The output .env file to store the command output.
21
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
22
+ * @returns The created tenant details.
23
+ */
24
+ export declare function tenantCreate(engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
25
+ apiKey?: string;
26
+ tenantId?: string;
27
+ label?: string;
28
+ outputJson?: string;
29
+ outputEnv?: string;
30
+ outputEnvPrefix?: string;
31
+ }): Promise<{
32
+ apiKey: string;
33
+ tenantId: string;
34
+ label: string;
35
+ }>;
@@ -0,0 +1,24 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
4
+ /**
5
+ * Get the command definition parameters.
6
+ * @param commandDefinitions The registered command definitions.
7
+ */
8
+ export declare function getCommandDefinitionTenantImport(commandDefinitions: {
9
+ [id: string]: ICliCommandDefinition;
10
+ }): void;
11
+ /**
12
+ * Command for importing a tenant.
13
+ * @param engineCore The engine core.
14
+ * @param envVars The environment variables for the node.
15
+ * @param params The parameters for the command.
16
+ * @param params.apiKey The api key to import.
17
+ * @param params.tenantId The tenant ID to import the api key to.
18
+ * @param params.label The label for the api key.
19
+ */
20
+ export declare function tenantImport(engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
21
+ apiKey?: string;
22
+ tenantId?: string;
23
+ label?: string;
24
+ }): Promise<void>;
@@ -0,0 +1,46 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
4
+ /**
5
+ * Get the command definition parameters.
6
+ * @param commandDefinitions The registered command definitions.
7
+ */
8
+ export declare function getCommandDefinitionUserCreate(commandDefinitions: {
9
+ [id: string]: ICliCommandDefinition;
10
+ }): void;
11
+ /**
12
+ * Command for creating a user.
13
+ * @param engineCore The engine core.
14
+ * @param envVars The environment variables for the node.
15
+ * @param params The parameters for the command.
16
+ * @param params.userIdentity The DID for the user.
17
+ * @param params.organizationIdentity The organization DID for the user.
18
+ * @param params.email The email for the user.
19
+ * @param params.password The password for the user.
20
+ * @param params.givenName The given name for the user.
21
+ * @param params.familyName The family name for the user.
22
+ * @param params.overwriteMode The mode to use when a user with the same identity already exists.
23
+ * @param params.outputJson The output .json file to store the command output.
24
+ * @param params.outputEnv The output .env file to store the command output.
25
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
26
+ * @returns The created user details or undefined if skipped.
27
+ */
28
+ export declare function userCreate(engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
29
+ userIdentity?: string;
30
+ organizationIdentity?: string;
31
+ email?: string;
32
+ password?: string;
33
+ givenName?: string;
34
+ familyName?: string;
35
+ overwriteMode?: "skip" | "overwrite" | "error";
36
+ outputJson?: string;
37
+ outputEnv?: string;
38
+ outputEnvPrefix?: string;
39
+ }): Promise<{
40
+ did: string;
41
+ organizationDid: string;
42
+ email: string;
43
+ password: string;
44
+ givenName: string;
45
+ familyName: string;
46
+ } | undefined>;
@@ -0,0 +1,43 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionVaultKeyCreate(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for creating a vault key.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.identity The DID to create the vault key for.
19
+ * @param params.keyId The ID of the key to create.
20
+ * @param params.keyType The type of key to create.
21
+ * @param params.overwriteMode The mode to use when a user with the same identity already exists.
22
+ * @param params.outputJson The output .json file to store the command output.
23
+ * @param params.outputEnv The output .env file to store the command output.
24
+ * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.
25
+ * @returns The created vault key details or undefined if skipped.
26
+ */
27
+ export declare function vaultKeyCreate(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
28
+ identity?: string;
29
+ keyType?: string;
30
+ keyId?: string;
31
+ overwriteMode?: "skip" | "overwrite" | "error";
32
+ outputJson?: string;
33
+ outputEnv?: string;
34
+ outputEnvPrefix?: string;
35
+ }): Promise<{
36
+ identity: string;
37
+ keyId: string;
38
+ keyType?: string;
39
+ privateKeyBase64?: string;
40
+ publicKeyBase64?: string;
41
+ privateKeyHex?: string;
42
+ publicKeyHex?: string;
43
+ } | undefined>;
@@ -0,0 +1,28 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig.js";
4
+ import type { INodeEngineState } from "../models/INodeEngineState.js";
5
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
6
+ /**
7
+ * Get the command definition parameters.
8
+ * @param commandDefinitions The registered command definitions.
9
+ */
10
+ export declare function getCommandDefinitionVaultKeyImport(commandDefinitions: {
11
+ [id: string]: ICliCommandDefinition;
12
+ }): void;
13
+ /**
14
+ * Command for importing a vault key.
15
+ * @param engineCore The engine core.
16
+ * @param envVars The environment variables for the node.
17
+ * @param params The parameters for the command.
18
+ * @param params.identity The DID to create the vault key for.
19
+ * @param params.keyId The ID of the key to create.
20
+ * @param params.keyType The type of key to create.
21
+ * @param params.privateKeyHex The private key in hexadecimal format.
22
+ */
23
+ export declare function vaultKeyImport(engineCore: IEngineCore<INodeEngineConfig, INodeEngineState>, envVars: INodeEnvironmentVariables, params: {
24
+ identity?: string;
25
+ keyType?: string;
26
+ keyId?: string;
27
+ privateKeyHex?: string;
28
+ }): Promise<void>;
@@ -0,0 +1,16 @@
1
+ export declare const ATTESTATION_VERIFICATION_METHOD_ID = "attestation-assertion";
2
+ export declare const IMMUTABLE_PROOF_VERIFICATION_METHOD_ID = "immutable-proof-assertion";
3
+ export declare const BLOB_STORAGE_ENCRYPTION_KEY_ID = "blob-encryption";
4
+ export declare const SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID = "synchronised-storage-blob-encryption";
5
+ export declare const VC_AUTHENTICATION_VERIFICATION_METHOD_ID = "vc-authentication-assertion";
6
+ export declare const AUTH_SIGNING_KEY_ID = "auth-signing";
7
+ export declare const CONTEXT_ID_HANDLER_FEATURE_DID = "did";
8
+ export declare const CONTEXT_ID_HANDLER_FEATURE_TENANT = "tenant";
9
+ /**
10
+ * Get the default environment variables for the node.
11
+ * @param envPrefix The environment variable prefix.
12
+ * @returns The default environment variables.
13
+ */
14
+ export declare function getEnvDefaults(envPrefix: string): {
15
+ [key: string]: string;
16
+ };
@@ -1,11 +1,24 @@
1
- export * from "./bootstrap";
2
- export * from "./builders/engineEnvBuilder";
3
- export * from "./builders/engineServerEnvBuilder";
4
- export * from "./models/IEngineEnvironmentVariables";
5
- export * from "./models/IEngineServerEnvironmentVariables";
6
- export * from "./models/INodeEnvironmentVariables";
7
- export * from "./models/INodeOptions";
8
- export * from "./models/nodeFeatures";
9
- export * from "./node";
10
- export * from "./server";
11
- export * from "./utils";
1
+ export * from "./builders/engineEnvBuilder.js";
2
+ export * from "./builders/engineServerEnvBuilder.js";
3
+ export * from "./builders/extensionsBuilder.js";
4
+ export * from "./cli.js";
5
+ export * from "./defaults.js";
6
+ export * from "./models/cliCommandParamType.js";
7
+ export * from "./models/ICacheMetadata.js";
8
+ export * from "./models/ICliArgs.js";
9
+ export * from "./models/ICliCommand.js";
10
+ export * from "./models/ICliCommandDefinition.js";
11
+ export * from "./models/ICliCommandDefinitionParam.js";
12
+ export * from "./models/IEngineEnvironmentVariables.js";
13
+ export * from "./models/IEngineServerEnvironmentVariables.js";
14
+ export * from "./models/IModuleProtocol.js";
15
+ export * from "./models/INodeEngineConfig.js";
16
+ export * from "./models/INodeEngineState.js";
17
+ export * from "./models/INodeEnvironmentVariables.js";
18
+ export * from "./models/INodeOptions.js";
19
+ export * from "./models/IProtocolHandlerResult.js";
20
+ export * from "./models/moduleProtocol.js";
21
+ export * from "./models/nodeExtensionMethods.js";
22
+ export * from "./node.js";
23
+ export * from "./start.js";
24
+ export * from "./utils.js";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Metadata for cached HTTPS extensions.
3
+ */
4
+ export interface ICacheMetadata {
5
+ /**
6
+ * Timestamp when the file was downloaded.
7
+ */
8
+ downloadedAt: number;
9
+ /**
10
+ * Original URL of the cached file.
11
+ */
12
+ url: string;
13
+ /**
14
+ * Size of the cached file in bytes.
15
+ */
16
+ size: number;
17
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Command to execute in the CLI.
3
+ */
4
+ export interface ICliArgs {
5
+ /**
6
+ * The path of the node executable.
7
+ */
8
+ nodePath?: string;
9
+ /**
10
+ * The path of the script to execute.
11
+ */
12
+ scriptPath?: string;
13
+ /**
14
+ * The command line options.
15
+ */
16
+ options?: {
17
+ key: string;
18
+ value: string;
19
+ }[];
20
+ }
@@ -0,0 +1,17 @@
1
+ import type { CliCommandParamType } from "./cliCommandParamType.js";
2
+ import type { ICliCommandDefinition } from "./ICliCommandDefinition.js";
3
+ /**
4
+ * Command to execute in the CLI.
5
+ */
6
+ export interface ICliCommand {
7
+ /**
8
+ * The command to execute.
9
+ */
10
+ definition: ICliCommandDefinition;
11
+ /**
12
+ * The params to execute the command with.
13
+ */
14
+ params: {
15
+ [id: string]: CliCommandParamType;
16
+ };
17
+ }
@@ -0,0 +1,46 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ import type { CliCommandParamType } from "./cliCommandParamType.js";
3
+ import type { ICliCommandDefinitionParam } from "./ICliCommandDefinitionParam.js";
4
+ import type { INodeEnvironmentVariables } from "./INodeEnvironmentVariables.js";
5
+ /**
6
+ * Command to execute in the CLI.
7
+ */
8
+ export interface ICliCommandDefinition {
9
+ /**
10
+ * The command name.
11
+ */
12
+ command: string;
13
+ /**
14
+ * The command description.
15
+ */
16
+ description: string;
17
+ /**
18
+ * The example.
19
+ */
20
+ example: string;
21
+ /**
22
+ * The params available for the command.
23
+ */
24
+ params: ICliCommandDefinitionParam[];
25
+ /**
26
+ * The method to execute for the command.
27
+ */
28
+ action: (engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
29
+ [id: string]: CliCommandParamType;
30
+ }) => Promise<unknown>;
31
+ /**
32
+ * Indicates whether the engine needs to be started before executing the command.
33
+ * @default true
34
+ */
35
+ requiresEngineStarted?: boolean;
36
+ /**
37
+ * Indicates whether the engine needs the node identity to be set if configured to use.
38
+ * @default true
39
+ */
40
+ requiresNodeIdentity?: boolean;
41
+ /**
42
+ * Indicates whether the engine needs the tenant id to be set if configured to use.
43
+ * @default true
44
+ */
45
+ requiresTenantId?: boolean;
46
+ }
@@ -0,0 +1,35 @@
1
+ import type { CliCommandParamType } from "./cliCommandParamType.js";
2
+ /**
3
+ * Command param to execute in the CLI.
4
+ */
5
+ export interface ICliCommandDefinitionParam {
6
+ /**
7
+ * The param key.
8
+ */
9
+ key: string;
10
+ /**
11
+ * The param type.
12
+ */
13
+ type: "string" | "number" | "boolean";
14
+ /**
15
+ * Possible options for the param.
16
+ */
17
+ options?: string[];
18
+ /**
19
+ * The extended type e.g. hex etc.
20
+ */
21
+ extendedType?: string;
22
+ /**
23
+ * Whether the param is required.
24
+ * @default true
25
+ */
26
+ required?: boolean;
27
+ /**
28
+ * The default value of the param.
29
+ */
30
+ defaultValue?: CliCommandParamType;
31
+ /**
32
+ * The param description.
33
+ */
34
+ description: string;
35
+ }