@noy-db/hub 0.6.0-pre.8 → 0.6.0

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 (512) hide show
  1. package/CHANGELOG.md +7079 -0
  2. package/codemods/0.6.0-pre.json +211 -0
  3. package/dist/api-6X2VLZ7J.js +20 -0
  4. package/dist/attestation/index.js +19 -19
  5. package/dist/{backup-KULFZ2T4.js → backup-VL4GRIEW.js} +36 -18
  6. package/dist/backup-VL4GRIEW.js.map +1 -0
  7. package/dist/blobs/index.js +22 -20
  8. package/dist/blobs/index.js.map +1 -1
  9. package/dist/broker/index.js +12 -12
  10. package/dist/cargo/index.js +35 -35
  11. package/dist/{chunk-KUDZVJKQ.js → chunk-22GR3O4J.js} +2 -2
  12. package/dist/{chunk-CCZJJ4I2.js → chunk-2CBFYXJX.js} +6 -6
  13. package/dist/{chunk-JJNOLSG5.js → chunk-2J5IT37K.js} +15 -16
  14. package/dist/chunk-2J5IT37K.js.map +1 -0
  15. package/dist/{chunk-PNKHAKQ7.js → chunk-2ZCWHCLF.js} +17 -10
  16. package/dist/chunk-2ZCWHCLF.js.map +1 -0
  17. package/dist/{chunk-2BMRJ6LQ.js → chunk-2ZT4INZ4.js} +8 -11
  18. package/dist/{chunk-2BMRJ6LQ.js.map → chunk-2ZT4INZ4.js.map} +1 -1
  19. package/dist/{chunk-FAXZQ5UF.js → chunk-323MN67Z.js} +2 -2
  20. package/dist/{chunk-VMCCGUQB.js → chunk-36CEG6CM.js} +2 -2
  21. package/dist/{chunk-PDLLCOGD.js → chunk-3OE2QNSM.js} +20 -17
  22. package/dist/chunk-3OE2QNSM.js.map +1 -0
  23. package/dist/{chunk-AHLJSVRL.js → chunk-3YGUHUJA.js} +5 -7
  24. package/dist/chunk-3YGUHUJA.js.map +1 -0
  25. package/dist/{chunk-ZJADGNYF.js → chunk-4AOERLTV.js} +1 -1
  26. package/dist/chunk-4AOERLTV.js.map +1 -0
  27. package/dist/{chunk-J7FM3RAU.js → chunk-4ATF4BLF.js} +87 -34
  28. package/dist/chunk-4ATF4BLF.js.map +1 -0
  29. package/dist/{chunk-747LRSOO.js → chunk-4K6BIMLF.js} +2 -2
  30. package/dist/{chunk-PXCBVDFY.js → chunk-5ATC6UT4.js} +40 -7
  31. package/dist/chunk-5ATC6UT4.js.map +1 -0
  32. package/dist/{chunk-4GZ6XOVW.js → chunk-5F7BZAGV.js} +44 -42
  33. package/dist/chunk-5F7BZAGV.js.map +1 -0
  34. package/dist/{chunk-FNSMZQS4.js → chunk-5IHGJHWC.js} +2 -2
  35. package/dist/{chunk-4I72F5DF.js → chunk-5LZZQMIC.js} +11 -14
  36. package/dist/chunk-5LZZQMIC.js.map +1 -0
  37. package/dist/{chunk-JXIDGFKS.js → chunk-5O5ZSW7N.js} +4 -2
  38. package/dist/chunk-5O5ZSW7N.js.map +1 -0
  39. package/dist/{chunk-CEJWMBXO.js → chunk-5OT4G5N5.js} +6 -2
  40. package/dist/chunk-5OT4G5N5.js.map +1 -0
  41. package/dist/{chunk-GAG7QOVO.js → chunk-64WHKBMP.js} +53 -18
  42. package/dist/chunk-64WHKBMP.js.map +1 -0
  43. package/dist/{chunk-7TSYBD3E.js → chunk-65JXA63J.js} +2 -2
  44. package/dist/{chunk-Z45YRGFO.js → chunk-6NR36UNB.js} +2 -2
  45. package/dist/{chunk-W77KZHCW.js → chunk-6RH7PRTL.js} +16 -17
  46. package/dist/chunk-6RH7PRTL.js.map +1 -0
  47. package/dist/{chunk-3JVXVJ7L.js → chunk-7OBIBPCV.js} +10 -10
  48. package/dist/{chunk-AR2JDFAE.js → chunk-7Q3RHOA5.js} +2 -2
  49. package/dist/chunk-7ZGPQOFV.js +190 -0
  50. package/dist/chunk-7ZGPQOFV.js.map +1 -0
  51. package/dist/{chunk-QULVCV3M.js → chunk-AJGGBXWA.js} +4 -4
  52. package/dist/{chunk-CADUYBQD.js → chunk-ATL3ZVXT.js} +2 -2
  53. package/dist/{chunk-DMQCLZ4Z.js → chunk-ATY3ZASK.js} +2 -2
  54. package/dist/{chunk-4HDYQL3J.js → chunk-B4CRUZPR.js} +2 -2
  55. package/dist/{chunk-IMZLOJTK.js → chunk-BMU2DS3S.js} +30 -21
  56. package/dist/chunk-BMU2DS3S.js.map +1 -0
  57. package/dist/{chunk-6SAFL5YE.js → chunk-BZ3WMOYX.js} +3 -3
  58. package/dist/{chunk-UHXCLPGC.js → chunk-C3XWJCG7.js} +2 -2
  59. package/dist/chunk-C3XWJCG7.js.map +1 -0
  60. package/dist/{chunk-HXGUIPQB.js → chunk-CKKN25P2.js} +3 -3
  61. package/dist/{chunk-3URQC7EH.js → chunk-CXPOG3ZY.js} +355 -132
  62. package/dist/chunk-CXPOG3ZY.js.map +1 -0
  63. package/dist/{chunk-3FSX6LDG.js → chunk-D2YFQ7XG.js} +18 -3
  64. package/dist/{chunk-3FSX6LDG.js.map → chunk-D2YFQ7XG.js.map} +1 -1
  65. package/dist/{chunk-52JPHN5N.js → chunk-D6SXRMZZ.js} +27 -149
  66. package/dist/chunk-D6SXRMZZ.js.map +1 -0
  67. package/dist/{chunk-2DHSSLOD.js → chunk-DECNV4QK.js} +13 -15
  68. package/dist/chunk-DECNV4QK.js.map +1 -0
  69. package/dist/{chunk-6BU3L4UE.js → chunk-DNKVKO7K.js} +7 -10
  70. package/dist/chunk-DNKVKO7K.js.map +1 -0
  71. package/dist/{chunk-6HFM7EIT.js → chunk-EHRIDNZX.js} +2 -2
  72. package/dist/{chunk-3737A6EA.js → chunk-EHW7NLGD.js} +127 -31
  73. package/dist/chunk-EHW7NLGD.js.map +1 -0
  74. package/dist/{chunk-BEFVYAR5.js → chunk-EQOTJL76.js} +4 -4
  75. package/dist/chunk-EQOTJL76.js.map +1 -0
  76. package/dist/{chunk-E6427JU2.js → chunk-EV2TDHQZ.js} +19 -3
  77. package/dist/chunk-EV2TDHQZ.js.map +1 -0
  78. package/dist/{chunk-WFUIE565.js → chunk-FNYCT27B.js} +17 -14
  79. package/dist/chunk-FNYCT27B.js.map +1 -0
  80. package/dist/{chunk-RTAMLDWP.js → chunk-FU5VYEYK.js} +2 -2
  81. package/dist/chunk-FX3UIDCS.js +66 -0
  82. package/dist/chunk-FX3UIDCS.js.map +1 -0
  83. package/dist/{chunk-7F4DBNSP.js → chunk-GANFIM2M.js} +135 -18
  84. package/dist/chunk-GANFIM2M.js.map +1 -0
  85. package/dist/{chunk-4VUPLMZ6.js → chunk-GCU42IG7.js} +66 -71
  86. package/dist/chunk-GCU42IG7.js.map +1 -0
  87. package/dist/{chunk-RXYYFSBB.js → chunk-GKTW3KLV.js} +4 -4
  88. package/dist/chunk-HK67PX4J.js +27 -0
  89. package/dist/chunk-HK67PX4J.js.map +1 -0
  90. package/dist/{chunk-OF3L2SD6.js → chunk-HOPNIR5R.js} +2 -2
  91. package/dist/{chunk-WLZ47GSL.js → chunk-HSJBJIB2.js} +12 -10
  92. package/dist/{chunk-WLZ47GSL.js.map → chunk-HSJBJIB2.js.map} +1 -1
  93. package/dist/{chunk-ADW22QSB.js → chunk-HWI7GHJZ.js} +4 -4
  94. package/dist/{chunk-GQ3BX5EA.js → chunk-I3ISCYT7.js} +2 -2
  95. package/dist/{chunk-YJ6IONGA.js → chunk-IWKCJCLP.js} +11 -3
  96. package/dist/{chunk-YJ6IONGA.js.map → chunk-IWKCJCLP.js.map} +1 -1
  97. package/dist/{chunk-NJDQ4YSV.js → chunk-IWQPYT6S.js} +4 -4
  98. package/dist/{chunk-JRKZTEZZ.js → chunk-J6I5VR6P.js} +444 -73
  99. package/dist/chunk-J6I5VR6P.js.map +1 -0
  100. package/dist/{chunk-2Z3NCLNX.js → chunk-JHYKSMVX.js} +7 -7
  101. package/dist/{chunk-6FJWSWFT.js → chunk-JIHWBKMQ.js} +3 -3
  102. package/dist/{chunk-YAWK6AWF.js → chunk-JKATP6OE.js} +2 -2
  103. package/dist/{chunk-PL2GHSCM.js → chunk-JMJSCI7U.js} +157 -90
  104. package/dist/chunk-JMJSCI7U.js.map +1 -0
  105. package/dist/{chunk-Q6TEJXBX.js → chunk-JXHNUYQO.js} +31 -49
  106. package/dist/chunk-JXHNUYQO.js.map +1 -0
  107. package/dist/{chunk-WK5XUYYF.js → chunk-JYPRZWCZ.js} +473 -231
  108. package/dist/chunk-JYPRZWCZ.js.map +1 -0
  109. package/dist/{chunk-5ZKS6ZE2.js → chunk-K6CPIK3R.js} +4 -4
  110. package/dist/chunk-K6CPIK3R.js.map +1 -0
  111. package/dist/{chunk-CDB2HVQW.js → chunk-KM6ZXG7U.js} +14 -15
  112. package/dist/chunk-KM6ZXG7U.js.map +1 -0
  113. package/dist/{chunk-DG27IUVI.js → chunk-LC6NE4IQ.js} +2 -2
  114. package/dist/{chunk-WASHZV34.js → chunk-LIR2DJWP.js} +63 -25
  115. package/dist/chunk-LIR2DJWP.js.map +1 -0
  116. package/dist/{chunk-VZ3XFUQ7.js → chunk-LUYPYCHY.js} +16 -22
  117. package/dist/chunk-LUYPYCHY.js.map +1 -0
  118. package/dist/{chunk-G6S5VVHP.js → chunk-M7WBE3OR.js} +10 -10
  119. package/dist/chunk-M7WBE3OR.js.map +1 -0
  120. package/dist/{chunk-VJFMXYKP.js → chunk-MPKP6L5E.js} +2 -2
  121. package/dist/{chunk-IGJCYUT5.js → chunk-NSITFOCJ.js} +1 -1
  122. package/dist/chunk-NSITFOCJ.js.map +1 -0
  123. package/dist/{chunk-FUHKW252.js → chunk-OCJ3JA4O.js} +2 -2
  124. package/dist/{chunk-VCETL77O.js → chunk-ONPVHX2Y.js} +36 -7
  125. package/dist/chunk-ONPVHX2Y.js.map +1 -0
  126. package/dist/{chunk-WLYIROCJ.js → chunk-OQMCFHUX.js} +2 -2
  127. package/dist/{chunk-JRCYZEHU.js → chunk-OR2FYRYR.js} +2 -2
  128. package/dist/{chunk-HNHCQ556.js → chunk-PFWE7FJG.js} +2 -2
  129. package/dist/{chunk-NPP5R7FF.js → chunk-PJX72ICF.js} +22 -18
  130. package/dist/chunk-PJX72ICF.js.map +1 -0
  131. package/dist/{chunk-U5O6GIWZ.js → chunk-POFYIGQ2.js} +3 -3
  132. package/dist/{chunk-35EBKWQU.js → chunk-QH47SQLD.js} +4 -4
  133. package/dist/{chunk-FZ6NYJ7L.js → chunk-QQRRKO7W.js} +11 -8
  134. package/dist/chunk-QQRRKO7W.js.map +1 -0
  135. package/dist/{chunk-HVQGCKY4.js → chunk-QVXZFJBU.js} +2 -2
  136. package/dist/{chunk-FMQJZH4R.js → chunk-RDB66EKD.js} +6 -6
  137. package/dist/{chunk-X56RTUK3.js → chunk-RJZQ2PVD.js} +3 -3
  138. package/dist/{chunk-SUFG5E73.js → chunk-RPRASGEY.js} +2 -2
  139. package/dist/{chunk-XWX7GL56.js → chunk-S2I5MYSA.js} +7 -10
  140. package/dist/chunk-S2I5MYSA.js.map +1 -0
  141. package/dist/{chunk-FFDNKRCY.js → chunk-S6PJ6ZKE.js} +2 -2
  142. package/dist/chunk-S6PJ6ZKE.js.map +1 -0
  143. package/dist/{chunk-JIUVJ4M7.js → chunk-S7PM7Z4K.js} +3 -3
  144. package/dist/{chunk-55LKVALY.js → chunk-T7IR4N2S.js} +1 -3
  145. package/dist/chunk-T7IR4N2S.js.map +1 -0
  146. package/dist/{chunk-N35NC4JH.js → chunk-TKBB62DN.js} +2 -2
  147. package/dist/{chunk-YPYHVOXP.js → chunk-UJ4Z67UQ.js} +2 -2
  148. package/dist/chunk-UJ4Z67UQ.js.map +1 -0
  149. package/dist/{chunk-7MNBICB5.js → chunk-W3HAIN6U.js} +16 -14
  150. package/dist/chunk-W3HAIN6U.js.map +1 -0
  151. package/dist/{chunk-4UVDI4XE.js → chunk-WPZ5FVAS.js} +4 -4
  152. package/dist/{chunk-MSWYQLMQ.js → chunk-XINT4VJA.js} +2 -2
  153. package/dist/{chunk-7G6VDWXB.js → chunk-XPEPMK4Y.js} +3 -3
  154. package/dist/chunk-XPEPMK4Y.js.map +1 -0
  155. package/dist/{chunk-W3TVWF6N.js → chunk-YCGLAANM.js} +2 -2
  156. package/dist/{chunk-O2ERS4UJ.js → chunk-YTUFV7U7.js} +80 -51
  157. package/dist/chunk-YTUFV7U7.js.map +1 -0
  158. package/dist/{chunk-FDX7OWWI.js → chunk-YYV53EHO.js} +2 -2
  159. package/dist/{chunk-HNGSV2YC.js → chunk-Z3BZXPRO.js} +67 -10
  160. package/dist/chunk-Z3BZXPRO.js.map +1 -0
  161. package/dist/{chunk-6NVPFKN3.js → chunk-ZIMQDXTQ.js} +92 -35
  162. package/dist/chunk-ZIMQDXTQ.js.map +1 -0
  163. package/dist/{chunk-5JY5TSVY.js → chunk-ZJUZOJVW.js} +25 -31
  164. package/dist/chunk-ZJUZOJVW.js.map +1 -0
  165. package/dist/{chunk-3IXIU6FP.js → chunk-ZY6P7M52.js} +7 -10
  166. package/dist/chunk-ZY6P7M52.js.map +1 -0
  167. package/dist/{chunk-H73G4XF4.js → chunk-ZYZJLYNS.js} +7 -11
  168. package/dist/chunk-ZYZJLYNS.js.map +1 -0
  169. package/dist/classified/index.js +5 -5
  170. package/dist/{classified-marker-2KJAXRRO.js → classified-marker-AZDSDG6V.js} +3 -3
  171. package/dist/collection-facade-WSUAYFJ4.js +45 -0
  172. package/dist/{computed-6G5M3UPH.js → computed-VG2PCM4L.js} +3 -3
  173. package/dist/consent/index.js +10 -10
  174. package/dist/cover/index.js +10 -3
  175. package/dist/custody/index.js +12 -11
  176. package/dist/{dead-filter-DCB62VWW.js → dead-filter-JNQNB3TA.js} +2 -2
  177. package/dist/debug/index.js +1 -1
  178. package/dist/{delegation-MO7YZYJS.js → delegation-5F36DRDH.js} +24 -23
  179. package/dist/delegation-5F36DRDH.js.map +1 -0
  180. package/dist/derivations/index.js +12 -12
  181. package/dist/derive-MPOGZ4NR.js +22 -0
  182. package/dist/directory/index.js +10 -10
  183. package/dist/{dispatch-MJ6SHB3Y.js → dispatch-3ZA733EY.js} +18 -18
  184. package/dist/{dispatch-FZEAWKVM.js → dispatch-TNM5CRLZ.js} +9 -6
  185. package/dist/dispatch-TNM5CRLZ.js.map +1 -0
  186. package/dist/{enclave-JU4YIEPB.js → enclave-Y2ALNDRD.js} +31 -9
  187. package/dist/executor-BBEEUFO3.js +9 -0
  188. package/dist/executor-G6G3YEWR.js +9 -0
  189. package/dist/executor-ZUTUMTPA.js +29 -0
  190. package/dist/export-accessible-S3KEB763.js +23 -0
  191. package/dist/extract-partition-KVCTSUVE.js +38 -0
  192. package/dist/{fanout-sidecar-NNAJQXMX.js → fanout-sidecar-3QZU7ZZX.js} +18 -27
  193. package/dist/fanout-sidecar-3QZU7ZZX.js.map +1 -0
  194. package/dist/find-V4FN5ITT.js +11 -0
  195. package/dist/forget/index.js +9 -9
  196. package/dist/guards/index.js +7 -7
  197. package/dist/history/index.js +23 -20
  198. package/dist/history/index.js.map +1 -1
  199. package/dist/i18n/index.js +14 -14
  200. package/dist/index.d.ts +30 -13
  201. package/dist/index.js +180 -188
  202. package/dist/index.js.map +1 -1
  203. package/dist/indexing/index.js +4 -4
  204. package/dist/introspection/index.js +11 -11
  205. package/dist/issue-5CFBWBRX.js +19 -0
  206. package/dist/kernel/collection.d.ts +8 -2
  207. package/dist/kernel/constants.d.ts +36 -0
  208. package/dist/kernel/enclave/crypto.d.ts +52 -4
  209. package/dist/kernel/enclave/index.d.ts +10 -3
  210. package/dist/kernel/enclave/record-aad.d.ts +131 -0
  211. package/dist/kernel/enclave/record-envelope.d.ts +76 -0
  212. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  213. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  214. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  215. package/dist/kernel/enclave/record-keys/rekey-blob.d.ts +88 -0
  216. package/dist/kernel/enclave/record-keys/rekey.d.ts +91 -0
  217. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
  218. package/dist/kernel/errors.d.ts +132 -12
  219. package/dist/kernel/merge-authority.d.ts +25 -0
  220. package/dist/kernel/noydb.d.ts +27 -4
  221. package/dist/kernel/query/builder.d.ts +51 -4
  222. package/dist/kernel/query/join.d.ts +27 -0
  223. package/dist/kernel/query/live.d.ts +31 -9
  224. package/dist/kernel/query/predicate.d.ts +9 -0
  225. package/dist/kernel/refs.d.ts +3 -1
  226. package/dist/kernel/sync-policy.d.ts +0 -2
  227. package/dist/kernel/tier-visibility.d.ts +34 -0
  228. package/dist/kernel/types.d.ts +111 -13
  229. package/dist/kernel/vault.d.ts +14 -8
  230. package/dist/kernel/via/index.d.ts +11 -2
  231. package/dist/kernel/via/reconcile.d.ts +12 -0
  232. package/dist/{ledger-AETNF4OM.js → ledger-MQIIOTZB.js} +11 -11
  233. package/dist/liberate-LW7OKVBH.js +25 -0
  234. package/dist/{link-set-E5HNY67I.js → link-set-5PJBBR63.js} +11 -11
  235. package/dist/{managed-secret-CWQ6PND5.js → managed-secret-ETDG6AAE.js} +11 -3
  236. package/dist/materialized-views/index.js +24 -24
  237. package/dist/migrate-cek-V3VDRV24.js +19 -0
  238. package/dist/migrate-cek-V3VDRV24.js.map +1 -0
  239. package/dist/money/index.js +5 -5
  240. package/dist/noydb-LFDRMYZ5.js +85 -0
  241. package/dist/overlay-views/index.js +4 -4
  242. package/dist/periods/index.js +18 -12
  243. package/dist/pod/index.js +79 -89
  244. package/dist/pod-handle-AZ3CXY5Y.js +41 -0
  245. package/dist/pod-handle-AZ3CXY5Y.js.map +1 -0
  246. package/dist/policy/index.js +11 -4
  247. package/dist/port/to/index.d.ts +4 -4
  248. package/dist/port/to/locator.d.ts +54 -8
  249. package/dist/port/with/i18n-strategy.d.ts +4 -1
  250. package/dist/port/with/lookup-strategy.d.ts +4 -1
  251. package/dist/port/with/merge-authority.d.ts +52 -0
  252. package/dist/port/with/service-bus.d.ts +0 -4
  253. package/dist/port/with/strategies.d.ts +2 -0
  254. package/dist/port/with/team-strategy.d.ts +5 -1
  255. package/dist/portability/index.js +8 -8
  256. package/dist/{post-register-2XSSMGEQ.js → post-register-QCJYRMIK.js} +6 -6
  257. package/dist/query/index.js +6 -6
  258. package/dist/reduce/index.js +6 -6
  259. package/dist/register-JBOEHTVX.js +32 -0
  260. package/dist/registry-5DYHQFJS.js +9 -0
  261. package/dist/registry-EANV44W2.js +9 -0
  262. package/dist/registry-J25H6VB4.js +19 -0
  263. package/dist/registry-R23SQUQH.js +18 -0
  264. package/dist/request-withdrawal-KQ4W4UT5.js +31 -0
  265. package/dist/{reveal-BW36KCOQ.js → reveal-W7BKZSUP.js} +6 -6
  266. package/dist/revoke-H3VSTAIE.js +24 -0
  267. package/dist/satellites/index.js +1 -1
  268. package/dist/schema-update/index.js +2 -2
  269. package/dist/sealed-record/index.js +20 -13
  270. package/dist/sealed-record/index.js.map +1 -1
  271. package/dist/search/index.js +4 -4
  272. package/dist/{seed-GDV5PT4R.js → seed-55FPOMYP.js} +20 -22
  273. package/dist/seed-55FPOMYP.js.map +1 -0
  274. package/dist/sequence/index.js +9 -9
  275. package/dist/session/index.js +10 -10
  276. package/dist/shadow/index.js +2 -2
  277. package/dist/share-link/index.js +1 -1
  278. package/dist/signer-53AQ3BU2.js +25 -0
  279. package/dist/snapshots/index.js +10 -10
  280. package/dist/snapshots/index.js.map +1 -1
  281. package/dist/{stale-ARHFVL5U.js → stale-TH7SSVRV.js} +10 -10
  282. package/dist/storage-WSF7ZKTL.js +23 -0
  283. package/dist/{store-coordination-provider-GFCUOBR6.js → store-coordination-provider-R27VRD6K.js} +18 -12
  284. package/dist/store-coordination-provider-R27VRD6K.js.map +1 -0
  285. package/dist/sync/index.js +11 -11
  286. package/dist/team/index.js +15 -14
  287. package/dist/tiers/index.js +11 -10
  288. package/dist/to/index.js +17 -9
  289. package/dist/to/index.js.map +1 -1
  290. package/dist/transactions/index.js +4 -4
  291. package/dist/{ulid-PTAIMDG4.js → ulid-VQW6ERQN.js} +2 -2
  292. package/dist/util/index.js +1 -1
  293. package/dist/vault-head/index.js +115 -0
  294. package/dist/vault-head/index.js.map +1 -0
  295. package/dist/{verify-RO5RTZOJ.js → verify-M5LQH43C.js} +5 -5
  296. package/dist/via/blob/index.d.ts +3 -0
  297. package/dist/via/lookup/handle.d.ts +4 -1
  298. package/dist/walk-NABCHDZN.js +21 -0
  299. package/dist/with-audit/periods/index.d.ts +3 -3
  300. package/dist/with-audit/periods/periods.d.ts +82 -2
  301. package/dist/with-audit/periods/strategy.d.ts +1 -1
  302. package/dist/with-audit/periods/vault-facade.d.ts +54 -1
  303. package/dist/with-audit/periods/window.d.ts +10 -0
  304. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  305. package/dist/with-audit/tiers/index.d.ts +17 -2
  306. package/dist/with-cargo/adopt-partition.d.ts +1 -1
  307. package/dist/with-cargo/extract-partition.d.ts +1 -1
  308. package/dist/with-cargo/index.d.ts +1 -1
  309. package/dist/with-commit/history/history.d.ts +26 -0
  310. package/dist/with-commit/history/index.d.ts +2 -1
  311. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  312. package/dist/with-commit/history/strategy.d.ts +11 -1
  313. package/dist/with-commit/numbering/index.d.ts +0 -5
  314. package/dist/with-commit/vault-head/active.d.ts +2 -0
  315. package/dist/with-commit/vault-head/head.d.ts +28 -0
  316. package/dist/with-commit/vault-head/index.d.ts +10 -0
  317. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  318. package/dist/with-commit/vault-head/verify.d.ts +90 -0
  319. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +4 -0
  320. package/dist/with-formula/materialized-views/projection-legs.d.ts +59 -0
  321. package/dist/with-formula/materialized-views/registry.d.ts +50 -0
  322. package/dist/with-formula/materialized-views/types.d.ts +68 -10
  323. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  324. package/dist/with-party/directory/storage.d.ts +0 -11
  325. package/dist/with-party/directory/visibility.d.ts +0 -21
  326. package/dist/with-party/policy/storage.d.ts +0 -10
  327. package/dist/with-party/team/index.d.ts +1 -1
  328. package/dist/with-party/team/keyring.d.ts +139 -2
  329. package/dist/with-party/team/noydb-facade.d.ts +5 -1
  330. package/dist/with-party/team/roster-tag.d.ts +101 -0
  331. package/dist/with-party/team/tiers.d.ts +2 -1
  332. package/dist/with-pod/format.d.ts +10 -12
  333. package/dist/with-pod/index.d.ts +10 -10
  334. package/dist/with-pod/open.d.ts +2 -2
  335. package/dist/with-pod/pod-handle.d.ts +19 -0
  336. package/dist/with-pod/pod-store.d.ts +0 -8
  337. package/dist/with-pod/{bundle.d.ts → pod.d.ts} +11 -19
  338. package/dist/with-pod/ulid.d.ts +1 -1
  339. package/dist/with-shape/blobs/blob-compaction.d.ts +13 -0
  340. package/dist/with-shape/blobs/blob-set.d.ts +83 -11
  341. package/dist/with-shape/blobs/orphan-report.d.ts +62 -0
  342. package/dist/with-shape/introspection/index.d.ts +1 -0
  343. package/dist/with-sync/engine.d.ts +54 -5
  344. package/dist/with-sync/strategy.d.ts +3 -0
  345. package/dist/withdraw-accessible-VCINIG6V.js +28 -0
  346. package/package.json +10 -4
  347. package/dist/api-RXUMEKT3.js +0 -20
  348. package/dist/backup-KULFZ2T4.js.map +0 -1
  349. package/dist/bundle-handle-GFNHT52M.js +0 -36
  350. package/dist/bundle-handle-GFNHT52M.js.map +0 -1
  351. package/dist/chunk-2DHSSLOD.js.map +0 -1
  352. package/dist/chunk-3737A6EA.js.map +0 -1
  353. package/dist/chunk-3IXIU6FP.js.map +0 -1
  354. package/dist/chunk-3URQC7EH.js.map +0 -1
  355. package/dist/chunk-4GZ6XOVW.js.map +0 -1
  356. package/dist/chunk-4I72F5DF.js.map +0 -1
  357. package/dist/chunk-4VUPLMZ6.js.map +0 -1
  358. package/dist/chunk-52JPHN5N.js.map +0 -1
  359. package/dist/chunk-55LKVALY.js.map +0 -1
  360. package/dist/chunk-5JY5TSVY.js.map +0 -1
  361. package/dist/chunk-5ZKS6ZE2.js.map +0 -1
  362. package/dist/chunk-6BU3L4UE.js.map +0 -1
  363. package/dist/chunk-6NVPFKN3.js.map +0 -1
  364. package/dist/chunk-7F4DBNSP.js.map +0 -1
  365. package/dist/chunk-7G6VDWXB.js.map +0 -1
  366. package/dist/chunk-7H73RIE3.js +0 -45
  367. package/dist/chunk-7H73RIE3.js.map +0 -1
  368. package/dist/chunk-7MNBICB5.js.map +0 -1
  369. package/dist/chunk-AFHQATY4.js +0 -47
  370. package/dist/chunk-AFHQATY4.js.map +0 -1
  371. package/dist/chunk-AHLJSVRL.js.map +0 -1
  372. package/dist/chunk-BEFVYAR5.js.map +0 -1
  373. package/dist/chunk-CDB2HVQW.js.map +0 -1
  374. package/dist/chunk-CEJWMBXO.js.map +0 -1
  375. package/dist/chunk-E6427JU2.js.map +0 -1
  376. package/dist/chunk-FFDNKRCY.js.map +0 -1
  377. package/dist/chunk-FZ6NYJ7L.js.map +0 -1
  378. package/dist/chunk-G6S5VVHP.js.map +0 -1
  379. package/dist/chunk-GAG7QOVO.js.map +0 -1
  380. package/dist/chunk-H73G4XF4.js.map +0 -1
  381. package/dist/chunk-HNGSV2YC.js.map +0 -1
  382. package/dist/chunk-IGJCYUT5.js.map +0 -1
  383. package/dist/chunk-IMZLOJTK.js.map +0 -1
  384. package/dist/chunk-J7FM3RAU.js.map +0 -1
  385. package/dist/chunk-JJNOLSG5.js.map +0 -1
  386. package/dist/chunk-JRKZTEZZ.js.map +0 -1
  387. package/dist/chunk-JXIDGFKS.js.map +0 -1
  388. package/dist/chunk-NPP5R7FF.js.map +0 -1
  389. package/dist/chunk-O2ERS4UJ.js.map +0 -1
  390. package/dist/chunk-PDLLCOGD.js.map +0 -1
  391. package/dist/chunk-PL2GHSCM.js.map +0 -1
  392. package/dist/chunk-PNKHAKQ7.js.map +0 -1
  393. package/dist/chunk-PXCBVDFY.js.map +0 -1
  394. package/dist/chunk-Q6TEJXBX.js.map +0 -1
  395. package/dist/chunk-UHXCLPGC.js.map +0 -1
  396. package/dist/chunk-VCETL77O.js.map +0 -1
  397. package/dist/chunk-VZ3XFUQ7.js.map +0 -1
  398. package/dist/chunk-W77KZHCW.js.map +0 -1
  399. package/dist/chunk-WASHZV34.js.map +0 -1
  400. package/dist/chunk-WFUIE565.js.map +0 -1
  401. package/dist/chunk-WK5XUYYF.js.map +0 -1
  402. package/dist/chunk-XWX7GL56.js.map +0 -1
  403. package/dist/chunk-YPYHVOXP.js.map +0 -1
  404. package/dist/chunk-ZJADGNYF.js.map +0 -1
  405. package/dist/collection-facade-QEJIM6BC.js +0 -45
  406. package/dist/delegation-MO7YZYJS.js.map +0 -1
  407. package/dist/derive-IUA6JFLB.js +0 -22
  408. package/dist/dispatch-FZEAWKVM.js.map +0 -1
  409. package/dist/executor-CYJQLKKI.js +0 -9
  410. package/dist/executor-S4QIKEHW.js +0 -9
  411. package/dist/executor-YIQB2S6N.js +0 -29
  412. package/dist/export-accessible-4S36PQNR.js +0 -23
  413. package/dist/extract-partition-IO7FDZ2P.js +0 -38
  414. package/dist/fanout-sidecar-NNAJQXMX.js.map +0 -1
  415. package/dist/find-RBBYKXI7.js +0 -11
  416. package/dist/issue-RIVHSY2S.js +0 -19
  417. package/dist/liberate-GFN4C7RR.js +0 -24
  418. package/dist/noydb-3MT74MZS.js +0 -83
  419. package/dist/register-4EFJCVYD.js +0 -32
  420. package/dist/registry-4SDHHOJ7.js +0 -18
  421. package/dist/registry-CZVINVQH.js +0 -9
  422. package/dist/registry-IKUR2MXD.js +0 -9
  423. package/dist/registry-OYTFGWVK.js +0 -19
  424. package/dist/request-withdrawal-KGXGDPVQ.js +0 -31
  425. package/dist/revoke-JFN773KF.js +0 -24
  426. package/dist/seed-GDV5PT4R.js.map +0 -1
  427. package/dist/signer-TA55QB6R.js +0 -25
  428. package/dist/storage-V7MTFAQJ.js +0 -23
  429. package/dist/store-coordination-provider-GFCUOBR6.js.map +0 -1
  430. package/dist/walk-3ZECBFDA.js +0 -21
  431. package/dist/with-pod/bundle-handle.d.ts +0 -9
  432. package/dist/withdraw-accessible-7PG4DYQK.js +0 -28
  433. /package/dist/{api-RXUMEKT3.js.map → api-6X2VLZ7J.js.map} +0 -0
  434. /package/dist/{chunk-KUDZVJKQ.js.map → chunk-22GR3O4J.js.map} +0 -0
  435. /package/dist/{chunk-CCZJJ4I2.js.map → chunk-2CBFYXJX.js.map} +0 -0
  436. /package/dist/{chunk-FAXZQ5UF.js.map → chunk-323MN67Z.js.map} +0 -0
  437. /package/dist/{chunk-VMCCGUQB.js.map → chunk-36CEG6CM.js.map} +0 -0
  438. /package/dist/{chunk-747LRSOO.js.map → chunk-4K6BIMLF.js.map} +0 -0
  439. /package/dist/{chunk-FNSMZQS4.js.map → chunk-5IHGJHWC.js.map} +0 -0
  440. /package/dist/{chunk-7TSYBD3E.js.map → chunk-65JXA63J.js.map} +0 -0
  441. /package/dist/{chunk-Z45YRGFO.js.map → chunk-6NR36UNB.js.map} +0 -0
  442. /package/dist/{chunk-3JVXVJ7L.js.map → chunk-7OBIBPCV.js.map} +0 -0
  443. /package/dist/{chunk-AR2JDFAE.js.map → chunk-7Q3RHOA5.js.map} +0 -0
  444. /package/dist/{chunk-QULVCV3M.js.map → chunk-AJGGBXWA.js.map} +0 -0
  445. /package/dist/{chunk-CADUYBQD.js.map → chunk-ATL3ZVXT.js.map} +0 -0
  446. /package/dist/{chunk-DMQCLZ4Z.js.map → chunk-ATY3ZASK.js.map} +0 -0
  447. /package/dist/{chunk-4HDYQL3J.js.map → chunk-B4CRUZPR.js.map} +0 -0
  448. /package/dist/{chunk-6SAFL5YE.js.map → chunk-BZ3WMOYX.js.map} +0 -0
  449. /package/dist/{chunk-HXGUIPQB.js.map → chunk-CKKN25P2.js.map} +0 -0
  450. /package/dist/{chunk-6HFM7EIT.js.map → chunk-EHRIDNZX.js.map} +0 -0
  451. /package/dist/{chunk-RTAMLDWP.js.map → chunk-FU5VYEYK.js.map} +0 -0
  452. /package/dist/{chunk-RXYYFSBB.js.map → chunk-GKTW3KLV.js.map} +0 -0
  453. /package/dist/{chunk-OF3L2SD6.js.map → chunk-HOPNIR5R.js.map} +0 -0
  454. /package/dist/{chunk-ADW22QSB.js.map → chunk-HWI7GHJZ.js.map} +0 -0
  455. /package/dist/{chunk-GQ3BX5EA.js.map → chunk-I3ISCYT7.js.map} +0 -0
  456. /package/dist/{chunk-NJDQ4YSV.js.map → chunk-IWQPYT6S.js.map} +0 -0
  457. /package/dist/{chunk-2Z3NCLNX.js.map → chunk-JHYKSMVX.js.map} +0 -0
  458. /package/dist/{chunk-6FJWSWFT.js.map → chunk-JIHWBKMQ.js.map} +0 -0
  459. /package/dist/{chunk-YAWK6AWF.js.map → chunk-JKATP6OE.js.map} +0 -0
  460. /package/dist/{chunk-DG27IUVI.js.map → chunk-LC6NE4IQ.js.map} +0 -0
  461. /package/dist/{chunk-VJFMXYKP.js.map → chunk-MPKP6L5E.js.map} +0 -0
  462. /package/dist/{chunk-FUHKW252.js.map → chunk-OCJ3JA4O.js.map} +0 -0
  463. /package/dist/{chunk-WLYIROCJ.js.map → chunk-OQMCFHUX.js.map} +0 -0
  464. /package/dist/{chunk-JRCYZEHU.js.map → chunk-OR2FYRYR.js.map} +0 -0
  465. /package/dist/{chunk-HNHCQ556.js.map → chunk-PFWE7FJG.js.map} +0 -0
  466. /package/dist/{chunk-U5O6GIWZ.js.map → chunk-POFYIGQ2.js.map} +0 -0
  467. /package/dist/{chunk-35EBKWQU.js.map → chunk-QH47SQLD.js.map} +0 -0
  468. /package/dist/{chunk-HVQGCKY4.js.map → chunk-QVXZFJBU.js.map} +0 -0
  469. /package/dist/{chunk-FMQJZH4R.js.map → chunk-RDB66EKD.js.map} +0 -0
  470. /package/dist/{chunk-X56RTUK3.js.map → chunk-RJZQ2PVD.js.map} +0 -0
  471. /package/dist/{chunk-SUFG5E73.js.map → chunk-RPRASGEY.js.map} +0 -0
  472. /package/dist/{chunk-JIUVJ4M7.js.map → chunk-S7PM7Z4K.js.map} +0 -0
  473. /package/dist/{chunk-N35NC4JH.js.map → chunk-TKBB62DN.js.map} +0 -0
  474. /package/dist/{chunk-4UVDI4XE.js.map → chunk-WPZ5FVAS.js.map} +0 -0
  475. /package/dist/{chunk-MSWYQLMQ.js.map → chunk-XINT4VJA.js.map} +0 -0
  476. /package/dist/{chunk-W3TVWF6N.js.map → chunk-YCGLAANM.js.map} +0 -0
  477. /package/dist/{chunk-FDX7OWWI.js.map → chunk-YYV53EHO.js.map} +0 -0
  478. /package/dist/{classified-marker-2KJAXRRO.js.map → classified-marker-AZDSDG6V.js.map} +0 -0
  479. /package/dist/{collection-facade-QEJIM6BC.js.map → collection-facade-WSUAYFJ4.js.map} +0 -0
  480. /package/dist/{computed-6G5M3UPH.js.map → computed-VG2PCM4L.js.map} +0 -0
  481. /package/dist/{dead-filter-DCB62VWW.js.map → dead-filter-JNQNB3TA.js.map} +0 -0
  482. /package/dist/{derive-IUA6JFLB.js.map → derive-MPOGZ4NR.js.map} +0 -0
  483. /package/dist/{dispatch-MJ6SHB3Y.js.map → dispatch-3ZA733EY.js.map} +0 -0
  484. /package/dist/{enclave-JU4YIEPB.js.map → enclave-Y2ALNDRD.js.map} +0 -0
  485. /package/dist/{executor-CYJQLKKI.js.map → executor-BBEEUFO3.js.map} +0 -0
  486. /package/dist/{executor-S4QIKEHW.js.map → executor-G6G3YEWR.js.map} +0 -0
  487. /package/dist/{executor-YIQB2S6N.js.map → executor-ZUTUMTPA.js.map} +0 -0
  488. /package/dist/{export-accessible-4S36PQNR.js.map → export-accessible-S3KEB763.js.map} +0 -0
  489. /package/dist/{extract-partition-IO7FDZ2P.js.map → extract-partition-KVCTSUVE.js.map} +0 -0
  490. /package/dist/{find-RBBYKXI7.js.map → find-V4FN5ITT.js.map} +0 -0
  491. /package/dist/{issue-RIVHSY2S.js.map → issue-5CFBWBRX.js.map} +0 -0
  492. /package/dist/{ledger-AETNF4OM.js.map → ledger-MQIIOTZB.js.map} +0 -0
  493. /package/dist/{liberate-GFN4C7RR.js.map → liberate-LW7OKVBH.js.map} +0 -0
  494. /package/dist/{link-set-E5HNY67I.js.map → link-set-5PJBBR63.js.map} +0 -0
  495. /package/dist/{managed-secret-CWQ6PND5.js.map → managed-secret-ETDG6AAE.js.map} +0 -0
  496. /package/dist/{noydb-3MT74MZS.js.map → noydb-LFDRMYZ5.js.map} +0 -0
  497. /package/dist/{post-register-2XSSMGEQ.js.map → post-register-QCJYRMIK.js.map} +0 -0
  498. /package/dist/{register-4EFJCVYD.js.map → register-JBOEHTVX.js.map} +0 -0
  499. /package/dist/{registry-4SDHHOJ7.js.map → registry-5DYHQFJS.js.map} +0 -0
  500. /package/dist/{registry-CZVINVQH.js.map → registry-EANV44W2.js.map} +0 -0
  501. /package/dist/{registry-IKUR2MXD.js.map → registry-J25H6VB4.js.map} +0 -0
  502. /package/dist/{registry-OYTFGWVK.js.map → registry-R23SQUQH.js.map} +0 -0
  503. /package/dist/{request-withdrawal-KGXGDPVQ.js.map → request-withdrawal-KQ4W4UT5.js.map} +0 -0
  504. /package/dist/{reveal-BW36KCOQ.js.map → reveal-W7BKZSUP.js.map} +0 -0
  505. /package/dist/{revoke-JFN773KF.js.map → revoke-H3VSTAIE.js.map} +0 -0
  506. /package/dist/{signer-TA55QB6R.js.map → signer-53AQ3BU2.js.map} +0 -0
  507. /package/dist/{stale-ARHFVL5U.js.map → stale-TH7SSVRV.js.map} +0 -0
  508. /package/dist/{storage-V7MTFAQJ.js.map → storage-WSF7ZKTL.js.map} +0 -0
  509. /package/dist/{ulid-PTAIMDG4.js.map → ulid-VQW6ERQN.js.map} +0 -0
  510. /package/dist/{verify-RO5RTZOJ.js.map → verify-M5LQH43C.js.map} +0 -0
  511. /package/dist/{walk-3ZECBFDA.js.map → walk-NABCHDZN.js.map} +0 -0
  512. /package/dist/{withdraw-accessible-7PG4DYQK.js.map → withdraw-accessible-VCINIG6V.js.map} +0 -0
