@learncard/lca-api-service 1.6.2 → 1.7.0

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 (81) hide show
  1. package/.env.example +2 -0
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +132 -0
  4. package/config/config.dev.json +1 -0
  5. package/config/config.example.json +1 -0
  6. package/config/config.production.json +1 -0
  7. package/config/config.scouts.dev.json +1 -0
  8. package/config/config.scouts.production.json +1 -0
  9. package/dist/accesslayer/notifications/create.d.ts +2 -1
  10. package/dist/app.d.ts +70 -8
  11. package/dist/config/environment.d.ts +6 -0
  12. package/dist/config/stageConfig.d.ts +4 -0
  13. package/dist/helpers/analyticsEligibility.d.ts +6 -0
  14. package/dist/helpers/brainUrl.d.ts +1 -0
  15. package/dist/helpers/brainUrl.test.d.ts +1 -0
  16. package/dist/helpers/currentProfile.d.ts +6 -0
  17. package/dist/helpers/currentProfile.test.d.ts +1 -0
  18. package/dist/helpers/retryingOnce.d.ts +1 -0
  19. package/dist/helpers/retryingOnce.test.d.ts +1 -0
  20. package/dist/index.js +2 -2
  21. package/dist/models/EscrowHold.d.ts +1 -0
  22. package/dist/models/EscrowHold.indexes.test.d.ts +1 -0
  23. package/dist/models/Notification.d.ts +114 -2
  24. package/dist/models/SigningAuthority.d.ts +1 -1
  25. package/dist/models/UserKey.d.ts +23 -0
  26. package/dist/publish-metafile.json +1 -1
  27. package/dist/routes/credentials.d.ts +1 -1
  28. package/dist/routes/index.d.ts +5 -0
  29. package/dist/routes/keys.d.ts +1 -0
  30. package/dist/routes/notifications.d.ts +65 -4
  31. package/dist/routes/preferences.test.d.ts +1 -0
  32. package/dist/routes/signing-authority.d.ts +3 -3
  33. package/dist/services/escrow-enclave/index.d.ts +2 -0
  34. package/dist/services/escrow-enclave/logFailure.d.ts +1 -0
  35. package/dist/types/credentials.d.ts +1 -1
  36. package/dist/types/notifications.d.ts +118 -2
  37. package/docs/bedrock-generation.md +7 -6
  38. package/lambdaApp.test.ts +114 -0
  39. package/lambdaApp.ts +23 -11
  40. package/package.json +11 -11
  41. package/scripts/escrow-lambda-http.ts +74 -0
  42. package/scripts/verify-escrow-startup.mjs +463 -0
  43. package/serverless-local.yml +1 -1
  44. package/serverless.yml +1 -1
  45. package/src/accesslayer/notifications/create.test.ts +80 -0
  46. package/src/accesslayer/notifications/create.ts +97 -2
  47. package/src/config/environment.test.ts +27 -1
  48. package/src/config/environment.ts +16 -0
  49. package/src/config/escrowDeployment.test.ts +1 -0
  50. package/src/docker-entry.ts +1 -2
  51. package/src/helpers/analyticsEligibility.ts +15 -0
  52. package/src/helpers/brainUrl.test.ts +13 -0
  53. package/src/helpers/brainUrl.ts +3 -0
  54. package/src/helpers/currentProfile.test.ts +55 -0
  55. package/src/helpers/currentProfile.ts +58 -0
  56. package/src/helpers/locale.helpers.test.ts +4 -1
  57. package/src/helpers/locale.helpers.ts +4 -2
  58. package/src/helpers/retryingOnce.test.ts +33 -0
  59. package/src/helpers/retryingOnce.ts +18 -0
  60. package/src/models/EscrowHold.indexes.test.ts +208 -0
  61. package/src/models/EscrowHold.ts +106 -51
  62. package/src/models/UserKey.ts +69 -1
  63. package/src/routes/escrow.ts +30 -12
  64. package/src/routes/index.ts +5 -8
  65. package/src/routes/keys.ts +8 -0
  66. package/src/routes/notifications.ts +34 -1
  67. package/src/routes/preferences.test.ts +216 -0
  68. package/src/routes/preferences.ts +54 -4
  69. package/src/services/escrow-enclave/index.ts +38 -1
  70. package/src/services/escrow-enclave/logFailure.ts +5 -1
  71. package/src/services/escrow-enclave/production.test.ts +64 -0
  72. package/src/services/escrow-enclave/softwareEnclave.test.ts +14 -2
  73. package/test/jobs/escrowHoldReminders.spec.ts +21 -4
  74. package/test/keys-escrow.spec.ts +149 -3
  75. package/test/keys-lifecycle-invariants.spec.ts +235 -0
  76. package/test/keys-pin-sign-in.spec.ts +34 -2
  77. package/test/notifications.spec.ts +102 -0
  78. package/tsconfig.entrypoints.json +1 -1
  79. package/vitest.config.ts +1 -0
  80. package/scripts/node24-runtime.cjs +0 -9
  81. package/scripts/verify-node24-layer.cjs +0 -49
