@noy-db/hub 0.9.0-pre.0 → 0.9.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/api-6EFD43KN.js +18 -0
  3. package/dist/as/index.js +10 -10
  4. package/dist/at/index.js +8 -8
  5. package/dist/attestation/index.js +18 -18
  6. package/dist/{backup-7RKNZMQO.js → backup-RJBFQSHE.js} +92 -31
  7. package/dist/backup-RJBFQSHE.js.map +1 -0
  8. package/dist/blobs/index.js +12 -12
  9. package/dist/broker/index.js +13 -13
  10. package/dist/by/index.js +2 -2
  11. package/dist/capsule/contract.js +6 -6
  12. package/dist/capsule/enclave-aes/crypto.d.ts +18 -0
  13. package/dist/capsule/enclave-aes/index.d.ts +2 -2
  14. package/dist/capsule/enclave-aes/index.js +14 -8
  15. package/dist/capsule/enclave-aes/index.js.map +1 -1
  16. package/dist/capsule/index.d.ts +1 -1
  17. package/dist/{capsule-57BDK7LG.js → capsule-6LJAVQNM.js} +14 -8
  18. package/dist/cargo/index.js +35 -35
  19. package/dist/{chunk-72XBVN4J.js → chunk-25FXU6WS.js} +2 -2
  20. package/dist/chunk-25FXU6WS.js.map +1 -0
  21. package/dist/{chunk-PCYPXLEX.js → chunk-2DOCDOPL.js} +6 -6
  22. package/dist/{chunk-RIZTZJX6.js → chunk-2LBS62AC.js} +2 -2
  23. package/dist/{chunk-EUD3HQM4.js → chunk-2ST3WA3C.js} +4 -4
  24. package/dist/{chunk-APFFJN5T.js → chunk-3G3GOGZZ.js} +31 -34
  25. package/dist/chunk-3G3GOGZZ.js.map +1 -0
  26. package/dist/{chunk-4UIP3QNW.js → chunk-3YBIVLTC.js} +2 -2
  27. package/dist/{chunk-UNSQZSZP.js → chunk-4CHM2TRS.js} +2 -2
  28. package/dist/{chunk-NYJBYVBG.js → chunk-4CUJLEOA.js} +4 -4
  29. package/dist/{chunk-YFFMPZPY.js → chunk-4TG2ITRW.js} +2 -2
  30. package/dist/{chunk-ZHQJAV6D.js → chunk-5HQFROZS.js} +2 -2
  31. package/dist/{chunk-6Y5E4SJU.js → chunk-5ZVE3N5C.js} +5 -5
  32. package/dist/{chunk-EMAWOGVH.js → chunk-654RE5YC.js} +3 -3
  33. package/dist/{chunk-DHU2AQ6T.js → chunk-66GD7XXU.js} +2 -2
  34. package/dist/{chunk-JZ4EDEIP.js → chunk-72FQ46VW.js} +3 -3
  35. package/dist/{chunk-7BMOS4JQ.js → chunk-7JPA3LIH.js} +11 -11
  36. package/dist/{chunk-QGFEBNHO.js → chunk-7K42TSCY.js} +4 -4
  37. package/dist/{chunk-OJU67C23.js → chunk-7Q6IU3R7.js} +4 -4
  38. package/dist/{chunk-JBMMWYOH.js → chunk-7UHLO4ZN.js} +35 -2
  39. package/dist/chunk-7UHLO4ZN.js.map +1 -0
  40. package/dist/{chunk-GRS2HIV6.js → chunk-ADCXTW7L.js} +2 -2
  41. package/dist/{chunk-BJH77UY2.js → chunk-AGGPT4UE.js} +2 -2
  42. package/dist/{chunk-TZYTMZZY.js → chunk-AKIEBFIJ.js} +10 -10
  43. package/dist/{chunk-DL6BZKP3.js → chunk-B3B6HV5S.js} +2 -2
  44. package/dist/{chunk-5XONHAFD.js → chunk-B6EWMGFX.js} +2 -2
  45. package/dist/{chunk-TFWFPZRU.js → chunk-B7Y2BRQA.js} +11 -11
  46. package/dist/{chunk-TFWFPZRU.js.map → chunk-B7Y2BRQA.js.map} +1 -1
  47. package/dist/{chunk-MRJDLXI3.js → chunk-BFJE2GPP.js} +8 -8
  48. package/dist/{chunk-G46JSSVX.js → chunk-BJRKXNFP.js} +7 -7
  49. package/dist/{chunk-RNACRT5H.js → chunk-BPQ5CRJF.js} +2 -2
  50. package/dist/{chunk-BYHCKX73.js → chunk-BVRJYMFZ.js} +3 -3
  51. package/dist/{chunk-GETUTTZU.js → chunk-C4XV3PSJ.js} +4 -4
  52. package/dist/{chunk-XXNWU5QZ.js → chunk-DFC4WTJW.js} +2 -2
  53. package/dist/{chunk-YQFBH5ZJ.js → chunk-DMIEKD24.js} +3 -3
  54. package/dist/{chunk-2ZFD2UJC.js → chunk-DQAXA2GK.js} +9 -9
  55. package/dist/{chunk-ZVSKSUGI.js → chunk-DWCFGF2K.js} +5 -5
  56. package/dist/{chunk-5HNW4ZTA.js → chunk-E2C6FFSI.js} +6 -6
  57. package/dist/{chunk-2A56DSRI.js → chunk-EQ6C2ZPT.js} +17 -51
  58. package/dist/chunk-EQ6C2ZPT.js.map +1 -0
  59. package/dist/{chunk-G66YXUTY.js → chunk-EZOFTI4K.js} +3 -3
  60. package/dist/{chunk-6QLCS7ET.js → chunk-FMINS2B6.js} +2 -2
  61. package/dist/{chunk-6WS35E6X.js → chunk-FPF5HRBE.js} +2 -2
  62. package/dist/{chunk-7CT6SX4M.js → chunk-FZVCZEVI.js} +3 -3
  63. package/dist/{chunk-BUE7R3B5.js → chunk-GIQJGXV7.js} +2 -2
  64. package/dist/{chunk-GOJQ5DZA.js → chunk-GYZICGRU.js} +4 -4
  65. package/dist/chunk-GYZICGRU.js.map +1 -0
  66. package/dist/{chunk-C53ER7AG.js → chunk-H334G6KU.js} +2 -2
  67. package/dist/{chunk-GCUMOKTN.js → chunk-HE7EAHGS.js} +3 -3
  68. package/dist/{chunk-BU2ABHFW.js → chunk-HKB4HZDU.js} +4 -4
  69. package/dist/{chunk-5UUJE4FP.js → chunk-ICF3TIGY.js} +2 -2
  70. package/dist/{chunk-H3YM66EI.js → chunk-IF2M43G4.js} +2 -2
  71. package/dist/{chunk-VSUQI5Q6.js → chunk-IKPQ2GGB.js} +15 -1
  72. package/dist/chunk-IKPQ2GGB.js.map +1 -0
  73. package/dist/{chunk-Z3ZXVB2Y.js → chunk-IKS2CPAG.js} +12 -12
  74. package/dist/chunk-IKS2CPAG.js.map +1 -0
  75. package/dist/{chunk-IVMFIKNA.js → chunk-IMIQAGR7.js} +6 -6
  76. package/dist/{chunk-226V6XXJ.js → chunk-IQAJ4OR6.js} +6 -6
  77. package/dist/{chunk-ZMVSKYTJ.js → chunk-IUD7WU67.js} +10 -10
  78. package/dist/{chunk-OK57EATL.js → chunk-IVLRPRXM.js} +2 -2
  79. package/dist/{chunk-K673OO6B.js → chunk-JAQHWHUN.js} +4 -4
  80. package/dist/{chunk-MQ7YWBQ5.js → chunk-K4JSTGXT.js} +2 -2
  81. package/dist/{chunk-55P6OBB7.js → chunk-KN4LUMH6.js} +2 -2
  82. package/dist/{chunk-NZULV7LK.js → chunk-KZA3DITX.js} +4 -4
  83. package/dist/{chunk-ECGXA4LT.js → chunk-L2VM64HK.js} +2 -2
  84. package/dist/chunk-L4UL4IAR.js +55 -0
  85. package/dist/chunk-L4UL4IAR.js.map +1 -0
  86. package/dist/{chunk-XITHENBI.js → chunk-LUCQY3OM.js} +7 -7
  87. package/dist/{chunk-XITHENBI.js.map → chunk-LUCQY3OM.js.map} +1 -1
  88. package/dist/{chunk-LGGIFKJP.js → chunk-MAQBYBUX.js} +4 -4
  89. package/dist/{chunk-ABU6A4Z5.js → chunk-MBPZMZVB.js} +2 -2
  90. package/dist/{chunk-WFWFXDNS.js → chunk-MCNNZBG7.js} +2 -2
  91. package/dist/{chunk-NIXRB5BP.js → chunk-MLVPMDOZ.js} +2 -2
  92. package/dist/{chunk-BVF3SXD7.js → chunk-MMCN7TLK.js} +5 -5
  93. package/dist/{chunk-FSQNGPHH.js → chunk-MRCR7ZMC.js} +612 -175
  94. package/dist/chunk-MRCR7ZMC.js.map +1 -0
  95. package/dist/{chunk-PTJY5R3O.js → chunk-NCTN2FW4.js} +2 -2
  96. package/dist/{chunk-UOZOWN73.js → chunk-ND6S2DKC.js} +2 -2
  97. package/dist/{chunk-XKBTJGFP.js → chunk-NTVKHQ3L.js} +2 -2
  98. package/dist/{chunk-UHFGK6YA.js → chunk-NXQEOC3X.js} +3 -3
  99. package/dist/{chunk-UAKY6E4N.js → chunk-O2VQ3K36.js} +2 -2
  100. package/dist/{chunk-JSWKVZCR.js → chunk-OGKMRIIJ.js} +2 -2
  101. package/dist/{chunk-L2F3CFCH.js → chunk-ONZ3B5EW.js} +4 -4
  102. package/dist/{chunk-AJFPAHMW.js → chunk-OOPSMQX5.js} +3 -3
  103. package/dist/{chunk-QDHHHI5Q.js → chunk-OYEBSWLE.js} +5 -5
  104. package/dist/{chunk-ZWF3EWZA.js → chunk-P6FATPXQ.js} +2 -2
  105. package/dist/{chunk-QSHATAXJ.js → chunk-PLTIJDQN.js} +2 -2
  106. package/dist/{chunk-V55JASXO.js → chunk-PR7ILCIH.js} +3 -3
  107. package/dist/{chunk-X2RP4TO5.js → chunk-QE3TLZ6Z.js} +7 -7
  108. package/dist/{chunk-QXJXG7DN.js → chunk-QFW4MYGN.js} +5 -5
  109. package/dist/{chunk-2WJKJZSO.js → chunk-QHG7GQKM.js} +2 -2
  110. package/dist/{chunk-FZXRLNJO.js → chunk-QT5ITL25.js} +3 -3
  111. package/dist/{chunk-SNM7LSYG.js → chunk-R2ZULFXU.js} +4 -4
  112. package/dist/{chunk-SPPOUJLN.js → chunk-RRTQAQ3N.js} +2 -2
  113. package/dist/{chunk-JA25QG5M.js → chunk-RUE6TCES.js} +622 -119
  114. package/dist/chunk-RUE6TCES.js.map +1 -0
  115. package/dist/{chunk-L5A3KR7R.js → chunk-SALY3LIJ.js} +3 -3
  116. package/dist/{chunk-SFCD6OU7.js → chunk-SBAR5JQ6.js} +2 -2
  117. package/dist/{chunk-WHOKGHJ3.js → chunk-SCH2F7R2.js} +7 -7
  118. package/dist/{chunk-JPSL5GIZ.js → chunk-SOOAW6HK.js} +3 -3
  119. package/dist/{chunk-TMIJAR2X.js → chunk-T4VTRKCY.js} +3 -3
  120. package/dist/{chunk-5LMCVBMY.js → chunk-T5EXREMW.js} +5 -5
  121. package/dist/{chunk-YKGJ44Z7.js → chunk-TDJVQTXD.js} +3 -3
  122. package/dist/{chunk-PUBI455O.js → chunk-THQ3BHLM.js} +2 -2
  123. package/dist/{chunk-BMHQHH7Q.js → chunk-TLIFNRU5.js} +2 -2
  124. package/dist/{chunk-PGC35KXE.js → chunk-TRHUNPXP.js} +2 -2
  125. package/dist/{chunk-SWXLZ4HX.js → chunk-UL6MTRMJ.js} +8 -8
  126. package/dist/{delegation-ONLM4JFI.js → chunk-UNL6YGL5.js} +59 -16
  127. package/dist/chunk-UNL6YGL5.js.map +1 -0
  128. package/dist/{chunk-J4KAPKBJ.js → chunk-UORWAG7K.js} +2 -2
  129. package/dist/{chunk-45VHWE4C.js → chunk-V7AKGAXY.js} +271 -69
  130. package/dist/chunk-V7AKGAXY.js.map +1 -0
  131. package/dist/{chunk-XXQ5XIYY.js → chunk-VLQ6KT7F.js} +2 -2
  132. package/dist/{chunk-PT2YCQVK.js → chunk-VP37VUKQ.js} +4 -4
  133. package/dist/{chunk-QGSNJD3B.js → chunk-WBUHHMLN.js} +2 -2
  134. package/dist/{chunk-4J3MNVVX.js → chunk-WRLWEYHY.js} +7 -1
  135. package/dist/{chunk-4J3MNVVX.js.map → chunk-WRLWEYHY.js.map} +1 -1
  136. package/dist/{chunk-PFCTSXHU.js → chunk-X6Z2SIRF.js} +2 -2
  137. package/dist/{chunk-XA34THLF.js → chunk-XLKWF3L4.js} +4 -4
  138. package/dist/{chunk-K7RW7FI4.js → chunk-XPNJH7GN.js} +5 -5
  139. package/dist/{chunk-RDOEOPOI.js → chunk-XPW7T2GN.js} +5 -5
  140. package/dist/{chunk-2ELOCEXE.js → chunk-XX4R7TUB.js} +1 -1
  141. package/dist/chunk-XX4R7TUB.js.map +1 -0
  142. package/dist/{chunk-EA4VDI5D.js → chunk-Y55XHMQB.js} +4 -4
  143. package/dist/{chunk-CB4467G3.js → chunk-YH4OUOSI.js} +33 -7
  144. package/dist/chunk-YH4OUOSI.js.map +1 -0
  145. package/dist/{chunk-BNFNQNEP.js → chunk-YJGKOSQD.js} +2 -2
  146. package/dist/{chunk-3V6LZHUO.js → chunk-Z3STG43F.js} +2 -2
  147. package/dist/{chunk-ZBUAX4EF.js → chunk-ZD7WFMV2.js} +2 -2
  148. package/dist/{chunk-OM3SEDI4.js → chunk-ZF6JECDT.js} +4 -4
  149. package/dist/{chunk-3Y5JLSXS.js → chunk-ZF7KNSLU.js} +2 -2
  150. package/dist/{chunk-B65CC6Z6.js → chunk-ZGKODRGB.js} +2 -2
  151. package/dist/{chunk-D4V5JJAK.js → chunk-ZNEKQFGF.js} +4 -4
  152. package/dist/{chunk-D5A3GCZ4.js → chunk-ZUTUNVFD.js} +3 -3
  153. package/dist/{chunk-G5EDYVSE.js → chunk-ZWMOHANW.js} +5 -5
  154. package/dist/{chunk-CAD7N6HQ.js → chunk-ZZZ4VCY2.js} +10 -10
  155. package/dist/chunk-ZZZ4VCY2.js.map +1 -0
  156. package/dist/classified/index.js +5 -5
  157. package/dist/{classified-marker-KHDOYIJB.js → classified-marker-WKP33U2R.js} +3 -3
  158. package/dist/collection-facade-COSGZKLC.js +41 -0
  159. package/dist/{computed-XMFTHAXV.js → computed-WN6V53ZV.js} +3 -3
  160. package/dist/consent/index.js +8 -8
  161. package/dist/cover/index.js +8 -8
  162. package/dist/custody/index.js +12 -12
  163. package/dist/{dead-filter-CXV5NS67.js → dead-filter-43WL3Y5H.js} +10 -10
  164. package/dist/debug/index.js +7 -7
  165. package/dist/delegation-5UWT4JGT.js +26 -0
  166. package/dist/derivations/index.js +22 -22
  167. package/dist/derive-IL5JNLEE.js +20 -0
  168. package/dist/directory/index.js +9 -9
  169. package/dist/{dispatch-2MQFMEGY.js → dispatch-LOQQD5JK.js} +19 -19
  170. package/dist/{dispatch-OFDA4WQV.js → dispatch-SHKTG57L.js} +5 -5
  171. package/dist/executor-6PQ7WAGV.js +35 -0
  172. package/dist/executor-6ZPQA6HS.js +8 -0
  173. package/dist/executor-OXRA64TY.js +8 -0
  174. package/dist/export-accessible-XG3FKJWW.js +22 -0
  175. package/dist/extract-partition-33747NY5.js +35 -0
  176. package/dist/{fanout-sidecar-BO67PCPO.js → fanout-sidecar-NEB6IYV7.js} +8 -8
  177. package/dist/find-VW543G3J.js +10 -0
  178. package/dist/forget/index.js +8 -8
  179. package/dist/guards/index.js +4 -4
  180. package/dist/history/index.js +15 -13
  181. package/dist/history/index.js.map +1 -1
  182. package/dist/i18n/index.js +13 -13
  183. package/dist/index.d.ts +3 -2
  184. package/dist/index.js +111 -107
  185. package/dist/index.js.map +1 -1
  186. package/dist/indexing/index.js +5 -5
  187. package/dist/introspection/index.js +10 -10
  188. package/dist/issue-4ZPSY44M.js +19 -0
  189. package/dist/kernel/collection.d.ts +85 -6
  190. package/dist/kernel/constants.d.ts +7 -0
  191. package/dist/kernel/errors.d.ts +9 -0
  192. package/dist/kernel/merge-authority.d.ts +5 -1
  193. package/dist/kernel/noydb.d.ts +116 -21
  194. package/dist/kernel/rejection-seal.d.ts +13 -0
  195. package/dist/kernel/sync-wiring.d.ts +55 -0
  196. package/dist/kernel/types.d.ts +370 -8
  197. package/dist/kernel/vault.d.ts +39 -5
  198. package/dist/{ledger-MSJGWKGW.js → ledger-MZ25UFT2.js} +10 -10
  199. package/dist/liberate-OJIP2ZFX.js +25 -0
  200. package/dist/{link-set-QXXSPPHL.js → link-set-4FRRAVTH.js} +10 -10
  201. package/dist/{managed-secret-VSK7ANQI.js → managed-secret-SQWO2EUR.js} +9 -9
  202. package/dist/materialized-views/index.js +25 -25
  203. package/dist/{migrate-cek-GEBFYBDC.js → migrate-cek-JWEM4RP6.js} +2 -2
  204. package/dist/money/index.js +5 -5
  205. package/dist/noydb-U62OVKXB.js +100 -0
  206. package/dist/on/index.js +12 -12
  207. package/dist/overlay-views/index.js +4 -4
  208. package/dist/periods/index.js +11 -11
  209. package/dist/pod/index.js +66 -64
  210. package/dist/{pod-handle-YE7CT66T.js → pod-handle-R6Y4MILX.js} +8 -8
  211. package/dist/policy/index.js +9 -9
  212. package/dist/port/with/admission-authority.d.ts +34 -0
  213. package/dist/port/with/broker-strategy.d.ts +10 -0
  214. package/dist/port/with/rejection-courier.d.ts +37 -0
  215. package/dist/port/with/restore-host.d.ts +33 -0
  216. package/dist/port/with/service-bus.d.ts +18 -0
  217. package/dist/port/with/team-strategy.d.ts +2 -2
  218. package/dist/port/with/write-hooks.d.ts +2 -0
  219. package/dist/portability/index.js +8 -8
  220. package/dist/{post-register-QC5TEAW3.js → post-register-GRVQHBOH.js} +6 -6
  221. package/dist/query/all/index.js +15 -15
  222. package/dist/query/index.js +7 -7
  223. package/dist/query/live/index.js +7 -7
  224. package/dist/query/reduce/index.js +10 -10
  225. package/dist/query/relate/index.js +9 -9
  226. package/dist/reduce/index.js +8 -8
  227. package/dist/register-YJ5YLQ36.js +30 -0
  228. package/dist/registry-ICOHBQFD.js +8 -0
  229. package/dist/registry-MJ7MWCSW.js +35 -0
  230. package/dist/registry-MVEKKGWL.js +23 -0
  231. package/dist/registry-XP744FAP.js +8 -0
  232. package/dist/request-withdrawal-LSU4G6W3.js +28 -0
  233. package/dist/restore-to-DVBHAQAA.js +66 -0
  234. package/dist/restore-to-DVBHAQAA.js.map +1 -0
  235. package/dist/{reveal-YQTRNQFH.js → reveal-AIHOIK2N.js} +7 -7
  236. package/dist/revoke-QUT7WWG3.js +24 -0
  237. package/dist/satellites/index.js +1 -1
  238. package/dist/schema-update/index.js +2 -2
  239. package/dist/sealed-record/index.js +11 -11
  240. package/dist/search/index.js +4 -4
  241. package/dist/{seed-JMQTRKRE.js → seed-GFLA4FCK.js} +33 -18
  242. package/dist/seed-GFLA4FCK.js.map +1 -0
  243. package/dist/sequence/index.js +8 -8
  244. package/dist/session/index.js +8 -8
  245. package/dist/shadow/index.js +2 -2
  246. package/dist/signer-NYR4I3FO.js +23 -0
  247. package/dist/snapshots/index.js +9 -9
  248. package/dist/{stale-SKV33PBU.js → stale-PIJPAL5T.js} +9 -9
  249. package/dist/storage-VH6SPXHC.js +21 -0
  250. package/dist/{store-coordination-provider-Z6HKPOGM.js → store-coordination-provider-2KSHCOPU.js} +9 -9
  251. package/dist/sync/index.js +16 -16
  252. package/dist/sync/index.js.map +1 -1
  253. package/dist/team/index.js +15 -15
  254. package/dist/tiers/index.js +10 -10
  255. package/dist/to/index.js +2 -2
  256. package/dist/transactions/index.js +3 -3
  257. package/dist/util/index.js +1 -1
  258. package/dist/vault-head/index.js +7 -7
  259. package/dist/{verify-KWQIWLGH.js → verify-PCFS4PNS.js} +7 -7
  260. package/dist/walk-OZCN6LJS.js +20 -0
  261. package/dist/with-audit/guards/types.d.ts +2 -0
  262. package/dist/with-audit/tiers/index.d.ts +5 -5
  263. package/dist/with-commit/history/history.d.ts +16 -0
  264. package/dist/with-commit/history/restore-to.d.ts +40 -0
  265. package/dist/with-party/broker/seed.d.ts +4 -0
  266. package/dist/with-party/custody/strategy.d.ts +2 -2
  267. package/dist/with-party/team/delegation.d.ts +41 -11
  268. package/dist/with-party/team/index.d.ts +2 -0
  269. package/dist/with-party/team/keyring.d.ts +132 -3
  270. package/dist/with-party/team/noydb-facade.d.ts +14 -2
  271. package/dist/with-party/team/roster-tag.d.ts +1 -1
  272. package/dist/with-pod/backup.d.ts +9 -17
  273. package/dist/with-sync/active.d.ts +28 -1
  274. package/dist/with-sync/engine.d.ts +59 -2
  275. package/dist/with-sync/index.d.ts +1 -0
  276. package/dist/with-sync/reserved-mirror.d.ts +27 -4
  277. package/dist/with-sync/strategy.d.ts +2 -0
  278. package/dist/withdraw-accessible-MTFP7OIB.js +25 -0
  279. package/dist/withdraw-accessible-MTFP7OIB.js.map +1 -0
  280. package/package.json +3 -3
  281. package/dist/api-MSJXVYQG.js +0 -18
  282. package/dist/backup-7RKNZMQO.js.map +0 -1
  283. package/dist/chunk-2A56DSRI.js.map +0 -1
  284. package/dist/chunk-2ELOCEXE.js.map +0 -1
  285. package/dist/chunk-45VHWE4C.js.map +0 -1
  286. package/dist/chunk-72XBVN4J.js.map +0 -1
  287. package/dist/chunk-APFFJN5T.js.map +0 -1
  288. package/dist/chunk-CAD7N6HQ.js.map +0 -1
  289. package/dist/chunk-CB4467G3.js.map +0 -1
  290. package/dist/chunk-FSQNGPHH.js.map +0 -1
  291. package/dist/chunk-GOJQ5DZA.js.map +0 -1
  292. package/dist/chunk-JA25QG5M.js.map +0 -1
  293. package/dist/chunk-JBMMWYOH.js.map +0 -1
  294. package/dist/chunk-VSUQI5Q6.js.map +0 -1
  295. package/dist/chunk-Z3ZXVB2Y.js.map +0 -1
  296. package/dist/collection-facade-LZIF7GWD.js +0 -41
  297. package/dist/delegation-ONLM4JFI.js.map +0 -1
  298. package/dist/derive-3YSIS36W.js +0 -20
  299. package/dist/executor-E6YDJ7YA.js +0 -8
  300. package/dist/executor-NJX3YQQ4.js +0 -35
  301. package/dist/executor-WWM3DD4P.js +0 -8
  302. package/dist/export-accessible-RLHU5G4W.js +0 -22
  303. package/dist/extract-partition-QII2EDCS.js +0 -35
  304. package/dist/find-6M7GYDUZ.js +0 -10
  305. package/dist/issue-LPEEEMPP.js +0 -19
  306. package/dist/liberate-LEKDYKTC.js +0 -25
  307. package/dist/noydb-F2AUF6KL.js +0 -98
  308. package/dist/register-SN72QALV.js +0 -30
  309. package/dist/registry-253FF7C6.js +0 -35
  310. package/dist/registry-3AZWQTDT.js +0 -23
  311. package/dist/registry-7UEBTHWG.js +0 -8
  312. package/dist/registry-IVJ67NFQ.js +0 -8
  313. package/dist/request-withdrawal-UKVJZKX2.js +0 -28
  314. package/dist/revoke-G2KXJQA5.js +0 -24
  315. package/dist/seed-JMQTRKRE.js.map +0 -1
  316. package/dist/signer-IUIYR3CX.js +0 -23
  317. package/dist/storage-NPBYP2SM.js +0 -21
  318. package/dist/walk-F4OLXI5H.js +0 -20
  319. package/dist/withdraw-accessible-ZKPLZ66E.js +0 -25
  320. /package/dist/{api-MSJXVYQG.js.map → api-6EFD43KN.js.map} +0 -0
  321. /package/dist/{capsule-57BDK7LG.js.map → capsule-6LJAVQNM.js.map} +0 -0
  322. /package/dist/{chunk-PCYPXLEX.js.map → chunk-2DOCDOPL.js.map} +0 -0
  323. /package/dist/{chunk-RIZTZJX6.js.map → chunk-2LBS62AC.js.map} +0 -0
  324. /package/dist/{chunk-EUD3HQM4.js.map → chunk-2ST3WA3C.js.map} +0 -0
  325. /package/dist/{chunk-4UIP3QNW.js.map → chunk-3YBIVLTC.js.map} +0 -0
  326. /package/dist/{chunk-UNSQZSZP.js.map → chunk-4CHM2TRS.js.map} +0 -0
  327. /package/dist/{chunk-NYJBYVBG.js.map → chunk-4CUJLEOA.js.map} +0 -0
  328. /package/dist/{chunk-YFFMPZPY.js.map → chunk-4TG2ITRW.js.map} +0 -0
  329. /package/dist/{chunk-ZHQJAV6D.js.map → chunk-5HQFROZS.js.map} +0 -0
  330. /package/dist/{chunk-6Y5E4SJU.js.map → chunk-5ZVE3N5C.js.map} +0 -0
  331. /package/dist/{chunk-EMAWOGVH.js.map → chunk-654RE5YC.js.map} +0 -0
  332. /package/dist/{chunk-DHU2AQ6T.js.map → chunk-66GD7XXU.js.map} +0 -0
  333. /package/dist/{chunk-JZ4EDEIP.js.map → chunk-72FQ46VW.js.map} +0 -0
  334. /package/dist/{chunk-7BMOS4JQ.js.map → chunk-7JPA3LIH.js.map} +0 -0
  335. /package/dist/{chunk-QGFEBNHO.js.map → chunk-7K42TSCY.js.map} +0 -0
  336. /package/dist/{chunk-OJU67C23.js.map → chunk-7Q6IU3R7.js.map} +0 -0
  337. /package/dist/{chunk-GRS2HIV6.js.map → chunk-ADCXTW7L.js.map} +0 -0
  338. /package/dist/{chunk-BJH77UY2.js.map → chunk-AGGPT4UE.js.map} +0 -0
  339. /package/dist/{chunk-TZYTMZZY.js.map → chunk-AKIEBFIJ.js.map} +0 -0
  340. /package/dist/{chunk-DL6BZKP3.js.map → chunk-B3B6HV5S.js.map} +0 -0
  341. /package/dist/{chunk-5XONHAFD.js.map → chunk-B6EWMGFX.js.map} +0 -0
  342. /package/dist/{chunk-MRJDLXI3.js.map → chunk-BFJE2GPP.js.map} +0 -0
  343. /package/dist/{chunk-G46JSSVX.js.map → chunk-BJRKXNFP.js.map} +0 -0
  344. /package/dist/{chunk-RNACRT5H.js.map → chunk-BPQ5CRJF.js.map} +0 -0
  345. /package/dist/{chunk-BYHCKX73.js.map → chunk-BVRJYMFZ.js.map} +0 -0
  346. /package/dist/{chunk-GETUTTZU.js.map → chunk-C4XV3PSJ.js.map} +0 -0
  347. /package/dist/{chunk-XXNWU5QZ.js.map → chunk-DFC4WTJW.js.map} +0 -0
  348. /package/dist/{chunk-YQFBH5ZJ.js.map → chunk-DMIEKD24.js.map} +0 -0
  349. /package/dist/{chunk-2ZFD2UJC.js.map → chunk-DQAXA2GK.js.map} +0 -0
  350. /package/dist/{chunk-ZVSKSUGI.js.map → chunk-DWCFGF2K.js.map} +0 -0
  351. /package/dist/{chunk-5HNW4ZTA.js.map → chunk-E2C6FFSI.js.map} +0 -0
  352. /package/dist/{chunk-G66YXUTY.js.map → chunk-EZOFTI4K.js.map} +0 -0
  353. /package/dist/{chunk-6QLCS7ET.js.map → chunk-FMINS2B6.js.map} +0 -0
  354. /package/dist/{chunk-6WS35E6X.js.map → chunk-FPF5HRBE.js.map} +0 -0
  355. /package/dist/{chunk-7CT6SX4M.js.map → chunk-FZVCZEVI.js.map} +0 -0
  356. /package/dist/{chunk-BUE7R3B5.js.map → chunk-GIQJGXV7.js.map} +0 -0
  357. /package/dist/{chunk-C53ER7AG.js.map → chunk-H334G6KU.js.map} +0 -0
  358. /package/dist/{chunk-GCUMOKTN.js.map → chunk-HE7EAHGS.js.map} +0 -0
  359. /package/dist/{chunk-BU2ABHFW.js.map → chunk-HKB4HZDU.js.map} +0 -0
  360. /package/dist/{chunk-5UUJE4FP.js.map → chunk-ICF3TIGY.js.map} +0 -0
  361. /package/dist/{chunk-H3YM66EI.js.map → chunk-IF2M43G4.js.map} +0 -0
  362. /package/dist/{chunk-IVMFIKNA.js.map → chunk-IMIQAGR7.js.map} +0 -0
  363. /package/dist/{chunk-226V6XXJ.js.map → chunk-IQAJ4OR6.js.map} +0 -0
  364. /package/dist/{chunk-ZMVSKYTJ.js.map → chunk-IUD7WU67.js.map} +0 -0
  365. /package/dist/{chunk-OK57EATL.js.map → chunk-IVLRPRXM.js.map} +0 -0
  366. /package/dist/{chunk-K673OO6B.js.map → chunk-JAQHWHUN.js.map} +0 -0
  367. /package/dist/{chunk-MQ7YWBQ5.js.map → chunk-K4JSTGXT.js.map} +0 -0
  368. /package/dist/{chunk-55P6OBB7.js.map → chunk-KN4LUMH6.js.map} +0 -0
  369. /package/dist/{chunk-NZULV7LK.js.map → chunk-KZA3DITX.js.map} +0 -0
  370. /package/dist/{chunk-ECGXA4LT.js.map → chunk-L2VM64HK.js.map} +0 -0
  371. /package/dist/{chunk-LGGIFKJP.js.map → chunk-MAQBYBUX.js.map} +0 -0
  372. /package/dist/{chunk-ABU6A4Z5.js.map → chunk-MBPZMZVB.js.map} +0 -0
  373. /package/dist/{chunk-WFWFXDNS.js.map → chunk-MCNNZBG7.js.map} +0 -0
  374. /package/dist/{chunk-NIXRB5BP.js.map → chunk-MLVPMDOZ.js.map} +0 -0
  375. /package/dist/{chunk-BVF3SXD7.js.map → chunk-MMCN7TLK.js.map} +0 -0
  376. /package/dist/{chunk-PTJY5R3O.js.map → chunk-NCTN2FW4.js.map} +0 -0
  377. /package/dist/{chunk-UOZOWN73.js.map → chunk-ND6S2DKC.js.map} +0 -0
  378. /package/dist/{chunk-XKBTJGFP.js.map → chunk-NTVKHQ3L.js.map} +0 -0
  379. /package/dist/{chunk-UHFGK6YA.js.map → chunk-NXQEOC3X.js.map} +0 -0
  380. /package/dist/{chunk-UAKY6E4N.js.map → chunk-O2VQ3K36.js.map} +0 -0
  381. /package/dist/{chunk-JSWKVZCR.js.map → chunk-OGKMRIIJ.js.map} +0 -0
  382. /package/dist/{chunk-L2F3CFCH.js.map → chunk-ONZ3B5EW.js.map} +0 -0
  383. /package/dist/{chunk-AJFPAHMW.js.map → chunk-OOPSMQX5.js.map} +0 -0
  384. /package/dist/{chunk-QDHHHI5Q.js.map → chunk-OYEBSWLE.js.map} +0 -0
  385. /package/dist/{chunk-ZWF3EWZA.js.map → chunk-P6FATPXQ.js.map} +0 -0
  386. /package/dist/{chunk-QSHATAXJ.js.map → chunk-PLTIJDQN.js.map} +0 -0
  387. /package/dist/{chunk-V55JASXO.js.map → chunk-PR7ILCIH.js.map} +0 -0
  388. /package/dist/{chunk-X2RP4TO5.js.map → chunk-QE3TLZ6Z.js.map} +0 -0
  389. /package/dist/{chunk-QXJXG7DN.js.map → chunk-QFW4MYGN.js.map} +0 -0
  390. /package/dist/{chunk-2WJKJZSO.js.map → chunk-QHG7GQKM.js.map} +0 -0
  391. /package/dist/{chunk-FZXRLNJO.js.map → chunk-QT5ITL25.js.map} +0 -0
  392. /package/dist/{chunk-SNM7LSYG.js.map → chunk-R2ZULFXU.js.map} +0 -0
  393. /package/dist/{chunk-SPPOUJLN.js.map → chunk-RRTQAQ3N.js.map} +0 -0
  394. /package/dist/{chunk-L5A3KR7R.js.map → chunk-SALY3LIJ.js.map} +0 -0
  395. /package/dist/{chunk-SFCD6OU7.js.map → chunk-SBAR5JQ6.js.map} +0 -0
  396. /package/dist/{chunk-WHOKGHJ3.js.map → chunk-SCH2F7R2.js.map} +0 -0
  397. /package/dist/{chunk-JPSL5GIZ.js.map → chunk-SOOAW6HK.js.map} +0 -0
  398. /package/dist/{chunk-TMIJAR2X.js.map → chunk-T4VTRKCY.js.map} +0 -0
  399. /package/dist/{chunk-5LMCVBMY.js.map → chunk-T5EXREMW.js.map} +0 -0
  400. /package/dist/{chunk-YKGJ44Z7.js.map → chunk-TDJVQTXD.js.map} +0 -0
  401. /package/dist/{chunk-PUBI455O.js.map → chunk-THQ3BHLM.js.map} +0 -0
  402. /package/dist/{chunk-BMHQHH7Q.js.map → chunk-TLIFNRU5.js.map} +0 -0
  403. /package/dist/{chunk-PGC35KXE.js.map → chunk-TRHUNPXP.js.map} +0 -0
  404. /package/dist/{chunk-SWXLZ4HX.js.map → chunk-UL6MTRMJ.js.map} +0 -0
  405. /package/dist/{chunk-J4KAPKBJ.js.map → chunk-UORWAG7K.js.map} +0 -0
  406. /package/dist/{chunk-XXQ5XIYY.js.map → chunk-VLQ6KT7F.js.map} +0 -0
  407. /package/dist/{chunk-PT2YCQVK.js.map → chunk-VP37VUKQ.js.map} +0 -0
  408. /package/dist/{chunk-QGSNJD3B.js.map → chunk-WBUHHMLN.js.map} +0 -0
  409. /package/dist/{chunk-PFCTSXHU.js.map → chunk-X6Z2SIRF.js.map} +0 -0
  410. /package/dist/{chunk-XA34THLF.js.map → chunk-XLKWF3L4.js.map} +0 -0
  411. /package/dist/{chunk-K7RW7FI4.js.map → chunk-XPNJH7GN.js.map} +0 -0
  412. /package/dist/{chunk-RDOEOPOI.js.map → chunk-XPW7T2GN.js.map} +0 -0
  413. /package/dist/{chunk-EA4VDI5D.js.map → chunk-Y55XHMQB.js.map} +0 -0
  414. /package/dist/{chunk-BNFNQNEP.js.map → chunk-YJGKOSQD.js.map} +0 -0
  415. /package/dist/{chunk-3V6LZHUO.js.map → chunk-Z3STG43F.js.map} +0 -0
  416. /package/dist/{chunk-ZBUAX4EF.js.map → chunk-ZD7WFMV2.js.map} +0 -0
  417. /package/dist/{chunk-OM3SEDI4.js.map → chunk-ZF6JECDT.js.map} +0 -0
  418. /package/dist/{chunk-3Y5JLSXS.js.map → chunk-ZF7KNSLU.js.map} +0 -0
  419. /package/dist/{chunk-B65CC6Z6.js.map → chunk-ZGKODRGB.js.map} +0 -0
  420. /package/dist/{chunk-D4V5JJAK.js.map → chunk-ZNEKQFGF.js.map} +0 -0
  421. /package/dist/{chunk-D5A3GCZ4.js.map → chunk-ZUTUNVFD.js.map} +0 -0
  422. /package/dist/{chunk-G5EDYVSE.js.map → chunk-ZWMOHANW.js.map} +0 -0
  423. /package/dist/{classified-marker-KHDOYIJB.js.map → classified-marker-WKP33U2R.js.map} +0 -0
  424. /package/dist/{collection-facade-LZIF7GWD.js.map → collection-facade-COSGZKLC.js.map} +0 -0
  425. /package/dist/{computed-XMFTHAXV.js.map → computed-WN6V53ZV.js.map} +0 -0
  426. /package/dist/{dead-filter-CXV5NS67.js.map → dead-filter-43WL3Y5H.js.map} +0 -0
  427. /package/dist/{derive-3YSIS36W.js.map → delegation-5UWT4JGT.js.map} +0 -0
  428. /package/dist/{executor-E6YDJ7YA.js.map → derive-IL5JNLEE.js.map} +0 -0
  429. /package/dist/{dispatch-2MQFMEGY.js.map → dispatch-LOQQD5JK.js.map} +0 -0
  430. /package/dist/{dispatch-OFDA4WQV.js.map → dispatch-SHKTG57L.js.map} +0 -0
  431. /package/dist/{executor-NJX3YQQ4.js.map → executor-6PQ7WAGV.js.map} +0 -0
  432. /package/dist/{executor-WWM3DD4P.js.map → executor-6ZPQA6HS.js.map} +0 -0
  433. /package/dist/{export-accessible-RLHU5G4W.js.map → executor-OXRA64TY.js.map} +0 -0
  434. /package/dist/{extract-partition-QII2EDCS.js.map → export-accessible-XG3FKJWW.js.map} +0 -0
  435. /package/dist/{find-6M7GYDUZ.js.map → extract-partition-33747NY5.js.map} +0 -0
  436. /package/dist/{fanout-sidecar-BO67PCPO.js.map → fanout-sidecar-NEB6IYV7.js.map} +0 -0
  437. /package/dist/{issue-LPEEEMPP.js.map → find-VW543G3J.js.map} +0 -0
  438. /package/dist/{ledger-MSJGWKGW.js.map → issue-4ZPSY44M.js.map} +0 -0
  439. /package/dist/{liberate-LEKDYKTC.js.map → ledger-MZ25UFT2.js.map} +0 -0
  440. /package/dist/{link-set-QXXSPPHL.js.map → liberate-OJIP2ZFX.js.map} +0 -0
  441. /package/dist/{managed-secret-VSK7ANQI.js.map → link-set-4FRRAVTH.js.map} +0 -0
  442. /package/dist/{noydb-F2AUF6KL.js.map → managed-secret-SQWO2EUR.js.map} +0 -0
  443. /package/dist/{migrate-cek-GEBFYBDC.js.map → migrate-cek-JWEM4RP6.js.map} +0 -0
  444. /package/dist/{register-SN72QALV.js.map → noydb-U62OVKXB.js.map} +0 -0
  445. /package/dist/{pod-handle-YE7CT66T.js.map → pod-handle-R6Y4MILX.js.map} +0 -0
  446. /package/dist/{post-register-QC5TEAW3.js.map → post-register-GRVQHBOH.js.map} +0 -0
  447. /package/dist/{registry-253FF7C6.js.map → register-YJ5YLQ36.js.map} +0 -0
  448. /package/dist/{registry-3AZWQTDT.js.map → registry-ICOHBQFD.js.map} +0 -0
  449. /package/dist/{registry-7UEBTHWG.js.map → registry-MJ7MWCSW.js.map} +0 -0
  450. /package/dist/{registry-IVJ67NFQ.js.map → registry-MVEKKGWL.js.map} +0 -0
  451. /package/dist/{request-withdrawal-UKVJZKX2.js.map → registry-XP744FAP.js.map} +0 -0
  452. /package/dist/{revoke-G2KXJQA5.js.map → request-withdrawal-LSU4G6W3.js.map} +0 -0
  453. /package/dist/{reveal-YQTRNQFH.js.map → reveal-AIHOIK2N.js.map} +0 -0
  454. /package/dist/{signer-IUIYR3CX.js.map → revoke-QUT7WWG3.js.map} +0 -0
  455. /package/dist/{stale-SKV33PBU.js.map → signer-NYR4I3FO.js.map} +0 -0
  456. /package/dist/{storage-NPBYP2SM.js.map → stale-PIJPAL5T.js.map} +0 -0
  457. /package/dist/{walk-F4OLXI5H.js.map → storage-VH6SPXHC.js.map} +0 -0
  458. /package/dist/{store-coordination-provider-Z6HKPOGM.js.map → store-coordination-provider-2KSHCOPU.js.map} +0 -0
  459. /package/dist/{verify-KWQIWLGH.js.map → verify-PCFS4PNS.js.map} +0 -0
  460. /package/dist/{withdraw-accessible-ZKPLZ66E.js.map → walk-OZCN6LJS.js.map} +0 -0
