@wildo-ai/platform-config-lib 1.1.10 → 1.1.11

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 (231) hide show
  1. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +1 -1
  2. package/dist/esm/_unimplemented/unimplemented-field-warning.js +1 -1
  3. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -1
  4. package/dist/esm/blueprint/anchored-region.d.ts +83 -0
  5. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -0
  6. package/dist/esm/blueprint/anchored-region.js +263 -0
  7. package/dist/esm/blueprint/anchored-region.js.map +1 -0
  8. package/dist/esm/blueprint/blueprint.schemas.d.ts +689 -0
  9. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -0
  10. package/dist/esm/blueprint/blueprint.schemas.js +638 -0
  11. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -0
  12. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  14. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +13 -1
  15. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap.contracts.js +6 -0
  17. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +21 -3
  19. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/bootstrap.schemas.js +14 -3
  21. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  22. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +121 -0
  23. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +129 -0
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  26. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  27. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  29. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  30. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  31. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  32. package/dist/esm/bootstrap/runtime-response-integrity.d.ts +249 -0
  33. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -0
  34. package/dist/esm/bootstrap/runtime-response-integrity.js +353 -0
  35. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -0
  36. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts +32 -0
  37. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -0
  38. package/dist/esm/bootstrap/runtime-secret-env.contracts.js +43 -0
  39. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -0
  40. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  41. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  42. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts +51 -0
  43. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -0
  44. package/dist/esm/canonical-json/rfc8785-canonical-json.js +231 -0
  45. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -0
  46. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  47. package/dist/esm/index.d.ts +15 -0
  48. package/dist/esm/index.d.ts.map +1 -1
  49. package/dist/esm/index.js +15 -0
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/key-management/approval-seal-verifier.d.ts +216 -0
  52. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -0
  53. package/dist/esm/key-management/approval-seal-verifier.js +233 -0
  54. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -0
  55. package/dist/esm/key-management/approval-seal.contracts.d.ts +131 -0
  56. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -0
  57. package/dist/esm/key-management/approval-seal.contracts.js +115 -0
  58. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -0
  59. package/dist/esm/key-management/data-key.contracts.d.ts +108 -0
  60. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -0
  61. package/dist/esm/key-management/data-key.contracts.js +54 -0
  62. package/dist/esm/key-management/data-key.contracts.js.map +1 -0
  63. package/dist/esm/key-management/es256-jws.d.ts +60 -0
  64. package/dist/esm/key-management/es256-jws.d.ts.map +1 -0
  65. package/dist/esm/key-management/es256-jws.js +135 -0
  66. package/dist/esm/key-management/es256-jws.js.map +1 -0
  67. package/dist/esm/key-management/key-provider.spi.d.ts +151 -0
  68. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -0
  69. package/dist/esm/key-management/key-provider.spi.js +38 -0
  70. package/dist/esm/key-management/key-provider.spi.js.map +1 -0
  71. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +93 -0
  72. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -0
  73. package/dist/esm/key-management/keyring-rotation.contracts.js +101 -0
  74. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -0
  75. package/dist/esm/key-management/keyring-status.contracts.d.ts +66 -0
  76. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/keyring-status.contracts.js +45 -0
  78. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -0
  79. package/dist/esm/key-management/signature-request.contracts.d.ts +95 -0
  80. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -0
  81. package/dist/esm/key-management/signature-request.contracts.js +96 -0
  82. package/dist/esm/key-management/signature-request.contracts.js.map +1 -0
  83. package/dist/esm/key-management/signing-log-export.contracts.d.ts +216 -0
  84. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -0
  85. package/dist/esm/key-management/signing-log-export.contracts.js +268 -0
  86. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -0
  87. package/dist/esm/key-management/vault-custody.contracts.d.ts +55 -0
  88. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -0
  89. package/dist/esm/key-management/vault-custody.contracts.js +88 -0
  90. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -0
  91. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  92. package/dist/esm/lockfile/lockfile-io.d.ts +7 -9
  93. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  94. package/dist/esm/lockfile/lockfile-io.js +23 -22
  95. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  96. package/dist/esm/lockfile/materialize-infra-section.d.ts +17 -14
  97. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  98. package/dist/esm/lockfile/materialize-infra-section.js +9 -9
  99. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  100. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +26 -2
  101. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  102. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -2
  103. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  104. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  105. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +9 -2
  106. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  107. package/dist/esm/project-config/application-served-public-documents.loader.d.ts +26 -0
  108. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -0
  109. package/dist/esm/project-config/application-served-public-documents.loader.js +78 -0
  110. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -0
  111. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  112. package/dist/esm/project-config/define-infra-env-config.d.ts +236 -15
  113. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  114. package/dist/esm/project-config/define-infra-env-config.js +104 -91
  115. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  116. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  117. package/dist/esm/project-config/define-saas-config.d.ts +133 -3
  118. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  119. package/dist/esm/project-config/define-saas-config.js +170 -19
  120. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  121. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  122. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  123. package/dist/esm/project-config/hosted-infra-env-config.js +3 -0
  124. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  125. package/dist/esm/project-config/index.d.ts +3 -0
  126. package/dist/esm/project-config/index.d.ts.map +1 -1
  127. package/dist/esm/project-config/index.js +3 -0
  128. package/dist/esm/project-config/index.js.map +1 -1
  129. package/dist/esm/project-config/loader.d.ts.map +1 -1
  130. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  131. package/dist/esm/project-config/npm-version-range.js +39 -16
  132. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  133. package/dist/esm/project-config/owning-package-tsconfig.d.ts +15 -0
  134. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -0
  135. package/dist/esm/project-config/owning-package-tsconfig.js +29 -0
  136. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -0
  137. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  138. package/dist/esm/project-config/provider-companion-discovery.d.ts +4 -4
  139. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  140. package/dist/esm/project-config/provider-companion-discovery.js +13 -9
  141. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  142. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +32 -3
  143. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  144. package/dist/esm/project-config/provider-runtime-artifacts.js +67 -13
  145. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  146. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  147. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  148. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  149. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  150. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
  151. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  152. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
  153. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  154. package/dist/esm/project-config/shared/csp-defaults.d.ts +4 -5
  155. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  156. package/dist/esm/project-config/shared/csp-defaults.js +4 -5
  157. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  158. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  159. package/dist/esm/project-config/shared/csp.schemas.d.ts +1 -2
  160. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  161. package/dist/esm/project-config/shared/csp.schemas.js +1 -2
  162. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  163. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  164. package/dist/esm/project-config/shared/environment.schemas.d.ts +6 -0
  165. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  166. package/dist/esm/project-config/shared/environment.schemas.js +8 -1
  167. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  168. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  169. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  170. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +1 -0
  171. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  172. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +3 -0
  173. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  174. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +4 -0
  175. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  176. package/dist/esm/project-config/shared/minion-resource-access.validation.js +6 -2
  177. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  178. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +250 -0
  179. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -0
  180. package/dist/esm/project-config/shared/platform-key-management.schemas.js +194 -0
  181. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -0
  182. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  183. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  184. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
  185. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  186. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  187. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  188. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  189. package/dist/esm/registry/index.d.ts +1 -0
  190. package/dist/esm/registry/index.d.ts.map +1 -1
  191. package/dist/esm/registry/index.js +1 -0
  192. package/dist/esm/registry/index.js.map +1 -1
  193. package/dist/esm/registry/local-checkout-source.d.ts +22 -2
  194. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  195. package/dist/esm/registry/local-checkout-source.js +66 -3
  196. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  197. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +10 -0
  198. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  199. package/dist/esm/registry/module-artifact.schemas.d.ts +23 -0
  200. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  201. package/dist/esm/registry/module-manifest.schemas.d.ts +336 -18
  202. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  203. package/dist/esm/registry/module-manifest.schemas.js +245 -19
  204. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  205. package/dist/esm/registry/module-search.schemas.d.ts +2 -0
  206. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  207. package/dist/esm/registry/module-search.schemas.js +14 -1
  208. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  209. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  210. package/dist/esm/registry/registry-errors.d.ts +22 -2
  211. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  212. package/dist/esm/registry/registry-errors.js +28 -2
  213. package/dist/esm/registry/registry-errors.js.map +1 -1
  214. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
  215. package/dist/esm/registry/registry-section-schemas.constants.d.ts +5 -0
  216. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  217. package/dist/esm/registry/registry-url-resolution.d.ts +72 -0
  218. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -0
  219. package/dist/esm/registry/registry-url-resolution.js +157 -0
  220. package/dist/esm/registry/registry-url-resolution.js.map +1 -0
  221. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  222. package/dist/esm/schemas/framework-secrets.schemas.d.ts +55 -0
  223. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  224. package/dist/esm/schemas/framework-secrets.schemas.js +53 -0
  225. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  226. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  227. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  228. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  229. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  230. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  231. package/package.json +7 -7
