resuxjs 0.3.11 → 0.4.0-beta.3

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 (361) hide show
  1. package/README.md +23 -1
  2. package/dist/bin.d.ts +1 -2
  3. package/dist/bin.js +5 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/build/index.d.ts +29 -0
  6. package/dist/build/index.js +51 -0
  7. package/dist/build/index.js.map +1 -0
  8. package/dist/cli.d.ts +19 -8
  9. package/dist/cli.js +2653 -3688
  10. package/dist/cli.js.map +1 -1
  11. package/dist/compiler/adapter.d.ts +19 -15
  12. package/dist/compiler/adapter.js +69 -93
  13. package/dist/compiler/adapter.js.map +1 -1
  14. package/dist/compiler/dev-warnings.d.ts +14 -10
  15. package/dist/compiler/dev-warnings.js +247 -319
  16. package/dist/compiler/dev-warnings.js.map +1 -1
  17. package/dist/compiler/directives.d.ts +7 -3
  18. package/dist/compiler/directives.js +125 -150
  19. package/dist/compiler/directives.js.map +1 -1
  20. package/dist/compiler/implementation.d.ts +117 -112
  21. package/dist/compiler/implementation.js +2954 -3426
  22. package/dist/compiler/index.d.ts +19 -15
  23. package/dist/compiler/index.js +69 -93
  24. package/dist/compiler/index.js.map +1 -1
  25. package/dist/core/config.d.ts +19 -10
  26. package/dist/core/config.js +42 -25
  27. package/dist/core/config.js.map +1 -1
  28. package/dist/core/hooks.d.ts +133 -131
  29. package/dist/core/hooks.js +45 -55
  30. package/dist/core/hooks.js.map +1 -1
  31. package/dist/core/index.d.ts +5 -4
  32. package/dist/core/index.js +6 -5
  33. package/dist/core/module-container.d.ts +97 -93
  34. package/dist/core/module-container.js +180 -185
  35. package/dist/core/module-container.js.map +1 -1
  36. package/dist/core/resux.d.ts +20 -15
  37. package/dist/core/resux.js +18 -13
  38. package/dist/core/resux.js.map +1 -1
  39. package/dist/create-bin.d.ts +1 -2
  40. package/dist/create-bin.js +5 -0
  41. package/dist/create-bin.js.map +1 -1
  42. package/dist/create.d.ts +6 -2
  43. package/dist/create.js +496 -638
  44. package/dist/create.js.map +1 -1
  45. package/dist/deploy/cloudflare.d.ts +7 -2
  46. package/dist/deploy/cloudflare.js +31 -34
  47. package/dist/deploy/cloudflare.js.map +1 -1
  48. package/dist/deploy/common.d.ts +19 -15
  49. package/dist/deploy/common.js +119 -188
  50. package/dist/deploy/common.js.map +1 -1
  51. package/dist/deploy/framework-runtime.d.ts +5 -1
  52. package/dist/deploy/framework-runtime.js +44 -48
  53. package/dist/deploy/framework-runtime.js.map +1 -1
  54. package/dist/deploy/index.d.ts +8 -3
  55. package/dist/deploy/index.js +56 -80
  56. package/dist/deploy/index.js.map +1 -1
  57. package/dist/deploy/netlify.d.ts +7 -2
  58. package/dist/deploy/netlify.js +41 -41
  59. package/dist/deploy/netlify.js.map +1 -1
  60. package/dist/deploy/node.d.ts +7 -2
  61. package/dist/deploy/node.js +24 -19
  62. package/dist/deploy/node.js.map +1 -1
  63. package/dist/deploy/production-report.d.ts +5 -1
  64. package/dist/deploy/production-report.js +15 -14
  65. package/dist/deploy/production-report.js.map +1 -1
  66. package/dist/deploy/runtime-dependencies.d.ts +8 -4
  67. package/dist/deploy/runtime-dependencies.js +158 -220
  68. package/dist/deploy/runtime-dependencies.js.map +1 -1
  69. package/dist/deploy/static.d.ts +7 -2
  70. package/dist/deploy/static.js +17 -14
  71. package/dist/deploy/static.js.map +1 -1
  72. package/dist/deploy/types.d.ts +33 -29
  73. package/dist/deploy/types.js +1 -2
  74. package/dist/deploy/vercel.d.ts +8 -3
  75. package/dist/deploy/vercel.js +138 -188
  76. package/dist/deploy/vercel.js.map +1 -1
  77. package/dist/fonts/index.d.ts +19 -14
  78. package/dist/fonts/index.js +115 -134
  79. package/dist/fonts/index.js.map +1 -1
  80. package/dist/globals.d.ts +79 -78
  81. package/dist/globals.js +1 -2
  82. package/dist/halal-core/ai/classifyProject.d.ts +9 -4
  83. package/dist/halal-core/ai/classifyProject.js +82 -95
  84. package/dist/halal-core/ai/classifyProject.js.map +1 -1
  85. package/dist/halal-core/ai/classifyRuntimeContent.d.ts +8 -3
  86. package/dist/halal-core/ai/classifyRuntimeContent.js +78 -95
  87. package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
  88. package/dist/halal-core/ai/createProjectSummary.d.ts +40 -36
  89. package/dist/halal-core/ai/createProjectSummary.js +39 -39
  90. package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
  91. package/dist/halal-core/ai/halalClassifierPrompt.d.ts +5 -1
  92. package/dist/halal-core/ai/halalClassifierPrompt.js +5 -1
  93. package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -1
  94. package/dist/halal-core/ai/redactSensitiveData.d.ts +5 -1
  95. package/dist/halal-core/ai/redactSensitiveData.js +82 -110
  96. package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
  97. package/dist/halal-core/ai/validateAiResponse.d.ts +7 -2
  98. package/dist/halal-core/ai/validateAiResponse.js +56 -83
  99. package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
  100. package/dist/halal-core/cli/check.d.ts +5 -1
  101. package/dist/halal-core/cli/check.js +28 -30
  102. package/dist/halal-core/cli/check.js.map +1 -1
  103. package/dist/halal-core/cli/explain.d.ts +5 -1
  104. package/dist/halal-core/cli/explain.js +27 -31
  105. package/dist/halal-core/cli/explain.js.map +1 -1
  106. package/dist/halal-core/cli/report.d.ts +5 -1
  107. package/dist/halal-core/cli/report.js +14 -10
  108. package/dist/halal-core/cli/report.js.map +1 -1
  109. package/dist/halal-core/cli/submitReview.d.ts +5 -1
  110. package/dist/halal-core/cli/submitReview.js +13 -9
  111. package/dist/halal-core/cli/submitReview.js.map +1 -1
  112. package/dist/halal-core/cli/verifyReview.d.ts +5 -1
  113. package/dist/halal-core/cli/verifyReview.js +17 -15
  114. package/dist/halal-core/cli/verifyReview.js.map +1 -1
  115. package/dist/halal-core/config.d.ts +39 -35
  116. package/dist/halal-core/config.js +77 -118
  117. package/dist/halal-core/config.js.map +1 -1
  118. package/dist/halal-core/crypto/integrity.d.ts +12 -8
  119. package/dist/halal-core/crypto/integrity.js +65 -87
  120. package/dist/halal-core/crypto/integrity.js.map +1 -1
  121. package/dist/halal-core/enforce.d.ts +9 -5
  122. package/dist/halal-core/enforce.js +90 -105
  123. package/dist/halal-core/enforce.js.map +1 -1
  124. package/dist/halal-core/index.d.ts +20 -16
  125. package/dist/halal-core/index.js +19 -19
  126. package/dist/halal-core/lifecycle.d.ts +5 -1
  127. package/dist/halal-core/lifecycle.js +16 -13
  128. package/dist/halal-core/lifecycle.js.map +1 -1
  129. package/dist/halal-core/policy.d.ts +7 -2
  130. package/dist/halal-core/policy.js +7 -2
  131. package/dist/halal-core/policy.js.map +1 -1
  132. package/dist/halal-core/report/formatBrowserOverlay.d.ts +7 -2
  133. package/dist/halal-core/report/formatBrowserOverlay.js +10 -8
  134. package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
  135. package/dist/halal-core/report/formatTerminalReport.d.ts +7 -2
  136. package/dist/halal-core/report/formatTerminalReport.js +27 -37
  137. package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
  138. package/dist/halal-core/report/generateHalalReport.d.ts +11 -6
  139. package/dist/halal-core/report/generateHalalReport.js +25 -27
  140. package/dist/halal-core/report/generateHalalReport.js.map +1 -1
  141. package/dist/halal-core/report/signReport.d.ts +8 -3
  142. package/dist/halal-core/report/signReport.js +17 -12
  143. package/dist/halal-core/report/signReport.js.map +1 -1
  144. package/dist/halal-core/report/verifyReport.d.ts +14 -9
  145. package/dist/halal-core/report/verifyReport.js +52 -41
  146. package/dist/halal-core/report/verifyReport.js.map +1 -1
  147. package/dist/halal-core/review/createReviewRequest.d.ts +7 -2
  148. package/dist/halal-core/review/createReviewRequest.js +21 -17
  149. package/dist/halal-core/review/createReviewRequest.js.map +1 -1
  150. package/dist/halal-core/review/reviewPolicy.d.ts +7 -3
  151. package/dist/halal-core/review/reviewPolicy.js +19 -17
  152. package/dist/halal-core/review/reviewPolicy.js.map +1 -1
  153. package/dist/halal-core/review/signedReviewFile.d.ts +17 -12
  154. package/dist/halal-core/review/signedReviewFile.js +25 -22
  155. package/dist/halal-core/review/signedReviewFile.js.map +1 -1
  156. package/dist/halal-core/review/verifyReviewApproval.d.ts +12 -8
  157. package/dist/halal-core/review/verifyReviewApproval.js +69 -62
  158. package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
  159. package/dist/halal-core/rules/adultContentRules.d.ts +6 -2
  160. package/dist/halal-core/rules/adultContentRules.js +23 -23
  161. package/dist/halal-core/rules/adultContentRules.js.map +1 -1
  162. package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +6 -2
  163. package/dist/halal-core/rules/alcoholDrugVapeRules.js +22 -22
  164. package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
  165. package/dist/halal-core/rules/childSafetyRules.d.ts +6 -2
  166. package/dist/halal-core/rules/childSafetyRules.js +19 -19
  167. package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
  168. package/dist/halal-core/rules/coreCategories.d.ts +10 -6
  169. package/dist/halal-core/rules/coreCategories.js +237 -110
  170. package/dist/halal-core/rules/coreCategories.js.map +1 -1
  171. package/dist/halal-core/rules/cyberAbuseRules.d.ts +6 -2
  172. package/dist/halal-core/rules/cyberAbuseRules.js +27 -27
  173. package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
  174. package/dist/halal-core/rules/defaultBlockedRules.d.ts +24 -19
  175. package/dist/halal-core/rules/defaultBlockedRules.js +156 -199
  176. package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
  177. package/dist/halal-core/rules/dependencyRules.d.ts +11 -7
  178. package/dist/halal-core/rules/dependencyRules.js +50 -56
  179. package/dist/halal-core/rules/dependencyRules.js.map +1 -1
  180. package/dist/halal-core/rules/endpointRules.d.ts +9 -5
  181. package/dist/halal-core/rules/endpointRules.js +21 -23
  182. package/dist/halal-core/rules/endpointRules.js.map +1 -1
  183. package/dist/halal-core/rules/environmentalHarmRules.d.ts +6 -2
  184. package/dist/halal-core/rules/environmentalHarmRules.js +17 -17
  185. package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
  186. package/dist/halal-core/rules/financeRibaRules.d.ts +6 -2
  187. package/dist/halal-core/rules/financeRibaRules.js +20 -20
  188. package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
  189. package/dist/halal-core/rules/gamblingRules.d.ts +6 -2
  190. package/dist/halal-core/rules/gamblingRules.js +22 -22
  191. package/dist/halal-core/rules/gamblingRules.js.map +1 -1
  192. package/dist/halal-core/rules/generalHarmRules.d.ts +6 -2
  193. package/dist/halal-core/rules/generalHarmRules.js +15 -15
  194. package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
  195. package/dist/halal-core/rules/healthHarmRules.d.ts +6 -2
  196. package/dist/halal-core/rules/healthHarmRules.js +19 -19
  197. package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
  198. package/dist/halal-core/rules/keywordRules.d.ts +13 -9
  199. package/dist/halal-core/rules/keywordRules.js +90 -39
  200. package/dist/halal-core/rules/keywordRules.js.map +1 -1
  201. package/dist/halal-core/rules/privacyAbuseRules.d.ts +6 -2
  202. package/dist/halal-core/rules/privacyAbuseRules.js +21 -21
  203. package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
  204. package/dist/halal-core/rules/scamFraudRules.d.ts +6 -2
  205. package/dist/halal-core/rules/scamFraudRules.js +29 -29
  206. package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
  207. package/dist/halal-core/rules/selfHarmRules.d.ts +6 -2
  208. package/dist/halal-core/rules/selfHarmRules.js +17 -17
  209. package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
  210. package/dist/halal-core/rules/violenceExtremismRules.d.ts +6 -2
  211. package/dist/halal-core/rules/violenceExtremismRules.js +30 -30
  212. package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
  213. package/dist/halal-core/runtime/guard.d.ts +22 -17
  214. package/dist/halal-core/runtime/guard.js +163 -183
  215. package/dist/halal-core/runtime/guard.js.map +1 -1
  216. package/dist/halal-core/runtime/index.d.ts +5 -4
  217. package/dist/halal-core/runtime/index.js +5 -5
  218. package/dist/halal-core/runtime/reviewedMemory.d.ts +10 -5
  219. package/dist/halal-core/runtime/reviewedMemory.js +75 -110
  220. package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
  221. package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +17 -12
  222. package/dist/halal-core/runtime/serializeRuntimeContent.js +133 -156
  223. package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
  224. package/dist/halal-core/runtime/types.d.ts +55 -50
  225. package/dist/halal-core/runtime/types.js +1 -2
  226. package/dist/halal-core/scanner/scanApiRoutes.d.ts +5 -1
  227. package/dist/halal-core/scanner/scanApiRoutes.js +33 -36
  228. package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
  229. package/dist/halal-core/scanner/scanComponents.d.ts +5 -1
  230. package/dist/halal-core/scanner/scanComponents.js +13 -13
  231. package/dist/halal-core/scanner/scanComponents.js.map +1 -1
  232. package/dist/halal-core/scanner/scanContent.d.ts +8 -4
  233. package/dist/halal-core/scanner/scanContent.js +192 -261
  234. package/dist/halal-core/scanner/scanContent.js.map +1 -1
  235. package/dist/halal-core/scanner/scanDependencies.d.ts +5 -1
  236. package/dist/halal-core/scanner/scanDependencies.js +17 -15
  237. package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
  238. package/dist/halal-core/scanner/scanDomains.d.ts +7 -3
  239. package/dist/halal-core/scanner/scanDomains.js +12 -12
  240. package/dist/halal-core/scanner/scanDomains.js.map +1 -1
  241. package/dist/halal-core/scanner/scanEnvNames.d.ts +5 -1
  242. package/dist/halal-core/scanner/scanEnvNames.js +24 -26
  243. package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
  244. package/dist/halal-core/scanner/scanMetadata.d.ts +9 -5
  245. package/dist/halal-core/scanner/scanMetadata.js +21 -29
  246. package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
  247. package/dist/halal-core/scanner/scanPages.d.ts +5 -1
  248. package/dist/halal-core/scanner/scanPages.js +13 -15
  249. package/dist/halal-core/scanner/scanPages.js.map +1 -1
  250. package/dist/halal-core/scanner/scanProject.d.ts +19 -12
  251. package/dist/halal-core/scanner/scanProject.js +44 -49
  252. package/dist/halal-core/scanner/scanProject.js.map +1 -1
  253. package/dist/halal-core/scanner/scanRoutes.d.ts +5 -1
  254. package/dist/halal-core/scanner/scanRoutes.js +33 -39
  255. package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
  256. package/dist/halal-core/scanner/scanTranslations.d.ts +5 -1
  257. package/dist/halal-core/scanner/scanTranslations.js +22 -29
  258. package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
  259. package/dist/halal-core/status.d.ts +17 -13
  260. package/dist/halal-core/status.js +1 -2
  261. package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +5 -1
  262. package/dist/halal-core/tamper/verifyCoreIntegrity.js +27 -24
  263. package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
  264. package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +5 -1
  265. package/dist/halal-core/tamper/verifyLifecycleHooks.js +13 -12
  266. package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
  267. package/dist/halal-core/tamper/verifyReportSignature.d.ts +9 -4
  268. package/dist/halal-core/tamper/verifyReportSignature.js +20 -14
  269. package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
  270. package/dist/halal.d.ts +20 -1
  271. package/dist/halal.js +19 -2
  272. package/dist/i18n/index.d.ts +44 -40
  273. package/dist/i18n/index.js +218 -288
  274. package/dist/i18n/index.js.map +1 -1
  275. package/dist/i18n/shared.d.ts +33 -29
  276. package/dist/i18n/shared.js +204 -266
  277. package/dist/i18n/shared.js.map +1 -1
  278. package/dist/icons/index.d.ts +160 -154
  279. package/dist/icons/index.js +323 -273
  280. package/dist/icons/index.js.map +1 -1
  281. package/dist/index.d.ts +8 -1
  282. package/dist/index.js +8 -2
  283. package/dist/kit/index.d.ts +32 -27
  284. package/dist/kit/index.js +46 -43
  285. package/dist/kit/index.js.map +1 -1
  286. package/dist/nitro-server/index.d.ts +10 -6
  287. package/dist/nitro-server/index.js +6 -2
  288. package/dist/nitro-server/index.js.map +1 -1
  289. package/dist/node.d.ts +9 -4
  290. package/dist/node.js +89 -116
  291. package/dist/node.js.map +1 -1
  292. package/dist/reactivity/computed.d.ts +11 -6
  293. package/dist/reactivity/computed.js +46 -53
  294. package/dist/reactivity/computed.js.map +1 -1
  295. package/dist/reactivity/effect.d.ts +23 -18
  296. package/dist/reactivity/effect.js +105 -147
  297. package/dist/reactivity/effect.js.map +1 -1
  298. package/dist/reactivity/index.d.ts +8 -8
  299. package/dist/reactivity/index.js +8 -8
  300. package/dist/reactivity/reactive.d.ts +9 -5
  301. package/dist/reactivity/reactive.js +95 -134
  302. package/dist/reactivity/reactive.js.map +1 -1
  303. package/dist/reactivity/readonly.d.ts +2 -1
  304. package/dist/reactivity/readonly.js +3 -2
  305. package/dist/reactivity/ref.d.ts +23 -21
  306. package/dist/reactivity/ref.js +71 -81
  307. package/dist/reactivity/ref.js.map +1 -1
  308. package/dist/reactivity/scheduler.d.ts +8 -5
  309. package/dist/reactivity/scheduler.js +67 -69
  310. package/dist/reactivity/scheduler.js.map +1 -1
  311. package/dist/reactivity/types.d.ts +29 -25
  312. package/dist/reactivity/types.js +1 -2
  313. package/dist/reactivity/utils.d.ts +17 -13
  314. package/dist/reactivity/utils.js +25 -24
  315. package/dist/reactivity/utils.js.map +1 -1
  316. package/dist/reactivity/watch.d.ts +8 -4
  317. package/dist/reactivity/watch.js +74 -103
  318. package/dist/reactivity/watch.js.map +1 -1
  319. package/dist/runtime/core.d.ts +32 -0
  320. package/dist/runtime/core.js +155 -0
  321. package/dist/runtime/core.js.map +1 -0
  322. package/dist/runtime/index.d.ts +649 -622
  323. package/dist/runtime/index.js +4105 -5243
  324. package/dist/runtime/index.js.map +1 -1
  325. package/dist/runtime/reactivity.d.ts +7 -0
  326. package/dist/runtime/reactivity.js +7 -0
  327. package/dist/runtime/resume.d.ts +80 -0
  328. package/dist/runtime/resume.js +482 -0
  329. package/dist/runtime/resume.js.map +1 -0
  330. package/dist/runtime/router.d.ts +21 -0
  331. package/dist/runtime/router.js +60 -0
  332. package/dist/runtime/router.js.map +1 -0
  333. package/dist/runtime/streaming.d.ts +25 -0
  334. package/dist/runtime/streaming.js +200 -0
  335. package/dist/runtime/streaming.js.map +1 -0
  336. package/dist/security/media-fetch.d.ts +33 -0
  337. package/dist/security/media-fetch.js +302 -0
  338. package/dist/security/media-fetch.js.map +1 -0
  339. package/dist/security/path-boundary.d.ts +8 -0
  340. package/dist/security/path-boundary.js +71 -0
  341. package/dist/security/path-boundary.js.map +1 -0
  342. package/dist/ui/index.d.ts +1774 -1768
  343. package/dist/ui/index.js +974 -674
  344. package/dist/ui/index.js.map +1 -1
  345. package/dist/vite-builder/index.d.ts +9 -5
  346. package/dist/vite-builder/index.js +6 -2
  347. package/dist/vite-builder/index.js.map +1 -1
  348. package/package.json +46 -86
  349. package/dist/compiler/implementation.js.map +0 -1
  350. package/dist/core/index.js.map +0 -1
  351. package/dist/deploy/types.js.map +0 -1
  352. package/dist/globals.js.map +0 -1
  353. package/dist/halal-core/index.js.map +0 -1
  354. package/dist/halal-core/runtime/index.js.map +0 -1
  355. package/dist/halal-core/runtime/types.js.map +0 -1
  356. package/dist/halal-core/status.js.map +0 -1
  357. package/dist/halal.js.map +0 -1
  358. package/dist/index.js.map +0 -1
  359. package/dist/reactivity/index.js.map +0 -1
  360. package/dist/reactivity/readonly.js.map +0 -1
  361. package/dist/reactivity/types.js.map +0 -1