@@ -2,11 +2,11 @@ import {
2
2
  VDIG_ITERATIONS,
3
3
  mintBidxTag,
4
4
  pbkdf2VerifyDigest
5
- } from "./chunk-ABU6A4Z5.js";
5
+ } from "./chunk-MBPZMZVB.js";
6
6
  import {
7
7
  ctEqualTags,
8
8
  makeCapsule
9
- } from "./chunk-OM3SEDI4.js";
9
+ } from "./chunk-ZF6JECDT.js";
10
10
  import {
11
11
  IV_BYTES,
12
12
  KEY_BITS,
@@ -16,14 +16,14 @@ import {
16
16
  generateIV,
17
17
  generateSalt,
18
18
  normalizeForVerify
19
- } from "./chunk-PUBI455O.js";
19
+ } from "./chunk-THQ3BHLM.js";
20
20
  import {
21
21
  ClassifiedRotationError,
22
22
  DecryptionError,
23
23
  InvalidKeyError,
24
24
  TamperedError,
25
25
  ValidationError
26
- } from "./chunk-VSUQI5Q6.js";
26
+ } from "./chunk-IKPQ2GGB.js";
27
27
 
28
28
  // src/capsule/enclave-aes/classify/compare.ts
29
29
  var subtle = globalThis.crypto.subtle;
