@twin.org/node-core 0.0.1-next.8 → 0.0.1-next.9

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.
@@ -179,12 +179,13 @@ async function bootstrapIdentity(engineCore, envVars, features, nodeIdentity) {
179
179
  try {
180
180
  const identityResolverConnector = identityModels.IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
181
181
  identityDocument = await identityResolverConnector.resolveDocument(nodeIdentity);
182
- engineCore.logInfo(core.I18n.formatMessage("node.existingNodeIdentity"));
182
+ engineCore.logInfo(core.I18n.formatMessage("node.existingNodeIdentity", { identity: nodeIdentity }));
183
183
  }
184
184
  catch { }
185
185
  if (core.Is.empty(identityDocument)) {
186
186
  engineCore.logInfo(core.I18n.formatMessage("node.generatingNodeIdentity"));
187
187
  identityDocument = await identityConnector.createDocument(nodeIdentity);
188
+ engineCore.logInfo(core.I18n.formatMessage("node.createdNodeIdentity", { identity: identityDocument.id }));
188
189
  }
189
190
  if (engineDefaultTypes.identityConnector === engineTypes.IdentityConnectorType.Iota) {
190
191
  const didUrn = core.Urn.fromValidString(identityDocument.id);
@@ -309,7 +310,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
309
310
  const email = envVars.username ?? DEFAULT_NODE_USERNAME;
310
311
  let nodeAdminUser = await authUserEntityStorage.get(email);
311
312
  if (core.Is.empty(nodeAdminUser)) {
312
- engineCore.logInfo(core.I18n.formatMessage("node.creatingNodeUser"));
313
+ engineCore.logInfo(core.I18n.formatMessage("node.creatingNodeUser", { email }));
313
314
  const generatedPassword = envVars.password ?? crypto.PasswordGenerator.generate(16);
314
315
  const passwordBytes = core.Converter.utf8ToBytes(generatedPassword);
315
316
  const saltBytes = core.RandomHelper.generate(16);
@@ -325,7 +326,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
325
326
  await authUserEntityStorage.set(nodeAdminUser);
326
327
  }
327
328
  else {
328
- engineCore.logInfo(core.I18n.formatMessage("node.existingNodeUser"));
329
+ engineCore.logInfo(core.I18n.formatMessage("node.existingNodeUser", { email }));
329
330
  // The user already exists, so double check the other details match
330
331
  let needsUpdate = false;
331
332
  if (nodeAdminUser.identity !== context.state.nodeIdentity) {
@@ -354,7 +355,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
354
355
  }
355
356
  catch { }
356
357
  if (core.Is.empty(userProfile)) {
357
- engineCore.logInfo(core.I18n.formatMessage("node.creatingUserProfile"));
358
+ engineCore.logInfo(core.I18n.formatMessage("node.creatingUserProfile", { identity: context.state.nodeIdentity }));
358
359
  const publicProfile = {
359
360
  "@context": "https://schema.org",
360
361
  "@type": "Person",
@@ -370,7 +371,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
370
371
  await identityProfileConnector.create(context.state.nodeIdentity, publicProfile, privateProfile);
371
372
  }
372
373
  else {
373
- engineCore.logInfo(core.I18n.formatMessage("node.existingUserProfile"));
374
+ engineCore.logInfo(core.I18n.formatMessage("node.existingUserProfile", { identity: context.state.nodeIdentity }));
374
375
  }
375
376
  }
376
377
  }
@@ -391,20 +392,25 @@ async function bootstrapAttestationMethod(engineCore, context, envVars, features
391
392
  const identityConnector = identityModels.IdentityConnectorFactory.get(engineDefaultTypes.identityConnector);
392
393
  const identityResolverConnector = identityModels.IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
393
394
  const identityDocument = await identityResolverConnector.resolveDocument(context.state.nodeIdentity);
395
+ const fullMethodId = `${identityDocument.id}#${envVars.attestationVerificationMethodId}`;
394
396
  let createVm = true;
395
397
  try {
396
- identityModels.DocumentHelper.getVerificationMethod(identityDocument, `${identityDocument.id}#${envVars.attestationVerificationMethodId}`, "assertionMethod");
398
+ identityModels.DocumentHelper.getVerificationMethod(identityDocument, fullMethodId, "assertionMethod");
397
399
  createVm = false;
398
400
  }
399
401
  catch { }
400
402
  if (createVm) {
401
403
  // Add attestation verification method to DID, the correct node context is now in place
402
404
  // so the keys for the verification method will be stored correctly
403
- engineCore.logInfo(core.I18n.formatMessage("node.addingAttestation"));
405
+ engineCore.logInfo(core.I18n.formatMessage("node.addingAttestation", {
406
+ methodId: fullMethodId
407
+ }));
404
408
  await identityConnector.addVerificationMethod(context.state.nodeIdentity, context.state.nodeIdentity, "assertionMethod", envVars.attestationVerificationMethodId);
405
409
  }
406
410
  else {
407
- engineCore.logInfo(core.I18n.formatMessage("node.existingAttestation"));
411
+ engineCore.logInfo(core.I18n.formatMessage("node.existingAttestation", {
412
+ methodId: fullMethodId
413
+ }));
408
414
  }
409
415
  }
410
416
  }
@@ -423,20 +429,25 @@ async function bootstrapImmutableProofMethod(engineCore, context, envVars, featu
423
429
  const identityConnector = identityModels.IdentityConnectorFactory.get(engineDefaultTypes.identityConnector);
424
430
  const identityResolverConnector = identityModels.IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
425
431
  const identityDocument = await identityResolverConnector.resolveDocument(context.state.nodeIdentity);
432
+ const fullMethodId = `${identityDocument.id}#${envVars.immutableProofVerificationMethodId}`;
426
433
  let createVm = true;
427
434
  try {
428
- identityModels.DocumentHelper.getVerificationMethod(identityDocument, `${identityDocument.id}#${envVars.immutableProofVerificationMethodId}`, "assertionMethod");
435
+ identityModels.DocumentHelper.getVerificationMethod(identityDocument, fullMethodId, "assertionMethod");
429
436
  createVm = false;
430
437
  }
431
438
  catch { }
432
439
  if (createVm) {
433
440
  // Add AIG verification method to DID, the correct node context is now in place
434
441
  // so the keys for the verification method will be stored correctly
435
- engineCore.logInfo(core.I18n.formatMessage("node.addingImmutableProof"));
442
+ engineCore.logInfo(core.I18n.formatMessage("node.addingImmutableProof", {
443
+ methodId: fullMethodId
444
+ }));
436
445
  await identityConnector.addVerificationMethod(context.state.nodeIdentity, context.state.nodeIdentity, "assertionMethod", envVars.immutableProofVerificationMethodId);
437
446
  }
438
447
  else {
439
- engineCore.logInfo(core.I18n.formatMessage("node.existingImmutableProof"));
448
+ engineCore.logInfo(core.I18n.formatMessage("node.existingImmutableProof", {
449
+ methodId: fullMethodId
450
+ }));
440
451
  }
441
452
  }
442
453
  }