@@ -1,49 +0,0 @@
1
- /* global require, module, process, Buffer, console */
2
- /* eslint-disable @typescript-eslint/no-require-imports -- Node CommonJS deployment script. */
3
- const assert = require('node:assert/strict');
4
- const fs = require('node:fs');
5
- const path = require('node:path');
6
- const { execFileSync } = require('node:child_process');
7
-
8
- const verifyLayer = (layerRoot, nodeMajor = Number(process.versions.node.split('.')[0])) => {
9
- assert.equal(nodeMajor, 24, 'LCA deployment must run with Node 24');
10
- assert.equal(process.platform, 'linux', 'LCA native layer requires Linux');
11
- assert.equal(process.arch, 'x64', 'LCA native layer requires x86_64');
12
- const modules = path.join(layerRoot, 'nodejs/node_modules/@learncard');
13
- const native = path.join(modules, 'didkit-plugin-node');
14
- const binary = path.join(native, 'index.linux-x64-gnu.node');
15
- assert.ok(fs.existsSync(binary), 'Missing Lambda Linux x64 GNU DIDKit addon');
16
- const binaryNames = fs.readdirSync(native).filter(name => name.endsWith('.node'));
17
- assert.deepEqual(
18
- binaryNames,
19
- ['index.linux-x64-gnu.node'],
20
- 'Layer must contain only the Lambda addon'
21
- );
22
- for (const pkg of ['didkit-plugin-node', 'didkit-plugin']) {
23
- const directory = path.join(modules, pkg);
24
- const manifest = JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8'));
25
- assert.ok(
26
- fs.existsSync(path.resolve(directory, manifest.main)),
27
- `Missing ${pkg} runtime entry`
28
- );
29
- }
30
- // Node 24 Lambda uses AL2023/glibc 2.34. Reject Ubuntu-built artifacts
31
- // requiring newer libc symbols before Serverless can change the stack.
32
- const versions = execFileSync('readelf', ['--version-info', binary], { encoding: 'utf8' });
33
- for (const match of versions.matchAll(/GLIBC_(\d+)\.(\d+)/g)) {
34
- assert.ok(
35
- Number(match[1]) < 2 || (Number(match[1]) === 2 && Number(match[2]) <= 34),
36
- `Addon requires ${match[0]}, newer than Lambda AL2023`
37
- );
38
- }
39
- // Exercise stable N-API with a deterministic synthetic key; never log key material.
40
- const addon = require(binary);
41
- const key = addon.generateEd25519KeyFromBytes(Buffer.alloc(32, 1));
42
- assert.match(addon.keyToDid('key', key), /^did:key:/);
43
- };
44
-
45
- module.exports = { verifyLayer };
46
- if (require.main === module) {
47
- verifyLayer(path.resolve('didkit-native-layer'));
48
- console.log('LCA Node 24 native layer ABI, libc and package checks passed');
49
- }