@@ -196,6 +196,12 @@ async function importTransferKey(raw) {
196
196
  }
197
197
  return subtle2.importKey("raw", raw, { name: "AES-GCM", length: KEY_BITS }, false, ["encrypt", "decrypt"]);
198
198
  }
199
+ async function importWrappingKey(raw) {
200
+ if (raw.byteLength !== 32) {
201
+ throw new ValidationError(`wrapping key must be 32 bytes, got ${raw.byteLength}.`);
202
+ }
203
+ return subtle2.importKey("raw", raw, { name: "AES-KW", length: KEY_BITS }, false, ["wrapKey", "unwrapKey"]);
204
+ }
199
205
  async function encrypt(plaintext, dek, aad) {
200
206
  const iv = generateIV();
201
207
  const encoded = new TextEncoder().encode(plaintext);
@@ -214,8 +220,14 @@ async function encrypt(plaintext, dek, aad) {
214
220
  };
215
221
  }
216
222
  async function decrypt(ivBase64, dataBase64, dek, aad) {
217
- const iv = base64ToBuffer(ivBase64);
218
- const ciphertext = base64ToBuffer(dataBase64);
223
+ let iv;
224
+ let ciphertext;
225
+ try {
226
+ iv = base64ToBuffer(ivBase64);
227
+ ciphertext = base64ToBuffer(dataBase64);
228
+ } catch (err) {
229
+ throw new DecryptionError(`envelope body is not valid base64: ${err instanceof Error ? err.message : String(err)}`);
230
+ }
219
231
  try {
220
232
  const plaintext = await subtle2.decrypt(
221
233
  {
@@ -419,6 +431,17 @@ async function recipientWrap(pub, bytes) {
419
431
  async function recipientUnwrap(pair, wrapped) {
420
432
  return new Uint8Array(await subtle2.decrypt({ name: "RSA-OAEP" }, pair.privateKey, wrapped));
421
433
  }
434
+ async function exportRecipientPrivateKeyPkcs8(pair) {
435
+ return new Uint8Array(await subtle2.exportKey("pkcs8", pair.privateKey));
436
+ }
437
+ async function importRecipientKeyPair(pkcs8, spki) {
438
+ const alg = { name: "RSA-OAEP", hash: "SHA-256" };
439
+ const [privateKey, publicKey] = await Promise.all([
440
+ subtle2.importKey("pkcs8", pkcs8, alg, false, ["decrypt"]),
441
+ subtle2.importKey("spki", spki, alg, false, ["encrypt"])
442
+ ]);
443
+ return { privateKey, publicKey };
444
+ }
422
445
 
423
446
  // src/capsule/enclave-aes/classify/vdig.ts
424
447
  var subtle3 = globalThis.crypto.subtle;
@@ -541,6 +564,7 @@ export {
541
564
  unwrapCek,
542
565
  importCek,
543
566
  importTransferKey,
567
+ importWrappingKey,
544
568
  encrypt,
545
569
  decrypt,
546
570
  encryptBytes,
@@ -557,9 +581,11 @@ export {
557
581
  importRecipientPublicKeySpki,
558
582
  recipientWrap,
559
583
  recipientUnwrap,
584
+ exportRecipientPrivateKeyPkcs8,
585
+ importRecipientKeyPair,
560
586
  deriveVdigSlotKey,
561
587
  openVdigPayload,
562
588
  aesCapsule,
563
589
  dualReadSealedSlot
564
590
  };
565
- //# sourceMappingURL=chunk-CB4467G3.js.map
591
+ //# sourceMappingURL=chunk-YH4OUOSI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/capsule/enclave-aes/classify/compare.ts","../src/capsule/enclave-aes/crypto.ts","../src/capsule/enclave-aes/classify/vdig.ts","../src/capsule/enclave-aes/classify/write.ts","../src/capsule/enclave-aes/primitives.ts","../src/capsule/enclave-aes/bound.ts"],"sourcesContent":["/**\n * C2 — fixed-length-tag constant-time comparison (hub-portable; no\n * Node timingSafeEqual). Two mandatory rules (spec §3):\n * 1. Only fixed 32-byte tags are ever compared — ctEqualTags throws on\n * anything else (tag length is structural, never secret-dependent).\n * 2. Every comparand is reduced to a 32-byte tag under a FRESH ephemeral\n * HMAC-SHA256 key before comparison — keyed blinding makes compare\n * timing uncorrelated with underlying values; rule 1 (not blinding)\n * is what removes input-length timing. Length inequality folds into\n * unequal tags — never an early return.\n * @module\n */\n\nimport { ctEqualTags } from '../../plumbing/ct-equal.js'\nconst subtle = globalThis.crypto.subtle\n\n\n/**\n * Blinded equality of arbitrary-length byte strings: fresh K_e per\n * comparison (never stored, never reused), HMAC both sides to 32-byte\n * tags, then ctEqualTags. On the digest path the inputs are already\n * 32-byte PBKDF2 outputs but still route through this reduction so\n * there is exactly ONE comparison construction (spec §3 rule 2).\n */\nexport async function blindedEqual(a: Uint8Array, b: Uint8Array): Promise<boolean> {\n const ke = await subtle.generateKey({ name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n const tagA = new Uint8Array(await subtle.sign('HMAC', ke, a as BufferSource))\n const tagB = new Uint8Array(await subtle.sign('HMAC', ke, b as BufferSource))\n return ctEqualTags(tagA, tagB)\n}\n","/**\n * Cryptographic primitives — thin wrappers around the Web Crypto API.\n *\n * ## Design principle\n *\n * **Zero npm crypto dependencies.** Every operation uses `globalThis.crypto.subtle`,\n * which is available natively in Node.js ≥ 18, all modern browsers, and\n * Deno/Bun. This avoids supply-chain risk from third-party crypto packages and\n * ensures the library stays auditable.\n *\n * ## Algorithms\n *\n * | Use case | Algorithm | Parameters |\n * |----------|-----------|------------|\n * | Key derivation | PBKDF2-SHA256 | 600,000 iterations, 32-byte salt |\n * | Record encryption | AES-256-GCM | 12-byte random IV per operation |\n * | DEK wrapping | AES-KW (RFC 3394) | 256-bit KEK |\n * | Binary encrypt | AES-256-GCM | same as record encryption |\n * | Integrity | HMAC-SHA256 | for presence channels |\n * | Content hash | SHA-256 | for ledger and bundle integrity |\n *\n * ## Key lifecycle\n *\n * ```\n * secret + salt\n * └─► deriveKey() → KEK (CryptoKey, extractable: false)\n * └─► wrapKey() → wrapped DEK bytes [stored in keyring]\n * └─► unwrapKey() → DEK (CryptoKey) [memory only during session]\n * └─► encrypt() / decrypt() → ciphertext / plaintext\n * ```\n *\n * IVs are generated fresh by {@link generateIV} on every encrypt call.\n * Reusing an IV with the same key would break GCM's authentication guarantee —\n * this function should be the only place IVs are produced.\n *\n * @module\n */\n\nimport { DecryptionError, InvalidKeyError, TamperedError, ValidationError } from '../../kernel/errors.js'\nimport {\n KEY_BITS,\n IV_BYTES,\n bufferToBase64,\n base64ToBuffer,\n generateIV,\n encodeEchoParts,\n type EchoSecretParts,\n} from '../plumbing/digest.js'\n\n/**\n * **EnclaveKey** — the opaque key type at the enclave seam.\n *\n * In noy-db's reference enclave this is `CryptoKey` (the Web Crypto API's\n * key handle). A fork's enclave redefines this alias to its own key\n * representation (e.g. `type EnclaveKey = null` for a keyless HSM-backed\n * fork) — outside `capsule/enclave-aes/**`, every consumer must treat it as\n * opaque: never construct, inspect, or serialize it directly, only pass it\n * between barrel functions (`encrypt`/`decrypt`/`wrapKey`/`unwrapKey`/…).\n */\nexport type EnclaveKey = CryptoKey\n\n/** Opaque asymmetric pair at the enclave seam — `CryptoKeyPair` in the reference enclave. */\nexport type EnclaveKeyPair = CryptoKeyPair\n\nconst PBKDF2_ITERATIONS = 600_000\n\nconst subtle = globalThis.crypto.subtle\n\n// ─── Key Derivation ────────────────────────────────────────────────────\n\n/** Derive a KEK from a secret and salt using PBKDF2-SHA256. */\nexport async function deriveKey(\n secret: string,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n return deriveKekFromMaterial(new TextEncoder().encode(secret), salt)\n}\n\n/**\n * Shared PBKDF2 → AES-KW derivation core. `material` is the raw\n * pre-KDF input bytes (a UTF-8 phrase for standard mode, an\n * AG-1-encoded 3-part structure for echo mode).\n */\nasync function deriveKekFromMaterial(\n material: Uint8Array,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n const keyMaterial = await subtle.importKey('raw', material as BufferSource, 'PBKDF2', false, ['deriveKey'])\n return subtle.deriveKey(\n { name: 'PBKDF2', salt: salt as BufferSource, iterations: PBKDF2_ITERATIONS, hash: 'SHA-256' },\n keyMaterial,\n { name: 'AES-KW', length: KEY_BITS },\n false,\n ['wrapKey', 'unwrapKey'],\n )\n}\n\n/** One three-part echo secret: prompt (typed) → echo (revealed) → key (typed). */\n\n/**\n * Domain context for the AG-1 encoding. The leading `0xFF` is the load-bearing\n * byte: it is not a legal UTF-8 lead byte, so `TextEncoder` can never emit it —\n * no string's UTF-8 encoding can equal an AG-1 encoding, whatever the string.\n */\n\nexport async function deriveEchoKey(\n parts: EchoSecretParts,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n return deriveKekFromMaterial(encodeEchoParts(parts), salt)\n}\n\n/**\n * Which AES algorithm/usage a {@link deriveSecretKey} result is for:\n * `'aes-kw'` mints a key-wrapping key (`wrapKey`/`unwrapKey`, e.g. for\n * KEK derivation); `'aes-gcm'` mints a direct encrypt/decrypt key (e.g.\n * for the wrap-DEKs primitive in `with-party/team/wrapped-deks.ts`).\n */\nexport type SecretKeyUsage = 'aes-kw' | 'aes-gcm'\n\n/**\n * Derive a non-extractable AES key from a secret/credential and salt\n * via PBKDF2-SHA256, generalizing {@link deriveKey}'s AES-KW derivation to\n * also cover AES-GCM-usage keys. Callers pin their own `iterations` and\n * `keyUsage` so an existing call site's exact parameters (and thus its\n * derived-key bytes) are preserved verbatim when migrated onto this\n * shared primitive — this is call-site consolidation, not a KDF change.\n */\nexport async function deriveSecretKey(\n secret: string,\n salt: Uint8Array,\n params: { iterations: number; keyUsage: SecretKeyUsage },\n): Promise<CryptoKey> {\n const keyMaterial = await subtle.importKey(\n 'raw',\n new TextEncoder().encode(secret),\n 'PBKDF2',\n false,\n ['deriveKey'],\n )\n\n return params.keyUsage === 'aes-gcm'\n ? subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt as BufferSource,\n iterations: params.iterations,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n : subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt as BufferSource,\n iterations: params.iterations,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-KW', length: KEY_BITS },\n false,\n ['wrapKey', 'unwrapKey'],\n )\n}\n\n// ─── DEK Generation ────────────────────────────────────────────────────\n\n/** Generate a random AES-256-GCM data encryption key. */\nexport async function generateDEK(): Promise<CryptoKey> {\n return subtle.generateKey(\n { name: 'AES-GCM', length: KEY_BITS },\n true, // extractable — needed for AES-KW wrapping\n ['encrypt', 'decrypt'],\n )\n}\n\n/**\n * Generate a NON-extractable AES-256-GCM key for in-memory-only use — a\n * session key, a device seal. Unlike {@link generateDEK} it can never be\n * wrapped or exported: WebCrypto enforces that, and it is the tab-scope\n * invariant `with-party/session` and `device-seal` rely on.\n */\nexport async function generateEphemeralKey(): Promise<CryptoKey> {\n return subtle.generateKey({ name: 'AES-GCM', length: KEY_BITS }, false, ['encrypt', 'decrypt'])\n}\n\n// ─── DEK-Set Codec ─────────────────────────────────────────────────────\n//\n// The portable form of a DEK set — `{ collection: base64(rawKey) }` — is the\n// plaintext body of every persisted WrappedDeksBlob (recovery-paper,\n// recovery-shamir, tier-2 password slots). It is an enclave door because it\n// is the one place a key's REPRESENTATION crosses into bytes: a fork with its\n// own EnclaveKey (hardware-backed, post-quantum, no encryption) decides here\n// what \"the bytes of a key\" means, and nothing outside capsule/enclave-aes has to\n// know. Byte-for-byte what wrapped-deks.ts did inline before #1317.\n\n/** Serialize a DEK set to `{ collection: base64(rawKey) }`. */\nexport async function exportDekSet(deks: Map<string, CryptoKey>): Promise<Record<string, string>> {\n const out: Record<string, string> = {}\n for (const [coll, dek] of deks) {\n out[coll] = bufferToBase64(await subtle.exportKey('raw', dek))\n }\n return out\n}\n\n/**\n * Reverse of {@link exportDekSet}. Keys come back extractable AES-GCM\n * (`encrypt`/`decrypt`), matching what `generateDEK` mints.\n */\nexport async function importDekSet(exported: Record<string, string>): Promise<Map<string, CryptoKey>> {\n const deks = new Map<string, CryptoKey>()\n for (const [coll, b64] of Object.entries(exported)) {\n const key = await subtle.importKey(\n 'raw',\n base64ToBuffer(b64) as BufferSource,\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n deks.set(coll, key)\n }\n return deks\n}\n\n// ─── Key Wrapping ──────────────────────────────────────────────────────\n\n/** Wrap (encrypt) a DEK with a KEK using AES-KW. Returns base64 string. */\nexport async function wrapKey(dek: CryptoKey, kek: CryptoKey): Promise<string> {\n const wrapped = await subtle.wrapKey('raw', dek, kek, 'AES-KW')\n return bufferToBase64(wrapped)\n}\n\n/** Unwrap (decrypt) a DEK from base64 string using a KEK. */\nexport async function unwrapKey(\n wrappedBase64: string,\n kek: CryptoKey,\n): Promise<CryptoKey> {\n try {\n return await subtle.unwrapKey(\n 'raw',\n base64ToBuffer(wrappedBase64) as BufferSource,\n kek,\n 'AES-KW',\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n } catch {\n throw new InvalidKeyError()\n }\n}\n\n// ─── Canary ────────────────────────────────────────────────────────────\n//\n// \"Is this KEK the right one?\" is answered by wrapping a CONSTANT key under\n// it and seeing whether the wrap opens later. AES-KW is deterministic\n// (RFC 3394 fixed IV), so the same constant under the same KEK always yields\n// the same bytes — every write site can re-mint on persist. The keyring\n// canary (32 zero bytes) and the echo prompt/echo verifiers (32 × 0x5a) are\n// both this primitive with a different constant.\n\n/** Wrap the constant AES-GCM key built from `plaintext` under `kek`. */\nexport async function mintCanary(kek: CryptoKey, plaintext: Uint8Array): Promise<string> {\n const constant = await subtle.importKey(\n 'raw', plaintext as BufferSource, { name: 'AES-GCM', length: KEY_BITS }, true, ['encrypt', 'decrypt'],\n )\n return wrapKey(constant, kek)\n}\n\n/** True iff `wrapped` unwraps under `kek` — the KEK is right AND the bytes are intact. */\nexport async function checkCanary(wrapped: string, kek: CryptoKey): Promise<boolean> {\n try {\n await unwrapKey(wrapped, kek)\n return true\n } catch {\n return false\n }\n}\n\n// ─── Per-record CEK wrapping ───────────────────────────────────────────\n\n/**\n * Derive a **dedicated** AES-KW wrapping key from a collection/tier DEK via\n * HKDF-SHA256, used to wrap/unwrap a per-record CEK.\n *\n * The collection/tier DEKs are AES-256-**GCM** keys (usages\n * `encrypt`/`decrypt`) and cannot themselves act as an AES-KW KEK. We do NOT\n * re-import the raw DEK bytes directly as an AES-KW key — that would reuse one\n * key across two primitives (AES-GCM for `_det`/presence, AES-KW for CEK\n * wrapping), violating key separation. Instead we HKDF-derive a domain-\n * separated KW key (salt `noydb-cek-wrap`), exactly as `derivePresenceKey`\n * derives a separate presence key. The derivation is deterministic, so\n * wrapping the same CEK under the same DEK always yields identical ciphertext\n * — which is what lets an update reuse a record's stable CEK and produce a\n * byte-identical `_cek`. The KW key is independent of the DEK's GCM key.\n *\n * The DEK must be extractable (it is — `generateDEK`/`unwrapKey` mint\n * extractable keys).\n */\nasync function asKwKey(dek: CryptoKey): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-cek-wrap')\n const info = new TextEncoder().encode('v1')\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey('raw', bits, 'AES-KW', false, ['wrapKey', 'unwrapKey'])\n}\n\n/**\n * AES-KW-wrap a per-record CEK under a collection/tier DEK. Returns base64.\n * Deterministic over `(cek, dek)`.\n */\nexport async function wrapCek(cek: CryptoKey, dek: CryptoKey): Promise<string> {\n const kw = await asKwKey(dek)\n const wrapped = await subtle.wrapKey('raw', cek, kw, 'AES-KW')\n return bufferToBase64(wrapped)\n}\n\n/**\n * Unwrap a per-record CEK from base64 under a collection/tier DEK. Throws\n * `InvalidKeyError` if the wrapped bytes do not authenticate under the DEK.\n */\nexport async function unwrapCek(wrappedBase64: string, dek: CryptoKey): Promise<CryptoKey> {\n const kw = await asKwKey(dek)\n try {\n return await subtle.unwrapKey(\n 'raw',\n base64ToBuffer(wrappedBase64) as BufferSource,\n kw,\n 'AES-KW',\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n } catch {\n throw new InvalidKeyError()\n }\n}\n\n/**\n * Import a raw 32-byte AES-256-GCM record CEK (e.g. from a sealed-CEK\n * delivery binding). Non-extractable, decrypt-only — the imported key is\n * used solely to open the record's `_iv`/`_data` body under `decrypt()`.\n */\nexport async function importCek(rawKey: Uint8Array): Promise<CryptoKey> {\n return subtle.importKey('raw', rawKey as BufferSource, { name: 'AES-GCM', length: KEY_BITS }, false, ['decrypt'])\n}\n\n/**\n * Import a raw 32-byte pre-shared key as a NON-extractable AES-256-GCM key\n * (encrypt + decrypt). The transfer seal (`with-cargo`) and the RSA-OAEP\n * TLV's per-blob CEK (`managed-secret`) both hand raw bytes to the enclave\n * here; the bytes never become a key anywhere else.\n */\nexport async function importTransferKey(raw: Uint8Array): Promise<CryptoKey> {\n if (raw.byteLength !== 32) {\n throw new ValidationError(`transfer key must be 32 bytes, got ${raw.byteLength}.`)\n }\n return subtle.importKey('raw', raw as BufferSource, { name: 'AES-GCM', length: KEY_BITS }, false, ['encrypt', 'decrypt'])\n}\n\n/**\n * core#65 — import raw 32 bytes as a NON-extractable AES-KW key (wrap +\n * unwrap). The per-delegation CONTENT KEY: a delegation's tier DEKs are\n * AES-KW-wrapped under it exactly as they are under a KEK, and the key itself\n * travels RSA-OAEP-sealed to the target's inbox public half — so the token's\n * slot NAMES stay readable to any vault member for audit while its keys open\n * for the target alone. Distinct from {@link importTransferKey}, which imports\n * an AES-GCM key for body encryption and cannot wrap.\n */\nexport async function importWrappingKey(raw: Uint8Array): Promise<CryptoKey> {\n if (raw.byteLength !== 32) {\n throw new ValidationError(`wrapping key must be 32 bytes, got ${raw.byteLength}.`)\n }\n return subtle.importKey('raw', raw as BufferSource, { name: 'AES-KW', length: KEY_BITS }, false, ['wrapKey', 'unwrapKey'])\n}\n\n// ─── Encrypt / Decrypt ─────────────────────────────────────────────────\n\nexport interface EncryptResult {\n iv: string // base64\n data: string // base64\n}\n\n/**\n * Encrypt plaintext JSON string with AES-256-GCM. Fresh IV per call.\n *\n * `aad` binds the record's identity into the auth tag (#1041) — see\n * `record-aad.ts` for what is bound and why `_v` is not. A body sealed with\n * AAD can only be opened by a reader supplying the identical bytes, which is\n * what stops an untrusted store from relocating or re-tiering an envelope.\n *\n * Optional **only while the call-site sweep is in progress**. It becomes\n * mandatory once every `encrypt`/`decrypt` pair supplies it, at which point\n * the format version bumps and the reader rejects anything unbound. Until\n * then an omitted `aad` reproduces the previous, unauthenticated behaviour.\n */\nexport async function encrypt(\n plaintext: string,\n dek: CryptoKey,\n aad?: Uint8Array,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const encoded = new TextEncoder().encode(plaintext)\n\n const ciphertext = await subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n ...(aad !== undefined && { additionalData: aad as BufferSource }),\n },\n dek,\n encoded,\n )\n\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext. Throws on wrong key or tampered data.\n *\n * `aad` must be byte-identical to what {@link encrypt} was given, or the auth\n * tag fails and this throws `TamperedError` (#1041). Note the asymmetry that\n * makes this useful: a mismatched identity is indistinguishable from a\n * corrupted body, so relocation fails **closed** rather than returning a\n * plausible record in the wrong place.\n */\nexport async function decrypt(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n aad?: Uint8Array,\n): Promise<string> {\n // A body that is not even base64 (`atob` throws a DOMException) is a corrupted\n // envelope, and must read as one: the same named error a wrong key produces,\n // never the raw WebCrypto/`atob` exception (measured by a consumer, core#67).\n let iv: Uint8Array\n let ciphertext: Uint8Array\n try {\n iv = base64ToBuffer(ivBase64)\n ciphertext = base64ToBuffer(dataBase64)\n } catch (err) {\n throw new DecryptionError(`envelope body is not valid base64: ${err instanceof Error ? err.message : String(err)}`)\n }\n\n try {\n const plaintext = await subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n ...(aad !== undefined && { additionalData: aad as BufferSource }),\n },\n dek,\n ciphertext as BufferSource,\n )\n return new TextDecoder().decode(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError(...(await classifyTagFailure(iv, ciphertext, dek, aad)))\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n\n/**\n * Distinguish a FORMAT TRANSITION from an attack, when the enclave can (#1103).\n *\n * ## The problem\n *\n * Since #1041 switched identity AAD on, one `TamperedError` covers at least\n * four situations: legitimate pre-binding data, a store that reconstructs an\n * envelope and drops a bound field, a CEK/rotation mismatch, and actual\n * tampering. `SECURITY.md` and the subsystem docs teach the LAST reading — so a\n * user who upgrades, hits this on their own honest data, and consults the docs\n * is told their store has been compromised.\n *\n * That is a false positive on the product's central security claim, and the\n * cost is not merely a confusing message: **a tamper alarm that cries wolf is\n * one users learn to ignore.**\n *\n * ## Why the probe is sound, and why it is NOT a downgrade\n *\n * A body sealed before #1041 carries no AAD, so it opens under an empty one.\n * Retrying that way is **positive evidence** of the legacy format rather than a\n * guess: forging a body that decrypts under this DEK requires the DEK, and an\n * untrusted store does not hold one.\n *\n * ⚠️ **Classification ONLY — the plaintext is discarded and the caller still\n * throws.** That is the entire safety argument: the outcome is identical either\n * way, so this cannot become the lenient path #1041 exists to remove. A variant\n * that RETURNED the retry's plaintext would be exactly the accept-without-AAD\n * downgrade the binding was built to prevent. Do not \"optimise\" it into one.\n *\n * Note what the honest message concedes: pre-#1041 data had no authenticated\n * metadata, so a legacy record that was ALSO tampered with reads as legacy.\n * That is not a weakening — it is an accurate statement about data that\n * genuinely never carried a binding.\n */\nasync function classifyTagFailure(\n iv: Uint8Array,\n ciphertext: Uint8Array,\n dek: CryptoKey,\n aad: Uint8Array | undefined,\n): Promise<[] | [string, 'unbound-legacy-format']> {\n // Only meaningful when AAD was supplied: with none there is no second\n // interpretation to test, and the failure is a plain tag mismatch.\n if (aad === undefined) return []\n try {\n await subtle.decrypt({ name: 'AES-GCM', iv: iv as BufferSource }, dek, ciphertext as BufferSource)\n } catch {\n return [] // no benign explanation — the security alert stands\n }\n return [\n 'This record was sealed BEFORE record-identity binding (#1041) and cannot be read by this ' +\n 'version. Its body decrypts correctly under the record key, so this is a data-format ' +\n 'transition, not tampering — but it also means the record predates authenticated metadata. ' +\n 'There is no migration path; see noy-db #1100.',\n 'unbound-legacy-format',\n ]\n}\n\n// ─── Binary Encrypt / Decrypt ────────\n\n/**\n * Encrypt raw bytes with AES-256-GCM using a fresh random IV.\n * Used by the attachment store so binary blobs avoid double base64 encoding\n * (the existing `encrypt()` function calls `TextEncoder` on a string — here\n * we pass the `Uint8Array` directly to `subtle.encrypt`).\n */\nexport async function encryptBytes(\n data: Uint8Array,\n dek: CryptoKey,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const ciphertext = await subtle.encrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n data as unknown as BufferSource,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext back to raw bytes.\n * Counterpart to `encryptBytes`. Throws `TamperedError` on auth-tag failure.\n */\nexport async function decryptBytes(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n): Promise<Uint8Array> {\n const iv = base64ToBuffer(ivBase64)\n const ciphertext = base64ToBuffer(dataBase64)\n try {\n const plaintext = await subtle.decrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n ciphertext as BufferSource,\n )\n return new Uint8Array(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError()\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n\nexport async function encryptBytesWithAAD(\n data: Uint8Array,\n dek: CryptoKey,\n aad: Uint8Array,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const ciphertext = await subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n additionalData: aad as BufferSource,\n },\n dek,\n data as unknown as BufferSource,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext with AAD verification.\n *\n * If the AAD does not match the one used at encryption time (e.g. because\n * a chunk was reordered or substituted from another blob), the GCM auth\n * tag fails and this throws `TamperedError`.\n */\nexport async function decryptBytesWithAAD(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n aad: Uint8Array,\n): Promise<Uint8Array> {\n const iv = base64ToBuffer(ivBase64)\n const ciphertext = base64ToBuffer(dataBase64)\n try {\n const plaintext = await subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n additionalData: aad as BufferSource,\n },\n dek,\n ciphertext as BufferSource,\n )\n return new Uint8Array(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError()\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n// ─── Presence Key Derivation ──────────────────────────────\n\n\nexport async function deriveSealedFieldKey(\n dek: CryptoKey,\n collectionName: string,\n field: string,\n): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-sealed')\n // JSON-array encoding is injective: each element is separately quoted/\n // escaped, so collection `a/sealed/b` + field `c` cannot collide with\n // collection `a` + field `b/sealed/c`.\n const info = new TextEncoder().encode(JSON.stringify(['noydb-sealed', collectionName, field]))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n/**\n * Derive a per-record sealed-field key from the record's **per-record CEK**\n * rather than the collection DEK. Same HKDF construction as\n * {@link deriveSealedFieldKey} but with salt `'noydb-sealed-cek'` (distinct\n * from `'noydb-sealed'`), so a CEK-derived key can never collide with a\n * DEK-derived one for the same `{collection, field}`.\n *\n * The point: the sealed ciphertext's only key now flows from the record's CEK.\n * Dropping the record's wrapped `_cek` (crypto-shred / `forget`) makes the key\n * — and thus `_sealed[field]` — unrecoverable, giving sealed fields the same\n * erasure guarantee `_data` already has. The CEK must be extractable (it is —\n * `unwrapCek`/`generateDEK` mint extractable keys).\n *\n * @param cek The record's AES-256-GCM CEK (extractable).\n * @param collectionName Part of the HKDF `info` for domain separation.\n * @param field Sensitive field name — the rest of the `info`.\n * @returns A non-extractable AES-256-GCM key for that field's sealed slot.\n */\nexport async function deriveSealedFieldKeyFromCek(\n cek: CryptoKey,\n collectionName: string,\n field: string,\n): Promise<CryptoKey> {\n const rawCek = await subtle.exportKey('raw', cek)\n const hkdfKey = await subtle.importKey('raw', rawCek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-sealed-cek')\n const info = new TextEncoder().encode(JSON.stringify(['noydb-sealed-cek', collectionName, field]))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n// ─── Deterministic Encryption ────────────────────────────\n\n/**\n * Derive the collection's **dedicated deterministic-index key** from its DEK\n * via HKDF-SHA256 (L-1, #554).\n *\n * `_det` slots previously encrypted under the raw collection DEK — the same\n * key `_data` uses with a *randomized*-IV regime while `_det` uses a\n * *deterministic*-IV regime. Two IV regimes on one key is avoidable hygiene\n * debt (~2^-96 theoretical collision), so the deterministic index now gets its\n * own HKDF-separated key: salt `'noydb-det'`, info\n * `JSON.stringify(['noydb-det'])` (the injective JSON-array domain tag, same\n * convention as {@link deriveSealedFieldKey}). Per-field separation still\n * comes from the `'<collection>/<field>'` context inside\n * {@link encryptDeterministic}, exactly as before.\n *\n * The derived key stays **DEK-derived (collection-level)** on purpose: `_det`\n * is carried verbatim through per-record CEK rotation (see\n * `record-keys/sealing.ts`), so its key must not depend on the CEK. It rotates\n * with the collection DEK, like the presence key.\n *\n * The key is minted **extractable** — {@link encryptDeterministic} derives its\n * per-value IV via HKDF over the raw key bytes (an `exportKey` under the\n * hood), which a non-extractable key would forbid. Same in-memory posture as\n * the DEK itself (`generateDEK` mints extractable keys).\n *\n * @param dek The collection's AES-256-GCM DEK (extractable).\n * @returns A dedicated AES-256-GCM key for the `_det` deterministic index.\n */\nexport async function deriveDeterministicKey(dek: CryptoKey): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-det')\n const info = new TextEncoder().encode(JSON.stringify(['noydb-det']))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n}\n\n/**\n * Derive a deterministic 12-byte IV from `{ DEK, context, plaintext }`\n * via HKDF-SHA256. Given the same three inputs, the IV is identical, so\n * `encryptDeterministic` produces the same ciphertext on every call —\n * which is precisely what enables blind equality search on encrypted\n * fields.\n *\n * **The side channel this opens.** Two records whose field value is the\n * same produce the same ciphertext. An observer with store access can\n * therefore tell which records share a value — not *what* the value is,\n * but the equivalence class. This is the well-known trade-off of\n * deterministic encryption and is why the feature is strictly opt-in\n * per field, guarded by `acknowledgeDeterministicRisk: true` at\n * collection creation.\n *\n * The context string MUST include the collection name and field name,\n * so:\n * - The same plaintext in two different fields encrypts differently\n * (no cross-field equality leak).\n * - The same plaintext in two different collections (different DEKs)\n * encrypts differently by virtue of the key, even before HKDF\n * domain separation kicks in.\n */\nasync function deriveDeterministicIV(\n dek: CryptoKey,\n context: string,\n plaintext: string,\n): Promise<Uint8Array> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-deterministic-v1')\n const info = new TextEncoder().encode(`${context}\\x00${plaintext}`)\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n IV_BYTES * 8,\n )\n return new Uint8Array(bits)\n}\n\n/**\n * Encrypt a plaintext string with AES-256-GCM and a deterministic,\n * HKDF-derived IV.\n *\n * The same `{ dek, context, plaintext }` triple always produces the\n * same `{ iv, data }` — call this twice and you can string-compare the\n * ciphertexts to check equality of the inputs without decrypting them.\n *\n * @param context Domain-separation string — by convention\n * `'<collection>/<field>'`. Different contexts encrypt\n * the same plaintext to different ciphertexts, so\n * `email` in collection `users` does not collide with\n * `email` in collection `customers`.\n */\nexport async function encryptDeterministic(\n plaintext: string,\n dek: CryptoKey,\n context: string,\n): Promise<EncryptResult> {\n const iv = await deriveDeterministicIV(dek, context, plaintext)\n const encoded = new TextEncoder().encode(plaintext)\n const ciphertext = await subtle.encrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n encoded,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Counterpart to {@link encryptDeterministic}. The IV is stored\n * alongside the ciphertext (exactly like the randomized path), so\n * decrypt uses the stored IV and verifies the GCM auth tag — a tampered\n * ciphertext throws `TamperedError` just like randomized AES-GCM.\n */\nexport async function decryptDeterministic(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n): Promise<string> {\n return decrypt(ivBase64, dataBase64, dek)\n}\n\n// ─── Random Generation ─────────────────────────────────────────────────\n\n\nexport async function generateRecipientKeyPair(): Promise<CryptoKeyPair> {\n return subtle.generateKey(\n { name: 'RSA-OAEP', modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-256' },\n true,\n ['encrypt', 'decrypt'],\n )\n}\n\nexport async function exportRecipientPublicKeySpki(pair: CryptoKeyPair): Promise<Uint8Array> {\n return new Uint8Array(await subtle.exportKey('spki', pair.publicKey))\n}\n\nexport async function importRecipientPublicKeySpki(spki: Uint8Array): Promise<CryptoKey> {\n return subtle.importKey('spki', spki as BufferSource, { name: 'RSA-OAEP', hash: 'SHA-256' }, false, ['encrypt'])\n}\n\n/** RSA-OAEP-encrypt `bytes` (a 32-byte CEK) to the recipient's public key. */\nexport async function recipientWrap(pub: CryptoKey, bytes: Uint8Array): Promise<Uint8Array> {\n return new Uint8Array(await subtle.encrypt({ name: 'RSA-OAEP' }, pub, bytes as BufferSource))\n}\n\n/**\n * RSA-OAEP-decrypt with the pair's private key. Propagates WebCrypto's own\n * error on failure — callers that need a typed error map it themselves.\n */\nexport async function recipientUnwrap(pair: CryptoKeyPair, wrapped: Uint8Array): Promise<Uint8Array> {\n return new Uint8Array(await subtle.decrypt({ name: 'RSA-OAEP' }, pair.privateKey, wrapped as BufferSource))\n}\n\n/**\n * core#96 — the private half of a recipient pair as PKCS#8 bytes, so a caller\n * can seal it under a key it holds and persist it (a member's keyring inbox\n * key pair lives in the keyring file). The caller zeroes the bytes after use.\n */\nexport async function exportRecipientPrivateKeyPkcs8(pair: CryptoKeyPair): Promise<Uint8Array> {\n return new Uint8Array(await subtle.exportKey('pkcs8', pair.privateKey))\n}\n\n/** core#96 — rebuild a recipient pair from persisted PKCS#8 private + SPKI public bytes. */\nexport async function importRecipientKeyPair(pkcs8: Uint8Array, spki: Uint8Array): Promise<CryptoKeyPair> {\n const alg = { name: 'RSA-OAEP', hash: 'SHA-256' } as const\n const [privateKey, publicKey] = await Promise.all([\n subtle.importKey('pkcs8', pkcs8 as BufferSource, alg, false, ['decrypt']),\n subtle.importKey('spki', spki as BufferSource, alg, false, ['encrypt']),\n ])\n return { privateKey, publicKey }\n}\n\n// ─── Base64 Helpers ────────────────────────────────────────────────────\n\n\n","/**\n * The `_vdig` slot payload + crypto (stage 2, spec §2).\n *\n * A `_vdig[field]` blob is AES-256-GCM `\"iv:data\"` sealed under an\n * HKDF(CEK) slot key with AAD = ['noydb-classify-vdig', collection,\n * recordId, field] (C1 rollback-splice hardening). The AAD is NOT stored —\n * readers reconstruct it. It is deliberately `_v`-independent: C6's\n * carry-forward copies blob bytes verbatim across version bumps; the\n * same-record same-field TEMPORAL rollback residual is detected by the\n * ledger's conditional `_vdig` binding (envelope-body.ts).\n *\n * CEK-ONLY (I3): there is no DEK derivation and no\n * 'noydb-classify-vdig-dek' salt domain — every vdig slot dies with the\n * record's `_cek` (forget() shreds it totally; no vdig-dekResidue class).\n * @module\n */\nimport { encryptBytesWithAAD, decryptBytesWithAAD, type EnclaveKey } from '../crypto.js'\nimport { base64ToBuffer } from '../../plumbing/digest.js'\nimport { TamperedError } from '../../../kernel/errors.js'\n\nconst subtle = globalThis.crypto.subtle\n\nexport const VDIG_SALT_DOMAIN = 'noydb-classify-vdig'\n\nexport interface VdigDigestEntry {\n readonly salt: string // base64 32-byte per-write random salt\n readonly hash: string // base64 32-byte pbkdf2VerifyDigest output\n}\n\nexport interface VdigPayload {\n readonly v: 1\n readonly alg: 'PBKDF2-SHA256'\n readonly iter: number\n readonly cur: VdigDigestEntry & { readonly at: string } // ISO write-time\n /** Previous digests, oldest-first, length ≤ notLastN (cap 8). */\n readonly ring?: readonly VdigDigestEntry[]\n}\n\n/** Injective JSON-array AAD — same collision argument as deriveSealedFieldKey. */\nexport function buildVdigAad(collection: string, recordId: string, field: string): Uint8Array {\n return new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, recordId, field]))\n}\n\n/** HKDF(CEK) → non-extractable AES-256-GCM vdig slot key. CEK-only (I3). */\nexport async function deriveVdigSlotKey(\n cek: EnclaveKey,\n collection: string,\n field: string,\n): Promise<EnclaveKey> {\n const raw = await subtle.exportKey('raw', cek)\n const hkdf = await subtle.importKey('raw', raw, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode(VDIG_SALT_DOMAIN)\n const info = new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, field]))\n const bits = await subtle.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt, info }, hkdf, 256)\n return subtle.importKey('raw', bits, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt'])\n}\n\nexport async function sealVdigPayload(\n payload: VdigPayload,\n cek: EnclaveKey,\n collection: string,\n recordId: string,\n field: string,\n): Promise<string> {\n const key = await deriveVdigSlotKey(cek, collection, field)\n const { iv, data } = await encryptBytesWithAAD(\n new TextEncoder().encode(JSON.stringify(payload)),\n key,\n buildVdigAad(collection, recordId, field),\n )\n return `${iv}:${data}`\n}\n\n/** Throws TamperedError on any AAD / auth-tag mismatch (C1). */\nexport async function openVdigPayload(\n blob: string,\n cek: EnclaveKey,\n collection: string,\n recordId: string,\n field: string,\n): Promise<VdigPayload> {\n const sep = blob.indexOf(':')\n if (sep === -1) throw new TamperedError()\n const ivPart = blob.slice(0, sep)\n const dataPart = blob.slice(sep + 1)\n try {\n base64ToBuffer(ivPart)\n base64ToBuffer(dataPart)\n } catch {\n throw new TamperedError()\n }\n const key = await deriveVdigSlotKey(cek, collection, field)\n const bytes = await decryptBytesWithAAD(\n ivPart,\n dataPart,\n key,\n buildVdigAad(collection, recordId, field),\n )\n return JSON.parse(new TextDecoder().decode(bytes)) as VdigPayload\n}\n","/**\n * Digest-only write engine (C6 rotate branch + notLastN ring, spec §2/§4).\n * Called ONLY by RecordCodec.encryptRecord — both live inside the enclave.\n * @module\n */\nimport { type EnclaveKey } from '../crypto.js'\nimport { generateSalt, bufferToBase64, base64ToBuffer } from '../../plumbing/digest.js'\nimport { pbkdf2VerifyDigest, VDIG_ITERATIONS } from './digest.js'\nimport { normalizeForVerify } from '../../plumbing/normalize.js'\nimport { blindedEqual } from './compare.js'\nimport { sealVdigPayload, openVdigPayload, type VdigPayload, type VdigDigestEntry } from './vdig.js'\nimport { ClassifiedRotationError, TamperedError } from '../../../kernel/errors.js'\nimport type { VdigFieldPolicy } from '../../../kernel/types.js'\n\nexport async function mintVdigSlot(\n rawValue: string,\n policy: VdigFieldPolicy,\n prevBlob: string | undefined,\n cek: EnclaveKey,\n collection: string,\n recordId: string,\n field: string,\n): Promise<string> {\n const normalized = normalizeForVerify(policy.normalize, rawValue)\n\n let prev: VdigPayload | null = null\n if (prevBlob !== undefined) {\n try {\n prev = await openVdigPayload(prevBlob, cek, collection, recordId, field)\n } catch {\n // Any failure opening a prior _vdig slot (auth-tag mismatch, malformed\n // JSON, wrong AAD) is a tamper/false condition — normalize to\n // TamperedError so the write path never sees a distinct error shape.\n throw new TamperedError()\n }\n if (!Number.isInteger(prev.iter) || prev.iter < 1) {\n // A corrupted/tampered iter count would silently weaken (or break)\n // the reuse-check PBKDF2 pass — floor/validate before trusting it.\n throw new TamperedError()\n }\n }\n\n // notLastN reuse refusal: candidate vs cur + every ring entry, each a full\n // PBKDF2 at the payload's own iteration count (n × 600K is the documented\n // write-time cost ceiling, cap 8 — spec Q4).\n if (prev !== null && policy.notLastN > 0) {\n const history: readonly VdigDigestEntry[] = [prev.cur, ...(prev.ring ?? [])]\n for (const entry of history) {\n const digest = await pbkdf2VerifyDigest(normalized, base64ToBuffer(entry.salt), prev.iter)\n if (await blindedEqual(digest, base64ToBuffer(entry.hash))) {\n throw new ClassifiedRotationError(collection, field, 'password was used recently')\n }\n }\n }\n\n const salt = generateSalt()\n const hash = await pbkdf2VerifyDigest(normalized, salt, VDIG_ITERATIONS)\n const ring = prev !== null && policy.notLastN > 0\n ? [...(prev.ring ?? []), { salt: prev.cur.salt, hash: prev.cur.hash }].slice(-policy.notLastN)\n : undefined\n\n const payload: VdigPayload = {\n v: 1,\n alg: 'PBKDF2-SHA256',\n iter: VDIG_ITERATIONS,\n cur: { salt: bufferToBase64(salt), hash: bufferToBase64(hash), at: new Date().toISOString() },\n ...(ring !== undefined && ring.length > 0 ? { ring } : {}),\n }\n return sealVdigPayload(payload, cek, collection, recordId, field)\n}\n","/**\n * `enclave-aes` as a {@link CapsulePrimitives} — the 13 functions the shared\n * plumbing binds to.\n *\n * ⭐ THE ASSIGNMENT BELOW IS A TEST, and it is the reason this file exists as\n * a file rather than an inline object at the `makeCapsule()` call. Declaring\n * the seam type and implementing it are two different acts; nothing checks a\n * hand-written interface against the module it claims to describe unless\n * something binds one to the other. This binding caught two errors in the\n * declaration within minutes of it being written:\n *\n * - `deriveDeterministicKey` was declared `(dek, context)`. It takes ONE\n * argument — the AES capsule derives the context into the IV, not the key.\n * - `bufferToBase64` was declared `(bytes: Uint8Array)`. It also accepts an\n * `ArrayBuffer`, which is what its callers actually pass.\n *\n * Both would have compiled here and failed at the far end of the refactor,\n * where the cause is no longer visible. (The same lesson as `#16`: a\n * structural declaration drifts silently from its implementation until an\n * assignment pins the two together.)\n *\n * ⚠️ Method shorthand in `CapsulePrimitives` is checked BIVARIANTLY, so this\n * assignment does NOT catch parameter-arity drift — that is exactly how the\n * `deriveDeterministicKey` mistake survived the type and was caught by a call\n * site instead. Keep the conformance kit's call-site coverage; this assignment\n * is necessary, not sufficient.\n */\nimport type { CapsulePrimitives } from '../contract.js'\nimport { encrypt, decrypt, encryptBytesWithAAD, decryptBytesWithAAD, encryptDeterministic, deriveDeterministicKey, deriveSealedFieldKey, deriveSealedFieldKeyFromCek, generateDEK, wrapCek, unwrapCek } from './crypto.js'\nimport { bufferToBase64 } from '../plumbing/digest.js'\nimport { mintVdigSlot } from './classify/write.js'\nimport { mintBidxTag } from './classify/bidx.js'\nimport { openVdigPayload, sealVdigPayload } from './classify/vdig.js'\n\nexport const aesPrimitives: CapsulePrimitives = {\n encrypt,\n decrypt,\n encryptBytesWithAAD,\n decryptBytesWithAAD,\n encryptDeterministic,\n deriveDeterministicKey,\n deriveSealedFieldKey,\n deriveSealedFieldKeyFromCek,\n generateDEK,\n wrapCek,\n unwrapCek,\n bufferToBase64,\n mintVdigSlot,\n mintBidxTag,\n openVdigPayload,\n sealVdigPayload,\n}\n","/**\n * The AES capsule, assembled: hub's shared plumbing bound to `aesPrimitives`.\n *\n * `classify/**` stays capsule-private (it is an optional group an exclave\n * refuses) but still needs `dualReadSealedSlot`, which is plumbing. Binding it\n * once here keeps `reveal.ts`/`verify.ts` from each building their own copy —\n * two bindings of the same primitives would work, but they would be two\n * objects, and `instanceof` across them is the class of bug the Stage B door\n * test caught by asserting identity rather than names.\n */\nimport { makeCapsule } from '../plumbing/index.js'\nimport { aesPrimitives } from './primitives.js'\n\nexport const aesCapsule = makeCapsule(aesPrimitives)\nexport const { dualReadSealedSlot } = aesCapsule\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,SAAS,WAAW,OAAO;AAUjC,eAAsB,aAAa,GAAe,GAAiC;AACjF,QAAM,KAAK,MAAM,OAAO,YAAY,EAAE,MAAM,QAAQ,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;AACtF,QAAM,OAAO,IAAI,WAAW,MAAM,OAAO,KAAK,QAAQ,IAAI,CAAiB,CAAC;AAC5E,QAAM,OAAO,IAAI,WAAW,MAAM,OAAO,KAAK,QAAQ,IAAI,CAAiB,CAAC;AAC5E,SAAO,YAAY,MAAM,IAAI;AAC/B;;;ACmCA,IAAM,oBAAoB;AAE1B,IAAMA,UAAS,WAAW,OAAO;AAKjC,eAAsB,UACpB,QACA,MACoB;AACpB,SAAO,sBAAsB,IAAI,YAAY,EAAE,OAAO,MAAM,GAAG,IAAI;AACrE;AAOA,eAAe,sBACb,UACA,MACoB;AACpB,QAAM,cAAc,MAAMA,QAAO,UAAU,OAAO,UAA0B,UAAU,OAAO,CAAC,WAAW,CAAC;AAC1G,SAAOA,QAAO;AAAA,IACZ,EAAE,MAAM,UAAU,MAA4B,YAAY,mBAAmB,MAAM,UAAU;AAAA,IAC7F;AAAA,IACA,EAAE,MAAM,UAAU,QAAQ,SAAS;AAAA,IACn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,7 @@ import {
11
11
  filterRecords,
12
12
  fnViewDecoder,
13
13
  orderKeyOf
14
- } from "./chunk-ZVSKSUGI.js";
14
+ } from "./chunk-DWCFGF2K.js";
15
15
 
16
16
  // src/kernel/query/internal/maintenance.ts
17
17
  var MaintenanceMethods = class {
@@ -97,4 +97,4 @@ var MaintenanceMethods = class {
97
97
  export {
98
98
  MaintenanceMethods
99
99
  };
100
- //# sourceMappingURL=chunk-BNFNQNEP.js.map
100
+ //# sourceMappingURL=chunk-YJGKOSQD.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-4CFHL5RY.js";
10
10
  import {
11
11
  readPath
12
- } from "./chunk-BUE7R3B5.js";
12
+ } from "./chunk-GIQJGXV7.js";
13
13
 
14
14
  // src/with-lookup/indexing/index-snapshot.ts
15
15
  var FIELD_INDEX_SNAPSHOT_VERSION = 1;
@@ -933,4 +933,4 @@ export {
933
933
  normalizeIndexDefs,
934
934
  CollectionIndexes
935
935
  };
936
- //# sourceMappingURL=chunk-3V6LZHUO.js.map
936
+ //# sourceMappingURL=chunk-Z3STG43F.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NoydbError
3
- } from "./chunk-VSUQI5Q6.js";
3
+ } from "./chunk-IKPQ2GGB.js";
4
4
 
5
5
  // src/capsule/contract.ts
6
6
  function assertCapsuleSupports(caps, group, requirer) {
@@ -24,4 +24,4 @@ export {
24
24
  assertCapsuleSupports,
25
25
  CapsuleNotSupportedError
26
26
  };
27
- //# sourceMappingURL=chunk-ZBUAX4EF.js.map
27
+ //# sourceMappingURL=chunk-ZD7WFMV2.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  normalizeForVerify
3
- } from "./chunk-PUBI455O.js";
3
+ } from "./chunk-THQ3BHLM.js";
4
4
  import {
5
5
  NOYDB_FORMAT_VERSION,
6
6
  SealedHandle
7
- } from "./chunk-2ELOCEXE.js";
7
+ } from "./chunk-XX4R7TUB.js";
8
8
  import {
9
9
  ClassifiedConfigError,
10
10
  DebugReservedFieldError,
@@ -12,7 +12,7 @@ import {
12
12
  RecordCekNotFoundError,
13
13
  SchemaValidationError,
14
14
  ValidationError
15
- } from "./chunk-VSUQI5Q6.js";
15
+ } from "./chunk-IKPQ2GGB.js";
16
16
 
17
17
  // src/capsule/plumbing/record-aad.ts
18
18
  var SCHEME = "noydb-aad/2";
@@ -1372,4 +1372,4 @@ export {
1372
1372
  makeCapsule,
1373
1373
  ctEqualTags
1374
1374
  };
1375
- //# sourceMappingURL=chunk-OM3SEDI4.js.map
1375
+ //# sourceMappingURL=chunk-ZF6JECDT.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NonAdditiveSchemaChangeError,
3
3
  SchemaLockedError
4
- } from "./chunk-VSUQI5Q6.js";
4
+ } from "./chunk-IKPQ2GGB.js";
5
5
 