@@ -460,11 +471,11 @@ async function bootstrapBlobEncryption(engineCore, context, envVars, features) {
460
471
  }
461
472
  catch { }
462
473
  if (core.Is.empty(existingKey)) {
463
- engineCore.logInfo(core.I18n.formatMessage("node.creatingBlobEncryptionKey"));
464
- await vaultConnector.createKey(`${context.state.nodeIdentity}/${envVars.blobStorageEncryptionKey}`, vaultModels.VaultKeyType.ChaCha20Poly1305);
474
+ engineCore.logInfo(core.I18n.formatMessage("node.creatingBlobEncryptionKey", { keyName }));
475
+ await vaultConnector.createKey(keyName, vaultModels.VaultKeyType.ChaCha20Poly1305);
465
476
  }
466
477
  else {
467
- engineCore.logInfo(core.I18n.formatMessage("node.existingBlobEncryptionKey"));
478
+ engineCore.logInfo(core.I18n.formatMessage("node.existingBlobEncryptionKey", { keyName }));
468
479
  }
469
480
  }
470
481
  }
@@ -488,11 +499,11 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
488
499
  }
489
500
  catch { }
490
501
  if (core.Is.empty(existingKey)) {
491
- engineCore.logInfo(core.I18n.formatMessage("node.creatingAuthKey"));
492
- await vaultConnector.createKey(`${context.state.nodeIdentity}/${envVars.authSigningKeyId}`, vaultModels.VaultKeyType.Ed25519);
502
+ engineCore.logInfo(core.I18n.formatMessage("node.creatingAuthKey", { keyName }));
503
+ await vaultConnector.createKey(keyName, vaultModels.VaultKeyType.Ed25519);
493
504
  }
