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

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 (396) hide show
  1. package/dist/esm/_unimplemented/soft-warn.d.ts +24 -49
  2. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
  3. package/dist/esm/_unimplemented/soft-warn.js +24 -49
  4. package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
  5. package/dist/esm/blueprint/anchored-region.d.ts +83 -0
  6. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -0
  7. package/dist/esm/blueprint/anchored-region.js +263 -0
  8. package/dist/esm/blueprint/anchored-region.js.map +1 -0
  9. package/dist/esm/blueprint/blueprint.schemas.d.ts +600 -0
  10. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -0
  11. package/dist/esm/blueprint/blueprint.schemas.js +638 -0
  12. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -0
  13. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  14. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  17. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +13 -1
  18. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  19. package/dist/esm/bootstrap/bootstrap.contracts.js +6 -0
  20. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  21. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +29 -4
  22. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  23. package/dist/esm/bootstrap/bootstrap.schemas.js +29 -4
  24. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +131 -2
  26. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  27. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +139 -2
  28. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  29. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
  30. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  31. package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
  32. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  33. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
  34. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
  35. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
  36. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
  37. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
  38. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  39. package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
  40. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  41. package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
  42. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  43. package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
  44. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  45. package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
  46. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  47. package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
  48. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  49. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  50. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
  51. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  52. package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
  53. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  54. package/dist/esm/bootstrap/runtime-response-integrity.d.ts +249 -0
  55. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -0
  56. package/dist/esm/bootstrap/runtime-response-integrity.js +353 -0
  57. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -0
  58. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts +32 -0
  59. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -0
  60. package/dist/esm/bootstrap/runtime-secret-env.contracts.js +43 -0
  61. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -0
  62. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  63. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  64. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts +51 -0
  65. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -0
  66. package/dist/esm/canonical-json/rfc8785-canonical-json.js +231 -0
  67. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -0
  68. package/dist/esm/config-authoring.entry.js.map +1 -1
  69. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  70. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  71. package/dist/esm/index.d.ts +20 -1
  72. package/dist/esm/index.d.ts.map +1 -1
  73. package/dist/esm/index.js +20 -1
  74. package/dist/esm/index.js.map +1 -1
  75. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
  76. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
  78. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
  79. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
  80. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
  81. package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
  82. package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
  83. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
  84. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
  85. package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
  86. package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
  87. package/dist/esm/key-management/approval-seal-verifier.d.ts +278 -0
  88. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -0
  89. package/dist/esm/key-management/approval-seal-verifier.js +355 -0
  90. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -0
  91. package/dist/esm/key-management/approval-seal.contracts.d.ts +128 -0
  92. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -0
  93. package/dist/esm/key-management/approval-seal.contracts.js +135 -0
  94. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -0
  95. package/dist/esm/key-management/data-key.contracts.d.ts +106 -0
  96. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -0
  97. package/dist/esm/key-management/data-key.contracts.js +54 -0
  98. package/dist/esm/key-management/data-key.contracts.js.map +1 -0
  99. package/dist/esm/key-management/es256-jws.d.ts +60 -0
  100. package/dist/esm/key-management/es256-jws.d.ts.map +1 -0
  101. package/dist/esm/key-management/es256-jws.js +135 -0
  102. package/dist/esm/key-management/es256-jws.js.map +1 -0
  103. package/dist/esm/key-management/key-provider.spi.d.ts +158 -0
  104. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -0
  105. package/dist/esm/key-management/key-provider.spi.js +38 -0
  106. package/dist/esm/key-management/key-provider.spi.js.map +1 -0
  107. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +83 -0
  108. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -0
  109. package/dist/esm/key-management/keyring-rotation.contracts.js +101 -0
  110. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -0
  111. package/dist/esm/key-management/keyring-status.contracts.d.ts +59 -0
  112. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -0
  113. package/dist/esm/key-management/keyring-status.contracts.js +45 -0
  114. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -0
  115. package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
  116. package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
  117. package/dist/esm/key-management/pdf-incremental-update.js +730 -0
  118. package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
  119. package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
  120. package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
  121. package/dist/esm/key-management/pdf-truetype-font.js +152 -0
  122. package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
  123. package/dist/esm/key-management/qr-code.d.ts +38 -0
  124. package/dist/esm/key-management/qr-code.d.ts.map +1 -0
  125. package/dist/esm/key-management/qr-code.js +325 -0
  126. package/dist/esm/key-management/qr-code.js.map +1 -0
  127. package/dist/esm/key-management/signature-request.contracts.d.ts +91 -0
  128. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -0
  129. package/dist/esm/key-management/signature-request.contracts.js +96 -0
  130. package/dist/esm/key-management/signature-request.contracts.js.map +1 -0
  131. package/dist/esm/key-management/signing-log-export.contracts.d.ts +215 -0
  132. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -0
  133. package/dist/esm/key-management/signing-log-export.contracts.js +268 -0
  134. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -0
  135. package/dist/esm/key-management/vault-custody.contracts.d.ts +98 -0
  136. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -0
  137. package/dist/esm/key-management/vault-custody.contracts.js +154 -0
  138. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -0
  139. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  140. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  141. package/dist/esm/lockfile/canonical-json.d.ts +1 -1
  142. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  143. package/dist/esm/lockfile/canonical-json.js +1 -1
  144. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  145. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  146. package/dist/esm/lockfile/file-lock-hold.js +2 -1
  147. package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
  148. package/dist/esm/lockfile/lockfile-io.d.ts +13 -17
  149. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  150. package/dist/esm/lockfile/lockfile-io.js +29 -30
  151. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  152. package/dist/esm/lockfile/materialize-infra-section.d.ts +22 -20
  153. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  154. package/dist/esm/lockfile/materialize-infra-section.js +13 -14
  155. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  156. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +27 -249
  157. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  158. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +28 -3
  159. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  160. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
  161. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
  162. package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
  163. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
  164. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  165. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +22 -3
  166. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  167. package/dist/esm/project-config/application-served-public-documents.loader.d.ts +26 -0
  168. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -0
  169. package/dist/esm/project-config/application-served-public-documents.loader.js +86 -0
  170. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -0
  171. package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
  172. package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
  173. package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
  174. package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
  175. package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
  176. package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
  177. package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
  178. package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
  179. package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
  180. package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
  181. package/dist/esm/project-config/config-module-resolution.js +33 -0
  182. package/dist/esm/project-config/config-module-resolution.js.map +1 -0
  183. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  184. package/dist/esm/project-config/define-infra-env-config.d.ts +344 -69
  185. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  186. package/dist/esm/project-config/define-infra-env-config.js +194 -143
  187. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  188. package/dist/esm/project-config/define-minion-config.d.ts +26 -36
  189. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  190. package/dist/esm/project-config/define-minion-config.js +64 -25
  191. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  192. package/dist/esm/project-config/define-saas-config.d.ts +82 -348
  193. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  194. package/dist/esm/project-config/define-saas-config.js +262 -103
  195. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  196. package/dist/esm/project-config/define-worker-config.d.ts +10 -20
  197. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  198. package/dist/esm/project-config/define-worker-config.js +10 -12
  199. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  200. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  201. package/dist/esm/project-config/hosted-infra-env-config.js +4 -1
  202. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  203. package/dist/esm/project-config/index.d.ts +5 -0
  204. package/dist/esm/project-config/index.d.ts.map +1 -1
  205. package/dist/esm/project-config/index.js +5 -0
  206. package/dist/esm/project-config/index.js.map +1 -1
  207. package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
  208. package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
  209. package/dist/esm/project-config/loader-instances-zod.js +40 -0
  210. package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
  211. package/dist/esm/project-config/loader.d.ts +131 -14
  212. package/dist/esm/project-config/loader.d.ts.map +1 -1
  213. package/dist/esm/project-config/loader.js +226 -12
  214. package/dist/esm/project-config/loader.js.map +1 -1
  215. package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
  216. package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
  217. package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
  218. package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
  219. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  220. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  221. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  222. package/dist/esm/project-config/npm-version-range.js +39 -16
  223. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  224. package/dist/esm/project-config/owning-package-tsconfig.d.ts +15 -0
  225. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -0
  226. package/dist/esm/project-config/owning-package-tsconfig.js +29 -0
  227. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -0
  228. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  229. package/dist/esm/project-config/provider-companion-discovery.d.ts +4 -4
  230. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  231. package/dist/esm/project-config/provider-companion-discovery.js +16 -10
  232. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  233. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +103 -49
  234. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  235. package/dist/esm/project-config/provider-runtime-artifacts.js +216 -16
  236. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  237. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
  238. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  239. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  240. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  241. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  242. package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
  243. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  244. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  245. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  246. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
  247. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  248. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
  249. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  250. package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
  251. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  252. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  253. package/dist/esm/project-config/shared/csp-defaults.d.ts +36 -9
  254. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  255. package/dist/esm/project-config/shared/csp-defaults.js +54 -11
  256. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  257. package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
  258. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  259. package/dist/esm/project-config/shared/csp-emit.js +77 -24
  260. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  261. package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -85
  262. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  263. package/dist/esm/project-config/shared/csp.schemas.js +40 -13
  264. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  265. package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
  266. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  267. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  268. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  269. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  270. package/dist/esm/project-config/shared/environment.schemas.d.ts +101 -8
  271. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  272. package/dist/esm/project-config/shared/environment.schemas.js +128 -9
  273. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  274. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
  275. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  276. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  277. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  278. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +2 -1
  279. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  280. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +4 -1
  281. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  282. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  283. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  284. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  285. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  286. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +24 -0
  287. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  288. package/dist/esm/project-config/shared/minion-resource-access.validation.js +25 -2
  289. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  290. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  291. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  292. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +276 -0
  293. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -0
  294. package/dist/esm/project-config/shared/platform-key-management.schemas.js +296 -0
  295. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -0
  296. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  297. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
  298. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  299. package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
  300. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  301. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
  302. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  303. package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
  304. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  305. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
  306. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  307. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  308. package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
  309. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  310. package/dist/esm/project-config/static-asset-import-noop.js +36 -20
  311. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  312. package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
  313. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  314. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  315. package/dist/esm/registry/digest.schemas.js.map +1 -1
  316. package/dist/esm/registry/index.d.ts +3 -3
  317. package/dist/esm/registry/index.d.ts.map +1 -1
  318. package/dist/esm/registry/index.js +3 -3
  319. package/dist/esm/registry/index.js.map +1 -1
  320. package/dist/esm/registry/local-checkout-source.d.ts +22 -2
  321. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  322. package/dist/esm/registry/local-checkout-source.js +66 -3
  323. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  324. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +11 -98
  325. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  326. package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
  327. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  328. package/dist/esm/registry/module-artifact.schemas.d.ts +40 -17
  329. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  330. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  331. package/dist/esm/registry/module-manifest.schemas.d.ts +324 -74
  332. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  333. package/dist/esm/registry/module-manifest.schemas.js +377 -19
  334. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  335. package/dist/esm/registry/module-search.schemas.d.ts +2 -0
  336. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  337. package/dist/esm/registry/module-search.schemas.js +14 -1
  338. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  339. package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
  340. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  341. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  342. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  343. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  344. package/dist/esm/registry/registry-errors.d.ts +103 -5
  345. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  346. package/dist/esm/registry/registry-errors.js +213 -6
  347. package/dist/esm/registry/registry-errors.js.map +1 -1
  348. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  349. package/dist/esm/registry/registry-section-schemas.constants.d.ts +5 -0
  350. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  351. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  352. package/dist/esm/registry/registry-url-resolution.d.ts +72 -0
  353. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -0
  354. package/dist/esm/registry/registry-url-resolution.js +157 -0
  355. package/dist/esm/registry/registry-url-resolution.js.map +1 -0
  356. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  357. package/dist/esm/release/framework-release.constants.js.map +1 -1
  358. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  359. package/dist/esm/schemas/framework-secrets.schemas.d.ts +48 -0
  360. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  361. package/dist/esm/schemas/framework-secrets.schemas.js +53 -0
  362. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  363. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  364. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  365. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
  366. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  367. package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
  368. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  369. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  370. package/dist/esm/workspace-scope/index.js.map +1 -1
  371. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  372. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  373. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  374. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  375. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  376. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  377. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  378. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  379. package/dist/tsconfig.build.tsbuildinfo +1 -1
  380. package/package.json +12 -12
  381. package/dist/esm/_unimplemented/index.d.ts +0 -3
  382. package/dist/esm/_unimplemented/index.d.ts.map +0 -1
  383. package/dist/esm/_unimplemented/index.js +0 -3
  384. package/dist/esm/_unimplemented/index.js.map +0 -1
  385. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
  386. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
  387. package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
  388. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
  389. package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
  390. package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
  391. package/dist/esm/project-config/shared/cdn.example.js +0 -38
  392. package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
  393. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
  394. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
  395. package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
  396. package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