6
6
  // src/with-shape/schema-update/strategies.ts
7
7
  function blindUpdate() {
@@ -62,4 +62,4 @@ export {
62
62
  lockSchema,
63
63
  coordinatedCutover
64
64
  };
65
- //# sourceMappingURL=chunk-3Y5JLSXS.js.map
65
+ //# sourceMappingURL=chunk-ZF7KNSLU.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ReadOnlyFrameError
3
- } from "./chunk-VSUQI5Q6.js";
3
+ } from "./chunk-IKPQ2GGB.js";
4
4
 
5
5
  // src/with-fork/shadow/vault-frame.ts
6
6
  var VaultFrame = class {
@@ -71,4 +71,4 @@ export {
71
71
  VaultFrame,
72
72
  CollectionFrame
73
73
  };
74
- //# sourceMappingURL=chunk-B65CC6Z6.js.map
74
+ //# sourceMappingURL=chunk-ZGKODRGB.js.map
@@ -3,15 +3,15 @@ import {
3
3
  } from "./chunk-XBKH4FOC.js";
4
4
  import {
5
5
  normalizeJoinOn
6
- } from "./chunk-5UUJE4FP.js";
6
+ } from "./chunk-ICF3TIGY.js";
7
7
  import {
8
8
  sha256Hex
9
- } from "./chunk-4J3MNVVX.js";
9
+ } from "./chunk-WRLWEYHY.js";
10
10
  import {
11
11
  MaterializedViewConfigError,
12
12
  MaterializedViewSourceUnknownError,
13
13
  RefNotDeclaredError
14
- } from "./chunk-VSUQI5Q6.js";
14
+ } from "./chunk-IKPQ2GGB.js";
15
15
 