494
505
  else {
495
- engineCore.logInfo(core.I18n.formatMessage("node.existingAuthKey"));
506
+ engineCore.logInfo(core.I18n.formatMessage("node.existingAuthKey", { keyName }));
496
507
  }
497
508
  }
498
509
  }
@@ -568,7 +579,7 @@ async function run(options) {
568
579
  try {
569
580
  const serverInfo = {
570
581
  name: options?.serverName ?? "TWIN Node Server",
571
- version: options?.serverVersion ?? "0.0.1-next.8" // x-release-please-version
582
+ version: options?.serverVersion ?? "0.0.1-next.9" // x-release-please-version
572
583
  };
573
584
  console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
574
585
  const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
@@ -158,12 +158,13 @@ async function bootstrapIdentity(engineCore, envVars, features, nodeIdentity) {
158
158
  try {
159
159
  const identityResolverConnector = IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
160
160
  identityDocument = await identityResolverConnector.resolveDocument(nodeIdentity);
161
- engineCore.logInfo(I18n.formatMessage("node.existingNodeIdentity"));
161
+ engineCore.logInfo(I18n.formatMessage("node.existingNodeIdentity", { identity: nodeIdentity }));
162
162
  }
163
163
  catch { }
164
164
  if (Is.empty(identityDocument)) {
165
165
  engineCore.logInfo(I18n.formatMessage("node.generatingNodeIdentity"));
166
166
  identityDocument = await identityConnector.createDocument(nodeIdentity);
167
+ engineCore.logInfo(I18n.formatMessage("node.createdNodeIdentity", { identity: identityDocument.id }));
167
168
  }
168
169
  if (engineDefaultTypes.identityConnector === IdentityConnectorType.Iota) {
169
170
  const didUrn = Urn.fromValidString(identityDocument.id);
@@ -288,7 +289,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
288
289
  const email = envVars.username ?? DEFAULT_NODE_USERNAME;
289
290
  let nodeAdminUser = await authUserEntityStorage.get(email);
290
291
  if (Is.empty(nodeAdminUser)) {
291
- engineCore.logInfo(I18n.formatMessage("node.creatingNodeUser"));
292
+ engineCore.logInfo(I18n.formatMessage("node.creatingNodeUser", { email }));
292
293
  const generatedPassword = envVars.password ?? PasswordGenerator.generate(16);
293
294
  const passwordBytes = Converter.utf8ToBytes(generatedPassword);
294
295
  const saltBytes = RandomHelper.generate(16);
@@ -304,7 +305,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
304
305
  await authUserEntityStorage.set(nodeAdminUser);
305
306
  }
306
307
  else {
307
- engineCore.logInfo(I18n.formatMessage("node.existingNodeUser"));
308
+ engineCore.logInfo(I18n.formatMessage("node.existingNodeUser", { email }));
308
309
  // The user already exists, so double check the other details match
309
310
  let needsUpdate = false;
310
311
  if (nodeAdminUser.identity !== context.state.nodeIdentity) {
@@ -333,7 +334,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
333
334
  }
334
335
  catch { }
335
336
  if (Is.empty(userProfile)) {
336
- engineCore.logInfo(I18n.formatMessage("node.creatingUserProfile"));
337
+ engineCore.logInfo(I18n.formatMessage("node.creatingUserProfile", { identity: context.state.nodeIdentity }));
337
338
  const publicProfile = {
338
339
  "@context": "https://schema.org",
339
340
  "@type": "Person",
@@ -349,7 +350,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
349
350
  await identityProfileConnector.create(context.state.nodeIdentity, publicProfile, privateProfile);
350
351
  }
351
352
  else {
352
- engineCore.logInfo(I18n.formatMessage("node.existingUserProfile"));
353
+ engineCore.logInfo(I18n.formatMessage("node.existingUserProfile", { identity: context.state.nodeIdentity }));
353
354
  }
354
355
  }
355
356
  }
@@ -370,20 +371,25 @@ async function bootstrapAttestationMethod(engineCore, context, envVars, features
370
371
  const identityConnector = IdentityConnectorFactory.get(engineDefaultTypes.identityConnector);
371
372
  const identityResolverConnector = IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
372
373
  const identityDocument = await identityResolverConnector.resolveDocument(context.state.nodeIdentity);
374
+ const fullMethodId = `${identityDocument.id}#${envVars.attestationVerificationMethodId}`;
373
375
  let createVm = true;
374
376
  try {
375
- DocumentHelper.getVerificationMethod(identityDocument, `${identityDocument.id}#${envVars.attestationVerificationMethodId}`, "assertionMethod");
377
+ DocumentHelper.getVerificationMethod(identityDocument, fullMethodId, "assertionMethod");
376
378
  createVm = false;
377
379
  }
378
380
  catch { }
379
381
  if (createVm) {
380
382
  // Add attestation verification method to DID, the correct node context is now in place
381
383
  // so the keys for the verification method will be stored correctly
382
- engineCore.logInfo(I18n.formatMessage("node.addingAttestation"));
384
+ engineCore.logInfo(I18n.formatMessage("node.addingAttestation", {
385
+ methodId: fullMethodId
386
+ }));
383
387
  await identityConnector.addVerificationMethod(context.state.nodeIdentity, context.state.nodeIdentity, "assertionMethod", envVars.attestationVerificationMethodId);
384
388
  }
385
389
  else {
386
- engineCore.logInfo(I18n.formatMessage("node.existingAttestation"));
390
+ engineCore.logInfo(I18n.formatMessage("node.existingAttestation", {
391
+ methodId: fullMethodId
392
+ }));
387
393
  }
388
394
  }
389
395
  }
@@ -402,20 +408,25 @@ async function bootstrapImmutableProofMethod(engineCore, context, envVars, featu
402
408
  const identityConnector = IdentityConnectorFactory.get(engineDefaultTypes.identityConnector);
403
409
  const identityResolverConnector = IdentityResolverConnectorFactory.get(engineDefaultTypes.identityResolverConnector);
404
410
  const identityDocument = await identityResolverConnector.resolveDocument(context.state.nodeIdentity);
411
+ const fullMethodId = `${identityDocument.id}#${envVars.immutableProofVerificationMethodId}`;
405
412
  let createVm = true;
406
413
  try {
407
- DocumentHelper.getVerificationMethod(identityDocument, `${identityDocument.id}#${envVars.immutableProofVerificationMethodId}`, "assertionMethod");
414
+ DocumentHelper.getVerificationMethod(identityDocument, fullMethodId, "assertionMethod");
408
415
  createVm = false;
409
416
  }
410
417
  catch { }
411
418
  if (createVm) {
412
419
  // Add AIG verification method to DID, the correct node context is now in place
413
420
  // so the keys for the verification method will be stored correctly
414
- engineCore.logInfo(I18n.formatMessage("node.addingImmutableProof"));
421
+ engineCore.logInfo(I18n.formatMessage("node.addingImmutableProof", {
422
+ methodId: fullMethodId
423
+ }));
415
424
  await identityConnector.addVerificationMethod(context.state.nodeIdentity, context.state.nodeIdentity, "assertionMethod", envVars.immutableProofVerificationMethodId);
416
425
  }
417
426
  else {
418
- engineCore.logInfo(I18n.formatMessage("node.existingImmutableProof"));
427
+ engineCore.logInfo(I18n.formatMessage("node.existingImmutableProof", {
428
+ methodId: fullMethodId
429
+ }));
419
430
  }
420
431
  }
421
432
  }
@@ -439,11 +450,11 @@ async function bootstrapBlobEncryption(engineCore, context, envVars, features) {
439
450
  }
440
451
  catch { }
441
452
  if (Is.empty(existingKey)) {
442
- engineCore.logInfo(I18n.formatMessage("node.creatingBlobEncryptionKey"));
443
- await vaultConnector.createKey(`${context.state.nodeIdentity}/${envVars.blobStorageEncryptionKey}`, VaultKeyType.ChaCha20Poly1305);
453
+ engineCore.logInfo(I18n.formatMessage("node.creatingBlobEncryptionKey", { keyName }));
454
+ await vaultConnector.createKey(keyName, VaultKeyType.ChaCha20Poly1305);
444
455
  }
445
456
  else {
446
- engineCore.logInfo(I18n.formatMessage("node.existingBlobEncryptionKey"));
457
+ engineCore.logInfo(I18n.formatMessage("node.existingBlobEncryptionKey", { keyName }));
447
458
  }
448
459
  }
449
460
  }