@@ -117,6 +117,103 @@ export var PlatformSecurityEnvKey;
117
117
  (function (PlatformSecurityEnvKey) {
118
118
  PlatformSecurityEnvKey["PLATFORM_APPS_MANAGER_PRIVATE_KEY"] = "PLATFORM_APPS_MANAGER_PRIVATE_KEY";
119
119
  PlatformSecurityEnvKey["PLATFORM_APPS_MANAGER_PUBLIC_KEY"] = "PLATFORM_APPS_MANAGER_PUBLIC_KEY";
120
+ /**
121
+ * apps-manager's RESPONSE key (#2921): the private half that signs every successful answer on the routes application
122
+ * runtimes read (configuration, secrets, worker bootstrap, storage session, runtime-principal token). Its own key,
123
+ * never the {@link PLATFORM_APPS_MANAGER_PRIVATE_KEY} that signs runtime-principal tokens and crontabs requests: one key
124
+ * per purpose (NIST SP 800-57 Part 1 Rev 5 §5.2). Runtimes verify against the public halves carried in
125
+ * `PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`. Required: apps-manager refuses to start without it, because a
126
+ * response it cannot sign must not be sent (`runtime-response-integrity.ts`).
127
+ */
128
+ PlatformSecurityEnvKey["PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY"] = "PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY";
129
+ /**
130
+ * The platform's key-encryption ROOT (#2891): 32 random bytes, base64url, held by apps-manager alone. Every private
131
+ * key the engine's LOCAL key provider makes (the approval-seal keys among them) is sealed under it with AES-256-GCM
132
+ * before it is stored, so a platform database dump yields no usable private key.
133
+ *
134
+ * Losing it loses every LOCAL private key, and nothing else: the public halves are stored in each application, so
135
+ * every seal already made still verifies. The keys it sealed cannot sign again, and the keyring does not replace them on
136
+ * its own: apps-manager reports them at startup, and an operator who knows the root is gone for good runs
137
+ * `wildo keys rotate --root-lost --reason "<why>"` per application, which destroys them and makes fresh ones. A new
138
+ * root never opens the old keys, so restore it from backup before minting another. Back it up with the platform's other
139
+ * secrets. Every lane provides it (`wildo local doctor` reports it missing). apps-manager starts without it, so a stack
140
+ * predating it keeps running, and the keyring refuses its first operation (`PROVIDER_UNAVAILABLE`); a MALFORMED value is
141
+ * refused at startup.
142
+ */
143
+ PlatformSecurityEnvKey["PLATFORM_KEY_ENCRYPTION_ROOT"] = "PLATFORM_KEY_ENCRYPTION_ROOT";
144
+ /**
145
+ * The root a rotation replaced (#2891), kept only until every sealed key has been re-sealed under the current one.
146
+ * apps-manager opens a key under whichever root sealed it and re-seals it under the current root. Optional.
147
+ */
148
+ PlatformSecurityEnvKey["PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT"] = "PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT";
149
+ /**
150
+ * The platform's HashiCorp Vault or OpenBao (#2933), where apps-manager runs the `vault-transit` (REMOTE) and
151
+ * `vault-kv` (RETRIEVED) key providers. apps-manager alone holds these: no application runtime ever reaches the Vault.
152
+ * All optional; a platform without a Vault leaves them unset, and a binding to a Vault provider is refused
153
+ * (`PROVIDER_UNAVAILABLE`). The address and BOTH tokens are needed together; a partial set registers nothing and is
154
+ * reported at apps-manager's boot, while the LOCAL provider keeps serving.
155
+ *
156
+ * Two tokens, for least privilege, under the policies `vault-custody.contracts` states (`vaultSignerPolicy`,
157
+ * `vaultOperatorPolicy`): the SIGNER token may sign (`transit/sign/<prefix>*`) and read keys and key metadata; the
158
+ * OPERATOR token performs lifecycle acts (create, rotate, config, delete, KV write and destroy) and is denied signing
159
+ * and reading key material. Neither can make a key leave Vault: the signer is denied `/config`, `transit/export/*` and
160
+ * `transit/backup/*`, and the operator may not send `exportable` or `allow_plaintext_backup` at all.
161
+ * Not `VAULT_ADDR` / `VAULT_TOKEN`: those are read by Vault's own CLI and SDKs, and a stray one would be picked up.
162
+ */
163
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_ADDRESS"] = "PLATFORM_KEY_VAULT_ADDRESS";
164
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_SIGNER_TOKEN"] = "PLATFORM_KEY_VAULT_SIGNER_TOKEN";
165
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_OPERATOR_TOKEN"] = "PLATFORM_KEY_VAULT_OPERATOR_TOKEN";
166
+ /** Vault Enterprise namespace (`ns1/ns2/`). Optional. */
167
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_NAMESPACE"] = "PLATFORM_KEY_VAULT_NAMESPACE";
168
+ /** The Transit mount (`transit` when unset). */
169
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_TRANSIT_MOUNT"] = "PLATFORM_KEY_VAULT_TRANSIT_MOUNT";
170
+ /** The KV v2 mount (`secret` when unset). */
171
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_KV_MOUNT"] = "PLATFORM_KEY_VAULT_KV_MOUNT";
172
+ /** What every key and path apps-manager makes is named with, so the Vault policies can be scoped to it (`wildo-`). */
173
+ PlatformSecurityEnvKey["PLATFORM_KEY_VAULT_KEY_NAME_PREFIX"] = "PLATFORM_KEY_VAULT_KEY_NAME_PREFIX";
174
+ /**
175
+ * The platform's cloud KMS providers (#2896): `aws-kms`, `google-cloud-kms`, `azure-key-vault`. apps-manager alone
176
+ * holds them, and authenticates by its WORKLOAD identity (IAM role for service accounts, GKE workload identity, an
177
+ * Azure managed identity), so none of these is a secret. Each provider acts as TWO identities, as the Vault providers
178
+ * do with two tokens: a SIGNER that may only read keys and sign, and an OPERATOR that creates, disables and destroys
179
+ * them and may never sign. Every key of one provider is needed together; a partial set registers nothing and is
180
+ * reported at apps-manager's boot.
181
+ *
182
+ * AWS: apps-manager's own identity may only `sts:AssumeRole` the two roles named here.
183
+ */
184
+ PlatformSecurityEnvKey["PLATFORM_KEY_AWS_KMS_REGION"] = "PLATFORM_KEY_AWS_KMS_REGION";
185
+ PlatformSecurityEnvKey["PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN"] = "PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN";
186
+ PlatformSecurityEnvKey["PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN"] = "PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN";
187
+ /** A KMS endpoint other than the region's public one (a VPC interface endpoint). Optional. */
188
+ PlatformSecurityEnvKey["PLATFORM_KEY_AWS_KMS_ENDPOINT"] = "PLATFORM_KEY_AWS_KMS_ENDPOINT";
189
+ /** Google: the key ring (`projects/<p>/locations/<l>/keyRings/<r>`) and the two service accounts apps-manager impersonates. */
190
+ PlatformSecurityEnvKey["PLATFORM_KEY_GOOGLE_KMS_KEY_RING"] = "PLATFORM_KEY_GOOGLE_KMS_KEY_RING";
191
+ PlatformSecurityEnvKey["PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT"] = "PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT";
192
+ PlatformSecurityEnvKey["PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT"] = "PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT";
193
+ /** `HSM` (the default) or `SOFTWARE`: the protection level new keys are created at. */
194
+ PlatformSecurityEnvKey["PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL"] = "PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL";
195
+ /** Azure: the vault (or Managed HSM) URL and the client ids of the two user-assigned managed identities. */
196
+ PlatformSecurityEnvKey["PLATFORM_KEY_AZURE_KEY_VAULT_URL"] = "PLATFORM_KEY_AZURE_KEY_VAULT_URL";
197
+ PlatformSecurityEnvKey["PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID"] = "PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID";
198
+ PlatformSecurityEnvKey["PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID"] = "PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID";
199
+ /** `true` (the default) makes new keys `EC-HSM` (a Premium vault or Managed HSM); `false` makes them software `EC` keys. */
200
+ PlatformSecurityEnvKey["PLATFORM_KEY_AZURE_KEY_VAULT_HSM"] = "PLATFORM_KEY_AZURE_KEY_VAULT_HSM";
201
+ /**
202
+ * The Log Analytics workspace the vault's diagnostic setting sends its `AuditEvent` logs to, read hourly to corroborate
203
+ * the custodian's signatures (#2896). Optional: without it, no Azure hour is compared, and apps-manager says so at boot.
204
+ */
205
+ PlatformSecurityEnvKey["PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID"] = "PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID";
206
+ /**
207
+ * The platform's dedicated HSM over PKCS#11 (#2934): the vendor's module (a shared library in apps-manager's image or
208
+ * mounted into it), the token's label, and the user PIN. The module path and label come from
209
+ * `platformKeyManagement.pkcs11`; the PIN from `secrets.json` (`platformKeyPkcs11.pin`), operator-typed, and it is the
210
+ * only secret here. All three or none; a partial set registers nothing and is reported at apps-manager's boot.
211
+ */
212
+ PlatformSecurityEnvKey["PLATFORM_KEY_PKCS11_MODULE_PATH"] = "PLATFORM_KEY_PKCS11_MODULE_PATH";
213
+ PlatformSecurityEnvKey["PLATFORM_KEY_PKCS11_TOKEN_LABEL"] = "PLATFORM_KEY_PKCS11_TOKEN_LABEL";
214
+ PlatformSecurityEnvKey["PLATFORM_KEY_PKCS11_PIN"] = "PLATFORM_KEY_PKCS11_PIN";
215
+ /** Comma-separated token models the operator states are hardware (`CK_TOKEN_INFO.model`); none: every key is SOFTWARE. */
216
+ PlatformSecurityEnvKey["PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS"] = "PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS";
120
217
  /**
121
218
  * The crontabs-batches-manager's dedicated P2P signing keypair. The design is
122
219
  * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /
@@ -260,6 +357,30 @@ export var PlatformProviderSelectionEnvKey;
260
357
  (function (PlatformProviderSelectionEnvKey) {
261
358
  PlatformProviderSelectionEnvKey["WILDO_PROVIDER_SELECTION_OVERRIDES"] = "WILDO_PROVIDER_SELECTION_OVERRIDES";
262
359
  })(PlatformProviderSelectionEnvKey || (PlatformProviderSelectionEnvKey = {}));
360
+ /**
361
+ * Per-environment email env-var contract.
362
+ *
363
+ * Projected from `WildoInfraEnvConfig.email` by `env-vars-builder`, one scalar per value (the documentation-site shape:
364
+ * a single string needs no serialized payload). Read by the backend's inbound email services through
365
+ * `resolveInboundEmailConfig`, where it wins over `email.inbound.sharedDomain` in the backend configuration. Absent =>
366
+ * the authored value applies unchanged.
367
+ */
368
+ export var PlatformEmailEnvKey;
369
+ (function (PlatformEmailEnvKey) {
370
+ PlatformEmailEnvKey["WILDO_INBOUND_EMAIL_SHARED_DOMAIN"] = "WILDO_INBOUND_EMAIL_SHARED_DOMAIN";
371
+ })(PlatformEmailEnvKey || (PlatformEmailEnvKey = {}));
372
+ /**
373
+ * The ownership-DNS stand-in env-var contract (#2519).
374
+ *
375
+ * Projected from `WildoInfraEnvConfig.ownershipDnsStandIn.baseUrl` (local-only) by `env-vars-builder`. Read by the
376
+ * backend's `DnsTxtLookupBackendService` — the one door every domain-ownership challenge asks DNS through — which
377
+ * honours it only in a declared development or test runtime, and refuses to start with it set anywhere else. Absent =>
378
+ * every ownership challenge asks public DNS.
379
+ */
380
+ export var PlatformOwnershipDnsEnvKey;
381
+ (function (PlatformOwnershipDnsEnvKey) {
382
+ PlatformOwnershipDnsEnvKey["WILDO_OWNERSHIP_DNS_STAND_IN_URL"] = "WILDO_OWNERSHIP_DNS_STAND_IN_URL";
383
+ })(PlatformOwnershipDnsEnvKey || (PlatformOwnershipDnsEnvKey = {}));
263
384
  /**
264
385
  * Documentation-site BUILD env-var contract.
265
386
  *
@@ -295,6 +416,8 @@ export const PlatformIngressEnvKeys = PlatformIngressEnvKey;
295
416
  export const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;
296
417
  export const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;
297
418
  export const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;
419
+ export const PlatformEmailEnvKeys = PlatformEmailEnvKey;
420
+ export const PlatformOwnershipDnsEnvKeys = PlatformOwnershipDnsEnvKey;
298
421
  /**
299
422
  * Resolve a required environment variable value or throw a clear,
300
423
  * actionable error.
@@ -348,6 +471,12 @@ export const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set([
348
471
  PlatformInfrastructureEnvKey.IMMUDB_ADMIN_PASSWORD,
349
472
  PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,
350
473
  PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,
474
+ PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY,
475
+ PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_ROOT,
476
+ PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT,
477
+ PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_SIGNER_TOKEN,
478
+ PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_OPERATOR_TOKEN,
479
+ PlatformSecurityEnvKey.PLATFORM_KEY_PKCS11_PIN,
351
480
  PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,
352
481
  PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,
353
482
  PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,
@@ -1 +1 @@
1
- {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAmBX;AAnBD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B;;;;;;;;;;OAUG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AC;QACpC,MAAM,IAAI,KAAK,CACb,yCAAyC,OAAO,eAAe,eAAe,KAAK;YACnF,qFAAqF;YACrF,mCAAmC,CACpC,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,GAAG,CAAS;IACjE,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,oBAAoB;IACjD,4BAA4B,CAAC,uBAAuB;IACpD,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,4BAA4B,CAAC,qBAAqB;IAClD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,sBAAsB,CAAC,6CAA6C;IACpE,sBAAsB,CAAC,4CAA4C;IACnE,sBAAsB,CAAC,mCAAmC;IAC1D,sBAAsB,CAAC,qBAAqB;IAC5C,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n /**\n * The APPLICATION this process belongs to, as its slug (#1177).\n *\n * Distinct from {@link SERVICE_NAME}, which names the PROCESS — `wonder-todos-backend-api`,\n * `marketing-scrapper`, `my-node-worker`. Only the first of those contains the application's name,\n * which is why the logger cannot derive the application from it: a minion and a worker are named\n * after themselves.\n *\n * Emitted for APPLICATION runtimes only (backend, minion, worker, companion). The platform's own\n * services belong to no application and deliberately do not carry it.\n */\n APPLICATION_SLUG = 'APPLICATION_SLUG',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n /**\n * The self-hosted immudb server apps-manager provisions each application's audit database and user on (#1696):\n * host and gRPC port as apps-manager reaches it, and the server's built-in `immudb` SYSADMIN password — a\n * framework-managed PLATFORM secret (`immudb.adminPassword`), written into apps-manager's environment only.\n * No application receives it: each application writes with the confined user apps-manager minted for it.\n * Absent on a platform that self-hosts no immudb; an application declaring `immudb: { source: SELF }` is then\n * refused at registration (`NOT_HELD_BY_PLATFORM`), like every minting kind whose admin client is missing.\n */\n IMMUDB_ADMIN_HOST = 'IMMUDB_ADMIN_HOST',\n IMMUDB_ADMIN_PORT = 'IMMUDB_ADMIN_PORT',\n IMMUDB_ADMIN_PASSWORD = 'IMMUDB_ADMIN_PASSWORD',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n /*\n * The SECOND platform administrator — the one who APPROVES an application-wide access grant.\n *\n * `applicationAccessGrantApproverIsDistinct` refuses an approver who is the requester, and refuses\n * an absent approver, and the application-scoped grant has deliberately no auto-approval branch.\n * So a platform seeded with one administrator cannot read ANY application-wide surface — the\n * refusal shipped and the party who discharges it did not (#575).\n *\n * Four keys rather than a serialized payload, mirroring the administrator's own four: each is a\n * scalar read once at INIT, and a JSON blob would make a partially-stated identity a parse error\n * instead of the four named refusals INIT already gives for the first administrator.\n */\n APPROVER_EMAIL = 'APPROVER_EMAIL',\n APPROVER_PASSWORD = 'APPROVER_PASSWORD',\n APPROVER_FIRST_NAME = 'APPROVER_FIRST_NAME',\n APPROVER_LAST_NAME = 'APPROVER_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation; see `external-public-domain-rename.md`.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/substitutes for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"whenUnavailable\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformInfrastructureEnvKey.IMMUDB_ADMIN_PASSWORD,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
1
+ {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAmBX;AAnBD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B;;;;;;;;;;OAUG;IACH,8DAAqC,CAAA;IACrC,4EAAmD,CAAA;IACnD,4DAAmC,CAAA;IACnC,gEAAuC,CAAA;AACzC,CAAC,EAnBW,qBAAqB,KAArB,qBAAqB,QAmBhC;AAED,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wB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GAAG,IAAI,GAAG,CAAS;IACjE,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,oBAAoB;IACjD,4BAA4B,CAAC,uBAAuB;IACpD,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,4BAA4B,CAAC,qBAAqB;IAClD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,sBAAsB,CAAC,kDAAkD;IACzE,sBAAsB,CAAC,4BAA4B;IACnD,sBAAsB,CAAC,qCAAqC;IAC5D,sBAAsB,CAAC,+BAA+B;IACtD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,uBAAuB;IAC9C,sBAAsB,CAAC,6CAA6C;IACpE,sBAAsB,CAAC,4CAA4C;IACnE,sBAAsB,CAAC,mCAAmC;IAC1D,sBAAsB,CAAC,qBAAqB;IAC5C,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n /**\n * The APPLICATION this process belongs to, as its slug (#1177).\n *\n * Distinct from {@link SERVICE_NAME}, which names the PROCESS — `wonder-todos-backend-api`,\n * `marketing-scrapper`, `my-node-worker`. Only the first of those contains the application's name,\n * which is why the logger cannot derive the application from it: a minion and a worker are named\n * after themselves.\n *\n * Emitted for APPLICATION runtimes only (backend, minion, worker, companion). The platform's own\n * services belong to no application and deliberately do not carry it.\n */\n APPLICATION_SLUG = 'APPLICATION_SLUG',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n /**\n * The self-hosted immudb server apps-manager provisions each application's audit database and user on (#1696):\n * host and gRPC port as apps-manager reaches it, and the server's built-in `immudb` SYSADMIN password — a\n * framework-managed PLATFORM secret (`immudb.adminPassword`), written into apps-manager's environment only.\n * No application receives it: each application writes with the confined user apps-manager minted for it.\n * Absent on a platform that self-hosts no immudb; an application declaring `immudb: { source: SELF }` is then\n * refused at registration (`NOT_HELD_BY_PLATFORM`), like every minting kind whose admin client is missing.\n */\n IMMUDB_ADMIN_HOST = 'IMMUDB_ADMIN_HOST',\n IMMUDB_ADMIN_PORT = 'IMMUDB_ADMIN_PORT',\n IMMUDB_ADMIN_PASSWORD = 'IMMUDB_ADMIN_PASSWORD',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * apps-manager's RESPONSE key (#2921): the private half that signs every successful answer on the routes application\n * runtimes read (configuration, secrets, worker bootstrap, storage session, runtime-principal token). Its own key,\n * never the {@link PLATFORM_APPS_MANAGER_PRIVATE_KEY} that signs runtime-principal tokens and crontabs requests: one key\n * per purpose (NIST SP 800-57 Part 1 Rev 5 §5.2). Runtimes verify against the public halves carried in\n * `PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`. Required: apps-manager refuses to start without it, because a\n * response it cannot sign must not be sent (`runtime-response-integrity.ts`).\n */\n PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY',\n /**\n * The platform's key-encryption ROOT (#2891): 32 random bytes, base64url, held by apps-manager alone. Every private\n * key the engine's LOCAL key provider makes (the approval-seal keys among them) is sealed under it with AES-256-GCM\n * before it is stored, so a platform database dump yields no usable private key.\n *\n * Losing it loses every LOCAL private key, and nothing else: the public halves are stored in each application, so\n * every seal already made still verifies. The keys it sealed cannot sign again, and the keyring does not replace them on\n * its own: apps-manager reports them at startup, and an operator who knows the root is gone for good runs\n * `wildo keys rotate --root-lost --reason \"<why>\"` per application, which destroys them and makes fresh ones. A new\n * root never opens the old keys, so restore it from backup before minting another. Back it up with the platform's other\n * secrets. Every lane provides it (`wildo local doctor` reports it missing). apps-manager starts without it, so a stack\n * predating it keeps running, and the keyring refuses its first operation (`PROVIDER_UNAVAILABLE`); a MALFORMED value is\n * refused at startup.\n */\n PLATFORM_KEY_ENCRYPTION_ROOT = 'PLATFORM_KEY_ENCRYPTION_ROOT',\n /**\n * The root a rotation replaced (#2891), kept only until every sealed key has been re-sealed under the current one.\n * apps-manager opens a key under whichever root sealed it and re-seals it under the current root. Optional.\n */\n PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT = 'PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT',\n /**\n * The platform's HashiCorp Vault or OpenBao (#2933), where apps-manager runs the `vault-transit` (REMOTE) and\n * `vault-kv` (RETRIEVED) key providers. apps-manager alone holds these: no application runtime ever reaches the Vault.\n * All optional; a platform without a Vault leaves them unset, and a binding to a Vault provider is refused\n * (`PROVIDER_UNAVAILABLE`). The address and BOTH tokens are needed together; a partial set registers nothing and is\n * reported at apps-manager's boot, while the LOCAL provider keeps serving.\n *\n * Two tokens, for least privilege, under the policies `vault-custody.contracts` states (`vaultSignerPolicy`,\n * `vaultOperatorPolicy`): the SIGNER token may sign (`transit/sign/<prefix>*`) and read keys and key metadata; the\n * OPERATOR token performs lifecycle acts (create, rotate, config, delete, KV write and destroy) and is denied signing\n * and reading key material. Neither can make a key leave Vault: the signer is denied `/config`, `transit/export/*` and\n * `transit/backup/*`, and the operator may not send `exportable` or `allow_plaintext_backup` at all.\n * Not `VAULT_ADDR` / `VAULT_TOKEN`: those are read by Vault's own CLI and SDKs, and a stray one would be picked up.\n */\n PLATFORM_KEY_VAULT_ADDRESS = 'PLATFORM_KEY_VAULT_ADDRESS',\n PLATFORM_KEY_VAULT_SIGNER_TOKEN = 'PLATFORM_KEY_VAULT_SIGNER_TOKEN',\n PLATFORM_KEY_VAULT_OPERATOR_TOKEN = 'PLATFORM_KEY_VAULT_OPERATOR_TOKEN',\n /** Vault Enterprise namespace (`ns1/ns2/`). Optional. */\n PLATFORM_KEY_VAULT_NAMESPACE = 'PLATFORM_KEY_VAULT_NAMESPACE',\n /** The Transit mount (`transit` when unset). */\n PLATFORM_KEY_VAULT_TRANSIT_MOUNT = 'PLATFORM_KEY_VAULT_TRANSIT_MOUNT',\n /** The KV v2 mount (`secret` when unset). */\n PLATFORM_KEY_VAULT_KV_MOUNT = 'PLATFORM_KEY_VAULT_KV_MOUNT',\n /** What every key and path apps-manager makes is named with, so the Vault policies can be scoped to it (`wildo-`). */\n PLATFORM_KEY_VAULT_KEY_NAME_PREFIX = 'PLATFORM_KEY_VAULT_KEY_NAME_PREFIX',\n /**\n * The platform's cloud KMS providers (#2896): `aws-kms`, `google-cloud-kms`, `azure-key-vault`. apps-manager alone\n * holds them, and authenticates by its WORKLOAD identity (IAM role for service accounts, GKE workload identity, an\n * Azure managed identity), so none of these is a secret. Each provider acts as TWO identities, as the Vault providers\n * do with two tokens: a SIGNER that may only read keys and sign, and an OPERATOR that creates, disables and destroys\n * them and may never sign. Every key of one provider is needed together; a partial set registers nothing and is\n * reported at apps-manager's boot.\n *\n * AWS: apps-manager's own identity may only `sts:AssumeRole` the two roles named here.\n */\n PLATFORM_KEY_AWS_KMS_REGION = 'PLATFORM_KEY_AWS_KMS_REGION',\n PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN',\n PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN',\n /** A KMS endpoint other than the region's public one (a VPC interface endpoint). Optional. */\n PLATFORM_KEY_AWS_KMS_ENDPOINT = 'PLATFORM_KEY_AWS_KMS_ENDPOINT',\n /** Google: the key ring (`projects/<p>/locations/<l>/keyRings/<r>`) and the two service accounts apps-manager impersonates. */\n PLATFORM_KEY_GOOGLE_KMS_KEY_RING = 'PLATFORM_KEY_GOOGLE_KMS_KEY_RING',\n PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT',\n PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT',\n /** `HSM` (the default) or `SOFTWARE`: the protection level new keys are created at. */\n PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL = 'PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL',\n /** Azure: the vault (or Managed HSM) URL and the client ids of the two user-assigned managed identities. */\n PLATFORM_KEY_AZURE_KEY_VAULT_URL = 'PLATFORM_KEY_AZURE_KEY_VAULT_URL',\n PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID',\n PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID',\n /** `true` (the default) makes new keys `EC-HSM` (a Premium vault or Managed HSM); `false` makes them software `EC` keys. */\n PLATFORM_KEY_AZURE_KEY_VAULT_HSM = 'PLATFORM_KEY_AZURE_KEY_VAULT_HSM',\n /**\n * The Log Analytics workspace the vault's diagnostic setting sends its `AuditEvent` logs to, read hourly to corroborate\n * the custodian's signatures (#2896). Optional: without it, no Azure hour is compared, and apps-manager says so at boot.\n */\n PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID',\n /**\n * The platform's dedicated HSM over PKCS#11 (#2934): the vendor's module (a shared library in apps-manager's image or\n * mounted into it), the token's label, and the user PIN. The module path and label come from\n * `platformKeyManagement.pkcs11`; the PIN from `secrets.json` (`platformKeyPkcs11.pin`), operator-typed, and it is the\n * only secret here. All three or none; a partial set registers nothing and is reported at apps-manager's boot.\n */\n PLATFORM_KEY_PKCS11_MODULE_PATH = 'PLATFORM_KEY_PKCS11_MODULE_PATH',\n PLATFORM_KEY_PKCS11_TOKEN_LABEL = 'PLATFORM_KEY_PKCS11_TOKEN_LABEL',\n PLATFORM_KEY_PKCS11_PIN = 'PLATFORM_KEY_PKCS11_PIN',\n /** Comma-separated token models the operator states are hardware (`CK_TOKEN_INFO.model`); none: every key is SOFTWARE. */\n PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS = 'PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n /*\n * The SECOND platform administrator — the one who APPROVES an application-wide access grant.\n *\n * `applicationAccessGrantApproverIsDistinct` refuses an approver who is the requester, and refuses\n * an absent approver, and the application-scoped grant has deliberately no auto-approval branch.\n * So a platform seeded with one administrator cannot read ANY application-wide surface — the\n * refusal shipped and the party who discharges it did not (#575).\n *\n * Four keys rather than a serialized payload, mirroring the administrator's own four: each is a\n * scalar read once at INIT, and a JSON blob would make a partially-stated identity a parse error\n * instead of the four named refusals INIT already gives for the first administrator.\n */\n APPROVER_EMAIL = 'APPROVER_EMAIL',\n APPROVER_PASSWORD = 'APPROVER_PASSWORD',\n APPROVER_FIRST_NAME = 'APPROVER_FIRST_NAME',\n APPROVER_LAST_NAME = 'APPROVER_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation; see `external-public-domain-rename.md`.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/substitutes for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"whenUnavailable\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Per-environment email env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.email` by `env-vars-builder`, one scalar per value (the documentation-site shape:\n * a single string needs no serialized payload). Read by the backend's inbound email services through\n * `resolveInboundEmailConfig`, where it wins over `email.inbound.sharedDomain` in the backend configuration. Absent =>\n * the authored value applies unchanged.\n */\nexport enum PlatformEmailEnvKey {\n WILDO_INBOUND_EMAIL_SHARED_DOMAIN = 'WILDO_INBOUND_EMAIL_SHARED_DOMAIN',\n}\n\n/**\n * The ownership-DNS stand-in env-var contract (#2519).\n *\n * Projected from `WildoInfraEnvConfig.ownershipDnsStandIn.baseUrl` (local-only) by `env-vars-builder`. Read by the\n * backend's `DnsTxtLookupBackendService` — the one door every domain-ownership challenge asks DNS through — which\n * honours it only in a declared development or test runtime, and refuses to start with it set anywhere else. Absent =>\n * every ownership challenge asks public DNS.\n */\nexport enum PlatformOwnershipDnsEnvKey {\n WILDO_OWNERSHIP_DNS_STAND_IN_URL = 'WILDO_OWNERSHIP_DNS_STAND_IN_URL',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\nexport const PlatformEmailEnvKeys = PlatformEmailEnvKey;\nexport const PlatformOwnershipDnsEnvKeys = PlatformOwnershipDnsEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformInfrastructureEnvKey.IMMUDB_ADMIN_PASSWORD,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_SIGNER_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_OPERATOR_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_PKCS11_PIN,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"platform-store-preconnect.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD,GAAG,MAAM,GAAG,SAAS,CAOrB"}
1
+ {"version":3,"file":"platform-store-preconnect.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/platform-store-preconnect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD,GAAG,MAAM,GAAG,SAAS,CAOrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACpD;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,uFAAuF;IACvF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvD;AAqCD;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,GACjD,2BAA2B,CA+C7B"}
1
+ {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YA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MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,4BAA4B,EAAE,CAoD9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-network-topology.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-network-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,oBAAY,mBAAmB;IAC7B,sFAAsF;IACtF,IAAI,eAAe;IACnB;;;;OAIG;IACH,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,aAAa,wBAAwB;IACrC,UAAU,qBAAqB;IAC/B,WAAW,sBAAsB;IACjC,YAAY,uBAAuB;IACnC,cAAc,yBAAyB;IACvC,8FAA8F;IAC9F,UAAU,qBAAqB;IAC/B,0FAA0F;IAC1F,cAAc,yBAAyB;IACvC;;;;;OAKG;IACH,MAAM,iBAAiB;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAwBtF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,WAAW,CAAC,mBAAmB,CAAC,CAgClC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAEvE"}
1
+ {"version":3,"file":"runtime-network-topology.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-network-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,oBAAY,mBAAmB;IAC7B,sFAAsF;IACtF,IAAI,eAAe;IACnB;;;;OAIG;IACH,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,aAAa,wBAAwB;IACrC,UAAU,qBAAqB;IAC/B,WAAW,sBAAsB;IACjC,YAAY,uBAAuB;IACnC,cAAc,yBAAyB;IACvC,8FAA8F;IAC9F,UAAU,qBAAqB;IAC/B,0FAA0F;IAC1F,cAAc,yBAAyB;IACvC;;;;;OAKG;IACH,MAAM,iBAAiB;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAwBtF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,WAAW,CAAC,mBAAmB,CAAC,CAgClC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAEvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-platform-access.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-platform-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAGlH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAEvG;;;;;;;;;;;;;;;GAeG;AAGH,kEAAkE;AAClE,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,+BAA+B,GAAG,SAAS,GACvD;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQxC"}
1
+ {"version":3,"file":"runtime-platform-access.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-platform-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAGlH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAEvG;;;;;;;;;;;;;;;GAeG;AAGH,kEAAkE;AAClE,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,+BAA+B,GAAG,SAAS,GACvD;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-principal.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oB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C,MAAM,GAAG,SAAS,CAQpB"}
1
+ {"version":3,"file":"runtime-principal.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oBAAY,+BAA+B;IACzC;;;;;OAKG;IACH,mBAAmB,wBAAwB;IAC3C,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,qBAAqB,GACjC,+BAA+B,CAOjC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,+BAA+B,CAAC;IACtC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,EAAE,2BAE3C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,2BAA2B,GAAG,MAAM,CAIvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,GAAG,IAAI,CAaxF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C,GAAG,2BAA2B,EAAE,CAYhC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sCAAsC,CACpD,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,+BAA+B,GAAG,SAAS,CAW7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,+BAA+B,GAAG,SAAS,EAC1D,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CAQpB"}
@@ -0,0 +1,249 @@
1
+ import { type KeyObject } from 'node:crypto';
2
+ import { CryptoKey_Purpose } from '@wildo-ai/saas-models';
3
+ import { type P256PublicJwk } from '../key-management/es256-jws';
4
+ import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts';
5
+ /**
6
+ * Integrity of what apps-manager tells an application runtime (#2921) and a platform service (#2898).
7
+ *
8
+ * A platform service (crontabs, module-registry) is held to the same contract with the same key: its audience is its
9
+ * own platform application (`SERVICE_NAME`, the record the request authenticated against) and the backend principal,
10
+ * and the route binding keeps an answer on one plane (`platform-services-to-manager`) from standing in for the other
11
+ * (`apps-to-manager`).
12
+ *
13
+ * An application runtime (backend, minion, worker, development companion) learns its configuration, its secrets, its
14
+ * worker bootstrap, its storage session and its runtime-principal tokens from apps-manager, over HTTP. Before this
15
+ * contract it verified none of it: anything that could answer on `PLATFORM_APPS_MANAGER_URL` (a wrong DNS answer, a
16
+ * plain-HTTP hop, an impostor service) could hand a runtime a configuration and secrets of its choosing.
17
+ *
18
+ * ## The contract
19
+ *
20
+ * - **apps-manager signs every successful response** on the runtime-facing routes with its RESPONSE key, a key used for
21
+ * nothing else (not the key that signs runtime-principal tokens or crontabs requests: one key per purpose, NIST SP
22
+ * 800-57 Part 1 Rev 5 §5.2). The signature travels in {@link RUNTIME_RESPONSE_SIGNATURE_HEADER}.
23
+ * - **The signature is a compact JWS** (RFC 7515) with `alg: ES256`, `typ: wildo-runtime-response+jws` and a `kid`
24
+ * that is the RFC 7638 thumbprint of the signing key. Its claims bind:
25
+ * - `bodyDigest`: SHA-256 over the RFC 8785 (JCS) serialization of the body as sent (`canonicalizeJson`). The signer
26
+ * digests the exact text it sends, parsed back, so a `Date` or an `undefined` in the handler's object cannot make
27
+ * the two sides digest different values. RFC 8785 rather than a sorted `JSON.stringify`: the latter drops a
28
+ * `"__proto__"` member (so one could be added to a signed body undetected) and orders integer-like keys the
29
+ * JavaScript way, which no verifier in another language reproduces;
30
+ * - `aud`: the application id and the runtime principal the request authenticated as;
31
+ * - `nonce`: echoed from {@link RUNTIME_RESPONSE_NONCE_HEADER}, which the runtime generates fresh for every request.
32
+ * Replay protection rests on this nonce and on a short lifetime, never on a version a freshly booted runtime
33
+ * cannot remember;
34
+ * - `htm` / `htu`: the request's method and its apps-to-manager route (the DPoP pattern, RFC 9449 §4.2), so a
35
+ * genuine answer from one route cannot stand in for another under the same nonce;
36
+ * - `iat` / `exp`: a {@link RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS}-second window.
37
+ * - **Runtimes verify, fail-closed**, against up to {@link RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} public keys (current
38
+ * and next) carried in their environment as a one-line JWKS, so the response key can rotate without a flag day.
39
+ *
40
+ * ## Its key purpose (#2891)
41
+ *
42
+ * The response key is the {@link RUNTIME_RESPONSE_KEY_PURPOSE} key: platform-scoped, held by apps-manager alone, used for
43
+ * nothing else, and requested by nobody (its descriptor's `heldBy` and `mayRequestSignature` are empty). Its `typ`,
44
+ * algorithm and cryptoperiod are the purpose's. Its versions are the two the runtimes accept, current and next, which
45
+ * is the purpose's ACTIVE and NEXT.
46
+ *
47
+ * It stays in apps-manager's environment rather than in the platform keyring, deliberately: a runtime has to hold the
48
+ * verification keys BEFORE it can trust anything apps-manager says, so they reach it out of band, in its environment,
49
+ * and so does the signing half. A keyring version would be announced over the very channel the key authenticates.
50
+ *
51
+ * ## What this protects, stated
52
+ *
53
+ * The network path and an impostor apps-manager. NOT the host: the host supplies each runtime's environment, so it
54
+ * supplies the verification keys too.
55
+ *
56
+ * ## Why not a library
57
+ *
58
+ * ES256 over a compact JWS is a few lines of `node:crypto` (`dsaEncoding: 'ieee-p1363'` gives the raw r‖s form RFC 7518
59
+ * §3.4 requires). Every party here already runs Node, and the verifier must load in the dependency-light worker
60
+ * runtime, so taking no JOSE dependency keeps one implementation on both sides.
61
+ */
62
+ /** The key purpose that signs runtime responses (#2891): the response key is used for nothing else. */
63
+ export declare const RUNTIME_RESPONSE_KEY_PURPOSE = CryptoKey_Purpose.PLATFORM_RESPONSE_INTEGRITY;
64
+ /**
65
+ * The JWS `typ`, so a response signature can never be mistaken for any other JWS the platform issues (RFC 8725 §3.11):
66
+ * the response purpose's, from its descriptor, distinct from every other purpose's.
67
+ */
68
+ export declare const RUNTIME_RESPONSE_JWS_TYPE: string;
69
+ /** The only algorithm accepted, pinned rather than read from the header (RFC 8725 §3.1): the purpose's ES256. */
70
+ export declare const RUNTIME_RESPONSE_JWS_ALGORITHM = "ES256";
71
+ /** The issuer every response signature carries: apps-manager. */
72
+ export declare const RUNTIME_RESPONSE_ISSUER: string;
73
+ /** Response header carrying the compact JWS. */
74
+ export declare const RUNTIME_RESPONSE_SIGNATURE_HEADER = "x-wildo-response-signature";
75
+ /** Request header carrying the runtime's fresh nonce, echoed into the signature's `nonce` claim. */
76
+ export declare const RUNTIME_RESPONSE_NONCE_HEADER = "x-wildo-response-nonce";
77
+ /**
78
+ * How long a response signature is valid. It only needs to cover one round trip plus clock skew: the nonce is what
79
+ * stops a replay, and the window bounds how long a captured response is worth anything at all.
80
+ */
81
+ export declare const RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS = 60;
82
+ /** Tolerated clock difference between apps-manager and a runtime, in both directions. */
83
+ export declare const RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS = 30;
84
+ /** Random bytes in a nonce (256 bits, base64url-encoded). */
85
+ export declare const RUNTIME_RESPONSE_NONCE_BYTES = 32;
86
+ /** Current and next: a runtime accepts at most two response keys, so the key can rotate without a flag day. */
87
+ export declare const RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS = 2;
88
+ /**
89
+ * Why a response was refused. A closed vocabulary so a log, a test or an alert can branch on the reason rather than on
90
+ * an English message.
91
+ */
92
+ export declare enum RuntimeResponseVerificationFailure {
93
+ /** No signature header on a successful response. */
94
+ MISSING_SIGNATURE = "missing_signature",
95
+ /** The header is not a three-part compact JWS, or a part does not decode. */
96
+ MALFORMED_SIGNATURE = "malformed_signature",
97
+ /** The JWS `typ` is not {@link RUNTIME_RESPONSE_JWS_TYPE}. */
98
+ WRONG_TYPE = "wrong_type",
99
+ /** The JWS `alg` is not {@link RUNTIME_RESPONSE_JWS_ALGORITHM}. */
100
+ UNSUPPORTED_ALGORITHM = "unsupported_algorithm",
101
+ /** The `kid` names no key the runtime holds. */
102
+ UNKNOWN_KEY = "unknown_key",
103
+ /** The signature does not verify under the named key. */
104
+ BAD_SIGNATURE = "bad_signature",
105
+ /** The issuer is not apps-manager. */
106
+ WRONG_ISSUER = "wrong_issuer",
107
+ /** The audience names another application or another runtime principal. */
108
+ WRONG_AUDIENCE = "wrong_audience",
109
+ /** The echoed nonce is not the one this request sent. */
110
+ NONCE_MISMATCH = "nonce_mismatch",
111
+ /** The response answers another method or route than the one this request used. */
112
+ WRONG_REQUEST = "wrong_request",
113
+ /** Past `exp` (beyond the skew tolerance). */
114
+ EXPIRED = "expired",
115
+ /** `iat` is in the future (beyond the skew tolerance). */
116
+ NOT_YET_VALID = "not_yet_valid",
117
+ /** The body received is not the body that was signed. */
118
+ BODY_MISMATCH = "body_mismatch"
119
+ }
120
+ /** Thrown by {@link verifyRuntimeResponse}; `failure` is the branchable reason. */
121
+ export declare class RuntimeResponseVerificationError extends Error {
122
+ readonly failure: RuntimeResponseVerificationFailure;
123
+ constructor(failure: RuntimeResponseVerificationFailure, message: string);
124
+ }
125
+ /**
126
+ * Whether a caught value is a {@link RuntimeResponseVerificationError}. Decided by name and reason rather than
127
+ * `instanceof`, because a runtime can load two copies of this package (an application's injected snapshot beside the
128
+ * engine's), and a refusal thrown by one copy must still be recognised by code holding the other.
129
+ */
130
+ export declare function isRuntimeResponseVerificationError(value: unknown): value is RuntimeResponseVerificationError;
131
+ /** The audience of a response: which application, and which of its runtime principals, the answer is for. */
132
+ export interface RuntimeResponseAudience {
133
+ application: string;
134
+ /** {@link buildRuntimePrincipalKey} of the principal the request authenticated as. */
135
+ principal: string;
136
+ }
137
+ /**
138
+ * The route a request is bound to: its path without query and without a leading API mount prefix (`/api/v1`). apps-manager
139
+ * serves its runtime-facing and platform-facing routes both at the root and under that prefix, and a caller may use
140
+ * either, so both sides derive the route from the URL they actually used and drop the prefix before comparing.
141
+ *
142
+ * Only that prefix is dropped, so `PLATFORM_APPS_MANAGER_URL` must name the service's ROOT (`http(s)://host[:port]`, as
143
+ * every generated address does). A URL carrying a path prefix that a reverse proxy strips would bind a different route
144
+ * on each side and be refused as `wrong_request`.
145
+ */
146
+ export declare function runtimeResponseRouteOf(urlOrPath: string): string;
147
+ /** The request a response answers: its method and its URL (absolute, or a path). */
148
+ export interface RuntimeResponseRequestBinding {
149
+ method: string;
150
+ url: string;
151
+ }
152
+ /** The claims a response signature carries. */
153
+ export interface RuntimeResponseClaims {
154
+ iss: string;
155
+ aud: RuntimeResponseAudience;
156
+ /** The request's nonce, or `null` when the caller sent none. Every verifying caller sends one, so a verifier always demands it. */
157
+ nonce: string | null;
158
+ /** base64url(SHA-256(canonical body)). */
159
+ bodyDigest: string;
160
+ /** The request's method, upper-cased. */
161
+ htm: string;
162
+ /** The request's route, per {@link runtimeResponseRouteOf}. */
163
+ htu: string;
164
+ iat: number;
165
+ exp: number;
166
+ }
167
+ /** One verification key, ready to use. */
168
+ export interface RuntimeResponseVerificationKey {
169
+ kid: string;
170
+ key: KeyObject;
171
+ }
172
+ /** RFC 7638 thumbprint of a P-256 public key (the shared implementation, `p256JwkThumbprint`). */
173
+ export declare function runtimeResponseKeyThumbprint(jwk: P256PublicJwk): string;
174
+ /**
175
+ * Digest of a JSON value as it travels: SHA-256 over its canonical serialization, base64url-encoded.
176
+ *
177
+ * Takes the PARSED value. The signer passes `JSON.parse` of the exact text it sends; the verifier passes the body it
178
+ * parsed. Both therefore digest the same JSON value, whatever the handler's object held before serialization.
179
+ */
180
+ export declare function runtimeResponseBodyDigest(body: unknown): string;
181
+ /** A fresh nonce for one request. */
182
+ export declare function createRuntimeResponseNonce(): string;
183
+ /**
184
+ * Build the environment value that carries a runtime's verification keys: a one-line JWKS of up to two public keys
185
+ * (current first, then next).
186
+ *
187
+ * A JWKS rather than PEM because a PEM is multi-line, and multi-line values are where `.env` files and orchestrators
188
+ * disagree. Used by every lane's environment builder, so the format has one producer.
189
+ */
190
+ export declare function buildRuntimeResponseVerificationKeySet(publicKeyPems: readonly string[]): string;
191
+ /**
192
+ * Parse the environment value {@link buildRuntimeResponseVerificationKeySet} produced.
193
+ *
194
+ * Throws on anything other than one or two EC P-256 public keys, and on a `kid` that is not the key's own thumbprint:
195
+ * the thumbprint is recomputed, never trusted, so a key cannot be filed under another key's id.
196
+ */
197
+ export declare function parseRuntimeResponseVerificationKeySet(value: string): RuntimeResponseVerificationKey[];
198
+ /**
199
+ * Why a response signing key cannot be used with a published key set, or `null` when it can.
200
+ *
201
+ * apps-manager calls this at startup: a signing key that runtimes do not hold makes every runtime refuse every answer,
202
+ * and that is far cheaper to refuse once, at apps-manager's boot, naming the remedy, than in every runtime.
203
+ */
204
+ export declare function describeRuntimeResponseSigningKeyMismatch(privateKeyPem: string, verificationKeySet: string): string | null;
205
+ /** What apps-manager needs to sign one response. */
206
+ export interface SignRuntimeResponseInput {
207
+ /** The response key's private half (PEM, SEC1 or PKCS#8). */
208
+ privateKeyPem: string;
209
+ /** The exact text that will be sent as the body. */
210
+ bodyText: string;
211
+ application: string;
212
+ principal: ApplicationRuntimePrincipal;
213
+ /** The request's {@link RUNTIME_RESPONSE_NONCE_HEADER}, or `null` if it sent none. */
214
+ nonce: string | null;
215
+ /** The request being answered. */
216
+ request: RuntimeResponseRequestBinding;
217
+ /** Seconds since the epoch; injectable for tests. */
218
+ nowSeconds?: number;
219
+ }
220
+ /**
221
+ * Sign one response. Throws rather than returning nothing: a response that cannot be signed must not be sent.
222
+ */
223
+ export declare function signRuntimeResponse(input: SignRuntimeResponseInput): string;
224
+ /** What a runtime needs to verify one response. */
225
+ export interface VerifyRuntimeResponseInput {
226
+ /** The {@link RUNTIME_RESPONSE_SIGNATURE_HEADER} value, as received (absent when missing). */
227
+ signature: string | null | undefined;
228
+ /** The body, parsed from JSON. */
229
+ body: unknown;
230
+ keys: readonly RuntimeResponseVerificationKey[];
231
+ /** The runtime's own `APPLICATION_ID`. */
232
+ application: string;
233
+ /**
234
+ * The principal the runtime authenticates as, when it knows it. Omitted only by a caller that cannot know it at that
235
+ * point; the nonce still binds the response to this one request, so a response meant for a sibling cannot be replayed.
236
+ */
237
+ principal?: ApplicationRuntimePrincipal;
238
+ /** The nonce this request sent. */
239
+ nonce: string;
240
+ /** The request this runtime sent. */
241
+ request: RuntimeResponseRequestBinding;
242
+ nowSeconds?: number;
243
+ }
244
+ /**
245
+ * Verify one response, fail-closed. Returns the verified claims; throws {@link RuntimeResponseVerificationError}
246
+ * otherwise. The header's `alg` and `typ` are checked against pinned values and never used to choose an algorithm.
247
+ */
248
+ export declare function verifyRuntimeResponse(input: VerifyRuntimeResponseInput): RuntimeResponseClaims;
249
+ //# sourceMappingURL=runtime-response-integrity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-response-integrity.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-response-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAmB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAuF,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACtJ,OAAO,EAA4B,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE3G;;;;;;;;;;;;;;;;;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