@@ -1,19 +1,25 @@
1
1
  import {
2
- assertTierAccess,
3
- dekKey
4
- } from "./chunk-AHLJSVRL.js";
2
+ assertTierAccess
3
+ } from "./chunk-3YGUHUJA.js";
5
4
  import {
5
+ dekKey,
6
6
  liveRecordIsElevated,
7
7
  liveRecordTier
8
- } from "./chunk-3FSX6LDG.js";
8
+ } from "./chunk-D2YFQ7XG.js";
9
9
  import {
10
+ buildRecordAad,
10
11
  openEnvelopeJson,
11
12
  writeEnvelopeBody
12
- } from "./chunk-3URQC7EH.js";
13
+ } from "./chunk-CXPOG3ZY.js";
14
+ import {
15
+ buildRecordEnvelope,
16
+ buildSealedRecordEnvelope
17
+ } from "./chunk-FX3UIDCS.js";
13
18
  import {
14
19
  base64ToBuffer,
15
20
  bufferToBase64,
16
21
  decryptBytesWithAAD,
22
+ deriveBlobAddressKey,
17
23
  encrypt,
18
24
  encryptBytesWithAAD,
19
25
  generateDEK,
@@ -21,11 +27,9 @@ import {
21
27
  sha256Hex,
22
28
  unwrapCek,
23
29
  wrapCek
24
- } from "./chunk-VCETL77O.js";
25
- import {
26
- NOYDB_FORMAT_VERSION
27
- } from "./chunk-YPYHVOXP.js";
30
+ } from "./chunk-ONPVHX2Y.js";
28
31
  import {
32
+ BLOB_ADDRESS_KEY_ID,
29
33
  BlobIntentPendingError,
30
34
  BlobOfflineError,
31
35
  ConflictError,
@@ -35,7 +39,7 @@ import {
35
39
  UnsupportedTierCompositionError,
36
40
  ValidationError,
37
41
  isConflictError
38
- } from "./chunk-HNGSV2YC.js";
42
+ } from "./chunk-Z3BZXPRO.js";
39
43
 
