@selvajs/server 1.0.0-beta.9 → 1.0.1

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 (91) hide show
  1. package/README.md +18 -20
  2. package/dist/access/project-access-input.d.ts +13 -16
  3. package/dist/access/project-access-input.d.ts.map +1 -1
  4. package/dist/access/project-access-input.js +2 -2
  5. package/dist/access/project-access-input.js.map +1 -1
  6. package/dist/compute/idempotency.d.ts +18 -22
  7. package/dist/compute/idempotency.d.ts.map +1 -1
  8. package/dist/compute/idempotency.js +10 -14
  9. package/dist/compute/idempotency.js.map +1 -1
  10. package/dist/compute/index.d.ts.map +1 -1
  11. package/dist/compute/index.js +3 -5
  12. package/dist/compute/index.js.map +1 -1
  13. package/dist/compute/limits.d.ts +70 -86
  14. package/dist/compute/limits.d.ts.map +1 -1
  15. package/dist/compute/limits.js +27 -56
  16. package/dist/compute/limits.js.map +1 -1
  17. package/dist/compute/rate-limit.d.ts +41 -53
  18. package/dist/compute/rate-limit.d.ts.map +1 -1
  19. package/dist/compute/rate-limit.js +27 -35
  20. package/dist/compute/rate-limit.js.map +1 -1
  21. package/dist/compute/remote-definition.d.ts +8 -22
  22. package/dist/compute/remote-definition.d.ts.map +1 -1
  23. package/dist/compute/remote-definition.js +9 -19
  24. package/dist/compute/remote-definition.js.map +1 -1
  25. package/dist/compute/safe-url.d.ts +7 -5
  26. package/dist/compute/safe-url.d.ts.map +1 -1
  27. package/dist/compute/safe-url.js +26 -28
  28. package/dist/compute/safe-url.js.map +1 -1
  29. package/dist/definitions/definition-service.d.ts +13 -38
  30. package/dist/definitions/definition-service.d.ts.map +1 -1
  31. package/dist/definitions/definition-service.js +25 -53
  32. package/dist/definitions/definition-service.js.map +1 -1
  33. package/dist/definitions/index.d.ts +2 -2
  34. package/dist/definitions/index.d.ts.map +1 -1
  35. package/dist/definitions/index.js +1 -5
  36. package/dist/definitions/index.js.map +1 -1
  37. package/dist/definitions/load-for-render.d.ts +23 -20
  38. package/dist/definitions/load-for-render.d.ts.map +1 -1
  39. package/dist/definitions/load-for-render.js +55 -41
  40. package/dist/definitions/load-for-render.js.map +1 -1
  41. package/dist/definitions/schema-extraction.d.ts +36 -16
  42. package/dist/definitions/schema-extraction.d.ts.map +1 -1
  43. package/dist/definitions/schema-extraction.js +65 -28
  44. package/dist/definitions/schema-extraction.js.map +1 -1
  45. package/dist/errors/SentryErrorReporter.d.ts +2 -3
  46. package/dist/errors/SentryErrorReporter.d.ts.map +1 -1
  47. package/dist/errors/SentryErrorReporter.js +10 -14
  48. package/dist/errors/SentryErrorReporter.js.map +1 -1
  49. package/dist/http/body-size.d.ts +8 -11
  50. package/dist/http/body-size.d.ts.map +1 -1
  51. package/dist/http/body-size.js +8 -11
  52. package/dist/http/body-size.js.map +1 -1
  53. package/dist/http/redirect.d.ts +3 -7
  54. package/dist/http/redirect.d.ts.map +1 -1
  55. package/dist/http/redirect.js +8 -8
  56. package/dist/http/redirect.js.map +1 -1
  57. package/dist/http/route-classifier.d.ts +20 -24
  58. package/dist/http/route-classifier.d.ts.map +1 -1
  59. package/dist/http/route-classifier.js +6 -7
  60. package/dist/http/route-classifier.js.map +1 -1
  61. package/dist/http/security-headers.d.ts +13 -15
  62. package/dist/http/security-headers.d.ts.map +1 -1
  63. package/dist/http/security-headers.js +10 -12
  64. package/dist/http/security-headers.js.map +1 -1
  65. package/dist/logging/PinoLogger.d.ts +8 -14
  66. package/dist/logging/PinoLogger.d.ts.map +1 -1
  67. package/dist/logging/PinoLogger.js +29 -35
  68. package/dist/logging/PinoLogger.js.map +1 -1
  69. package/dist/logging/requestId.d.ts +20 -28
  70. package/dist/logging/requestId.d.ts.map +1 -1
  71. package/dist/logging/requestId.js +29 -37
  72. package/dist/logging/requestId.js.map +1 -1
  73. package/dist/ops/index.d.ts.map +1 -1
  74. package/dist/ops/index.js +2 -1
  75. package/dist/ops/index.js.map +1 -1
  76. package/dist/ops/semver.d.ts +22 -24
  77. package/dist/ops/semver.d.ts.map +1 -1
  78. package/dist/ops/semver.js +22 -25
  79. package/dist/ops/semver.js.map +1 -1
  80. package/dist/providers/create-selva-providers.d.ts +19 -27
  81. package/dist/providers/create-selva-providers.d.ts.map +1 -1
  82. package/dist/providers/create-selva-providers.js +28 -34
  83. package/dist/providers/create-selva-providers.js.map +1 -1
  84. package/dist/providers/index.d.ts.map +1 -1
  85. package/dist/providers/index.js +2 -4
  86. package/dist/providers/index.js.map +1 -1
  87. package/dist/tokens/token-codec.d.ts +24 -27
  88. package/dist/tokens/token-codec.d.ts.map +1 -1
  89. package/dist/tokens/token-codec.js +18 -21
  90. package/dist/tokens/token-codec.js.map +1 -1
  91. package/package.json +5 -5
