@twin.org/node-core 0.0.2-next.4 → 0.0.2-next.5

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.
@@ -485,8 +485,7 @@ async function bootstrapSynchronisedStorage(engineCore, context, envVars, featur
485
485
  await addVerificationMethod(engineCore, context, "synchronised storage", envVars.synchronisedStorageVerificationMethodId);
486
486
  // If this is a trusted node we need to add the blob encryption key pair
487
487
  if (core.Is.stringValue(envVars.synchronisedStorageBlobStorageEncryptionKeyId) &&
488
- core.Is.stringBase64(envVars.synchronisedStorageBlobStoragePrivateKey) &&
489
- core.Is.stringBase64(envVars.synchronisedStorageBlobStoragePublicKey)) {
488
+ core.Is.stringBase64(envVars.synchronisedStorageBlobStorageKey)) {
490
489
  const defaultVaultConnectorType = engineCore.getRegisteredInstanceType("vaultConnector");
491
490
  const vaultConnector = vaultModels.VaultConnectorFactory.get(defaultVaultConnectorType);
492
491
  const keyName = envVars.synchronisedStorageBlobStorageEncryptionKeyId;
@@ -497,7 +496,7 @@ async function bootstrapSynchronisedStorage(engineCore, context, envVars, featur
497
496
  catch { }
498
497
  if (core.Is.empty(existingKey)) {
499
498
  engineCore.logInfo(core.I18n.formatMessage("node.addingSynchronisedStorageBlobEncryptionKey", { keyName }));
500
- await vaultConnector.addKey(keyName, vaultModels.VaultKeyType.Rsa2048, core.Converter.base64ToBytes(envVars.synchronisedStorageBlobStoragePrivateKey), core.Converter.base64ToBytes(envVars.synchronisedStorageBlobStoragePublicKey));
499
+ await vaultConnector.addKey(keyName, vaultModels.VaultKeyType.ChaCha20Poly1305, core.Converter.base64ToBytes(envVars.synchronisedStorageBlobStorageKey));
501
500
  }
502
501
  else {
503
502
  engineCore.logInfo(core.I18n.formatMessage("node.existingSynchronisedStorageBlobEncryptionKey", { keyName }));
@@ -1476,9 +1475,10 @@ function configureDlt(coreConfig, envVars) {
1476
1475
  * @param coreEngineConfig The core engine config.
1477
1476
  * @param serverInfo The server information.
1478
1477
  * @param openApiSpecPath The path to the open api spec.
1478
+ * @param favIconPath The path to the favicon.
1479
1479
  * @returns The the config for the core and the server.
1480
1480
  */
1481
- function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath) {
1481
+ function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath, favIconPath) {
1482
1482
  envVars.authSigningKeyId ??= "auth-signing";
1483
1483
  const webServerOptions = {
1484
1484
  port: core.Coerce.number(envVars.port),
@@ -1505,7 +1505,8 @@ function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, o
1505
1505
  options: {
1506
1506
  config: {
1507
1507
  serverInfo,
1508
- openApiSpecPath
1508
+ openApiSpecPath,
1509
+ favIconPath
1509
1510
  }
1510
1511
  }
1511
1512
  }
@@ -1678,7 +1679,7 @@ async function run(nodeOptions) {
1678
1679
  nodeOptions ??= {};
1679
1680
  const serverInfo = {
1680
1681
  name: nodeOptions?.serverName ?? "TWIN Node Server",
1681
- version: nodeOptions?.serverVersion ?? "0.0.2-next.4" // x-release-please-version
1682
+ version: nodeOptions?.serverVersion ?? "0.0.2-next.5" // x-release-please-version
1682
1683
  };
1683
1684
  console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
1684
1685
  if (!core.Is.stringValue(nodeOptions?.executionDirectory)) {
@@ -1691,13 +1692,21 @@ async function run(nodeOptions) {
1691
1692
  console.info("Locales Directory:", nodeOptions.localesDirectory);
1692
1693
  await initialiseLocales(nodeOptions.localesDirectory);
1693
1694
  if (core.Is.empty(nodeOptions?.openApiSpecFile)) {
1694
- const specFile = path.resolve(path.join(nodeOptions.executionDirectory, "docs", "open-api", "spec.json"));
1695
+ const specFile = path.resolve(path.join(nodeOptions.executionDirectory ?? "", "docs", "open-api", "spec.json"));
1695
1696
  console.info("Default OpenAPI Spec File:", specFile);
1696
1697
  if (await fileExists(specFile)) {
1697
1698
  nodeOptions ??= {};
1698
1699
  nodeOptions.openApiSpecFile = specFile;
1699
1700
  }
1700
1701
  }
1702
+ if (core.Is.empty(nodeOptions?.favIconFile)) {
1703
+ const favIconFile = path.resolve(path.join(nodeOptions.executionDirectory ?? "", "static", "favicon.png"));
1704
+ console.info("Default Favicon File:", favIconFile);
1705
+ if (await fileExists(favIconFile)) {
1706
+ nodeOptions ??= {};
1707
+ nodeOptions.favIconFile = favIconFile;
1708
+ }
1709
+ }
1701
1710
  nodeOptions.envPrefix ??= "TWIN_NODE_";
1702
1711
  console.info("Environment Prefix:", nodeOptions.envPrefix);
1703
1712
  const { engineServerConfig, nodeEnvVars: envVars } = await buildConfiguration(process.env, nodeOptions, serverInfo);
@@ -1767,7 +1776,7 @@ async function buildConfiguration(processEnv, options, serverInfo) {
1767
1776
  }
1768
1777
  // Build the engine configuration from the environment variables.
1769
1778
  const coreConfig = buildEngineConfiguration(envVars);
1770
- const engineServerConfig = buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile);
1779
+ const engineServerConfig = buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile, options?.favIconFile);
1771
1780
  // Merge any custom configuration provided in the options.
1772
1781
  if (core.Is.arrayValue(options?.configFilenames)) {
1773
1782
  for (const configFile of options.configFilenames) {
@@ -464,8 +464,7 @@ async function bootstrapSynchronisedStorage(engineCore, context, envVars, featur
464
464
  await addVerificationMethod(engineCore, context, "synchronised storage", envVars.synchronisedStorageVerificationMethodId);
465
465
  // If this is a trusted node we need to add the blob encryption key pair
466
466
  if (Is.stringValue(envVars.synchronisedStorageBlobStorageEncryptionKeyId) &&
467
- Is.stringBase64(envVars.synchronisedStorageBlobStoragePrivateKey) &&
468
- Is.stringBase64(envVars.synchronisedStorageBlobStoragePublicKey)) {
467
+ Is.stringBase64(envVars.synchronisedStorageBlobStorageKey)) {
469
468
  const defaultVaultConnectorType = engineCore.getRegisteredInstanceType("vaultConnector");
470
469
  const vaultConnector = VaultConnectorFactory.get(defaultVaultConnectorType);
471
470
  const keyName = envVars.synchronisedStorageBlobStorageEncryptionKeyId;
@@ -476,7 +475,7 @@ async function bootstrapSynchronisedStorage(engineCore, context, envVars, featur
476
475
  catch { }
477
476
  if (Is.empty(existingKey)) {
478
477
  engineCore.logInfo(I18n.formatMessage("node.addingSynchronisedStorageBlobEncryptionKey", { keyName }));
479
- await vaultConnector.addKey(keyName, VaultKeyType.Rsa2048, Converter.base64ToBytes(envVars.synchronisedStorageBlobStoragePrivateKey), Converter.base64ToBytes(envVars.synchronisedStorageBlobStoragePublicKey));
478
+ await vaultConnector.addKey(keyName, VaultKeyType.ChaCha20Poly1305, Converter.base64ToBytes(envVars.synchronisedStorageBlobStorageKey));
480
479
  }
481
480
  else {
482
481
  engineCore.logInfo(I18n.formatMessage("node.existingSynchronisedStorageBlobEncryptionKey", { keyName }));
@@ -1455,9 +1454,10 @@ function configureDlt(coreConfig, envVars) {
1455
1454
  * @param coreEngineConfig The core engine config.
1456
1455
  * @param serverInfo The server information.
1457
1456
  * @param openApiSpecPath The path to the open api spec.
1457
+ * @param favIconPath The path to the favicon.
1458
1458
  * @returns The the config for the core and the server.
1459
1459
  */
1460
- function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath) {
1460
+ function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath, favIconPath) {
1461
1461
  envVars.authSigningKeyId ??= "auth-signing";
1462
1462
  const webServerOptions = {
1463
1463
  port: Coerce.number(envVars.port),
@@ -1484,7 +1484,8 @@ function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, o
1484
1484
  options: {
1485
1485
  config: {
1486
1486
  serverInfo,
1487
- openApiSpecPath
1487
+ openApiSpecPath,
1488
+ favIconPath
1488
1489
  }
1489
1490
  }
1490
1491
  }
@@ -1657,7 +1658,7 @@ async function run(nodeOptions) {
1657
1658
  nodeOptions ??= {};
1658
1659
  const serverInfo = {
1659
1660
  name: nodeOptions?.serverName ?? "TWIN Node Server",
1660
- version: nodeOptions?.serverVersion ?? "0.0.2-next.4" // x-release-please-version
1661
+ version: nodeOptions?.serverVersion ?? "0.0.2-next.5" // x-release-please-version
1661
1662
  };
1662
1663
  console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
1663
1664
  if (!Is.stringValue(nodeOptions?.executionDirectory)) {
@@ -1670,13 +1671,21 @@ async function run(nodeOptions) {
1670
1671
  console.info("Locales Directory:", nodeOptions.localesDirectory);
1671
1672
  await initialiseLocales(nodeOptions.localesDirectory);
1672
1673
  if (Is.empty(nodeOptions?.openApiSpecFile)) {
1673
- const specFile = path.resolve(path.join(nodeOptions.executionDirectory, "docs", "open-api", "spec.json"));
1674
+ const specFile = path.resolve(path.join(nodeOptions.executionDirectory ?? "", "docs", "open-api", "spec.json"));
1674
1675
  console.info("Default OpenAPI Spec File:", specFile);
1675
1676
  if (await fileExists(specFile)) {
1676
1677
  nodeOptions ??= {};
1677
1678
  nodeOptions.openApiSpecFile = specFile;
1678
1679
  }
1679
1680
  }
1681
+ if (Is.empty(nodeOptions?.favIconFile)) {
1682
+ const favIconFile = path.resolve(path.join(nodeOptions.executionDirectory ?? "", "static", "favicon.png"));
1683
+ console.info("Default Favicon File:", favIconFile);
1684
+ if (await fileExists(favIconFile)) {
1685
+ nodeOptions ??= {};
1686
+ nodeOptions.favIconFile = favIconFile;
1687
+ }
1688
+ }
1680
1689
  nodeOptions.envPrefix ??= "TWIN_NODE_";
1681
1690
  console.info("Environment Prefix:", nodeOptions.envPrefix);
1682
1691
  const { engineServerConfig, nodeEnvVars: envVars } = await buildConfiguration(process.env, nodeOptions, serverInfo);
@@ -1746,7 +1755,7 @@ async function buildConfiguration(processEnv, options, serverInfo) {
1746
1755
  }
1747
1756
  // Build the engine configuration from the environment variables.
1748
1757
  const coreConfig = buildEngineConfiguration(envVars);
1749
- const engineServerConfig = buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile);
1758
+ const engineServerConfig = buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile, options?.favIconFile);
1750
1759
  // Merge any custom configuration provided in the options.
1751
1760
  if (Is.arrayValue(options?.configFilenames)) {
1752
1761
  for (const configFile of options.configFilenames) {
@@ -8,6 +8,7 @@ import type { IEngineServerEnvironmentVariables } from "../models/IEngineServerE
8
8
  * @param coreEngineConfig The core engine config.
9
9
  * @param serverInfo The server information.
10
10
  * @param openApiSpecPath The path to the open api spec.
11
+ * @param favIconPath The path to the favicon.
11
12
  * @returns The the config for the core and the server.
12
13
  */
13
- export declare function buildEngineServerConfiguration(envVars: IEngineServerEnvironmentVariables, coreEngineConfig: IEngineCoreConfig, serverInfo: IServerInfo, openApiSpecPath?: string): IEngineServerConfig;
14
+ export declare function buildEngineServerConfiguration(envVars: IEngineServerEnvironmentVariables, coreEngineConfig: IEngineCoreConfig, serverInfo: IServerInfo, openApiSpecPath?: string, favIconPath?: string): IEngineServerConfig;
@@ -402,15 +402,10 @@ export interface IEngineEnvironmentVariables {
402
402
  */
403
403
  synchronisedStorageBlobStorageEncryptionKeyId?: string;
404
404
  /**
405
- * The private key used for blob encryption, should be RSA-2048 DER format encoded as base64.
405
+ * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.
406
406
  * Only required for trusted nodes, as regular nodes will not write encrypted data.
407
407
  */
408
- synchronisedStorageBlobStoragePrivateKey?: string;
409
- /**
410
- * The public key used for blob decryption, should be RSA-2048 DER format encoded as base64.
411
- * Only required for trusted nodes, as regular nodes will request the key from trusted nodes.
412
- */
413
- synchronisedStorageBlobStoragePublicKey?: string;
408
+ synchronisedStorageBlobStorageKey?: string;
414
409
  /**
415
410
  * How often to check for entity updates in minutes.
416
411
  * @default 5
@@ -45,6 +45,10 @@ export interface INodeOptions {
45
45
  * The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
46
46
  */
47
47
  openApiSpecFile?: string;
48
+ /**
49
+ * The path to the favicon, defaults to static/favicon.png.
50
+ */
51
+ favIconFile?: string;
48
52
  /**
49
53
  * Method to extend the engine environment variables with any additional custom configuration.
50
54
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/node-core - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/node/compare/node-core-v0.0.2-next.4...node-core-v0.0.2-next.5) (2025-08-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * update framework core ([8bd769a](https://github.com/twinfoundation/node/commit/8bd769a4451f5f1f6be3f115a5e94eeb05bce7f1))
9
+
3
10
  ## [0.0.2-next.4](https://github.com/twinfoundation/node/compare/node-core-v0.0.2-next.3...node-core-v0.0.2-next.4) (2025-08-14)
4
11
 
5
12
 
@@ -1,6 +1,6 @@
1
1
  # Function: buildEngineServerConfiguration()
2
2
 
3
- > **buildEngineServerConfiguration**(`envVars`, `coreEngineConfig`, `serverInfo`, `openApiSpecPath?`): `IEngineServerConfig`
3
+ > **buildEngineServerConfiguration**(`envVars`, `coreEngineConfig`, `serverInfo`, `openApiSpecPath?`, `favIconPath?`): `IEngineServerConfig`
4
4
 
5
5
  Handles the configuration of the server.
6
6
 
@@ -30,6 +30,12 @@ The server information.
30
30
 
31
31
  The path to the open api spec.
32
32
 
33
+ ### favIconPath?
34
+
35
+ `string`
36
+
37
+ The path to the favicon.
38
+
33
39
  ## Returns
34
40
 
35
41
  `IEngineServerConfig`
@@ -799,24 +799,15 @@ Defaults to synchronised-storage-blob-encryption
799
799
 
800
800
  ***
801
801
 
802
- ### synchronisedStorageBlobStoragePrivateKey?
802
+ ### synchronisedStorageBlobStorageKey?
803
803
 
804
- > `optional` **synchronisedStorageBlobStoragePrivateKey**: `string`
804
+ > `optional` **synchronisedStorageBlobStorageKey**: `string`
805
805
 
806
- The private key used for blob encryption, should be RSA-2048 DER format encoded as base64.
806
+ The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.
807
807
  Only required for trusted nodes, as regular nodes will not write encrypted data.
808
808
 
809
809
  ***
810
810
 
811
- ### synchronisedStorageBlobStoragePublicKey?
812
-
813
- > `optional` **synchronisedStorageBlobStoragePublicKey**: `string`
814
-
815
- The public key used for blob decryption, should be RSA-2048 DER format encoded as base64.
816
- Only required for trusted nodes, as regular nodes will request the key from trusted nodes.
817
-
818
- ***
819
-
820
811
  ### synchronisedStorageEntityUpdateIntervalMinutes?
821
812
 
822
813
  > `optional` **synchronisedStorageEntityUpdateIntervalMinutes**: `string`
@@ -1191,29 +1191,16 @@ Defaults to synchronised-storage-blob-encryption
1191
1191
 
1192
1192
  ***
1193
1193
 
1194
- ### synchronisedStorageBlobStoragePrivateKey?
1194
+ ### synchronisedStorageBlobStorageKey?
1195
1195
 
1196
- > `optional` **synchronisedStorageBlobStoragePrivateKey**: `string`
1196
+ > `optional` **synchronisedStorageBlobStorageKey**: `string`
1197
1197
 
1198
- The private key used for blob encryption, should be RSA-2048 DER format encoded as base64.
1198
+ The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.
1199
1199
  Only required for trusted nodes, as regular nodes will not write encrypted data.
1200
1200
 
1201
1201
  #### Inherited from
1202
1202
 
1203
- [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`synchronisedStorageBlobStoragePrivateKey`](IEngineEnvironmentVariables.md#synchronisedstorageblobstorageprivatekey)
1204
-
1205
- ***
1206
-
1207
- ### synchronisedStorageBlobStoragePublicKey?
1208
-
1209
- > `optional` **synchronisedStorageBlobStoragePublicKey**: `string`
1210
-
1211
- The public key used for blob decryption, should be RSA-2048 DER format encoded as base64.
1212
- Only required for trusted nodes, as regular nodes will request the key from trusted nodes.
1213
-
1214
- #### Inherited from
1215
-
1216
- [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`synchronisedStorageBlobStoragePublicKey`](IEngineEnvironmentVariables.md#synchronisedstorageblobstoragepublickey)
1203
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`synchronisedStorageBlobStorageKey`](IEngineEnvironmentVariables.md#synchronisedstorageblobstoragekey)
1217
1204
 
1218
1205
  ***
1219
1206
 
@@ -85,6 +85,14 @@ The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
85
85
 
86
86
  ***
87
87
 
88
+ ### favIconFile?
89
+
90
+ > `optional` **favIconFile**: `string`
91
+
92
+ The path to the favicon, defaults to static/favicon.png.
93
+
94
+ ***
95
+
88
96
  ### extendEnvVars()?
89
97
 
90
98
  > `optional` **extendEnvVars**: (`envVars`) => `Promise`\<`void`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/node-core",
3
- "version": "0.0.2-next.4",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "TWIN Node Core for serving APIs using the specified configuration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "@twin.org/identity-models": "next",
29
29
  "@twin.org/vault-models": "next",
30
30
  "@twin.org/wallet-models": "next",
31
- "dotenv": "17.2.0",
31
+ "dotenv": "17.2.1",
32
32
  "schema-dts": "1.1.5"
33
33
  },
34
34
  "main": "./dist/cjs/index.cjs",