40
44
  // src/with-shape/blobs/blob-pinning.ts
41
45
  function memoryBlobPinStore() {
@@ -301,30 +305,28 @@ function parseIntentKey(key) {
301
305
  if (idx === -1) return null;
302
306
  return { collection: key.slice(0, idx), recordId: key.slice(idx + 2) };
303
307
  }
304
- async function encodeIntentEnvelope(intent, dek, newVersion = 1) {
308
+ async function encodeIntentEnvelope(intent, dek, key, newVersion = 1) {
305
309
  const json = JSON.stringify(intent);
306
- const body = await writeEnvelopeBody(json, dek);
307
- return {
308
- _noydb: NOYDB_FORMAT_VERSION,
309
- _v: newVersion,
310
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
311
- ...body
312
- };
310
+ return buildSealedRecordEnvelope(
311
+ { collection: BLOB_INTENT_COLLECTION, id: key, version: newVersion },
312
+ (identity) => writeEnvelopeBody(identity, json, dek),
313
+ {}
314
+ );
313
315
  }
314
- async function decodeIntentEnvelope(envelope, dek) {
315
- const json = await openEnvelopeJson(envelope, dek);
316
+ async function decodeIntentEnvelope(key, envelope, dek) {
317
+ const json = await openEnvelopeJson({ collection: BLOB_INTENT_COLLECTION, id: key }, envelope, dek);
316
318
  return JSON.parse(json);
317
319
  }
318
320
  async function getIntent(adapter, vault, collection, recordId, getDEK) {
319
321
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, intentKey(collection, recordId));
320
322
  if (!envelope) return null;
321
323
  const dek = await getDEK(collection);
322
- return decodeIntentEnvelope(envelope, dek);
324
+ return decodeIntentEnvelope(intentKey(collection, recordId), envelope, dek);
323
325
  }
324
326
  async function createIntent(adapter, vault, collection, recordId, getDEK, intent) {
325
327
  const key = intentKey(collection, recordId);
326
328
  const dek = await getDEK(collection);
327
- const envelope = await encodeIntentEnvelope(intent, dek);
329
+ const envelope = await encodeIntentEnvelope(intent, dek, key);
328
330
  try {
329
331
  await adapter.put(vault, BLOB_INTENT_COLLECTION, key, envelope, 0);
330
332
  } catch (err) {
@@ -344,10 +346,10 @@ async function recordAppliedStamp(adapter, vault, collection, recordId, getDEK,
344
346
  for (let attempt = 0; attempt < MAX_APPLIED_STAMP_RETRIES; attempt++) {
345
347
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, key);
346
348
  if (!envelope) return;
347
- const intent = await decodeIntentEnvelope(envelope, dek);
349
+ const intent = await decodeIntentEnvelope(key, envelope, dek);
348
350
  if (intent.op !== "rehome" || intent.appliedStamps?.includes(stamp)) return;
349
351
  const updated = { ...intent, appliedStamps: [...intent.appliedStamps ?? [], stamp] };
350
- const newEnvelope = await encodeIntentEnvelope(updated, dek, envelope._v + 1);
352
+ const newEnvelope = await encodeIntentEnvelope(updated, dek, key, envelope._v + 1);
351
353
  try {
352
354
  await adapter.put(vault, BLOB_INTENT_COLLECTION, key, newEnvelope, envelope._v);
353
355
  return;
@@ -366,7 +368,7 @@ async function sweepBlobIntents(adapter, vault, getDEK, resume, onResumeError) {
366
368
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, key);
367
369
  if (!envelope) continue;
368
370
  const dek = await getDEK(parsed.collection);
369
- const intent = await decodeIntentEnvelope(envelope, dek);
371
+ const intent = await decodeIntentEnvelope(key, envelope, dek);
370
372
  await resume(parsed.collection, parsed.recordId, intent);
371
373
  } catch (err) {
372
374
  onResumeError?.(parsed.collection, parsed.recordId, err);
@@ -567,6 +569,26 @@ var BlobSet = class _BlobSet {
567
569
  * write throws an AEAD decrypt error rather than silently writing under
568
570
  * the wrong key.
569
571
  */
572
+ /**
573
+ * The content-addressing key for `tier` (#1126).
574
+ *
575
+ * Derived from `_blob_addr`, a vault-lifetime keyring slot `rotateKeys`
576
+ * refuses to touch — so a rotation re-keys chunk BODIES while every stored
577
+ * eTag, and therefore every chunk AAD and every `_blob_index` /
578
+ * `_blob_slots_*` / `_blob_versions_*` row, survives it unchanged.
579
+ *
580
+ * Before this the address was keyed by the `_blob` DEK itself, so after any
581
+ * rotation `HMAC(live DEK, plaintext) !== storedETag` permanently, for every
582
+ * blob written earlier: `decryptResponse()` raised `TamperedError` on the
583
+ * presigned-URL path forever, and dedup split.
584
+ *
585
+ * Still derived PER TIER, because the address is meant to be tier-scoped —
586
+ * `rehomeForTier` re-addresses on a tier move for exactly that reason. Only
587
+ * the ROTATION coupling was ever wrong.
588
+ */
589
+ async addressKey(tier) {
590
+ return deriveBlobAddressKey(await this.getDEK(BLOB_ADDRESS_KEY_ID), tier);
591
+ }
570
592
  async ownerTier() {
571
593
  if (this.clearedTier !== void 0) return this.clearedTier;
572
594
  return liveRecordTier(this.store, this.vault, this.collection, this.recordId);
@@ -654,7 +676,7 @@ var BlobSet = class _BlobSet {
654
676
  };
655
677
  }
656
678
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
657
- const json = await openEnvelopeJson(envelope, dek);
679
+ const json = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, dek);
658
680
  return {
659
681
  slots: JSON.parse(json),
660
682
  version: envelope._v
@@ -678,38 +700,28 @@ var BlobSet = class _BlobSet {
678
700
  }
679
701
  const fromDek = await this.getDEK(dekKey(this.collection, fromTier));
680
702
  try {
681
- const json2 = await openEnvelopeJson(envelope, fromDek);
703
+ const json2 = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, fromDek);
682
704
  return { slots: JSON.parse(json2), version: envelope._v, atTier: fromTier };
683
705
  } catch (err) {
684
706
  if (!(err instanceof TamperedError) || fromTier === toTier) throw err;
685
707
  }
686
708
  const toDek = await this.getDEK(dekKey(this.collection, toTier));
687
- const json = await openEnvelopeJson(envelope, toDek);
709
+ const json = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, toDek);
688
710
  return { slots: JSON.parse(json), version: envelope._v, atTier: toTier };
689
711
  }
690
712
  /** @param tier See {@link loadSlots}'s `tier` param — same resolution. */
691
713
  async saveSlots(slots, currentVersion, tier) {
692
714
  const json = JSON.stringify(slots);
693
715
  const now = (/* @__PURE__ */ new Date()).toISOString();
716
+ const identity = { collection: this.slotsCollection, id: this.recordId, version: currentVersion + 1 };
717
+ const body = { ts: now };
694
718
  let envelope;
695
719
  if (this.encrypted) {
696
720
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
697
- const { iv, data } = await encrypt(json, dek);
698
- envelope = {
699
- _noydb: NOYDB_FORMAT_VERSION,
700
- _v: currentVersion + 1,
701
- _ts: now,
702
- _iv: iv,
703
- _data: data
704
- };
721
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
722
+ envelope = buildRecordEnvelope(identity, { ...body, iv, data });
705
723
  } else {
706
- envelope = {
707
- _noydb: NOYDB_FORMAT_VERSION,
708
- _v: currentVersion + 1,
709
- _ts: now,
710
- _iv: "",
711
- _data: json
712
- };
724
+ envelope = buildRecordEnvelope(identity, { ...body, iv: "", data: json });
713
725
  }
714
726
  await this.store.put(
715
727
  this.vault,
@@ -844,14 +856,14 @@ var BlobSet = class _BlobSet {
844
856
  const fallbackTier = alsoTryTier ?? (t > 0 ? 0 : void 0);
845
857
  const primaryDek = await this.getDEK(dekKey(BLOB_COLLECTION, t));
846
858
  try {
847
- const json2 = await openEnvelopeJson(envelope, primaryDek);
859
+ const json2 = await openEnvelopeJson({ collection: BLOB_INDEX_COLLECTION, id: eTag }, envelope, primaryDek);
848
860
  return { blob: JSON.parse(json2), version: envelope._v, atTier: t };
849
861
  } catch (err) {
850
862
  if (!(err instanceof TamperedError)) throw err;
851
863
  if (fallbackTier === void 0 || fallbackTier === t) throw err;
852
864
  }
853
865
  const fallbackDek = await this.getDEK(dekKey(BLOB_COLLECTION, fallbackTier));
854
- const json = await openEnvelopeJson(envelope, fallbackDek);
866
+ const json = await openEnvelopeJson({ collection: BLOB_INDEX_COLLECTION, id: eTag }, envelope, fallbackDek);
855
867
  return { blob: JSON.parse(json), version: envelope._v, atTier: fallbackTier };
856
868
  }
857
869
  /**
@@ -891,12 +903,13 @@ var BlobSet = class _BlobSet {
891
903
  const now = (/* @__PURE__ */ new Date()).toISOString();
892
904
  const newVersion = (expectedVersion ?? 0) + 1;
893
905
  let envelope;
906
+ const identity = { collection: BLOB_INDEX_COLLECTION, id: blob.eTag, version: newVersion };
894
907
  if (this.encrypted) {
895
908
  const dek = await this.getDEK(dekKey(BLOB_COLLECTION, tier ?? await this.ownerTier()));
896
- const { iv, data } = await encrypt(json, dek);
897
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: newVersion, _ts: now, _iv: iv, _data: data };
909
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
910
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
898
911
  } else {
899
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: newVersion, _ts: now, _iv: "", _data: json };
912
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: json });
900
913
  }
901
914
  await this.store.put(
902
915
  this.vault,
@@ -1021,13 +1034,18 @@ var BlobSet = class _BlobSet {
1021
1034
  * - not yet stamped → apply via `casUpdateRefCountStamped`, then proceed
1022
1035
  * exactly like the unstamped path below.
1023
1036
  *
1024
- * A crash can also land AFTER the index row is deleted but BEFORE every
1025
- * chunk is `loadBlobObject` then returns null (indistinguishable from
1026
- * "never existed") and the object's `chunkCount` is gone with it. A
1027
- * stamped caller who knows the true count (the journal marker's captured
1028
- * `holds`, once that plumbing lands) supplies it via `chunkCountHint` so
1029
- * this call can still finish the chunk deletion; without it, an
1030
- * already-index-gone eTag is reported `'shredded'` same as today (best
1037
+ * A crash can also land part-way through the deletion itself. Since #1127
1038
+ * that deletion runs CHUNKS FIRST (see `deleteChunksThenIndex`), so what
1039
+ * survives is an index row with some chunks already gone a reachable,
1040
+ * re-runnable state rather than chunks nothing can ever address again.
1041
+ *
1042
+ * An eTag whose index row is ALREADY absent on entry is therefore either
1043
+ * pre-#1127 residue or a completed deletion. `loadBlobObject` returns null
1044
+ * (indistinguishable from "never existed") and the object's `chunkCount` is
1045
+ * gone with it. A stamped caller who knows the true count (the journal
1046
+ * marker's captured `holds`, once that plumbing lands) supplies it via
1047
+ * `chunkCountHint` so this call can still finish the chunk deletion; without
1048
+ * it, an already-index-gone eTag is reported `'shredded'` same as today (best
1031
1049
  * effort — nothing left to key the cleanup off of).
1032
1050
  */
1033
1051
  async releaseRef(eTag, n, reclaimLegacy, tier, stamp, chunkCountHint) {
@@ -1044,24 +1062,72 @@ var BlobSet = class _BlobSet {
1044
1062
  if (stamp !== void 0 && loaded.blob.lastOps?.includes(stamp)) {
1045
1063
  if (loaded.blob.refCount > 0) return erasable ? "retainedShared" : "residue";
1046
1064
  if (erasable || reclaimLegacy) {
1047
- await this.store.delete(this.vault, BLOB_INDEX_COLLECTION, eTag);
1048
1065
  const chunkCount = chunkCountHint ?? loaded.blob.chunkCount;
1049
- for (let i = 0; i < chunkCount; i++) {
1050
- await this.store.delete(this.vault, BLOB_CHUNKS_COLLECTION, `${eTag}_${i}`);
1051
- }
1066
+ await this.deleteChunksThenIndex(eTag, chunkCount);
1052
1067
  }
1053
1068
  return erasable ? "shredded" : "residue";
1054
1069
  }
1055
1070
  const remaining = stamp !== void 0 ? (await this.casUpdateRefCountStamped(eTag, -n, tier, stamp)).refCount : await this.casUpdateRefCount(eTag, -n, tier);
1056
1071
  if (remaining > 0) return erasable ? "retainedShared" : "residue";
1057
1072
  if (erasable || reclaimLegacy) {
1058
- await this.store.delete(this.vault, BLOB_INDEX_COLLECTION, eTag);
1059
- for (let i = 0; i < loaded.blob.chunkCount; i++) {
1060
- await this.store.delete(this.vault, BLOB_CHUNKS_COLLECTION, `${eTag}_${i}`);
1061
- }
1073
+ await this.deleteChunksThenIndex(eTag, loaded.blob.chunkCount);
1062
1074
  }
1063
1075
  return erasable ? "shredded" : "residue";
1064
1076
  }
1077
+ /**
1078
+ * Delete a blob's chunks, THEN its index row. The order is the whole point
1079
+ * (#1127).
1080
+ *
1081
+ * Both deletions used to run index-first, which meant a crash in between
1082
+ * stranded chunks with no index row. Nothing can ever reach those again:
1083
+ * `loadBlobObject` returns null, so no reader addresses them — and
1084
+ * `rekeyBlobSet` derives its chunk ids from each index entry's `chunkCount`,
1085
+ * so a rotation never visits them either. For a LEGACY blob (bytes under the
1086
+ * `_blob` DEK itself rather than a per-blob content CEK) the bodies then stay
1087
+ * openable under the retired `_blob` DEK — precisely the key a revoked member
1088
+ * walked away with. Crash during `forget()`, revoke later, and real blob
1089
+ * content sits readable indefinitely, with no error on either side.
1090
+ *
1091
+ * Reversing it removes the class rather than cleaning up after it: every
1092
+ * chunk that still exists has an index row, so every chunk is reachable by
1093
+ * `rekeyBlobSet` and gets re-keyed. There is no orphan to sweep because none
1094
+ * is produced.
1095
+ *
1096
+ * The residue this ordering leaves instead is an index row whose chunks are
1097
+ * partly gone. That state is better, but it is NOT free — it cost one reader
1098
+ * correction (`resolveRehomedVersionETag`, which read an old blob's bytes
1099
+ * while resuming a rehome and now checks `refCount <= 0` instead of relying
1100
+ * on the row having vanished). An earlier draft of this comment called the
1101
+ * new state "strictly better"; the full suite disproved that, and any future
1102
+ * path that reads a blob by index needs the same care. What is true of it:
1103
+ * - it is REACHABLE, so a re-run of `releaseRef` completes the deletion
1104
+ * idempotently (both `store.delete` calls are void on an absent key);
1105
+ * - `rekeyBlobSet` already tolerates it — a missing chunk hits its
1106
+ * `if (!chunkEnv || !chunkEnv._iv) continue`, so a rotation still
1107
+ * succeeds and still re-keys every chunk that remains;
1108
+ * - it cannot leak, because the bytes that survive are the ones still
1109
+ * covered by rotation.
1110
+ *
1111
+ * This also makes one ordering rule true across the blob subsystem rather
1112
+ * than two opposite ones: `kernel/enclave/record-keys/rekey-blob.ts` already
1113
+ * re-encrypts chunks before re-sealing their index entry, and documents that
1114
+ * order as its resume property.
1115
+ *
1116
+ * Deliberately NOT paired with a sweep that deletes pre-existing orphans:
1117
+ * such a sweep must decide "orphaned" from `store.list(_blob_index)`, and the
1118
+ * store is untrusted. A store that withholds one index row could make a LIVE
1119
+ * blob's chunks look orphaned and have us destroy them — turning withholding,
1120
+ * which is reversible, into permanent loss. Reporting them is safe; deleting
1121
+ * them on the store's word is not. The report half shipped as
1122
+ * `reportOrphanBlobChunks` (#1133), surfaced through `vault.compact()`; a
1123
+ * reclaim pass remains deliberately unbuilt for the reason above.
1124
+ */
1125
+ async deleteChunksThenIndex(eTag, chunkCount) {
1126
+ for (let i = 0; i < chunkCount; i++) {
1127
+ await this.store.delete(this.vault, BLOB_CHUNKS_COLLECTION, `${eTag}_${i}`);
1128
+ }
1129
+ await this.store.delete(this.vault, BLOB_INDEX_COLLECTION, eTag);
1130
+ }
1065
1131
  /**
1066
1132
  * Crypto-shred this record's blob attachments — called by
1067
1133
  * `vault.forget()`.
@@ -1449,7 +1515,7 @@ var BlobSet = class _BlobSet {
1449
1515
  const envelope = await this.store.get(this.vault, this.versionsCollection, key);
1450
1516
  if (!envelope) continue;
1451
1517
  try {
1452
- const record = this.encrypted ? JSON.parse(await openEnvelopeJson(envelope, dek)) : JSON.parse(envelope._data);
1518
+ const record = this.encrypted ? JSON.parse(await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek)) : JSON.parse(envelope._data);
1453
1519
  holds.set(record.eTag, (holds.get(record.eTag) ?? 0) + 1);
1454
1520
  readable.push(key);
1455
1521
  } catch {
@@ -1623,7 +1689,6 @@ var BlobSet = class _BlobSet {
1623
1689
  if (Object.keys(slots).length > 0) {
1624
1690
  if (slotsAtTier === toTier) {
1625
1691
  const toBlobDEK = await this.getDEK(dekKey(BLOB_COLLECTION, toTier));
1626
- const fromBlobDEK = await this.getDEK(dekKey(BLOB_COLLECTION, fromTier));
1627
1692
  const doneETags = new Set(Object.values(slots).map((s) => s.eTag).filter((eTag) => eTag !== ""));
1628
1693
  for (const eTag of doneETags) {
1629
1694
  let loaded;
@@ -1635,7 +1700,7 @@ var BlobSet = class _BlobSet {
1635
1700
  }
1636
1701
  if (!loaded || loaded.atTier !== toTier || loaded.blob._cek === void 0) continue;
1637
1702
  const plaintext = await this.fetchAllChunks(loaded.blob, toBlobDEK);
1638
- const oldETag = await hmacSha256Hex(fromBlobDEK, plaintext);
1703
+ const oldETag = await hmacSha256Hex(await this.addressKey(fromTier), plaintext);
1639
1704
  if (oldETag !== eTag) rehomedETags.set(oldETag, eTag);
1640
1705
  }
1641
1706
  } else {
@@ -1651,7 +1716,7 @@ var BlobSet = class _BlobSet {
1651
1716
  if (blob._cek === void 0) continue;
1652
1717
  if (policy === "dedup" && blob.refCount > 1) continue;
1653
1718
  const plaintext = await this.fetchAllChunks(blob, fromBlobDEK);
1654
- rehomedETags.set(eTag, await hmacSha256Hex(toBlobDEK, plaintext));
1719
+ rehomedETags.set(eTag, await hmacSha256Hex(await this.addressKey(toTier), plaintext));
1655
1720
  for (const [slotName, slot] of Object.entries(slots)) {
1656
1721
  if (slot.eTag !== eTag) continue;
1657
1722
  await this.putUnderDEK(slotName, plaintext, toBlobDEK, {
@@ -1733,13 +1798,13 @@ var BlobSet = class _BlobSet {
1733
1798
  if (!this.encrypted) return { record: JSON.parse(envelope._data), atTier: fromTier };
1734
1799
  const fromDek = await this.getDEK(dekKey(this.collection, fromTier));
1735
1800
  try {
1736
- const json2 = await openEnvelopeJson(envelope, fromDek);
1801
+ const json2 = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, fromDek);
1737
1802
  return { record: JSON.parse(json2), atTier: fromTier };
1738
1803
  } catch (err) {
1739
1804
  if (!(err instanceof TamperedError) || fromTier === toTier) throw err;
1740
1805
  }
1741
1806
  const toDek = await this.getDEK(dekKey(this.collection, toTier));
1742
- const json = await openEnvelopeJson(envelope, toDek);
1807
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, toDek);
1743
1808
  return { record: JSON.parse(json), atTier: toTier };
1744
1809
  }
1745
1810
  /**
@@ -1793,7 +1858,12 @@ var BlobSet = class _BlobSet {
1793
1858
  return already;
1794
1859
  }
1795
1860
  const loaded = await this.loadBlobObject(record.eTag, fromTier);
1796
- if (!loaded || loaded.blob._cek === void 0) return record.eTag;
1861
+ if (!loaded) return record.eTag;
1862
+ if (loaded.blob.refCount <= 0) {
1863
+ await this.releaseOldETagAfterMove(record.eTag, fromTier, stamp);
1864
+ return record.eTag;
1865
+ }
1866
+ if (loaded.blob._cek === void 0) return record.eTag;
1797
1867
  if (policy === "dedup" && loaded.blob.refCount > 1) return record.eTag;
1798
1868
  const plaintext = await this.fetchAllChunks(loaded.blob, fromBlobDEK);
1799
1869
  const { eTag: newETag } = await this.writeBlobContent(plaintext, toBlobDEK, {
@@ -1901,18 +1971,13 @@ var BlobSet = class _BlobSet {
1901
1971
  const id = `${eTag}_${index}`;
1902
1972
  const now = (/* @__PURE__ */ new Date()).toISOString();
1903
1973
  let envelope;
1974
+ const identity = { collection: BLOB_CHUNKS_COLLECTION, id, version: 1 };
1904
1975
  if (dek) {
1905
1976
  const aad = chunkAAD(eTag, index, chunkCount);
1906
1977
  const { iv, data } = await encryptBytesWithAAD(chunk, dek, aad);
1907
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: iv, _data: data };
1978
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
1908
1979
  } else {
1909
- envelope = {
1910
- _noydb: NOYDB_FORMAT_VERSION,
1911
- _v: 1,
1912
- _ts: now,
1913
- _iv: "",
1914
- _data: bufferToBase64(chunk)
1915
- };
1980
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: bufferToBase64(chunk) });
1916
1981
  }
1917
1982
  await this.store.put(this.vault, BLOB_CHUNKS_COLLECTION, id, envelope);
1918
1983
  }
@@ -1962,7 +2027,7 @@ var BlobSet = class _BlobSet {
1962
2027
  return JSON.parse(envelope._data);
1963
2028
  }
1964
2029
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
1965
- const json = await openEnvelopeJson(envelope, dek);
2030
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek);
1966
2031
  return JSON.parse(json);