@@ -467,11 +478,11 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
467
478
  }
468
479
  catch { }
469
480
  if (Is.empty(existingKey)) {
470
- engineCore.logInfo(I18n.formatMessage("node.creatingAuthKey"));
471
- await vaultConnector.createKey(`${context.state.nodeIdentity}/${envVars.authSigningKeyId}`, VaultKeyType.Ed25519);
481
+ engineCore.logInfo(I18n.formatMessage("node.creatingAuthKey", { keyName }));
482
+ await vaultConnector.createKey(keyName, VaultKeyType.Ed25519);
472
483
  }
473
484
  else {
474
- engineCore.logInfo(I18n.formatMessage("node.existingAuthKey"));
485
+ engineCore.logInfo(I18n.formatMessage("node.existingAuthKey", { keyName }));
475
486
  }
476
487
  }
477
488
  }
@@ -547,7 +558,7 @@ async function run(options) {
547
558
  try {
548
559
  const serverInfo = {
549
560
  name: options?.serverName ?? "TWIN Node Server",
550
- version: options?.serverVersion ?? "0.0.1-next.8" // x-release-please-version
561
+ version: options?.serverVersion ?? "0.0.1-next.9" // x-release-please-version
551
562
  };
552
563
  console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
553
564
  const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/node-core - Changelog
2
2
 
3
+ ## [0.0.1-next.9](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.8...node-core-v0.0.1-next.9) (2025-06-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * additional startup logging ([0740293](https://github.com/twinfoundation/node/commit/0740293b366032f2907046603abf587c9c324aff))
9
+
3
10
  ## [0.0.1-next.8](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.7...node-core-v0.0.1-next.8) (2025-06-18)
4
11
 
5
12
 
package/locales/en.json CHANGED
@@ -13,20 +13,21 @@
13
13
  "fundingWallet": "Funding wallet \"{address}\"",
14
14
  "fundedWallet": "Wallet already funded",
15
15
  "generatingNodeIdentity": "Generating node identity",
16
- "existingNodeIdentity": "Node identity already exists",
16
+ "existingNodeIdentity": "Node identity already exists \"{identity}\"",
17
+ "createdNodeIdentity": "Node identity created \"{identity}\"",
17
18
  "identityExplorer": "Identity explorer \"{url}\"",
18
- "creatingNodeUser": "Creating node user",
19
- "existingNodeUser": "Node user already exists",
20
- "creatingAuthKey": "Creating authentication key",
21
- "existingAuthKey": "Authentication key already exists",
22
- "addingAttestation": "Adding attestation verification method",
23
- "existingAttestation": "Attestation verification method already exists",
24
- "addingImmutableProof": "Adding immutable proof verification method",
25
- "existingImmutableProof": "Immutable proof verification method already exists",
26
- "creatingBlobEncryptionKey": "Creating blob encryption key",
27
- "existingBlobEncryptionKey": "Blob encryption key already exists",
28
- "creatingUserProfile": "Creating user profile",
29
- "existingUserProfile": "User profile already exists",
19
+ "creatingNodeUser": "Creating node user \"{email}\"",
20
+ "existingNodeUser": "Node user already exists \"{email}\"",
21
+ "creatingAuthKey": "Creating authentication key \"{keyName}\"",
22
+ "existingAuthKey": "Authentication key already exists \"{keyName}\"",
23
+ "addingAttestation": "Adding attestation verification method \"{methodId}\"",
24
+ "existingAttestation": "Attestation verification method already exists \"{methodId}\"",
25
+ "addingImmutableProof": "Adding immutable proof verification method \"{methodId}\"",
26
+ "existingImmutableProof": "Immutable proof verification method already exists \"{methodId}\"",
27
+ "creatingBlobEncryptionKey": "Creating blob encryption key \"{keyName}\"",
28
+ "existingBlobEncryptionKey": "Blob encryption key already exists \"{keyName}\"",
29
+ "creatingUserProfile": "Creating user profile \"{identity}\"",
30
+ "existingUserProfile": "User profile already exists \"{identity}\"",
30
31
  "nodeIdentity": "Node identity \"{identity}\"",
31
32
  "nodeAdminUserEmail": "Node Admin User Email \"{email}\"",
32
33
  "nodeAdminUserPassword": "Node Admin User Password \"{password}\""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/node-core",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "TWIN Node Core for serving APIs using the specified configuration",
5
5
  "repository": {
6
6
  "type": "git",