16
16
  // src/with-formula/materialized-views/dependency-analyzer.ts
17
17
  function analyzeDependencies(query) {
@@ -574,4 +574,4 @@ export {
574
574
  ungatedMvContext,
575
575
  wrapDbWithPredicates
576
576
  };
577
- //# sourceMappingURL=chunk-D4V5JJAK.js.map
577
+ //# sourceMappingURL=chunk-ZNEKQFGF.js.map
@@ -5,10 +5,10 @@ import {
5
5
  generateSigningKeyPair,
6
6
  openEnvelopeJson,
7
7
  sha256Hex
8
- } from "./chunk-4J3MNVVX.js";
8
+ } from "./chunk-WRLWEYHY.js";
9
9
  import {
10
10
  ConflictError
11
- } from "./chunk-VSUQI5Q6.js";
11
+ } from "./chunk-IKPQ2GGB.js";
12
12
 
13
13
  // src/with-audit/attestation/signer.ts
14
14
  var ATTESTATIONS_COLLECTION = "_attestations";
@@ -54,4 +54,4 @@ export {
54
54
  loadSigner,
55
55
  loadOrCreateSigner
56
56
  };
57
- //# sourceMappingURL=chunk-D5A3GCZ4.js.map
57
+ //# sourceMappingURL=chunk-ZUTUNVFD.js.map
@@ -2,20 +2,20 @@ import {
2
2
  BLOB_CHUNKS_COLLECTION,
3
3
  BLOB_COLLECTION,
4
4
  BLOB_INDEX_COLLECTION
5
- } from "./chunk-QXJXG7DN.js";
5
+ } from "./chunk-QFW4MYGN.js";
6
6
  import {
7
7
  installViaBinder
8
- } from "./chunk-PTJY5R3O.js";
8
+ } from "./chunk-NCTN2FW4.js";
9
9
  import {
10
10
  buildRecordAad,
11
11
  buildRecordEnvelope,
12
12
  encrypt,
13
13
  openEnvelopeJson
14
- } from "./chunk-4J3MNVVX.js";
14
+ } from "./chunk-WRLWEYHY.js";
15
15
  import {
16
16
  TamperedError,
17
17
  ValidationError
18
- } from "./chunk-VSUQI5Q6.js";
18
+ } from "./chunk-IKPQ2GGB.js";
19
19
 