1967
2032
  }
1968
2033
  /** @param tier See {@link loadVersionRecord}'s `tier` param — same resolution. */
@@ -1983,12 +2048,13 @@ var BlobSet = class _BlobSet {
1983
2048
  const json = JSON.stringify(record);
1984
2049
  const now = (/* @__PURE__ */ new Date()).toISOString();
1985
2050
  let envelope;
2051
+ const identity = { collection: this.versionsCollection, id: key, version: 1 };
1986
2052
  if (this.encrypted) {
1987
2053
  const dek = await this.getDEK(dekKey(this.collection, tier));
1988
- const { iv, data } = await encrypt(json, dek);
1989
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: iv, _data: data };
2054
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
2055
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
1990
2056
  } else {
1991
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: "", _data: json };
2057
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: json });
1992
2058
  }
1993
2059
  await this.store.put(this.vault, this.versionsCollection, key, envelope);
1994
2060
  }
@@ -2022,7 +2088,7 @@ var BlobSet = class _BlobSet {
2022
2088
  * attacker-controlled content pulled from the same forged row and would
2023
2089
  * make the check tautological). After assembling the plaintext, we
2024
2090
  * recompute the SAME content address every write path mints
2025
- * (`hmacSha256Hex(flatBlobDEK, plaintext)` — `writeBlobContent`'s Step 1,
2091
+ * (`hmacSha256Hex(addressKey(tier), plaintext)` — `writeBlobContent`'s Step 1,
2026
2092
  * unconditional on `_cek`) and compare it to that requested eTag. A
2027
2093
  * forged row can produce valid ciphertext under the flat DEK, but can't
2028
2094
  * produce plaintext that re-hashes to an address it doesn't control.
@@ -2050,7 +2116,7 @@ var BlobSet = class _BlobSet {
2050
2116
  const assembled = concatChunks(chunks);
2051
2117
  const plaintext = blob.compression === "gzip" ? await decompressBytes(assembled) : assembled;
2052
2118
  if (verifyFlatETag !== void 0 && blobDEK) {
2053
- const recomputed = await hmacSha256Hex(blobDEK, plaintext);
2119
+ const recomputed = await hmacSha256Hex(await this.addressKey(0), plaintext);
2054
2120
  if (recomputed !== verifyFlatETag) {
2055
2121
  throw new TamperedError(
2056
2122
  `Blob content for eTag "${verifyFlatETag}" failed content-address verification after a flat-tier fallback open \u2014 the _blob_index/_blob_chunks rows do not match the requested content address (#747/#749 review I1)`
@@ -2134,8 +2200,9 @@ var BlobSet = class _BlobSet {
2134
2200
  return;
2135
2201
  }
2136
2202
  this.assertBlobWritable();
2137
- const blobDEK = this.encrypted ? await this.getDEK(dekKey(BLOB_COLLECTION, await this.ownerTier())) : null;
2138
- return this.putUnderDEK(slotName, data, blobDEK, opts);
2203
+ const ownerTier = await this.ownerTier();
2204
+ const blobDEK = this.encrypted ? await this.getDEK(dekKey(BLOB_COLLECTION, ownerTier)) : null;
2205
+ return this.putUnderDEK(slotName, data, blobDEK, opts, void 0, ownerTier);
2139
2206
  }
2140
2207
  /**
2141
2208
  * The slot-attachment core of `put()` (Step 7 — CAS the slot metadata),
@@ -2300,7 +2367,7 @@ var BlobSet = class _BlobSet {
2300
2367
  * dedup-hit branch's behavior exactly.
2301
2368
  */
2302
2369
  async writeBlobContent(data, blobDEK, opts, tier, incrementStamp, knownApplied) {
2303
- const eTag = blobDEK ? await hmacSha256Hex(blobDEK, data) : await plainSha256Hex(data);
2370
+ const eTag = blobDEK ? await hmacSha256Hex(await this.addressKey(tier ?? 0), data) : await plainSha256Hex(data);
2304
2371
  let mimeType = opts?.mimeType;
2305
2372
  if (!mimeType) {
2306
2373
  const detected = detectMagic(data.subarray(0, 16));
@@ -2887,7 +2954,7 @@ var BlobSet = class _BlobSet {
2887
2954
  versions.push(JSON.parse(envelope._data));
2888
2955
  } else {
2889
2956
  const dek = await this.getDEK(this.collection);
2890
- const json = await openEnvelopeJson(envelope, dek);
2957
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek);
2891
2958
  versions.push(JSON.parse(json));
2892
2959
  }
2893
2960
  }
@@ -2996,7 +3063,7 @@ var BlobSet = class _BlobSet {
2996
3063
  const aad = chunkAAD(slot.eTag, 0, result.blob.chunkCount);
2997
3064
  const decrypted = await decryptBytesWithAAD(envelope._iv, envelope._data, chunkKey, aad);
2998
3065
  const plaintext = result.blob.compression === "gzip" ? await decompressBytes(decrypted) : decrypted;
2999
- const recomputed = await hmacSha256Hex(blobDEK, plaintext);
3066
+ const recomputed = await hmacSha256Hex(await this.addressKey(await this.ownerTier()), plaintext);
3000
3067
  if (recomputed !== slot.eTag) {
3001
3068
  throw new TamperedError(
3002
3069
  `Blob content for eTag "${slot.eTag}" failed content-address verification in decryptResponse() \u2014 the caller-provided ciphertext does not match the requested content address (#757)`
@@ -3070,4 +3137,4 @@ export {
3070
3137
  DEFAULT_CHUNK_SIZE,
3071
3138
  BlobSet
3072
3139
  };
3073
- //# sourceMappingURL=chunk-PL2GHSCM.js.map
3140
+ //# sourceMappingURL=chunk-JMJSCI7U.js.map