@@ -3,34 +3,31 @@ import { randomBytes, createHmac, timingSafeEqual } from 'node:crypto';
3
3
  * HMAC token codec — the primitive behind capability-URL tokens (share links,
4
4
  * invites, and anything shaped like them).
5
5
  *
6
- * ## Two-part design
7
- *
8
- * Each minted token involves TWO secrets:
6
+ * ## Format
7
+ * raw = `<prefix><base64url(32 random bytes)>`
8
+ * hash = base64url( HMAC-SHA256(secret, raw) )
9
9
  *
10
- * 1. **Per-token secret** — generated in `mintRawToken()` from 32 random
11
- * bytes, returned to the caller exactly once at mint time. Different
12
- * every token. This is what end-users carry in `?token=…`.
10
+ * ## Two secrets per token
13
11
  *
14
- * 2. **Instance-wide HMAC secret** (`config.secret`) — used to hash tokens
15
- * for storage. The store sees only `HMAC-SHA256(secret, token)`. A
16
- * DB-only leak therefore can't be replayed: the attacker would need the
17
- * secret too, and it lives in env, not the database.
12
+ * 1. **Per-token entropy** — the 32 random bytes in `mintRawToken()`, handed
13
+ * back exactly once at mint time and never stored. This is what end-users
14
+ * carry in `?token=…`.
18
15
  *
19
- * ## Format
20
- * raw = `<prefix><base64url(32 random bytes)>`
21
- * hash = base64url( HMAC-SHA256(secret, raw) )
16
+ * 2. **Instance-wide HMAC secret** (`config.secret`) — hashes tokens for
17
+ * storage, so the store holds only `HMAC-SHA256(secret, raw)`. A DB-only
18
+ * leak can't be replayed: the attacker also needs the secret, and it lives
19
+ * in env, not the database.
22
20
  *
23
- * The resolution path hashes the supplied token with the same secret and looks
24
- * up by exact match against the stored hash.
21
+ * Resolution hashes the supplied token with the same secret and looks up an
22
+ * exact match against the stored hash.
25
23
  *
26
- * Rotating the secret invalidates every token minted under it — give each
27
- * token family (each prefix) its own secret so they rotate independently.
24
+ * Rotating the secret invalidates every token minted under it — give each token
25
+ * family (each prefix) its own secret so they rotate independently.
28
26
  */
29
27
  /**
30
- * Minimum accepted secret length. Matches the "random ≥32-byte string"
31
- * guidance everywhere these secrets are documented; enforced here so a
32
- * short dev secret can't reach production silently (presence-only checks
33
- * let a 4-char secret through).
28
+ * Minimum accepted secret length, matching the "random ≥32-byte string"
29
+ * guidance these secrets are documented under. Enforced here because a
30
+ * presence-only check lets a 4-char dev secret reach production silently.
34
31
  */
35
32
  export const MIN_TOKEN_SECRET_LENGTH = 32;
36
33
  export function createTokenCodec(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"token-codec.js","sourceRoot":"","sources":["../../src/tokens/token-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAsB1C,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACxD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAClC,IAAI,MAAM,CAAC,MAAM,GAAG,uBAAuB,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACd,eAAe,MAAM,6BAA6B,uBAAuB,cAAc;YACtF,QAAQ,MAAM,CAAC,MAAM,+CAA+C,CACrE,CAAC;IACH,CAAC;IAED,OAAO;QACN,MAAM;QACN,YAAY;YACX,OAAO,MAAM,GAAG,WAAW,CAAC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M,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvD,CAAC;QACD,SAAS,CAAC,GAAW;YACpB,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACrE,CAAC;QACD,WAAW,CAAC,CAAS,EAAE,CAAS;YAC/B,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;gBAAE,OAAO,KAAK,CAAC;YAC1C,OAAO,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAChC,CAAC;QACD,cAAc,CAAC,KAAa;YAC3B,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;KACD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/server",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.1",
4
4
  "description": "Transport-agnostic server building blocks for apps built on the Selva engine (limits, rate limiting, SSRF guard, remote-definition fetch, definition service + render loader); the solve core lives in @selvajs/solve/server",
5
5
  "license": "MIT",
6
6
  "author": "VektorNode",
@@ -79,9 +79,9 @@
79
79
  "!**/*.spec.*"
80
80
  ],
81
81
  "dependencies": {
82
- "@selvajs/compute": "^4.0.0-beta.6",
83
- "@selvajs/platform": "^0.17.0-beta.3",
84
- "@selvajs/schemas": "^5.0.0-beta.3"
82
+ "@selvajs/compute": "^4.0.1",
83
+ "@selvajs/platform": "^0.17.0",
84
+ "@selvajs/schemas": "^5.0.0"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@sentry/node": ">=8",
@@ -99,7 +99,7 @@
99
99
  "@types/node": "^26.1.2",
100
100
  "typescript": "~6.0.3",
101
101
  "vitest": "^4.1.10",
102
- "@selvajs/config": "0.0.3"
102
+ "@selvajs/config": "0.0.4"
103
103
  },
104
104
  "scripts": {
105
105
  "build": "tsc",