20
20
  // src/via/blob/binding.ts
21
21
  async function eraseBlobs(ctx, cfg) {
@@ -472,4 +472,4 @@ export {
472
472
  BLOB_EVICTION_AUDIT_COLLECTION,
473
473
  runCompaction
474
474
  };
475
- //# sourceMappingURL=chunk-G5EDYVSE.js.map
475
+ //# sourceMappingURL=chunk-ZWMOHANW.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  matchesReferencingValue
3
- } from "./chunk-GETUTTZU.js";
3
+ } from "./chunk-C4XV3PSJ.js";
4
4
  import {
5
5
  PeriodClosedError
6
- } from "./chunk-VSUQI5Q6.js";
6
+ } from "./chunk-IKPQ2GGB.js";
7
7
 
8
8
  // src/kernel/via/dispatch.ts
9
9
  function touchFor(batch, collection) {
@@ -45,8 +45,8 @@ async function runGraphDispatchWave(vault, batch) {
45
45
  try {
46
46
  const stored = await coll._getStoredRecordForDispatch(id);
47
47
  if (!stored) continue;
48
- await coll.dispatchDerivations(id, stored.record, stored.version, wave);
49
- await coll.dispatchMaterializedViews(id, stored.record, wave);
48
+ await coll._dispatchDerivations(id, stored.record, stored.version, wave);
49
+ await coll._dispatchMaterializedViews(id, stored.record, wave);
50
50
  } catch (err) {
51
51
  console.warn(`[via-dispatch] wave recompute failed for ${collectionName}/${id}:`, err);
52
52
  vault._emit("derivation:wave-error", { collection: collectionName, id, error: err });
@@ -55,8 +55,8 @@ async function runGraphDispatchWave(vault, batch) {
55
55
  for (const [id, intents] of touch.deletes) {
56
56
  try {
57
57
  await coll._recomputeDeletedRollups(intents, wave);
58
- await coll.dispatchMaterializedViewsOnDelete(id);
59
- await coll.dispatchArrayDerivationsOnDelete(id);
58
+ await coll._dispatchMaterializedViewsOnDelete(id);
59
+ await coll._dispatchArrayDerivationsOnDelete(id);
60
60
  } catch (err) {
61
61
  console.warn(`[via-dispatch] wave delete-recompute failed for ${collectionName}/${id}:`, err);
62
62
  vault._emit("derivation:wave-error", { collection: collectionName, id, error: err });
@@ -99,7 +99,7 @@ function ledgerAuditHook(ledger, actor) {
99
99
  async function forgetDerivedFanout(vault, ref, envelope, stats, lookupCompareKeys) {
100
100
  const coll = vault._getCollection(ref.collection);
101
101
  if (coll) {
102
- const mv = await coll.dispatchMaterializedViewsOnDelete(ref.id);
102
+ const mv = await coll._dispatchMaterializedViewsOnDelete(ref.id);
103
103
  stats.recordsErased += mv.deleted;
104
104
  stats.derivedResidueUndecodable.push(...mv.residueUndecodable);
105
105
  stats.derivedResidueDeclined.push(...mv.residueDeclined);
@@ -113,12 +113,12 @@ async function forgetDerivedFanout(vault, ref, envelope, stats, lookupCompareKey
113
113
  stats.lookupReferencesResidue.push(...residue);
114
114
  }
115
115
  if (edges.some((e) => e.kind === "derivation")) {
116
- stats.recordsErased += await coll.dispatchArrayDerivationsOnDelete(ref.id, true);
116
+ stats.recordsErased += await coll._dispatchArrayDerivationsOnDelete(ref.id, true);
117
117
  }
118
118
  if (envelope && edges.some((e) => e.kind === "rollup")) {
119
119
  const priorRecord = await coll._decodeEnvelope(envelope, ref.id);
120
120
  if (priorRecord) {
121
- for (const r of await coll.dispatchRollupsOnDelete(ref.id, priorRecord)) {
121
+ for (const r of await coll._dispatchRollupsOnDelete(ref.id, priorRecord)) {
122
122
  if (r.outcome === "written") stats.aggregatesRecomputed += 1;
123
123
  else if (r.outcome === "skipped-frozen") stats.residueFrozen.push(`${r.into}:${r.parentId}`);
124
124
  }
@@ -173,4 +173,4 @@ export {
173
173
  forgetDerivedFanout,
174
174
  selfWriteFieldEqual
175
175
  };
176
- //# sourceMappingURL=chunk-CAD7N6HQ.js.map
176
+ //# sourceMappingURL=chunk-ZZZ4VCY2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/kernel/via/dispatch.ts"],"sourcesContent":["// kernel/via/dispatch.ts — the batched, origin-aware sync/cutover/restore dispatch wave\n// (Via port phase C, #638 Task 4, fixes #621).\n//\n// `Collection._onRecordMutated`'s `sync-apply`/`cutover`/`restore` cases feed touched\n// (collection, id) pairs into a per-session `GraphBatch` (owned by `Vault._collectGraphTouch`)\n// instead of dispatching inline — the `local-write` path keeps its own byte-identical inline\n// dispatch (`wave` stays `undefined` there, per the spec's behavior lock). At batch-flush time\n// `runGraphDispatchWave` decrypts each touched record (id threaded into the decrypt, matching\n// the phase-B at-rest contract) and re-runs the SAME `dispatchDerivations`/\n// `dispatchMaterializedViews` the local-write path uses, sharing one `WaveContext` so N touched\n// records feeding the SAME rollup/MV target recompute exactly once (per-target dedup).\n// See design-history/2026-07-11-via-phase-c-design.md §3.\n\nimport type { ViaGraph } from './graph.js'\nimport type { Collection } from '../collection.js'\nimport type { EncryptedEnvelope } from '../types.js'\nimport { PeriodClosedError } from '../errors.js'\nimport { matchesReferencingValue } from '../../port/with/lookup-strategy.js'\n\n/** One deleted child's resolved rollup PARENT intent (#640) — ids + a field name only. A\n * resolved `parentId` is an id, same class as any touched record id — never a stored value. */\nexport interface RollupDeleteIntent {\n readonly into: string\n readonly parentId: string\n readonly field: string\n}\n\n/** One collection's batched touches this session (#640 widens the #638 `Set<string>` shape):\n * `puts` — the original semantics, unchanged; `deletes` — a deleted record's id mapped to its\n * resolved rollup-parent intents, captured PRE-invalidation by `Collection._onRecordMutated`'s\n * sync-apply delete case (the FK is only readable there — see `kernel/collection.ts\n * #_rollupDeleteIntents`). */\nexport interface GraphTouch {\n readonly puts: Set<string>\n readonly deletes: Map<string, readonly RollupDeleteIntent[]>\n}\n\n/** Per-session touched set — collection → its `GraphTouch`. Metadata only — ids (collection\n * names, record ids INCLUDING resolved rollup parent ids) and field names; NEVER record payload\n * or key material. A resolved parentId is an id, same class as the touched ids — not a stored\n * value. */\nexport type GraphBatch = Map<string, GraphTouch>\n\n/** Get-or-create `batch`'s `GraphTouch` entry for `collection` (#640) — shared by\n * `Vault._collectGraphTouch`/`_collectGraphDelete` so each stays a one-line call. */\nexport function touchFor(batch: GraphBatch, collection: string): GraphTouch {\n let t = batch.get(collection)\n if (!t) {\n t = { puts: new Set(), deletes: new Map() }\n batch.set(collection, t)\n }\n return t\n}\n\n/** #640 — sync, I/O-free: `deleted`'s resolved rollup PARENT intents (the FK is only readable\n * NOW, before the record is gone) — a pure function so `Collection._rollupDeleteIntents` stays\n * a one-line delegator under the kernel-surface ceiling. `registry` is `this.derivationSource\n * ?.registry()`; `collectionName` is `this.name` (the CHILD/`rollup.from` side). Generic over\n * the registry's own spec shape so this file never imports a `with-formula` type (port-layering\n * — via/dispatch.ts must not gain a with-* import). */\nexport function resolveRollupDeleteIntents<S extends { source: string; rollup?: { from: string; key: string; field: string } }>(\n registry: { strategiesForSource(name: string): ReadonlyArray<{ spec: S }> } | undefined,\n collectionName: string,\n deleted: Record<string, unknown>,\n): RollupDeleteIntent[] {\n if (!registry) return []\n const intents: RollupDeleteIntent[] = []\n for (const { spec } of registry.strategiesForSource(collectionName)) {\n if (!spec.rollup || spec.rollup.from !== collectionName) continue\n const kv = deleted[spec.rollup.key]\n if (typeof kv === 'string' || typeof kv === 'number') intents.push({ into: spec.source, parentId: String(kv), field: spec.rollup.field })\n }\n return intents\n}\n\n/** #640 — resolve a `RollupDeleteIntent` back to its registry `spec`. The wave's per-intent\n * driver needs `spec.rollup.compute`, which `GraphBatch`'s metadata-only pin forbids batching —\n * so it's re-resolved here, post-boundary, instead of carried across it. `undefined` if the\n * intent's originating strategy was unregistered between collect time and wave time (residual\n * gap, freshness-only). */\nexport function findRollupSpecForIntent<S extends { source: string; rollup?: { from: string; field: string } }>(\n registry: { strategiesForSource(name: string): ReadonlyArray<{ spec: S }> } | undefined,\n collectionName: string,\n intent: RollupDeleteIntent,\n): S | undefined {\n return registry?.strategiesForSource(collectionName).find((s) => s.spec.source === intent.into && s.spec.rollup?.field === intent.field && s.spec.rollup?.from === collectionName)?.spec\n}\n\n/** One dedup ledger for a single wave — a target is recomputed at most once (mark-on-check). */\nexport class WaveContext {\n private readonly _seen = new Set<string>()\n seen(targetKey: string): boolean {\n if (this._seen.has(targetKey)) return true\n this._seen.add(targetKey)\n return false\n }\n}\n\n/** The slice of `Vault` the wave needs: the shared graph (the #553 zero-cost skip) and cached-\n * collection lookup — never constructs, since a touched collection is, by construction,\n * already open (it just fired `_onRecordMutated`). */\nexport interface VaultLike {\n readonly graph: ViaGraph\n _getCollection(name: string): Collection<Record<string, unknown>> | undefined\n /** #640 (#644 item 3) — structured wave-error surfacing, additive to the existing console.warn. */\n _emit(event: string, payload: unknown): void\n}\n\n/**\n * Run ONE dispatch wave for a completed batch: for each touched (collection, id), decrypt the\n * applied envelope (id threaded), then run the SAME `dispatchDerivations` +\n * `dispatchMaterializedViews` the local-write path uses — with a shared `WaveContext` so N\n * touched records feeding the SAME target recompute once. #553: a collection with no graph\n * out-edges (e.g. money-only) is skipped before any decrypt/dispatch async work.\n */\nexport async function runGraphDispatchWave(vault: VaultLike, batch: GraphBatch): Promise<void> {\n const wave = new WaveContext()\n for (const [collectionName, touch] of batch) {\n if (vault.graph.dependentsOf(collectionName).length === 0) continue\n const coll = vault._getCollection(collectionName)\n if (!coll) continue\n for (const id of touch.puts) {\n try {\n // Decrypt is INSIDE the per-id isolation boundary (whole-branch review Important\n // finding, #638): an undecryptable synced envelope (`TamperedError`) must not\n // escape `_getStoredRecordForDispatch` and abort the wave — that would propagate\n // through `_flushGraphBatch` and reject the surrounding `SyncEngine.pull`/`push`\n // AFTER records were already applied + meta persisted, starving every other\n // touched target in the same batch.\n const stored = await coll._getStoredRecordForDispatch(id)\n if (!stored) continue\n await coll._dispatchDerivations(id, stored.record, stored.version, wave)\n await coll._dispatchMaterializedViews(id, stored.record, wave)\n } catch (err) {\n // #638 Task 5 review mandate: one touched record's recompute must not abort the\n // whole wave (starving co-batched healthy targets) or the pull/push it's nested\n // inside. `PeriodClosedError` never reaches here — `putDerivedOutput` already\n // intercepts it at every output-write call site and turns it into a skip+event.\n // Anything else (a genuine decrypt failure, a derive()/executor bug, a schema\n // violation on the output, ...) is surfaced — not silently swallowed — via the\n // SAME console.warn channel `dispatchDerivations`/the MV executor already use for\n // their own non-strict-mode output failures, then isolated to just this one id.\n // #644 item 3: ADDITIVELY (never in place of the warn) emit a structured event too,\n // so a listener doesn't have to scrape console output to react to a wave failure.\n console.warn(`[via-dispatch] wave recompute failed for ${collectionName}/${id}:`, err)\n vault._emit('derivation:wave-error', { collection: collectionName, id, error: err })\n }\n }\n // #640 — delete-kind touches: the deleted child's rollup-parent intents, resolved (sync,\n // pre-invalidation) at collect time by `Collection._rollupDeleteIntents`. Same per-id\n // isolation as the puts loop above. #658: the wave now ALSO heals MV rows and array-shape\n // derivation output rows for the deleted child — parity with the local-delete boundary\n // (`Collection._doDelete`'s `!internal` block, which already calls all three). Still never\n // routed through `dispatchDerivations` (the mutation-choke-point.test.ts:85-99 pin — sync-\n // applied deletes never RE-DERIVE); `dispatchMaterializedViewsOnDelete`/\n // `dispatchArrayDerivationsOnDelete` only need `id` (MV refresh recomputes+diffs; array-\n // derivation reads its per-source sidecar) and never call `derive()`, so the pin holds.\n for (const [id, intents] of touch.deletes) {\n try {\n await coll._recomputeDeletedRollups(intents, wave)\n // #658: record-shape same-id outputs are left untouched (eraseRecordShapeToo defaults\n // false), matching local delete — the user deletes those directly if wanted.\n // #658: TODO dedup MV refresh per wave — `dispatchMaterializedViewsOnDelete` doesn't\n // accept a `WaveContext` (unlike the put-path `dispatchMaterializedViews`), so N deleted\n // children of one eager MV in a batch each trigger a full refresh pass. Threading `wave`\n // through would touch collection.ts's zero-slack kernel-surface ceiling for a perf-only\n // win; correctness doesn't depend on it (idempotent per source-id) — left as a follow-up.\n await coll._dispatchMaterializedViewsOnDelete(id)\n await coll._dispatchArrayDerivationsOnDelete(id)\n } catch (err) {\n console.warn(`[via-dispatch] wave delete-recompute failed for ${collectionName}/${id}:`, err)\n vault._emit('derivation:wave-error', { collection: collectionName, id, error: err })\n }\n }\n }\n}\n\n/** A record's post-freeze source mutation, for the `'derivation:skipped-frozen'` event\n * and the optional audit-trail entry. See {@link putDerivedOutput}. */\nexport interface DerivationSkippedFrozen {\n readonly source: { readonly collection: string; readonly id: string }\n readonly target: { readonly collection: string; readonly id: string }\n readonly period: string\n readonly endDate: string\n}\n\n/** The minimal put-capable shape `putDerivedOutput` needs. Any `Collection<T>` structurally\n * satisfies this — its real `options` type is a superset of what's declared here. */\nexport interface CollectionLike {\n put(id: string, value: unknown, options?: { readonly source?: string }): Promise<void>\n}\n\nexport interface PutDerivedOutputCtx {\n readonly emit: (ev: string, p: unknown) => void\n readonly source: { readonly collection: string; readonly id: string }\n readonly audit?: ((e: DerivationSkippedFrozen) => Promise<void>) | undefined\n}\n\n/**\n * Attempt a dispatch-driven output write. On `PeriodClosedError` (the closed-period\n * `beforePut` gate — `freezePeriod`/`archivePeriod` add no separate gate, per seam map\n * Part 7): SKIP (no `_ts` stamped — the gate throws before any write happens), emit\n * `'derivation:skipped-frozen'` on the event bus (ALWAYS), and append an audit-trail entry\n * when the with-history ledger is active. Returns `'written' | 'skipped-frozen'`. Any OTHER\n * error propagates unchanged — this helper narrows exactly one error class. The SOURCE\n * write is never wrapped through this helper — only derived-output writes are (§7).\n */\nexport async function putDerivedOutput(\n outColl: CollectionLike, id: string, value: unknown,\n ctx: PutDerivedOutputCtx,\n options?: { readonly source?: string },\n): Promise<'written' | 'skipped-frozen'> {\n try {\n await outColl.put(id, value, options)\n return 'written'\n } catch (err) {\n if (!(err instanceof PeriodClosedError)) throw err\n // Reach-around for the target collection's private `name` — the SAME pattern\n // `with-formula/materialized-views/executor.ts`'s `listOutputIds` already uses to\n // read a `Collection`'s private `adapter`/`vault`/`name` fields from outside the class.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const targetCollection = (outColl as any).name as string\n const event: DerivationSkippedFrozen = {\n source: ctx.source,\n target: { collection: targetCollection, id },\n period: err.periodName,\n endDate: err.endDate,\n }\n ctx.emit('derivation:skipped-frozen', event)\n if (ctx.audit) await ctx.audit(event)\n return 'skipped-frozen'\n }\n}\n\n/** Structural (no static import — kernel spine may not statically reach a with-* service,\n * the S4 gate recipe `check-architecture.mjs`'s port-layering check enforces) shape of the\n * with-history `LedgerStore.append` seam this helper needs. */\ninterface AuditLedgerLike {\n append(input: {\n readonly op: 'lifecycle'\n readonly collection: string\n readonly id: string\n readonly version: number\n readonly actor: string\n readonly payloadHash: string\n readonly reason?: string\n }): Promise<unknown>\n}\n\n/** @internal — the optional with-history ledger audit hook for `putDerivedOutput`, present\n * only when the ledger is active (mirrors every other kernel event's `if (this.ledger)`\n * gate). Encoded as a `'lifecycle'` entry — the existing \"non-data audit event\" op (the\n * same convention `forget`'s JSON-summary-in-`reason` entry uses; `ledger/entry.ts:88-104`). */\nexport function ledgerAuditHook(\n ledger: AuditLedgerLike | undefined, actor: string,\n): ((e: DerivationSkippedFrozen) => Promise<void>) | undefined {\n if (!ledger) return undefined\n return async (e) => {\n await ledger.append({\n op: 'lifecycle', collection: e.target.collection, id: e.target.id, version: 0, actor, payloadHash: '',\n reason: JSON.stringify({ event: 'derivation-skipped-frozen', ...e }),\n })\n }\n}\n\n/** `recomputeRollup`/`dispatchRollupsOnDelete`'s per-target write outcome (#638 Task 6):\n * `'written'`/`'skipped-frozen'` mirror {@link putDerivedOutput}'s result; `'noop'` covers\n * no-parent/no-change/deduped-by-wave — nothing to report either way. */\nexport type RollupOutcome = 'written' | 'skipped-frozen' | 'noop'\n\n/** Mutable accumulator `forgetDerivedFanout` writes into, one per `Vault.forget()` call — keeps\n * the per-ref loop's call site to a single line under vault.ts's tight kernel-surface ceiling.\n * Maps 1:1 onto `ForgetResult`'s additive fields (`with-audit/forget/strategy.ts`). */\nexport interface ForgetFanoutStats {\n recordsErased: number\n aggregatesRecomputed: number\n readonly residueFrozen: string[]\n /** #650 Task 5 (#648) — referencing records tombstoned via a `'ref'` edge's `cascade` policy. */\n lookupReferencesCascaded: number\n /** #650 Task 5 (#648) — referencing fields cleared via a `'ref'` edge's `nullify` policy. */\n lookupReferencesNullified: number\n /** #650 Task 5 review (Important fix) — `'ref'` edges whose compare-key could NOT be resolved,\n * even from the LIVE pre-shred row (the backing row itself is unreadable) — propagation was\n * skipped for these, reported here so the skip is never silent. `backing:key:collection.field`\n * entries, one per un-propagated edge. */\n readonly lookupReferencesResidue: string[]\n /** #776/#782/#785 — `outputCollection:id` MV-output rows that survived erasure invalidation\n * (eager tombstone leg AND lazy/manual `invalidateMVAtRest`) despite belonging to the\n * forgotten subject, because the ownership stamp could not be decoded (undecodable under\n * the default DEK — e.g. elevated above tier 0 on a tiered output collection). Ownership\n * UNCONFIRMED. Never erased, but surfaced here rather than silently skipped. */\n readonly derivedResidueUndecodable: string[]\n /** #782/#785 — `outputCollection:id` MV-output rows that decoded and stamp-matched but whose\n * `_internalDelete` declined (the #718 tier-elevation gate). Ownership CONFIRMED, erasure\n * declined — a real silent survival, surfaced here rather than silently skipped. */\n readonly derivedResidueDeclined: string[]\n}\n\n/**\n * #622 — after `_writeTombstone(ref.id, actor)` erases the forgotten subject's own record, fan\n * out to its derived residue via the graph (spec §5): record-grain artifacts (MV rows,\n * array-shape derivation rows, same-id record-shape derivation copies) are ERASED through the\n * SAME `!internal` housekeeping-bypass machinery the ordinary delete path uses (no user\n * `onDelete` re-fires — the shred-is-not-a-domain-delete property `_writeTombstone` protects);\n * aggregate-grain rollups are RECOMPUTED without the forgotten contribution in open periods, or\n * skip+audit (via `putDerivedOutput`, already wired into the rollup/MV output paths) in frozen\n * ones. Mutates `stats` in place. `envelope` is `ref`'s PRE-tombstone envelope, decoded only if\n * a rollup edge is actually present — the #553 zero-cost-skip discipline: no decrypt for the\n * common case of a forgotten record with no aggregate-grain consumer, and no work at all when\n * `ref.collection` has no graph out-edges. `lookupCompareKeys` is the `'ref'` edges' compare-key\n * map, resolved from the LIVE row BEFORE any shred (`VaultLinks.checkLookupRefsRestrict`'s return\n * value — `Vault.forget()`'s pre-shred restrict check doubles as the live-resolve pass) — see\n * {@link applyLookupRefsFanout}.\n */\nexport async function forgetDerivedFanout(\n vault: VaultLike,\n ref: { readonly collection: string; readonly id: string },\n envelope: EncryptedEnvelope | null,\n stats: ForgetFanoutStats,\n lookupCompareKeys: ReadonlyMap<string, string | undefined>,\n): Promise<void> {\n const coll = vault._getCollection(ref.collection)\n\n // #761 item 4 — drive the MV arm off `dispatchMaterializedViewsOnDelete` UNCONDITIONALLY,\n // ABOVE the `edges` check below: `registry.edges()` drops the same-collection\n // partition-disjoint MV edge (registry.ts's `sources.length === 0 → continue`), so a\n // same-collection MV's source collection never appears in `vault.graph`'s derived-artifact\n // edges even though the MV IS registered — forget() would otherwise never reach it.\n // `dispatchMaterializedViewsOnDelete` self-guards O(1) via `mvsForSource` (a no-op when\n // this collection isn't an MV source), so this is safe to call unconditionally. Safe to\n // route through the eager executor's tombstone leg ONLY because that leg is now\n // stamp-scoped (#762) — before that fix this would have opened a NEW forget-time\n // data-loss path into the unscoped tombstone diff.\n if (coll) {\n const mv = await coll._dispatchMaterializedViewsOnDelete(ref.id)\n stats.recordsErased += mv.deleted\n stats.derivedResidueUndecodable.push(...mv.residueUndecodable)\n stats.derivedResidueDeclined.push(...mv.residueDeclined)\n }\n\n const edges = vault.graph.derivedArtifactsOf(ref.collection)\n if (edges.length === 0 || !coll) return\n\n // #650 Task 5 (#648) — 'ref' cascade/nullify propagate ADDITIVELY, here, AFTER the shred\n // (restrict already refused BEFORE any shred — the caller's pre-tombstone check, spec §4).\n // The I/O shell (loop shape, collection accessor) is duplicated, not imported, from\n // `VaultLinks.applyLookupRefsPropagation`/`checkLookupRefsRestrict` (with-shape/links/\n // vault-facade.ts) — the kernel spine may not statically import a with-* service\n // (port-layering, the #638 Task 5 via/dispatch.ts precedent); `vault._getCollection` is\n // cached-only while `VaultLinks`' accessor constructs. The pure match predicate itself is\n // shared through the port seam (#651 Task 3 — `matchesReferencingValue`, `port/with/\n // lookup-strategy.ts`), so only the shell, not the coercion logic, stays duplicated. A\n // referencing edge whose dimension uses a non-default `key` (matrix tier only) needs the\n // backing row's OWN value at that field, not its PUT-id — the row is ALREADY tombstoned by\n // now, so it's read from `lookupCompareKeys`, resolved by the caller from the LIVE row\n // BEFORE the shred (#650 Task 5 review, Important fix — eliminates the post-shred\n // envelope-decode dependency this used to have, which silently skipped propagation whenever\n // that decode failed).\n if (edges.some((e) => e.kind === 'ref')) {\n const { cascaded, nullified, residue } = await applyLookupRefsFanout(vault, ref.collection, ref.id, lookupCompareKeys)\n stats.lookupReferencesCascaded += cascaded\n stats.lookupReferencesNullified += nullified\n stats.lookupReferencesResidue.push(...residue)\n }\n\n if (edges.some((e) => e.kind === 'derivation')) {\n // #622 review Finding 1: count REAL erasures (dispatchArrayDerivationsOnDelete's own\n // `_internalDelete`-backed tally), not the derivation EDGE count — an edge exists whenever\n // this collection is ANY trigger (source/sources[]/triggerBy), but the same-id record-shape\n // guard only erases for `spec.source === this.name`, and `derive()` may never have produced\n // an output row (optional-skip) in the first place. Both cases must contribute 0, not +1.\n stats.recordsErased += await coll._dispatchArrayDerivationsOnDelete(ref.id, true)\n }\n\n if (envelope && edges.some((e) => e.kind === 'rollup')) {\n const priorRecord = await coll._decodeEnvelope(envelope, ref.id)\n if (priorRecord) {\n for (const r of await coll._dispatchRollupsOnDelete(ref.id, priorRecord)) {\n if (r.outcome === 'written') stats.aggregatesRecomputed += 1\n else if (r.outcome === 'skipped-frozen') stats.residueFrozen.push(`${r.into}:${r.parentId}`)\n }\n }\n }\n}\n\n/**\n * Apply `cascade`/`nullify` propagation for `backing`'s non-restrict `'ref'` edges — the\n * forget-path counterpart of `VaultLinks.applyLookupRefsPropagation` (I/O shell duplicated, not\n * imported, match predicate shared via the port — see {@link forgetDerivedFanout}'s call site\n * comment). `restrict` edges are skipped here: the\n * forget loop's `checkLookupRefsRestrict`-equivalent call already refused (or the reference no\n * longer existed) BEFORE `_writeTombstone` ran, so by the time this runs only cascade/nullify\n * remain to propagate. `compareKeys` is the non-`'id'`-`keyField` compare-value map, resolved by\n * the caller from the LIVE row BEFORE the shred (#650 Task 5 review, Important fix) — the live row\n * is already shredded by the time THIS function runs, so it can no longer resolve one itself. A\n * `keyField` absent from (or `undefined` in) the map means that live resolve failed too — the edge\n * is reported as residue instead of silently skipped (never a bare `continue` with no trace).\n */\nasync function applyLookupRefsFanout(\n vault: VaultLike,\n backing: string,\n key: string,\n compareKeys: ReadonlyMap<string, string | undefined>,\n): Promise<{ cascaded: number; nullified: number; residue: string[] }> {\n let cascaded = 0\n let nullified = 0\n const residue: string[] = []\n for (const { referencing, onDelete, keyField } of vault.graph.referencingEdgesOf(backing)) {\n if (onDelete === 'restrict') continue\n const compareKey = keyField === 'id' ? key : compareKeys.get(keyField)\n if (compareKey === undefined) {\n residue.push(`${backing}:${key}:${referencing.collection}.${referencing.field}`)\n continue\n }\n const coll = vault._getCollection(referencing.collection)\n if (!coll) continue\n const matches = (await coll.list()).filter((rec) => matchesReferencingValue(rec, referencing.field, compareKey))\n for (const rec of matches) {\n const id = rec['id'] as string | undefined\n if (id === undefined) continue\n if (onDelete === 'cascade') {\n await coll.delete(id)\n cascaded++\n } else if (onDelete === 'nullify') {\n await coll.put(id, { ...rec, [referencing.field]: null })\n nullified++\n }\n }\n }\n return { cascaded, nullified, residue }\n}\n\n/**\n * Value-equality for a single self-write reverse-denorm field. Scalars\n * compare by identity; objects by canonical JSON (denorm values should be\n * deterministically shaped). Used as the cycle guard — when every denorm\n * field already matches, no write is issued and the self-write recursion ends.\n */\nexport function selfWriteFieldEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true\n if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') return false\n try {\n return JSON.stringify(a) === JSON.stringify(b)\n } catch {\n return false\n }\n}\n"],"mappings":";;;;;;;;AA6CO,SAAS,SAAS,OAAmB,YAAgC;AAC1E,MAAI,IAAI,MAAM,IAAI,UAAU;AAC5B,MAAI,CAAC,GAAG;AACN,QAAI,EAAE,MAAM,oBAAI,IAAI,GAAG,SAAS,oBAAI,IAAI,EAAE;AAC1C,UAAM,IAAI,YAAY,CAAC;AAAA,EACzB;AACA,SAAO;AACT;AAQO,SAAS,2BACd,UACA,gBACA,SACsB;AACtB,MAA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withClassified
5
- } from "../chunk-226V6XXJ.js";
5
+ } from "../chunk-IQAJ4OR6.js";
6
6
  import {
7
7
  ClassifiedNeverStoredError,
8
8
  ClassifiedValidationError,
@@ -11,15 +11,15 @@ import {
11
11
  isClassifiedFieldSpec,
12
12
  isClassifiedGroup,
13
13
  resolveClassifiedFields
14
- } from "../chunk-K673OO6B.js";
15
- import "../chunk-PTJY5R3O.js";
16
- import "../chunk-2ELOCEXE.js";
14
+ } from "../chunk-JAQHWHUN.js";
15
+ import "../chunk-NCTN2FW4.js";
16
+ import "../chunk-XX4R7TUB.js";
17
17
  import {
18
18
  ClassifiedConfigError,
19
19
  ClassifiedRevealError,
20
20
  ClassifiedRotationError,
21
21
  ClassifiedVerifyError
22
- } from "../chunk-VSUQI5Q6.js";
22
+ } from "../chunk-IKPQ2GGB.js";
23
23
  export {
24
24
  ClassifiedConfigError,
25
25
  ClassifiedNeverStoredError,
@@ -11,11 +11,11 @@ function markerForFields(vdigFields) {
11
11
  async function persistClassifiedMarkerForFields(store, vault, collectionName, vdigFields, dek) {
12
12
  const marker = markerForFields(vdigFields);
13
13
  if (marker === null) return;
14
- const { persistClassifiedMarker } = await import("./register-SN72QALV.js");
14
+ const { persistClassifiedMarker } = await import("./register-YJ5YLQ36.js");
15
15
  await persistClassifiedMarker({ store, vault, collectionName, dek, marker });
16
16
  }
17
17
  async function readClassifiedMarkerDigestOnly(store, vault, collectionName, dek) {
18
- const { loadPersistedSchema } = await import("./storage-NPBYP2SM.js");
18
+ const { loadPersistedSchema } = await import("./storage-VH6SPXHC.js");
19
19
  const persisted = await loadPersistedSchema(store, vault, collectionName, dek);
20
20
  return persisted?.classified?.digestOnly ?? [];
21
21
  }
@@ -23,4 +23,4 @@ export {
23
23
  persistClassifiedMarkerForFields,
24
24
  readClassifiedMarkerDigestOnly
25
25
  };
26
- //# sourceMappingURL=classified-marker-KHDOYIJB.js.map
26
+ //# sourceMappingURL=classified-marker-WKP33U2R.js.map