@@ -1,28 +1,24 @@
1
- import { existsSync, writeFileSync, mkdirSync } from "node:fs";
2
- import path from "node:path";
3
1
  import { evaluateRules } from "../rules/defaultBlockedRules.js";
4
- import { generateReportChecksum, generateReportSignature, } from "./signReport.js";
5
- export function generateHalalReport(scannedData, policy, outDir, options = {}) {
6
- const baseReport = evaluateRules(scannedData, policy);
7
- const createdDate = new Date().toISOString();
8
- const reportToSign = {
9
- ...baseReport,
10
- createdDate,
11
- };
12
- const signature = options.requireAuthenticated === true
13
- ? generateReportSignature(reportToSign, options.signingSecret)
14
- : generateReportChecksum(reportToSign);
15
- const finalReport = {
16
- ...reportToSign,
17
- signature,
18
- };
19
- if (!existsSync(outDir)) {
20
- mkdirSync(outDir, { recursive: true });
21
- }
22
- const reportPath = path.join(outDir, "halal-report.json");
23
- writeFileSync(reportPath, JSON.stringify(finalReport, null, 2), "utf8");
24
- const mdPath = path.join(outDir, "halal-report.md");
25
- const mdContent = `
2
+ import { generateReportChecksum, generateReportSignature } from "./signReport.js";
3
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
+ import path from "node:path";
5
+
6
+ //#region src/halal-core/report/generateHalalReport.ts
7
+ function generateHalalReport(scannedData, policy, outDir, options = {}) {
8
+ const baseReport = evaluateRules(scannedData, policy);
9
+ const createdDate = (/* @__PURE__ */ new Date()).toISOString();
10
+ const reportToSign = {
11
+ ...baseReport,
12
+ createdDate
13
+ };
14
+ const signature = options.requireAuthenticated === true ? generateReportSignature(reportToSign, options.signingSecret) : generateReportChecksum(reportToSign);
15
+ const finalReport = {
16
+ ...reportToSign,
17
+ signature
18
+ };
19
+ if (!existsSync(outDir)) mkdirSync(outDir, { recursive: true });
20
+ writeFileSync(path.join(outDir, "halal-report.json"), JSON.stringify(finalReport, null, 2), "utf8");
21
+ writeFileSync(path.join(outDir, "halal-report.md"), `
26
22
  # ResuxJS Halal Core Security Report
27
23
 
28
24
  - **Generated At**: ${createdDate}
@@ -39,8 +35,10 @@ ${finalReport.reasons.map((reason) => `- ${reason}`).join("\n") || "No warning e
39
35
 
40
36
  ## Action Required
41
37
  ${finalReport.recommendedAction}
42
- `.trim();
43
- writeFileSync(mdPath, mdContent, "utf8");
44
- return finalReport;
38
+ `.trim(), "utf8");
39
+ return finalReport;
45
40
  }