@@ -0,0 +1,215 @@
1
+ import { z } from 'zod';
2
+ import { CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';
3
+ import type { ApprovalSealVerificationKey } from './approval-seal-verifier';
4
+ /** The export's JWS `typ`. */
5
+ export declare const SIGNING_LOG_EXPORT_TYP: string;
6
+ /** The most entries one export carries; an operator pulls a longer log in several exports. */
7
+ export declare const SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES = 1000;
8
+ /** The anchor the first entry of an application's signing log chains to. */
9
+ export declare function signingLogGenesisHash(wildoApplicationId: string): string;
10
+ /** The fields of an entry its hash covers: everything but the hash itself. */
11
+ export interface SigningLogChainedFields {
12
+ readonly wildoApplicationId: string;
13
+ /** 1 for the application's first signature, +1 for each next one. */
14
+ readonly sequence: number;
15
+ readonly purpose: CryptoKey_Purpose;
16
+ readonly iss: string;
17
+ readonly jti: string;
18
+ /** SHA-256 (base64url) over the RFC 8785 serialization of the signed claims. */
19
+ readonly claimsDigest: string;
20
+ readonly decisionPayloadDigest: string;
21
+ readonly kid: string;
22
+ readonly iat: number;
23
+ readonly principal: string;
24
+ readonly previousEntryHash: string;
25
+ }
26
+ /** An entry's hash: SHA-256 over the RFC 8785 serialization of its chained fields. */
27
+ export declare function signingLogEntryHashOf(fields: SigningLogChainedFields): string;
28
+ /** One entry, as an export carries it: its chained fields (the application id is the export's) and its hash. */
29
+ export declare const SigningLogExportEntrySchema: z.ZodObject<{
30
+ sequence: z.ZodNumber;
31
+ purpose: z.ZodEnum<typeof CryptoKey_Purpose>;
32
+ iss: z.ZodString;
33
+ jti: z.ZodString;
34
+ claimsDigest: z.ZodString;
35
+ decisionPayloadDigest: z.ZodString;
36
+ kid: z.ZodString;
37
+ iat: z.ZodNumber;
38
+ principal: z.ZodString;
39
+ previousEntryHash: z.ZodString;
40
+ entryHash: z.ZodString;
41
+ }, z.core.$strict>;
42
+ export type SigningLogExportEntry = z.infer<typeof SigningLogExportEntrySchema>;
43
+ /** The chain's head when the export was made: sequence 0 and the genesis anchor for an empty log. */
44
+ export declare const SigningLogHeadSchema: z.ZodObject<{
45
+ sequence: z.ZodNumber;
46
+ entryHash: z.ZodString;
47
+ }, z.core.$strict>;
48
+ export type SigningLogHead = z.infer<typeof SigningLogHeadSchema>;
49
+ /**
50
+ * The signed claims of an export. `iss` and `iat` are the custodian's, as on a seal; `jti` names the export, and is the
51
+ * id of the log entry the export's own signature is recorded under, so the next export lists this one.
52
+ */
53
+ export declare const SigningLogExportClaimsSchema: z.ZodObject<{
54
+ iss: z.ZodString;
55
+ iat: z.ZodNumber;
56
+ jti: z.ZodString;
57
+ wildoApplicationId: z.ZodString;
58
+ afterSequence: z.ZodNumber;
59
+ entries: z.ZodArray<z.ZodObject<{
60
+ sequence: z.ZodNumber;
61
+ purpose: z.ZodEnum<typeof CryptoKey_Purpose>;
62
+ iss: z.ZodString;
63
+ jti: z.ZodString;
64
+ claimsDigest: z.ZodString;
65
+ decisionPayloadDigest: z.ZodString;
66
+ kid: z.ZodString;
67
+ iat: z.ZodNumber;
68
+ principal: z.ZodString;
69
+ previousEntryHash: z.ZodString;
70
+ entryHash: z.ZodString;
71
+ }, z.core.$strict>>;
72
+ head: z.ZodObject<{
73
+ sequence: z.ZodNumber;
74
+ entryHash: z.ZodString;
75
+ }, z.core.$strict>;
76
+ }, z.core.$strict>;
77
+ export type SigningLogExportClaims = z.infer<typeof SigningLogExportClaimsSchema>;
78
+ /**
79
+ * What the application backend asks the custodian for, on the operator's behalf: the entries after the operator's last
80
+ * export (0 for the first), at most `limit` of them. The custodian builds and signs the export from its own log; nothing
81
+ * in the request reaches the signed claims but the range.
82
+ */
83
+ export declare const SigningLogExportRequestSchema: z.ZodObject<{
84
+ afterSequence: z.ZodNumber;
85
+ limit: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strict>;
87
+ export type SigningLogExportRequest = z.infer<typeof SigningLogExportRequestSchema>;
88
+ /** The custodian's answer: the export, the key it was signed with, and where the operator's next pull starts. */
89
+ export interface SigningLogExportResponse {
90
+ readonly jws: string;
91
+ readonly kid: string;
92
+ readonly iss: string;
93
+ readonly iat: number;
94
+ /** The chain's head when the export was made. */
95
+ readonly headSequence: number;
96
+ /** The last sequence the export carries: the `afterSequence` of the next pull. */
97
+ readonly throughSequence: number;
98
+ /** The sequence the export's own signature was recorded under, so the next export lists it. */
99
+ readonly recordedAtSequence: number;
100
+ }
101
+ /**
102
+ * A published verification key's stored record, as a bundle or an export file states it (dates as ISO strings): its public
103
+ * half, the algorithm it pins, its scope and issuer, its state. A verifier given the operator's pin set takes only the
104
+ * public half and the issuer from it.
105
+ */
106
+ export declare const VerificationKeyRecordSchema: z.ZodObject<{
107
+ kid: z.ZodString;
108
+ publicJwk: z.ZodObject<{
109
+ kty: z.ZodLiteral<"EC">;
110
+ crv: z.ZodLiteral<"P-256">;
111
+ x: z.ZodString;
112
+ y: z.ZodString;
113
+ }, z.core.$strip>;
114
+ alg: z.ZodLiteral<"ES256">;
115
+ scope: z.ZodEnum<typeof CryptoKey_Scope>;
116
+ scopeId: z.ZodString;
117
+ iss: z.ZodString;
118
+ state: z.ZodEnum<typeof CryptoKey_VersionState>;
119
+ compromiseInstant: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>;
121
+ /** What the operator's door answers, and what the operator keeps: the export, and the stored record of its key. */
122
+ export declare const SigningLogExportFileSchema: z.ZodObject<{
123
+ jws: z.ZodString;
124
+ key: z.ZodObject<{
125
+ kid: z.ZodString;
126
+ publicJwk: z.ZodObject<{
127
+ kty: z.ZodLiteral<"EC">;
128
+ crv: z.ZodLiteral<"P-256">;
129
+ x: z.ZodString;
130
+ y: z.ZodString;
131
+ }, z.core.$strip>;
132
+ alg: z.ZodLiteral<"ES256">;
133
+ scope: z.ZodEnum<typeof CryptoKey_Scope>;
134
+ scopeId: z.ZodString;
135
+ iss: z.ZodString;
136
+ state: z.ZodEnum<typeof CryptoKey_VersionState>;
137
+ compromiseInstant: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>;
139
+ }, z.core.$strict>;
140
+ export type SigningLogExportFile = z.infer<typeof SigningLogExportFileSchema>;
141
+ /** Why an export does not verify. */
142
+ export declare enum SigningLogExportVerificationFailure {
143
+ /** Not a compact JWS with a JSON header and payload. */
144
+ MALFORMED = "malformed",
145
+ /** The header's `alg` is not ES256, or names a critical extension, or its `typ` is not the export's. */
146
+ HEADER_INVALID = "header_invalid",
147
+ /** No given key has the header's `kid`. */
148
+ UNKNOWN_KEY = "unknown_key",
149
+ /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */
150
+ UNPINNED = "unpinned",
151
+ SIGNATURE_INVALID = "signature_invalid",
152
+ /** The payload is not the export's claims shape. */
153
+ CLAIMS_INVALID = "claims_invalid",
154
+ /** The issuer is not the key's, or not the expected one; or the key is not the application's own export key. */
155
+ ISSUER_MISMATCH = "issuer_mismatch",
156
+ /** An entry's hash is not the hash of its fields, a link does not chain, a sequence is skipped, or the head disagrees. */
157
+ CHAIN_BROKEN = "chain_broken"
158
+ }
159
+ export interface SigningLogExportVerification {
160
+ /** Signed by a (pinned) export key of the application, and the entries chain. */
161
+ readonly valid: boolean;
162
+ /**
163
+ * The export is evidence: valid, and its key was not compromised before it signed. An export signed after its own key's
164
+ * compromise instant proves nothing, whatever it says.
165
+ */
166
+ readonly provable: boolean;
167
+ readonly failures: readonly SigningLogExportVerificationFailure[];
168
+ readonly kid?: string;
169
+ readonly keyState?: CryptoKey_VersionState;
170
+ readonly claims?: SigningLogExportClaims;
171
+ }
172
+ export interface SigningLogExportVerificationInput {
173
+ readonly jws: string;
174
+ /** The records of the keys that may have signed it (from an export file, from the application). */
175
+ readonly keys: readonly ApprovalSealVerificationKey[];
176
+ /** The operator's pin set for SIGNING_LOG_EXPORT, from a channel the host does not control. */
177
+ readonly pins?: CryptoKeyPinSet;
178
+ readonly expectedIssuer?: string;
179
+ }
180
+ /**
181
+ * The key a verifier may use for a record, with the pin's word on what became of it (#2932): undefined (the caller's
182
+ * `UNPINNED`) when a pin set is given and does not pin the key, or the record's public half is not the one the pinned
183
+ * thumbprint names. Without a pin set the record is trusted as given.
184
+ */
185
+ export declare function pinnedVerificationKeyOf(record: ApprovalSealVerificationKey, pins: CryptoKeyPinSet | undefined): ApprovalSealVerificationKey | undefined;
186
+ /** Whether a key COMPROMISED at its compromise instant was so at `epochSeconds` (a compromised key with no instant: always). */
187
+ export declare function compromisedAt(key: ApprovalSealVerificationKey, epochSeconds: number): boolean;
188
+ /** Verify one export: the header, the (pinned) key, the signature, the claims, and that its entries chain. Pure, offline. */
189
+ export declare function verifySigningLogExport(input: SigningLogExportVerificationInput): SigningLogExportVerification;
190
+ /** How exports of one log disagree. */
191
+ export declare enum SigningLogExportDisagreement {
192
+ /** Two exports give one sequence different hashes: an entry at or before it was inserted, edited or removed. */
193
+ CHAIN_DIVERGES = "chain_diverges",
194
+ /** A later export's head is behind an earlier one's: entries the operator already holds are gone from the log. */
195
+ CHAIN_TRUNCATED = "chain_truncated",
196
+ /** The exports are not of one application's log. */
197
+ DIFFERENT_LOGS = "different_logs"
198
+ }
199
+ export interface SigningLogExportComparison {
200
+ /** Every export agrees with every other on every sequence they both know. */
201
+ readonly consistent: boolean;
202
+ readonly disagreements: ReadonlyArray<{
203
+ readonly disagreement: SigningLogExportDisagreement;
204
+ readonly sequence?: number;
205
+ readonly exports: readonly string[];
206
+ }>;
207
+ }
208
+ /**
209
+ * Compare verified exports of one log, kept ones and a new one alike. Each export states a hash for every sequence it
210
+ * carries, for its head, and (through its first entry's link) for the sequence before its range; two exports that state
211
+ * different hashes for one sequence disagree, and so does a later export whose head is behind an earlier one's. Exports
212
+ * that do not verify, or prove nothing, are the caller's to leave out ({@link verifySigningLogExport}).
213
+ */
214
+ export declare function compareSigningLogExports(exports: readonly SigningLogExportClaims[]): SigningLogExportComparison;
215
+ //# sourceMappingURL=signing-log-export.contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing-log-export.contracts.d.ts","sourceRoot":"","sources":["../../../src/key-management/signing-log-export.contracts.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAmB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG1I,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,8BAA8B;AAC9B,eAAO,MAAM,sBAAsB,QAAwD,CAAC;AAE5F,8FAA8F;AAC9F,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,GAA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-0,0 +1,268 @@
1
+ /**
2
+ * # The signing log and its export (#2891, #2932)
3
+ *
4
+ * The custodian records every signature it makes in the application's SIGNING LOG, a hash chain: each entry carries the
5
+ * previous entry's hash, and the first chains to the application's genesis anchor, so a removed or edited entry breaks
6
+ * every hash after it. The log lives on the host. An EXPORT is what lets the operator hold it independently: a range of
7
+ * entries and the chain's head at that moment, signed under its own purpose ({@link CryptoKey_Purpose.SIGNING_LOG_EXPORT},
8
+ * `typ: signing-log+jws`), which the operator pulls into storage the host does not control.
9
+ *
10
+ * What a kept export proves, and only that:
11
+ * - **an entry inserted into the log's past** (or an entry edited or removed) breaks the chain against it: a later
12
+ * export disagrees with the kept one at some sequence, which {@link compareSigningLogExports} reports;
13
+ * - **a seal it lists existed when it was signed**, so a seal under a key compromised after that instant is
14
+ * corroborated (the approval-seal verifier reads the exports for this). Backdating after a compromise is therefore
15
+ * bounded by the time since the operator's last export.
16
+ *
17
+ * What it does not prove: anything about entries appended after it, until the next export; and nothing at all for a
18
+ * self-hosted operator, who is its own host and so signs its own exports.
19
+ *
20
+ * Everything here is pure and offline: an auditor checks exports with the operator's pin set and nothing else.
21
+ */
22
+ import { createHash } from 'node:crypto';
23
+ import { z } from 'zod';
24
+ import { CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, singleJwsTypeOf } from '@wildo-ai/saas-models';
25
+ import { canonicalizeJson } from '../canonical-json/rfc8785-canonical-json.js';
26
+ import { ES256_JWS_ALGORITHM, base64url, isP256PublicJwk, p256JwkThumbprint, verifyEs256 } from './es256-jws.js';
27
+ /** The export's JWS `typ`. */
28
+ export const SIGNING_LOG_EXPORT_TYP = singleJwsTypeOf(CryptoKey_Purpose.SIGNING_LOG_EXPORT);
29
+ /** The most entries one export carries; an operator pulls a longer log in several exports. */
30
+ export const SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES = 1000;
31
+ /** The anchor the first entry of an application's signing log chains to. */
32
+ export function signingLogGenesisHash(wildoApplicationId) {
33
+ return base64url(createHash('sha256').update(canonicalizeJson({ chain: 'wildo-signing-log-genesis', wildoApplicationId }), 'utf8').digest());
34
+ }
35
+ /** An entry's hash: SHA-256 over the RFC 8785 serialization of its chained fields. */
36
+ export function signingLogEntryHashOf(fields) {
37
+ const covered = {
38
+ wildoApplicationId: fields.wildoApplicationId,
39
+ sequence: fields.sequence,
40
+ purpose: fields.purpose,
41
+ iss: fields.iss,
42
+ jti: fields.jti,
43
+ claimsDigest: fields.claimsDigest,
44
+ decisionPayloadDigest: fields.decisionPayloadDigest,
45
+ kid: fields.kid,
46
+ iat: fields.iat,
47
+ principal: fields.principal,
48
+ previousEntryHash: fields.previousEntryHash,
49
+ };
50
+ return base64url(createHash('sha256').update(canonicalizeJson(covered), 'utf8').digest());
51
+ }
52
+ /** One entry, as an export carries it: its chained fields (the application id is the export's) and its hash. */
53
+ export const SigningLogExportEntrySchema = z.strictObject({
54
+ sequence: z.number().int().min(1),
55
+ purpose: z.enum(CryptoKey_Purpose),
56
+ iss: z.string().min(1),
57
+ jti: z.string().min(1),
58
+ claimsDigest: z.string().min(1),
59
+ decisionPayloadDigest: z.string().min(1),
60
+ kid: z.string().min(1),
61
+ iat: z.number().int(),
62
+ principal: z.string().min(1),
63
+ previousEntryHash: z.string().min(1),
64
+ entryHash: z.string().min(1),
65
+ });
66
+ /** The chain's head when the export was made: sequence 0 and the genesis anchor for an empty log. */
67
+ export const SigningLogHeadSchema = z.strictObject({ sequence: z.number().int().min(0), entryHash: z.string().min(1) });
68
+ /**
69
+ * The signed claims of an export. `iss` and `iat` are the custodian's, as on a seal; `jti` names the export, and is the
70
+ * id of the log entry the export's own signature is recorded under, so the next export lists this one.
71
+ */
72
+ export const SigningLogExportClaimsSchema = z.strictObject({
73
+ iss: z.string().min(1),
74
+ iat: z.number().int(),
75
+ jti: z.string().min(1),
76
+ wildoApplicationId: z.string().min(1),
77
+ /** The entries are the ones after this sequence (0: from the first). */
78
+ afterSequence: z.number().int().min(0),
79
+ entries: z.array(SigningLogExportEntrySchema).max(SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES),
80
+ head: SigningLogHeadSchema,
81
+ });
82
+ /**
83
+ * What the application backend asks the custodian for, on the operator's behalf: the entries after the operator's last
84
+ * export (0 for the first), at most `limit` of them. The custodian builds and signs the export from its own log; nothing
85
+ * in the request reaches the signed claims but the range.
86
+ */
87
+ export const SigningLogExportRequestSchema = z.strictObject({
88
+ afterSequence: z.number().int().min(0),
89
+ limit: z.number().int().min(1).max(SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES).optional(),
90
+ });
91
+ /**
92
+ * A published verification key's stored record, as a bundle or an export file states it (dates as ISO strings): its public
93
+ * half, the algorithm it pins, its scope and issuer, its state. A verifier given the operator's pin set takes only the
94
+ * public half and the issuer from it.
95
+ */
96
+ export const VerificationKeyRecordSchema = z.object({
97
+ kid: z.string().min(1),
98
+ publicJwk: z.object({ kty: z.literal('EC'), crv: z.literal('P-256'), x: z.string().min(1), y: z.string().min(1) }),
99
+ alg: z.literal(ES256_JWS_ALGORITHM),
100
+ scope: z.enum(CryptoKey_Scope),
101
+ scopeId: z.string().min(1),
102
+ iss: z.string().min(1),
103
+ state: z.enum(CryptoKey_VersionState),
104
+ compromiseInstant: z.string().optional(),
105
+ });
106
+ /** What the operator's door answers, and what the operator keeps: the export, and the stored record of its key. */
107
+ export const SigningLogExportFileSchema = z.strictObject({
108
+ jws: z.string().min(1),
109
+ key: VerificationKeyRecordSchema,
110
+ });
111
+ /** Why an export does not verify. */
112
+ export var SigningLogExportVerificationFailure;
113
+ (function (SigningLogExportVerificationFailure) {
114
+ /** Not a compact JWS with a JSON header and payload. */
115
+ SigningLogExportVerificationFailure["MALFORMED"] = "malformed";
116
+ /** The header's `alg` is not ES256, or names a critical extension, or its `typ` is not the export's. */
117
+ SigningLogExportVerificationFailure["HEADER_INVALID"] = "header_invalid";
118
+ /** No given key has the header's `kid`. */
119
+ SigningLogExportVerificationFailure["UNKNOWN_KEY"] = "unknown_key";
120
+ /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */
121
+ SigningLogExportVerificationFailure["UNPINNED"] = "unpinned";
122
+ SigningLogExportVerificationFailure["SIGNATURE_INVALID"] = "signature_invalid";
123
+ /** The payload is not the export's claims shape. */
124
+ SigningLogExportVerificationFailure["CLAIMS_INVALID"] = "claims_invalid";
125
+ /** The issuer is not the key's, or not the expected one; or the key is not the application's own export key. */
126
+ SigningLogExportVerificationFailure["ISSUER_MISMATCH"] = "issuer_mismatch";
127
+ /** An entry's hash is not the hash of its fields, a link does not chain, a sequence is skipped, or the head disagrees. */
128
+ SigningLogExportVerificationFailure["CHAIN_BROKEN"] = "chain_broken";
129
+ })(SigningLogExportVerificationFailure || (SigningLogExportVerificationFailure = {}));
130
+ function decodeJson(part) {
131
+ if (!part)
132
+ return null;
133
+ try {
134
+ const value = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));
135
+ return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : null;
136
+ }
137
+ catch {
138
+ return null;
139
+ }
140
+ }
141
+ /**
142
+ * The key a verifier may use for a record, with the pin's word on what became of it (#2932): undefined (the caller's
143
+ * `UNPINNED`) when a pin set is given and does not pin the key, or the record's public half is not the one the pinned
144
+ * thumbprint names. Without a pin set the record is trusted as given.
145
+ */
146
+ export function pinnedVerificationKeyOf(record, pins) {
147
+ if (!pins)
148
+ return record;
149
+ const pin = pins.keys.find((candidate) => candidate.kid === record.kid);
150
+ if (!pin || p256JwkThumbprint(record.publicJwk) !== pin.kid)
151
+ return undefined;
152
+ return {
153
+ ...record,
154
+ state: pin.state,
155
+ scope: pin.scope,
156
+ scopeId: pin.scopeId,
157
+ ...(pin.compromiseInstant ? { compromiseInstant: pin.compromiseInstant } : { compromiseInstant: undefined }),
158
+ };
159
+ }
160
+ /** Whether a key COMPROMISED at its compromise instant was so at `epochSeconds` (a compromised key with no instant: always). */
161
+ export function compromisedAt(key, epochSeconds) {
162
+ if (key.state !== CryptoKey_VersionState.COMPROMISED)
163
+ return false;
164
+ return key.compromiseInstant === undefined || epochSeconds * 1000 >= Date.parse(key.compromiseInstant);
165
+ }
166
+ /** The chain breaks inside an export, if any: each entry's hash, each link, each sequence, and the head. */
167
+ function chainIsIntact(claims) {
168
+ let previous = claims.afterSequence === 0 ? signingLogGenesisHash(claims.wildoApplicationId) : undefined;
169
+ for (const [index, entry] of claims.entries.entries()) {
170
+ if (entry.sequence !== claims.afterSequence + index + 1)
171
+ return false;
172
+ if (previous !== undefined && entry.previousEntryHash !== previous)
173
+ return false;
174
+ const { entryHash, ...fields } = entry;
175
+ if (signingLogEntryHashOf({ ...fields, wildoApplicationId: claims.wildoApplicationId }) !== entryHash)
176
+ return false;
177
+ previous = entryHash;
178
+ }
179
+ const last = claims.entries.at(-1);
180
+ const reached = last?.sequence ?? claims.afterSequence;
181
+ if (claims.head.sequence < reached)
182
+ return false;
183
+ if (last && claims.head.sequence === last.sequence && claims.head.entryHash !== last.entryHash)
184
+ return false;
185
+ if (claims.head.sequence === 0 && claims.head.entryHash !== signingLogGenesisHash(claims.wildoApplicationId))
186
+ return false;
187
+ return true;
188
+ }
189
+ /** Verify one export: the header, the (pinned) key, the signature, the claims, and that its entries chain. Pure, offline. */
190
+ export function verifySigningLogExport(input) {
191
+ const fail = (failure, extra = {}) => ({ valid: false, provable: false, failures: [failure], ...extra });
192
+ const parts = input.jws.split('.');
193
+ const header = parts.length === 3 ? decodeJson(parts[0]) : null;
194
+ const payload = parts.length === 3 ? decodeJson(parts[1]) : null;
195
+ if (!header || !payload || !parts[2])
196
+ return fail(SigningLogExportVerificationFailure.MALFORMED);
197
+ const kid = typeof header.kid === 'string' ? header.kid : undefined;
198
+ const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;
199
+ if (!record || !isP256PublicJwk(record.publicJwk))
200
+ return fail(SigningLogExportVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});
201
+ const key = pinnedVerificationKeyOf(record, input.pins);
202
+ if (!key)
203
+ return fail(SigningLogExportVerificationFailure.UNPINNED, { kid });
204
+ // ES256 from the key record, never from the header; no extension is understood; the export's own type only.
205
+ if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM || header.crit !== undefined || header.typ !== SIGNING_LOG_EXPORT_TYP) {
206
+ return fail(SigningLogExportVerificationFailure.HEADER_INVALID, { kid, keyState: key.state });
207
+ }
208
+ if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {
209
+ return fail(SigningLogExportVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });
210
+ }
211
+ const parsed = SigningLogExportClaimsSchema.safeParse(payload);
212
+ if (!parsed.success)
213
+ return fail(SigningLogExportVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state });
214
+ const claims = parsed.data;
215
+ const ownKey = key.scope === CryptoKey_Scope.APPLICATION && key.scopeId === claims.wildoApplicationId;
216
+ if (claims.iss !== key.iss || !ownKey || (input.expectedIssuer !== undefined && claims.iss !== input.expectedIssuer)) {
217
+ return fail(SigningLogExportVerificationFailure.ISSUER_MISMATCH, { kid, keyState: key.state, claims });
218
+ }
219
+ if (!chainIsIntact(claims))
220
+ return fail(SigningLogExportVerificationFailure.CHAIN_BROKEN, { kid, keyState: key.state, claims });
221
+ return { valid: true, provable: !compromisedAt(key, claims.iat), failures: [], kid, keyState: key.state, claims };
222
+ }
223
+ /** How exports of one log disagree. */
224
+ export var SigningLogExportDisagreement;
225
+ (function (SigningLogExportDisagreement) {
226
+ /** Two exports give one sequence different hashes: an entry at or before it was inserted, edited or removed. */
227
+ SigningLogExportDisagreement["CHAIN_DIVERGES"] = "chain_diverges";
228
+ /** A later export's head is behind an earlier one's: entries the operator already holds are gone from the log. */
229
+ SigningLogExportDisagreement["CHAIN_TRUNCATED"] = "chain_truncated";
230
+ /** The exports are not of one application's log. */
231
+ SigningLogExportDisagreement["DIFFERENT_LOGS"] = "different_logs";
232
+ })(SigningLogExportDisagreement || (SigningLogExportDisagreement = {}));
233
+ /**
234
+ * Compare verified exports of one log, kept ones and a new one alike. Each export states a hash for every sequence it
235
+ * carries, for its head, and (through its first entry's link) for the sequence before its range; two exports that state
236
+ * different hashes for one sequence disagree, and so does a later export whose head is behind an earlier one's. Exports
237
+ * that do not verify, or prove nothing, are the caller's to leave out ({@link verifySigningLogExport}).
238
+ */
239
+ export function compareSigningLogExports(exports) {
240
+ const disagreements = [];
241
+ if (new Set(exports.map((claims) => claims.wildoApplicationId)).size > 1) {
242
+ return { consistent: false, disagreements: [{ disagreement: SigningLogExportDisagreement.DIFFERENT_LOGS, exports: exports.map((claims) => claims.jti) }] };
243
+ }
244
+ const stated = new Map();
245
+ const state = (sequence, entryHash, jti) => {
246
+ const earlier = stated.get(sequence);
247
+ if (!earlier)
248
+ stated.set(sequence, { entryHash, jti });
249
+ else if (earlier.entryHash !== entryHash)
250
+ disagreements.push({ disagreement: SigningLogExportDisagreement.CHAIN_DIVERGES, sequence, exports: [earlier.jti, jti] });
251
+ };
252
+ for (const claims of exports) {
253
+ for (const entry of claims.entries)
254
+ state(entry.sequence, entry.entryHash, claims.jti);
255
+ const first = claims.entries[0];
256
+ if (first && claims.afterSequence > 0)
257
+ state(claims.afterSequence, first.previousEntryHash, claims.jti);
258
+ state(claims.head.sequence, claims.head.entryHash, claims.jti);
259
+ }
260
+ const byInstant = [...exports].sort((left, right) => left.iat - right.iat);
261
+ for (const [index, later] of byInstant.entries()) {
262
+ const ahead = byInstant.slice(0, index).find((earlier) => earlier.iat < later.iat && earlier.head.sequence > later.head.sequence);
263
+ if (ahead)
264
+ disagreements.push({ disagreement: SigningLogExportDisagreement.CHAIN_TRUNCATED, sequence: later.head.sequence, exports: [ahead.jti, later.jti] });
265
+ }
266
+ return { consistent: disagreements.length === 0, disagreements };
267
+ }
268
+ //# sourceMappingURL=signing-log-export.contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing-log-export.contracts.js","sourceRoot":"","sources":["../../../src/key-management/signing-log-export.contracts.ts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EAAE,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;AACnE,CAAC","sourcesContent":["/**\n * # The signing log and its export (#2891, #2932)\n *\n * The custodian records every signature it makes in the application's SIGNING LOG, a hash chain: each entry carries the\n * previous entry's hash, and the first chains to the application's genesis anchor, so a removed or edited entry breaks\n * every hash after it. The log lives on the host. An EXPORT is what lets the operator hold it independently: a range of\n * entries and the chain's head at that moment, signed under its own purpose ({@link CryptoKey_Purpose.SIGNING_LOG_EXPORT},\n * `typ: signing-log+jws`), which the operator pulls into storage the host does not control.\n *\n * What a kept export proves, and only that:\n * - **an entry inserted into the log's past** (or an entry edited or removed) breaks the chain against it: a later\n * export disagrees with the kept one at some sequence, which {@link compareSigningLogExports} reports;\n * - **a seal it lists existed when it was signed**, so a seal under a key compromised after that instant is\n * corroborated (the approval-seal verifier reads the exports for this). Backdating after a compromise is therefore\n * bounded by the time since the operator's last export.\n *\n * What it does not prove: anything about entries appended after it, until the next export; and nothing at all for a\n * self-hosted operator, who is its own host and so signs its own exports.\n *\n * Everything here is pure and offline: an auditor checks exports with the operator's pin set and nothing else.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, singleJwsTypeOf, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { canonicalizeJson } from '../canonical-json/rfc8785-canonical-json';\nimport { ES256_JWS_ALGORITHM, base64url, isP256PublicJwk, p256JwkThumbprint, verifyEs256 } from './es256-jws';\nimport type { ApprovalSealVerificationKey } from './approval-seal-verifier';\n\n/** The export's JWS `typ`. */\nexport const SIGNING_LOG_EXPORT_TYP = singleJwsTypeOf(CryptoKey_Purpose.SIGNING_LOG_EXPORT);\n\n/** The most entries one export carries; an operator pulls a longer log in several exports. */\nexport const SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES = 1000;\n\n/** The anchor the first entry of an application's signing log chains to. */\nexport function signingLogGenesisHash(wildoApplicationId: string): string {\n return base64url(createHash('sha256').update(canonicalizeJson({ chain: 'wildo-signing-log-genesis', wildoApplicationId }), 'utf8').digest());\n}\n\n/** The fields of an entry its hash covers: everything but the hash itself. */\nexport interface SigningLogChainedFields {\n readonly wildoApplicationId: string;\n /** 1 for the application's first signature, +1 for each next one. */\n readonly sequence: number;\n readonly purpose: CryptoKey_Purpose;\n readonly iss: string;\n readonly jti: string;\n /** SHA-256 (base64url) over the RFC 8785 serialization of the signed claims. */\n readonly claimsDigest: string;\n readonly decisionPayloadDigest: string;\n readonly kid: string;\n readonly iat: number;\n readonly principal: string;\n readonly previousEntryHash: string;\n}\n\n/** An entry's hash: SHA-256 over the RFC 8785 serialization of its chained fields. */\nexport function signingLogEntryHashOf(fields: SigningLogChainedFields): string {\n const covered: SigningLogChainedFields = {\n wildoApplicationId: fields.wildoApplicationId,\n sequence: fields.sequence,\n purpose: fields.purpose,\n iss: fields.iss,\n jti: fields.jti,\n claimsDigest: fields.claimsDigest,\n decisionPayloadDigest: fields.decisionPayloadDigest,\n kid: fields.kid,\n iat: fields.iat,\n principal: fields.principal,\n previousEntryHash: fields.previousEntryHash,\n };\n return base64url(createHash('sha256').update(canonicalizeJson(covered), 'utf8').digest());\n}\n\n/** One entry, as an export carries it: its chained fields (the application id is the export's) and its hash. */\nexport const SigningLogExportEntrySchema = z.strictObject({\n sequence: z.number().int().min(1),\n purpose: z.enum(CryptoKey_Purpose),\n iss: z.string().min(1),\n jti: z.string().min(1),\n claimsDigest: z.string().min(1),\n decisionPayloadDigest: z.string().min(1),\n kid: z.string().min(1),\n iat: z.number().int(),\n principal: z.string().min(1),\n previousEntryHash: z.string().min(1),\n entryHash: z.string().min(1),\n});\nexport type SigningLogExportEntry = z.infer<typeof SigningLogExportEntrySchema>;\n\n/** The chain's head when the export was made: sequence 0 and the genesis anchor for an empty log. */\nexport const SigningLogHeadSchema = z.strictObject({ sequence: z.number().int().min(0), entryHash: z.string().min(1) });\nexport type SigningLogHead = z.infer<typeof SigningLogHeadSchema>;\n\n/**\n * The signed claims of an export. `iss` and `iat` are the custodian's, as on a seal; `jti` names the export, and is the\n * id of the log entry the export's own signature is recorded under, so the next export lists this one.\n */\nexport const SigningLogExportClaimsSchema = z.strictObject({\n iss: z.string().min(1),\n iat: z.number().int(),\n jti: z.string().min(1),\n wildoApplicationId: z.string().min(1),\n /** The entries are the ones after this sequence (0: from the first). */\n afterSequence: z.number().int().min(0),\n entries: z.array(SigningLogExportEntrySchema).max(SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES),\n head: SigningLogHeadSchema,\n});\nexport type SigningLogExportClaims = z.infer<typeof SigningLogExportClaimsSchema>;\n\n/**\n * What the application backend asks the custodian for, on the operator's behalf: the entries after the operator's last\n * export (0 for the first), at most `limit` of them. The custodian builds and signs the export from its own log; nothing\n * in the request reaches the signed claims but the range.\n */\nexport const SigningLogExportRequestSchema = z.strictObject({\n afterSequence: z.number().int().min(0),\n limit: z.number().int().min(1).max(SIGNING_LOG_EXPORT_MAXIMUM_ENTRIES).optional(),\n});\nexport type SigningLogExportRequest = z.infer<typeof SigningLogExportRequestSchema>;\n\n/** The custodian's answer: the export, the key it was signed with, and where the operator's next pull starts. */\nexport interface SigningLogExportResponse {\n readonly jws: string;\n readonly kid: string;\n readonly iss: string;\n readonly iat: number;\n /** The chain's head when the export was made. */\n readonly headSequence: number;\n /** The last sequence the export carries: the `afterSequence` of the next pull. */\n readonly throughSequence: number;\n /** The sequence the export's own signature was recorded under, so the next export lists it. */\n readonly recordedAtSequence: number;\n}\n\n/**\n * A published verification key's stored record, as a bundle or an export file states it (dates as ISO strings): its public\n * half, the algorithm it pins, its scope and issuer, its state. A verifier given the operator's pin set takes only the\n * public half and the issuer from it.\n */\nexport const VerificationKeyRecordSchema = z.object({\n kid: z.string().min(1),\n publicJwk: z.object({ kty: z.literal('EC'), crv: z.literal('P-256'), x: z.string().min(1), y: z.string().min(1) }),\n alg: z.literal(ES256_JWS_ALGORITHM),\n scope: z.enum(CryptoKey_Scope),\n scopeId: z.string().min(1),\n iss: z.string().min(1),\n state: z.enum(CryptoKey_VersionState),\n compromiseInstant: z.string().optional(),\n});\n\n/** What the operator's door answers, and what the operator keeps: the export, and the stored record of its key. */\nexport const SigningLogExportFileSchema = z.strictObject({\n jws: z.string().min(1),\n key: VerificationKeyRecordSchema,\n});\nexport type SigningLogExportFile = z.infer<typeof SigningLogExportFileSchema>;\n\n/** Why an export does not verify. */\nexport enum SigningLogExportVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not ES256, or names a critical extension, or its `typ` is not the export's. */\n HEADER_INVALID = 'header_invalid',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload is not the export's claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The issuer is not the key's, or not the expected one; or the key is not the application's own export key. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** An entry's hash is not the hash of its fields, a link does not chain, a sequence is skipped, or the head disagrees. */\n CHAIN_BROKEN = 'chain_broken',\n}\n\nexport interface SigningLogExportVerification {\n /** Signed by a (pinned) export key of the application, and the entries chain. */\n readonly valid: boolean;\n /**\n * The export is evidence: valid, and its key was not compromised before it signed. An export signed after its own key's\n * compromise instant proves nothing, whatever it says.\n */\n readonly provable: boolean;\n readonly failures: readonly SigningLogExportVerificationFailure[];\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: SigningLogExportClaims;\n}\n\nexport interface SigningLogExportVerificationInput {\n readonly jws: string;\n /** The records of the keys that may have signed it (from an export file, from the application). */\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The operator's pin set for SIGNING_LOG_EXPORT, from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n readonly expectedIssuer?: string;\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The key a verifier may use for a record, with the pin's word on what became of it (#2932): undefined (the caller's\n * `UNPINNED`) when a pin set is given and does not pin the key, or the record's public half is not the one the pinned\n * thumbprint names. Without a pin set the record is trusted as given.\n */\nexport function pinnedVerificationKeyOf(\n record: ApprovalSealVerificationKey,\n pins: CryptoKeyPinSet | undefined,\n): ApprovalSealVerificationKey | undefined {\n if (!pins) return record;\n const pin = pins.keys.find((candidate) => candidate.kid === record.kid);\n if (!pin || p256JwkThumbprint(record.publicJwk) !== pin.kid) return undefined;\n return {\n ...record,\n state: pin.state,\n scope: pin.scope,\n scopeId: pin.scopeId,\n ...(pin.compromiseInstant ? { compromiseInstant: pin.compromiseInstant } : { compromiseInstant: undefined }),\n };\n}\n\n/** Whether a key COMPROMISED at its compromise instant was so at `epochSeconds` (a compromised key with no instant: always). */\nexport function compromisedAt(key: ApprovalSealVerificationKey, epochSeconds: number): boolean {\n if (key.state !== CryptoKey_VersionState.COMPROMISED) return false;\n return key.compromiseInstant === undefined || epochSeconds * 1000 >= Date.parse(key.compromiseInstant);\n}\n\n/** The chain breaks inside an export, if any: each entry's hash, each link, each sequence, and the head. */\nfunction chainIsIntact(claims: SigningLogExportClaims): boolean {\n let previous: string | undefined = claims.afterSequence === 0 ? signingLogGenesisHash(claims.wildoApplicationId) : undefined;\n for (const [index, entry] of claims.entries.entries()) {\n if (entry.sequence !== claims.afterSequence + index + 1) return false;\n if (previous !== undefined && entry.previousEntryHash !== previous) return false;\n const { entryHash, ...fields } = entry;\n if (signingLogEntryHashOf({ ...fields, wildoApplicationId: claims.wildoApplicationId }) !== entryHash) return false;\n previous = entryHash;\n }\n const last = claims.entries.at(-1);\n const reached = last?.sequence ?? claims.afterSequence;\n if (claims.head.sequence < reached) return false;\n if (last && claims.head.sequence === last.sequence && claims.head.entryHash !== last.entryHash) return false;\n if (claims.head.sequence === 0 && claims.head.entryHash !== signingLogGenesisHash(claims.wildoApplicationId)) return false;\n return true;\n}\n\n/** Verify one export: the header, the (pinned) key, the signature, the claims, and that its entries chain. Pure, offline. */\nexport function verifySigningLogExport(input: SigningLogExportVerificationInput): SigningLogExportVerification {\n const fail = (failure: SigningLogExportVerificationFailure, extra: Partial<SigningLogExportVerification> = {}): SigningLogExportVerification =>\n ({ valid: false, provable: false, failures: [failure], ...extra });\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(SigningLogExportVerificationFailure.MALFORMED);\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(SigningLogExportVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(SigningLogExportVerificationFailure.UNPINNED, { kid });\n // ES256 from the key record, never from the header; no extension is understood; the export's own type only.\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM || header.crit !== undefined || header.typ !== SIGNING_LOG_EXPORT_TYP) {\n return fail(SigningLogExportVerificationFailure.HEADER_INVALID, { kid, keyState: key.state });\n }\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(SigningLogExportVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n const parsed = SigningLogExportClaimsSchema.safeParse(payload);\n if (!parsed.success) return fail(SigningLogExportVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state });\n const claims = parsed.data;\n const ownKey = key.scope === CryptoKey_Scope.APPLICATION && key.scopeId === claims.wildoApplicationId;\n if (claims.iss !== key.iss || !ownKey || (input.expectedIssuer !== undefined && claims.iss !== input.expectedIssuer)) {\n return fail(SigningLogExportVerificationFailure.ISSUER_MISMATCH, { kid, keyState: key.state, claims });\n }\n if (!chainIsIntact(claims)) return fail(SigningLogExportVerificationFailure.CHAIN_BROKEN, { kid, keyState: key.state, claims });\n return { valid: true, provable: !compromisedAt(key, claims.iat), failures: [], kid, keyState: key.state, claims };\n}\n\n/** How exports of one log disagree. */\nexport enum SigningLogExportDisagreement {\n /** Two exports give one sequence different hashes: an entry at or before it was inserted, edited or removed. */\n CHAIN_DIVERGES = 'chain_diverges',\n /** A later export's head is behind an earlier one's: entries the operator already holds are gone from the log. */\n CHAIN_TRUNCATED = 'chain_truncated',\n /** The exports are not of one application's log. */\n DIFFERENT_LOGS = 'different_logs',\n}\n\nexport interface SigningLogExportComparison {\n /** Every export agrees with every other on every sequence they both know. */\n readonly consistent: boolean;\n readonly disagreements: ReadonlyArray<{ readonly disagreement: SigningLogExportDisagreement; readonly sequence?: number; readonly exports: readonly string[] }>;\n}\n\n/**\n * Compare verified exports of one log, kept ones and a new one alike. Each export states a hash for every sequence it\n * carries, for its head, and (through its first entry's link) for the sequence before its range; two exports that state\n * different hashes for one sequence disagree, and so does a later export whose head is behind an earlier one's. Exports\n * that do not verify, or prove nothing, are the caller's to leave out ({@link verifySigningLogExport}).\n */\nexport function compareSigningLogExports(exports: readonly SigningLogExportClaims[]): SigningLogExportComparison {\n const disagreements: Array<SigningLogExportComparison['disagreements'][number]> = [];\n if (new Set(exports.map((claims) => claims.wildoApplicationId)).size > 1) {\n return { consistent: false, disagreements: [{ disagreement: SigningLogExportDisagreement.DIFFERENT_LOGS, exports: exports.map((claims) => claims.jti) }] };\n }\n const stated = new Map<number, { readonly entryHash: string; readonly jti: string }>();\n const state = (sequence: number, entryHash: string, jti: string) => {\n const earlier = stated.get(sequence);\n if (!earlier) stated.set(sequence, { entryHash, jti });\n else if (earlier.entryHash !== entryHash) disagreements.push({ disagreement: SigningLogExportDisagreement.CHAIN_DIVERGES, sequence, exports: [earlier.jti, jti] });\n };\n for (const claims of exports) {\n for (const entry of claims.entries) state(entry.sequence, entry.entryHash, claims.jti);\n const first = claims.entries[0];\n if (first && claims.afterSequence > 0) state(claims.afterSequence, first.previousEntryHash, claims.jti);\n state(claims.head.sequence, claims.head.entryHash, claims.jti);\n }\n const byInstant = [...exports].sort((left, right) => left.iat - right.iat);\n for (const [index, later] of byInstant.entries()) {\n const ahead = byInstant.slice(0, index).find((earlier) => earlier.iat < later.iat && earlier.head.sequence > later.head.sequence);\n if (ahead) disagreements.push({ disagreement: SigningLogExportDisagreement.CHAIN_TRUNCATED, sequence: later.head.sequence, exports: [ahead.jti, later.jti] });\n }\n return { consistent: disagreements.length === 0, disagreements };\n}\n"]}