41
+
42
+ //#endregion
43
+ export { generateHalalReport };
46
44
  //# sourceMappingURL=generateHalalReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateHalalReport.js","sourceRoot":"","sources":["../../../src/halal-core/report/generateHalalReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AASzB,MAAM,UAAU,mBAAmB,CACjC,WAAgB,EAChB,MAAwB,EACxB,MAAc,EACd,UAAsC,EAAE;IAExC,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEtD,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,YAAY,GAAwC;QACxD,GAAG,UAAU;QACb,WAAW;KACZ,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CAAC,oBAAoB,KAAK,IAAI;QACrD,CAAC,CAAC,uBAAuB,CAAC,YAAY,EAAE,OAAO,CAAC,aAAa,CAAC;QAC9D,CAAC,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,WAAW,GAAqB;QACpC,GAAG,YAAY;QACf,SAAS;KACV,CAAC;IAEF,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC1D,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG;;;sBAGE,WAAW;4BACL,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE;sBACtC,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE;oBACrC,CAAC,WAAW,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;qBACxC,SAAS;;;EAG5B,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gCAAgC;;;EAGxG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,8BAA8B;;;EAG/F,WAAW,CAAC,iBAAiB;GAC5B,CAAC,IAAI,EAAE,CAAC;IAET,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEzC,OAAO,WAAW,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"generateHalalReport.js","names":[],"sources":["../../../src/halal-core/report/generateHalalReport.ts"],"sourcesContent":["import { existsSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { evaluateRules } from \"../rules/defaultBlockedRules.js\";\nimport {\n generateReportChecksum,\n generateReportSignature,\n} from \"./signReport.js\";\nimport type { HalalCheckResult } from \"../status.js\";\nimport type { ResuxHalalPolicy } from \"../config.js\";\n\nexport interface GenerateHalalReportOptions {\n requireAuthenticated?: boolean;\n signingSecret?: string;\n}\n\nexport function generateHalalReport(\n scannedData: any,\n policy: ResuxHalalPolicy,\n outDir: string,\n options: GenerateHalalReportOptions = {},\n): HalalCheckResult {\n const baseReport = evaluateRules(scannedData, policy);\n\n const createdDate = new Date().toISOString();\n const reportToSign: Omit<HalalCheckResult, \"signature\"> = {\n ...baseReport,\n createdDate,\n };\n\n const signature = options.requireAuthenticated === true\n ? generateReportSignature(reportToSign, options.signingSecret)\n : generateReportChecksum(reportToSign);\n const finalReport: HalalCheckResult = {\n ...reportToSign,\n signature,\n };\n\n if (!existsSync(outDir)) {\n mkdirSync(outDir, { recursive: true });\n }\n\n const reportPath = path.join(outDir, \"halal-report.json\");\n writeFileSync(reportPath, JSON.stringify(finalReport, null, 2), \"utf8\");\n\n const mdPath = path.join(outDir, \"halal-report.md\");\n const mdContent = `\n# ResuxJS Halal Core Security Report\n\n- **Generated At**: ${createdDate}\n- **Framework Status**: **${finalReport.status.toUpperCase()}**\n- **Risk Level**: **${finalReport.riskLevel.toUpperCase()}**\n- **Confidence**: ${(finalReport.confidence * 100).toFixed(0)}%\n- **Signature**: \\`${signature}\\`\n\n## Categories Detected\n${finalReport.categories.map((category) => `- ${category}`).join(\"\\n\") || \"No policy categories violated.\"}\n\n## Reasons\n${finalReport.reasons.map((reason) => `- ${reason}`).join(\"\\n\") || \"No warning elements flagged.\"}\n\n## Action Required\n${finalReport.recommendedAction}\n `.trim();\n\n writeFileSync(mdPath, mdContent, \"utf8\");\n\n return finalReport;\n}\n"],"mappings":";;;;;;AAeA,SAAgB,oBACd,aACA,QACA,QACA,UAAsC,EAAE,EACtB;CAClB,MAAM,aAAa,cAAc,aAAa,OAAO;CAErD,MAAM,+BAAc,IAAI,MAAM,EAAC,aAAa;CAC5C,MAAM,eAAoD;EACxD,GAAG;EACH;EACD;CAED,MAAM,YAAY,QAAQ,yBAAyB,OAC/C,wBAAwB,cAAc,QAAQ,cAAc,GAC5D,uBAAuB,aAAa;CACxC,MAAM,cAAgC;EACpC,GAAG;EACH;EACD;AAED,KAAI,CAAC,WAAW,OAAO,CACrB,WAAU,QAAQ,EAAE,WAAW,MAAM,CAAC;AAIxC,eADmB,KAAK,KAAK,QAAQ,oBAAoB,EAC/B,KAAK,UAAU,aAAa,MAAM,EAAE,EAAE,OAAO;AAsBvE,eApBe,KAAK,KAAK,QAAQ,kBAAkB,EACjC;;;sBAGE,YAAY;4BACN,YAAY,OAAO,aAAa,CAAC;sBACvC,YAAY,UAAU,aAAa,CAAC;qBACrC,YAAY,aAAa,KAAK,QAAQ,EAAE,CAAC;qBACzC,UAAU;;;EAG7B,YAAY,WAAW,KAAK,aAAa,KAAK,WAAW,CAAC,KAAK,KAAK,IAAI,iCAAiC;;;EAGzG,YAAY,QAAQ,KAAK,WAAW,KAAK,SAAS,CAAC,KAAK,KAAK,IAAI,+BAA+B;;;EAGhG,YAAY,kBAAkB;IAC5B,MAAM,EAEyB,OAAO;AAExC,QAAO"}
@@ -1,3 +1,8 @@
1
- import type { HalalCheckResult } from "../status.js";
2
- export declare function generateReportSignature(report: Omit<HalalCheckResult, "signature">, secret?: string): string;
3
- export declare function generateReportChecksum(report: Omit<HalalCheckResult, "signature">): string;
1
+ import { HalalCheckResult } from "../status.js";
2
+
3
+ //#region src/halal-core/report/signReport.d.ts
4
+ declare function generateReportSignature(report: Omit<HalalCheckResult, "signature">, secret?: string): string;
5
+ declare function generateReportChecksum(report: Omit<HalalCheckResult, "signature">): string;
6
+ //#endregion
7
+ export { generateReportChecksum, generateReportSignature };
8
+ //# sourceMappingURL=signReport.d.ts.map
@@ -1,17 +1,22 @@
1
1
  import { createIntegritySignature } from "../crypto/integrity.js";
2
+
3
+ //#region src/halal-core/report/signReport.ts
2
4
  const REPORT_SIGNING_ENV = "RESUX_HALAL_REPORT_SIGNING_SECRET";
3
- export function generateReportSignature(report, secret) {
4
- return createIntegritySignature(report, {
5
- envName: REPORT_SIGNING_ENV,
6
- secret,
7
- requireSecret: true,
8
- });
5
+ function generateReportSignature(report, secret) {
6
+ return createIntegritySignature(report, {
7
+ envName: REPORT_SIGNING_ENV,
8
+ secret,
9
+ requireSecret: true
10
+ });
9
11
  }
10
- export function generateReportChecksum(report) {
11
- return createIntegritySignature(report, {
12
- envName: REPORT_SIGNING_ENV,
13
- secret: "",
14
- requireSecret: false,
15
- });
12
+ function generateReportChecksum(report) {
13
+ return createIntegritySignature(report, {
14
+ envName: REPORT_SIGNING_ENV,
15
+ secret: "",
16
+ requireSecret: false
17
+ });
16
18
  }
19
+
20
+ //#endregion
21
+ export { generateReportChecksum, generateReportSignature };
17
22
  //# sourceMappingURL=signReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signReport.js","sourceRoot":"","sources":["../../../src/halal-core/report/signReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAE/D,MAAM,UAAU,uBAAuB,CACrC,MAA2C,EAC3C,MAAe;IAEf,OAAO,wBAAwB,CAAC,MAAM,EAAE;QACtC,OAAO,EAAE,kBAAkB;QAC3B,MAAM;QACN,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,MAA2C;IAE3C,OAAO,wBAAwB,CAAC,MAAM,EAAE;QACtC,OAAO,EAAE,kBAAkB;QAC3B,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"signReport.js","names":[],"sources":["../../../src/halal-core/report/signReport.ts"],"sourcesContent":["import type { HalalCheckResult } from \"../status.js\";\nimport { createIntegritySignature } from \"../crypto/integrity.js\";\n\nconst REPORT_SIGNING_ENV = \"RESUX_HALAL_REPORT_SIGNING_SECRET\";\n\nexport function generateReportSignature(\n report: Omit<HalalCheckResult, \"signature\">,\n secret?: string,\n): string {\n return createIntegritySignature(report, {\n envName: REPORT_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function generateReportChecksum(\n report: Omit<HalalCheckResult, \"signature\">,\n): string {\n return createIntegritySignature(report, {\n envName: REPORT_SIGNING_ENV,\n secret: \"\",\n requireSecret: false,\n });\n}\n"],"mappings":";;;AAGA,MAAM,qBAAqB;AAE3B,SAAgB,wBACd,QACA,QACQ;AACR,QAAO,yBAAyB,QAAQ;EACtC,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,uBACd,QACQ;AACR,QAAO,yBAAyB,QAAQ;EACtC,SAAS;EACT,QAAQ;EACR,eAAe;EAChB,CAAC"}
@@ -1,11 +1,16 @@
1
- import type { HalalCheckResult } from "../status.js";
2
- export interface ReportVerificationOptions {
3
- secret?: string;
4
- requireAuthenticated?: boolean;
5
- now?: number;
1
+ import { HalalCheckResult } from "../status.js";
2
+
3
+ //#region src/halal-core/report/verifyReport.d.ts
4
+ interface ReportVerificationOptions {
5
+ secret?: string;
6
+ requireAuthenticated?: boolean;
7
+ now?: number;
6
8
  }
7
- export declare function verifyReportSignature(report: HalalCheckResult, options?: ReportVerificationOptions): boolean;
8
- export declare function isReportValid(report: HalalCheckResult, options?: ReportVerificationOptions): {
9
- valid: boolean;
10
- reason?: string;
9
+ declare function verifyReportSignature(report: HalalCheckResult, options?: ReportVerificationOptions): boolean;
10
+ declare function isReportValid(report: HalalCheckResult, options?: ReportVerificationOptions): {
11
+ valid: boolean;
12
+ reason?: string;
11
13
  };
14
+ //#endregion
15
+ export { ReportVerificationOptions, isReportValid, verifyReportSignature };
16
+ //# sourceMappingURL=verifyReport.d.ts.map
@@ -1,45 +1,56 @@
1
- import { isAuthenticatedIntegritySignature, verifyIntegritySignature, } from "../crypto/integrity.js";
1
+ import { isAuthenticatedIntegritySignature, verifyIntegritySignature } from "../crypto/integrity.js";
2
+
3
+ //#region src/halal-core/report/verifyReport.ts
2
4
  const REPORT_SIGNING_ENV = "RESUX_HALAL_REPORT_SIGNING_SECRET";
3
- const REPORT_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
4
- const MAX_CLOCK_SKEW_MS = 5 * 60 * 1000;
5
- export function verifyReportSignature(report, options = {}) {
6
- if (!report || typeof report !== "object" || !report.signature) {
7
- return false;
8
- }
9
- const { signature, ...rest } = report;
10
- return verifyIntegritySignature(rest, signature, {
11
- envName: REPORT_SIGNING_ENV,
12
- secret: options.secret,
13
- requireSecret: options.requireAuthenticated === true,
14
- });
5
+ const REPORT_MAX_AGE_MS = 720 * 60 * 60 * 1e3;
6
+ const MAX_CLOCK_SKEW_MS = 300 * 1e3;
7
+ function verifyReportSignature(report, options = {}) {
8
+ if (!report || typeof report !== "object" || !report.signature) return false;
9
+ const { signature, ...rest } = report;
10
+ return verifyIntegritySignature(rest, signature, {
11
+ envName: REPORT_SIGNING_ENV,
12
+ secret: options.secret,
13
+ requireSecret: options.requireAuthenticated === true
14
+ });
15
15
  }
16
- export function isReportValid(report, options = {}) {
17
- if (!report || typeof report !== "object") {
18
- return { valid: false, reason: "No report provided." };
19
- }
20
- if (!verifyReportSignature(report, options)) {
21
- return { valid: false, reason: "Report integrity check is invalid or the report has been modified." };
22
- }
23
- if (options.requireAuthenticated === true && !isAuthenticatedIntegritySignature(report.signature)) {
24
- return { valid: false, reason: "Report requires an authenticated HMAC signature." };
25
- }
26
- if (report.status === "blocked") {
27
- return { valid: false, reason: `Project is blocked: ${report.reasons.join(", ")}` };
28
- }
29
- if (typeof report.createdDate !== "string" || !report.createdDate.trim()) {
30
- return { valid: false, reason: "Report creation date is missing." };
31
- }
32
- const createdAt = Date.parse(report.createdDate);
33
- if (!Number.isFinite(createdAt)) {
34
- return { valid: false, reason: "Report creation date is invalid." };
35
- }
36
- const now = options.now ?? Date.now();
37
- if (createdAt > now + MAX_CLOCK_SKEW_MS) {
38
- return { valid: false, reason: "Report creation date is unexpectedly in the future." };
39
- }
40
- if (now - createdAt > REPORT_MAX_AGE_MS) {
41
- return { valid: false, reason: "Report has expired (must be re-generated within 30 days)." };
42
- }
43
- return { valid: true };
16
+ function isReportValid(report, options = {}) {
17
+ if (!report || typeof report !== "object") return {
18
+ valid: false,
19
+ reason: "No report provided."
20
+ };
21
+ if (!verifyReportSignature(report, options)) return {
22
+ valid: false,
23
+ reason: "Report integrity check is invalid or the report has been modified."
24
+ };
25
+ if (options.requireAuthenticated === true && !isAuthenticatedIntegritySignature(report.signature)) return {
26
+ valid: false,
27
+ reason: "Report requires an authenticated HMAC signature."
28
+ };
29
+ if (report.status === "blocked") return {
30
+ valid: false,
31
+ reason: `Project is blocked: ${report.reasons.join(", ")}`
32
+ };
33
+ if (typeof report.createdDate !== "string" || !report.createdDate.trim()) return {
34
+ valid: false,
35
+ reason: "Report creation date is missing."
36
+ };
37
+ const createdAt = Date.parse(report.createdDate);
38
+ if (!Number.isFinite(createdAt)) return {
39
+ valid: false,
40
+ reason: "Report creation date is invalid."
41
+ };
42
+ const now = options.now ?? Date.now();
43
+ if (createdAt > now + MAX_CLOCK_SKEW_MS) return {
44
+ valid: false,
45
+ reason: "Report creation date is unexpectedly in the future."
46
+ };
47
+ if (now - createdAt > REPORT_MAX_AGE_MS) return {
48
+ valid: false,
49
+ reason: "Report has expired (must be re-generated within 30 days)."
50
+ };
51
+ return { valid: true };
44
52
  }
53
+
54
+ //#endregion
55
+ export { isReportValid, verifyReportSignature };
45
56
  //# sourceMappingURL=verifyReport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyReport.js","sourceRoot":"","sources":["../../../src/halal-core/report/verifyReport.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAC/D,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnD,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAQxC,MAAM,UAAU,qBAAqB,CACnC,MAAwB,EACxB,UAAqC,EAAE;IAEvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACtC,OAAO,wBAAwB,CAAC,IAAI,EAAE,SAAS,EAAE;QAC/C,OAAO,EAAE,kBAAkB;QAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,aAAa,EAAE,OAAO,CAAC,oBAAoB,KAAK,IAAI;KACrD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,MAAwB,EACxB,UAAqC,EAAE;IAEvC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,oEAAoE,EAAE,CAAC;IACxG,CAAC;IAED,IAAI,OAAO,CAAC,oBAAoB,KAAK,IAAI,IAAI,CAAC,iCAAiC,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAClG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,kDAAkD,EAAE,CAAC;IACtF,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IACtF,CAAC;IAED,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;QACzE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,kCAAkC,EAAE,CAAC;IACtE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,kCAAkC,EAAE,CAAC;IACtE,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,IAAI,SAAS,GAAG,GAAG,GAAG,iBAAiB,EAAE,CAAC;QACxC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,qDAAqD,EAAE,CAAC;IACzF,CAAC;IACD,IAAI,GAAG,GAAG,SAAS,GAAG,iBAAiB,EAAE,CAAC;QACxC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,2DAA2D,EAAE,CAAC;IAC/F,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"verifyReport.js","names":[],"sources":["../../../src/halal-core/report/verifyReport.ts"],"sourcesContent":["import type { HalalCheckResult } from \"../status.js\";\nimport {\n isAuthenticatedIntegritySignature,\n verifyIntegritySignature,\n} from \"../crypto/integrity.js\";\n\nconst REPORT_SIGNING_ENV = \"RESUX_HALAL_REPORT_SIGNING_SECRET\";\nconst REPORT_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;\nconst MAX_CLOCK_SKEW_MS = 5 * 60 * 1000;\n\nexport interface ReportVerificationOptions {\n secret?: string;\n requireAuthenticated?: boolean;\n now?: number;\n}\n\nexport function verifyReportSignature(\n report: HalalCheckResult,\n options: ReportVerificationOptions = {},\n): boolean {\n if (!report || typeof report !== \"object\" || !report.signature) {\n return false;\n }\n\n const { signature, ...rest } = report;\n return verifyIntegritySignature(rest, signature, {\n envName: REPORT_SIGNING_ENV,\n secret: options.secret,\n requireSecret: options.requireAuthenticated === true,\n });\n}\n\nexport function isReportValid(\n report: HalalCheckResult,\n options: ReportVerificationOptions = {},\n): { valid: boolean; reason?: string } {\n if (!report || typeof report !== \"object\") {\n return { valid: false, reason: \"No report provided.\" };\n }\n\n if (!verifyReportSignature(report, options)) {\n return { valid: false, reason: \"Report integrity check is invalid or the report has been modified.\" };\n }\n\n if (options.requireAuthenticated === true && !isAuthenticatedIntegritySignature(report.signature)) {\n return { valid: false, reason: \"Report requires an authenticated HMAC signature.\" };\n }\n\n if (report.status === \"blocked\") {\n return { valid: false, reason: `Project is blocked: ${report.reasons.join(\", \")}` };\n }\n\n if (typeof report.createdDate !== \"string\" || !report.createdDate.trim()) {\n return { valid: false, reason: \"Report creation date is missing.\" };\n }\n\n const createdAt = Date.parse(report.createdDate);\n if (!Number.isFinite(createdAt)) {\n return { valid: false, reason: \"Report creation date is invalid.\" };\n }\n\n const now = options.now ?? Date.now();\n if (createdAt > now + MAX_CLOCK_SKEW_MS) {\n return { valid: false, reason: \"Report creation date is unexpectedly in the future.\" };\n }\n if (now - createdAt > REPORT_MAX_AGE_MS) {\n return { valid: false, reason: \"Report has expired (must be re-generated within 30 days).\" };\n }\n\n return { valid: true };\n}\n"],"mappings":";;;AAMA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB,MAAU,KAAK,KAAK;AAC9C,MAAM,oBAAoB,MAAS;AAQnC,SAAgB,sBACd,QACA,UAAqC,EAAE,EAC9B;AACT,KAAI,CAAC,UAAU,OAAO,WAAW,YAAY,CAAC,OAAO,UACnD,QAAO;CAGT,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,yBAAyB,MAAM,WAAW;EAC/C,SAAS;EACT,QAAQ,QAAQ;EAChB,eAAe,QAAQ,yBAAyB;EACjD,CAAC;;AAGJ,SAAgB,cACd,QACA,UAAqC,EAAE,EACF;AACrC,KAAI,CAAC,UAAU,OAAO,WAAW,SAC/B,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAuB;AAGxD,KAAI,CAAC,sBAAsB,QAAQ,QAAQ,CACzC,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAsE;AAGvG,KAAI,QAAQ,yBAAyB,QAAQ,CAAC,kCAAkC,OAAO,UAAU,CAC/F,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoD;AAGrF,KAAI,OAAO,WAAW,UACpB,QAAO;EAAE,OAAO;EAAO,QAAQ,uBAAuB,OAAO,QAAQ,KAAK,KAAK;EAAI;AAGrF,KAAI,OAAO,OAAO,gBAAgB,YAAY,CAAC,OAAO,YAAY,MAAM,CACtE,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoC;CAGrE,MAAM,YAAY,KAAK,MAAM,OAAO,YAAY;AAChD,KAAI,CAAC,OAAO,SAAS,UAAU,CAC7B,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoC;CAGrE,MAAM,MAAM,QAAQ,OAAO,KAAK,KAAK;AACrC,KAAI,YAAY,MAAM,kBACpB,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAuD;AAExF,KAAI,MAAM,YAAY,kBACpB,QAAO;EAAE,OAAO;EAAO,QAAQ;EAA6D;AAG9F,QAAO,EAAE,OAAO,MAAM"}
@@ -1,2 +1,7 @@
1
- import type { ResuxHalalPolicy } from "../config.js";
2
- export declare function createReviewRequest(appRoot: string, policy: ResuxHalalPolicy, outDir: string): string;
1
+ import { ResuxHalalPolicy } from "../config.js";
2
+
3
+ //#region src/halal-core/review/createReviewRequest.d.ts
4
+ declare function createReviewRequest(appRoot: string, policy: ResuxHalalPolicy, outDir: string): string;
5
+ //#endregion
6
+ export { createReviewRequest };
7
+ //# sourceMappingURL=createReviewRequest.d.ts.map
@@ -1,21 +1,25 @@
1
- import { writeFileSync } from "node:fs";
2
- import path from "node:path";
3
1
  import { scanProject } from "../scanner/scanProject.js";
4
2
  import { createProjectSummary } from "../ai/createProjectSummary.js";
5
- export function createReviewRequest(appRoot, policy, outDir) {
6
- const scanned = scanProject(appRoot);
7
- const summary = createProjectSummary(scanned);
8
- const requestPayload = {
9
- projectName: policy.projectName || summary.projectName,
10
- projectType: policy.projectType || "unknown",
11
- description: policy.description || summary.projectDescription,
12
- reviewContact: policy.reviewContact || {},
13
- evidence: policy.evidence || [],
14
- projectSummary: summary,
15
- timestamp: new Date().toISOString()
16
- };
17
- const targetPath = path.join(outDir, "halal-review-request.json");
18
- writeFileSync(targetPath, JSON.stringify(requestPayload, null, 2), "utf8");
19
- return targetPath;
3
+ import { writeFileSync } from "node:fs";
4
+ import path from "node:path";
5
+
6
+ //#region src/halal-core/review/createReviewRequest.ts
7
+ function createReviewRequest(appRoot, policy, outDir) {
8
+ const summary = createProjectSummary(scanProject(appRoot));
9
+ const requestPayload = {
10
+ projectName: policy.projectName || summary.projectName,
11
+ projectType: policy.projectType || "unknown",
12
+ description: policy.description || summary.projectDescription,
13
+ reviewContact: policy.reviewContact || {},
14
+ evidence: policy.evidence || [],
15
+ projectSummary: summary,
16
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
17
+ };
18
+ const targetPath = path.join(outDir, "halal-review-request.json");
19
+ writeFileSync(targetPath, JSON.stringify(requestPayload, null, 2), "utf8");
20
+ return targetPath;
20
21
  }
22
+
23
+ //#endregion
24
+ export { createReviewRequest };
21
25
  //# sourceMappingURL=createReviewRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createReviewRequest.js","sourceRoot":"","sources":["../../../src/halal-core/review/createReviewRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,MAAwB,EACxB,MAAc;IAEd,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9C,MAAM,cAAc,GAAG;QACrB,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW;QACtD,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,SAAS;QAC5C,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,OAAO,CAAC,kBAAkB;QAC7D,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;QAC/B,cAAc,EAAE,OAAO;QACvB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IAClE,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAE3E,OAAO,UAAU,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"createReviewRequest.js","names":[],"sources":["../../../src/halal-core/review/createReviewRequest.ts"],"sourcesContent":["import { writeFileSync, existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { scanProject } from \"../scanner/scanProject.js\";\nimport { createProjectSummary } from \"../ai/createProjectSummary.js\";\nimport type { ResuxHalalPolicy } from \"../config.js\";\n\nexport function createReviewRequest(\n appRoot: string,\n policy: ResuxHalalPolicy,\n outDir: string\n): string {\n const scanned = scanProject(appRoot);\n const summary = createProjectSummary(scanned);\n\n const requestPayload = {\n projectName: policy.projectName || summary.projectName,\n projectType: policy.projectType || \"unknown\",\n description: policy.description || summary.projectDescription,\n reviewContact: policy.reviewContact || {},\n evidence: policy.evidence || [],\n projectSummary: summary,\n timestamp: new Date().toISOString()\n };\n\n const targetPath = path.join(outDir, \"halal-review-request.json\");\n writeFileSync(targetPath, JSON.stringify(requestPayload, null, 2), \"utf8\");\n\n return targetPath;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,oBACd,SACA,QACA,QACQ;CAER,MAAM,UAAU,qBADA,YAAY,QAAQ,CACS;CAE7C,MAAM,iBAAiB;EACrB,aAAa,OAAO,eAAe,QAAQ;EAC3C,aAAa,OAAO,eAAe;EACnC,aAAa,OAAO,eAAe,QAAQ;EAC3C,eAAe,OAAO,iBAAiB,EAAE;EACzC,UAAU,OAAO,YAAY,EAAE;EAC/B,gBAAgB;EAChB,4BAAW,IAAI,MAAM,EAAC,aAAa;EACpC;CAED,MAAM,aAAa,KAAK,KAAK,QAAQ,4BAA4B;AACjE,eAAc,YAAY,KAAK,UAAU,gBAAgB,MAAM,EAAE,EAAE,OAAO;AAE1E,QAAO"}
@@ -1,3 +1,7 @@
1
- export declare const REVIEWABLE_CATEGORIES: string[];
2
- export declare const NON_REVIEWABLE_CATEGORIES: string[];
3
- export declare function isCategoryReviewable(category: string): boolean;
1
+ //#region src/halal-core/review/reviewPolicy.d.ts
2
+ declare const REVIEWABLE_CATEGORIES: string[];
3
+ declare const NON_REVIEWABLE_CATEGORIES: string[];
4
+ declare function isCategoryReviewable(category: string): boolean;
5
+ //#endregion
6
+ export { NON_REVIEWABLE_CATEGORIES, REVIEWABLE_CATEGORIES, isCategoryReviewable };
7
+ //# sourceMappingURL=reviewPolicy.d.ts.map
@@ -1,21 +1,23 @@
1
- export const REVIEWABLE_CATEGORIES = [
2
- "haram_business",
3
- "privacy_abuse",
4
- "financial_harm",
5
- "health_safety_harm",
6
- "environmental_harm",
7
- "general_harm"
1
+ //#region src/halal-core/review/reviewPolicy.ts
2
+ const REVIEWABLE_CATEGORIES = [
3
+ "haram_business",
4
+ "privacy_abuse",
5
+ "financial_harm",
6
+ "health_safety_harm",
7
+ "environmental_harm",
8
+ "general_harm"
8
9
  ];
9
- export const NON_REVIEWABLE_CATEGORIES = [
10
- "illegal_criminal",
11
- "cyber_abuse",
12
- "sexual_harm",
13
- "violence_harm"
10
+ const NON_REVIEWABLE_CATEGORIES = [
11
+ "illegal_criminal",
12
+ "cyber_abuse",
13
+ "sexual_harm",
14
+ "violence_harm"
14
15
  ];
15
- export function isCategoryReviewable(category) {
16
- if (NON_REVIEWABLE_CATEGORIES.includes(category)) {
17
- return false;
18
- }
19
- return REVIEWABLE_CATEGORIES.includes(category);
16
+ function isCategoryReviewable(category) {
17
+ if (NON_REVIEWABLE_CATEGORIES.includes(category)) return false;
18
+ return REVIEWABLE_CATEGORIES.includes(category);
20
19
  }
20
+
21
+ //#endregion
22
+ export { NON_REVIEWABLE_CATEGORIES, REVIEWABLE_CATEGORIES, isCategoryReviewable };
21
23
  //# sourceMappingURL=reviewPolicy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reviewPolicy.js","sourceRoot":"","sources":["../../../src/halal-core/review/reviewPolicy.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,cAAc;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,eAAe;CAChB,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,IAAI,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"reviewPolicy.js","names":[],"sources":["../../../src/halal-core/review/reviewPolicy.ts"],"sourcesContent":["export const REVIEWABLE_CATEGORIES = [\n \"haram_business\",\n \"privacy_abuse\",\n \"financial_harm\",\n \"health_safety_harm\",\n \"environmental_harm\",\n \"general_harm\"\n];\n\nexport const NON_REVIEWABLE_CATEGORIES = [\n \"illegal_criminal\",\n \"cyber_abuse\",\n \"sexual_harm\",\n \"violence_harm\"\n];\n\nexport function isCategoryReviewable(category: string): boolean {\n if (NON_REVIEWABLE_CATEGORIES.includes(category)) {\n return false;\n }\n return REVIEWABLE_CATEGORIES.includes(category);\n}\n"],"mappings":";AAAA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,UAA2B;AAC9D,KAAI,0BAA0B,SAAS,SAAS,CAC9C,QAAO;AAET,QAAO,sBAAsB,SAAS,SAAS"}
@@ -1,13 +1,18 @@
1
- import type { HalalCheckResult } from "../status.js";
2
- export interface SignedReviewApproval {
3
- projectName: string;
4
- status: "allowed" | "review_required";
5
- reasons: string;
6
- reviewerId: string;
7
- signature: string;
8
- expires: string;
9
- evidenceHash: string;
1
+ import { HalalCheckResult } from "../status.js";
2
+
3
+ //#region src/halal-core/review/signedReviewFile.d.ts
4
+ interface SignedReviewApproval {
5
+ projectName: string;
6
+ status: "allowed" | "review_required";
7
+ reasons: string;
8
+ reviewerId: string;
9
+ signature: string;
10
+ expires: string;
11
+ evidenceHash: string;
10
12
  }
11
- export declare function generateReviewSignature(approval: Omit<SignedReviewApproval, "signature">, secret?: string): string;
12
- export declare function verifyReviewSignature(approval: SignedReviewApproval, secret?: string): boolean;
13
- export declare function createReviewEvidenceHash(report: HalalCheckResult | Omit<HalalCheckResult, "signature">): string;
13
+ declare function generateReviewSignature(approval: Omit<SignedReviewApproval, "signature">, secret?: string): string;
14
+ declare function verifyReviewSignature(approval: SignedReviewApproval, secret?: string): boolean;
15
+ declare function createReviewEvidenceHash(report: HalalCheckResult | Omit<HalalCheckResult, "signature">): string;
16
+ //#endregion
17
+ export { SignedReviewApproval, createReviewEvidenceHash, generateReviewSignature, verifyReviewSignature };
18
+ //# sourceMappingURL=signedReviewFile.d.ts.map
@@ -1,28 +1,31 @@
1
+ import { createIntegritySignature, stableSerialize, verifyIntegritySignature } from "../crypto/integrity.js";
1
2
  import { createHash } from "node:crypto";
2
- import { createIntegritySignature, stableSerialize, verifyIntegritySignature, } from "../crypto/integrity.js";
3
+
4
+ //#region src/halal-core/review/signedReviewFile.ts
3
5
  const REVIEW_SIGNING_ENV = "RESUX_HALAL_REVIEW_SIGNING_SECRET";
4
- export function generateReviewSignature(approval, secret) {
5
- return createIntegritySignature(approval, {
6
- envName: REVIEW_SIGNING_ENV,
7
- secret,
8
- requireSecret: true,
9
- });
6
+ function generateReviewSignature(approval, secret) {
7
+ return createIntegritySignature(approval, {
8
+ envName: REVIEW_SIGNING_ENV,
9
+ secret,
10
+ requireSecret: true
11
+ });
10
12
  }
11
- export function verifyReviewSignature(approval, secret) {
12
- if (!approval || typeof approval !== "object" || !approval.signature) {
13
- return false;
14
- }
15
- const { signature, ...rest } = approval;
16
- return verifyIntegritySignature(rest, signature, {
17
- envName: REVIEW_SIGNING_ENV,
18
- secret,
19
- requireSecret: true,
20
- });
13
+ function verifyReviewSignature(approval, secret) {
14
+ if (!approval || typeof approval !== "object" || !approval.signature) return false;
15
+ const { signature, ...rest } = approval;
16
+ return verifyIntegritySignature(rest, signature, {
17
+ envName: REVIEW_SIGNING_ENV,
18
+ secret,
19
+ requireSecret: true
20
+ });
21
21
  }
22
- export function createReviewEvidenceHash(report) {
23
- const evidence = { ...report };
24
- delete evidence.signature;
25
- delete evidence.createdDate;
26
- return `sha256:${createHash("sha256").update(stableSerialize(evidence)).digest("hex")}`;
22
+ function createReviewEvidenceHash(report) {
23
+ const evidence = { ...report };
24
+ delete evidence.signature;
25
+ delete evidence.createdDate;
26
+ return `sha256:${createHash("sha256").update(stableSerialize(evidence)).digest("hex")}`;
27
27
  }
28
+
29
+ //#endregion
30
+ export { createReviewEvidenceHash, generateReviewSignature, verifyReviewSignature };
28
31
  //# sourceMappingURL=signedReviewFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signedReviewFile.js","sourceRoot":"","sources":["../../../src/halal-core/review/signedReviewFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAYhC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAE/D,MAAM,UAAU,uBAAuB,CACrC,QAAiD,EACjD,MAAe;IAEf,OAAO,wBAAwB,CAAC,QAAQ,EAAE;QACxC,OAAO,EAAE,kBAAkB;QAC3B,MAAM;QACN,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,QAA8B,EAC9B,MAAe;IAEf,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;IACxC,OAAO,wBAAwB,CAAC,IAAI,EAAE,SAAS,EAAE;QAC/C,OAAO,EAAE,kBAAkB;QAC3B,MAAM;QACN,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAA8D;IAE9D,MAAM,QAAQ,GAAG,EAAE,GAAG,MAAM,EAA6B,CAAC;IAC1D,OAAO,QAAQ,CAAC,SAAS,CAAC;IAC1B,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC5B,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1F,CAAC"}
1
+ {"version":3,"file":"signedReviewFile.js","names":[],"sources":["../../../src/halal-core/review/signedReviewFile.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport type { HalalCheckResult } from \"../status.js\";\nimport {\n createIntegritySignature,\n stableSerialize,\n verifyIntegritySignature,\n} from \"../crypto/integrity.js\";\n\nexport interface SignedReviewApproval {\n projectName: string;\n status: \"allowed\" | \"review_required\";\n reasons: string;\n reviewerId: string;\n signature: string;\n expires: string;\n evidenceHash: string;\n}\n\nconst REVIEW_SIGNING_ENV = \"RESUX_HALAL_REVIEW_SIGNING_SECRET\";\n\nexport function generateReviewSignature(\n approval: Omit<SignedReviewApproval, \"signature\">,\n secret?: string,\n): string {\n return createIntegritySignature(approval, {\n envName: REVIEW_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function verifyReviewSignature(\n approval: SignedReviewApproval,\n secret?: string,\n): boolean {\n if (!approval || typeof approval !== \"object\" || !approval.signature) {\n return false;\n }\n const { signature, ...rest } = approval;\n return verifyIntegritySignature(rest, signature, {\n envName: REVIEW_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function createReviewEvidenceHash(\n report: HalalCheckResult | Omit<HalalCheckResult, \"signature\">,\n): string {\n const evidence = { ...report } as Record<string, unknown>;\n delete evidence.signature;\n delete evidence.createdDate;\n return `sha256:${createHash(\"sha256\").update(stableSerialize(evidence)).digest(\"hex\")}`;\n}\n"],"mappings":";;;;AAkBA,MAAM,qBAAqB;AAE3B,SAAgB,wBACd,UACA,QACQ;AACR,QAAO,yBAAyB,UAAU;EACxC,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,sBACd,UACA,QACS;AACT,KAAI,CAAC,YAAY,OAAO,aAAa,YAAY,CAAC,SAAS,UACzD,QAAO;CAET,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,yBAAyB,MAAM,WAAW;EAC/C,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,yBACd,QACQ;CACR,MAAM,WAAW,EAAE,GAAG,QAAQ;AAC9B,QAAO,SAAS;AAChB,QAAO,SAAS;AAChB,QAAO,UAAU,WAAW,SAAS,CAAC,OAAO,gBAAgB,SAAS,CAAC,CAAC,OAAO,MAAM"}
@@ -1,10 +1,14 @@
1
- export interface ReviewApprovalVerificationOptions {
2
- secret?: string;
3
- projectName?: string;
4
- evidenceHash?: string;
5
- now?: number;
1
+ //#region src/halal-core/review/verifyReviewApproval.d.ts
2
+ interface ReviewApprovalVerificationOptions {
3
+ secret?: string;
4
+ projectName?: string;
5
+ evidenceHash?: string;
6
+ now?: number;
6
7
  }
7
- export declare function verifyReviewApproval(appRoot: string, currentStatus: string, options?: ReviewApprovalVerificationOptions): {
8
- approved: boolean;
9
- reason?: string;
8
+ declare function verifyReviewApproval(appRoot: string, currentStatus: string, options?: ReviewApprovalVerificationOptions): {
9
+ approved: boolean;
10
+ reason?: string;
10
11
  };
12
+ //#endregion
13
+ export { ReviewApprovalVerificationOptions, verifyReviewApproval };
14
+ //# sourceMappingURL=verifyReviewApproval.d.ts.map