@noy-db/hub 0.6.0-pre.17 → 0.6.0-pre.19

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 (426) hide show
  1. package/dist/api-Z5VHH24A.js +20 -0
  2. package/dist/attestation/index.js +18 -18
  3. package/dist/{backup-7X3PFTSI.js → backup-K62BFMYK.js} +16 -16
  4. package/dist/{backup-7X3PFTSI.js.map → backup-K62BFMYK.js.map} +1 -1
  5. package/dist/blobs/index.js +13 -13
  6. package/dist/broker/index.js +12 -12
  7. package/dist/cargo/index.js +32 -32
  8. package/dist/{chunk-5SK5AFYH.js → chunk-2E2MKBMI.js} +2 -2
  9. package/dist/{chunk-SDEHNGWW.js → chunk-2IK6AC6A.js} +7 -6
  10. package/dist/{chunk-SDEHNGWW.js.map → chunk-2IK6AC6A.js.map} +1 -1
  11. package/dist/{chunk-7TZTQS4H.js → chunk-32O2N2CH.js} +48 -21
  12. package/dist/chunk-32O2N2CH.js.map +1 -0
  13. package/dist/{chunk-QKRJUPAC.js → chunk-37P5VB4N.js} +13 -16
  14. package/dist/chunk-37P5VB4N.js.map +1 -0
  15. package/dist/{chunk-5UGEGEIJ.js → chunk-3Y4OFWQJ.js} +1 -1
  16. package/dist/chunk-3Y4OFWQJ.js.map +1 -0
  17. package/dist/{chunk-7LLKPODL.js → chunk-437FDIHO.js} +3 -3
  18. package/dist/{chunk-AMKCY454.js → chunk-47ZFULEZ.js} +8 -3
  19. package/dist/{chunk-AMKCY454.js.map → chunk-47ZFULEZ.js.map} +1 -1
  20. package/dist/{chunk-4GR422R5.js → chunk-4HVTRHSA.js} +16 -9
  21. package/dist/chunk-4HVTRHSA.js.map +1 -0
  22. package/dist/{chunk-VEA35MQP.js → chunk-5BS6IQZZ.js} +11 -14
  23. package/dist/chunk-5BS6IQZZ.js.map +1 -0
  24. package/dist/{chunk-QWNYUTI2.js → chunk-5EJQNA26.js} +2 -2
  25. package/dist/{chunk-C66T4W5P.js → chunk-5J5TTSGW.js} +3 -3
  26. package/dist/{chunk-JHYISAID.js → chunk-5JT4Y5UE.js} +10 -10
  27. package/dist/{chunk-VUQZYVYX.js → chunk-6S466CMQ.js} +92 -35
  28. package/dist/chunk-6S466CMQ.js.map +1 -0
  29. package/dist/{chunk-IRHOQFA7.js → chunk-7RCZ436O.js} +2 -2
  30. package/dist/{chunk-42IDLU5V.js → chunk-A3NTKHDB.js} +2 -2
  31. package/dist/{chunk-3JQVA527.js → chunk-A4K5GLE6.js} +4 -4
  32. package/dist/{chunk-K2MR7ROB.js → chunk-APV42WPR.js} +2 -2
  33. package/dist/{chunk-MVG67SMN.js → chunk-AQF7JSQR.js} +2 -2
  34. package/dist/{chunk-VTTRWLOR.js → chunk-BP4I7IBK.js} +2 -2
  35. package/dist/{chunk-T7AEAFEE.js → chunk-BTNKPDZM.js} +3 -3
  36. package/dist/{chunk-PCXAUC65.js → chunk-C7WJNVJG.js} +2 -2
  37. package/dist/{chunk-UNR6G3EJ.js → chunk-CV7WXCZD.js} +37 -33
  38. package/dist/chunk-CV7WXCZD.js.map +1 -0
  39. package/dist/{chunk-67XA44HH.js → chunk-CVYXIN5B.js} +3 -3
  40. package/dist/{chunk-BKYQNNO3.js → chunk-D5UDZANO.js} +203 -137
  41. package/dist/chunk-D5UDZANO.js.map +1 -0
  42. package/dist/{chunk-HVR74IBG.js → chunk-DJ23QZIN.js} +2 -2
  43. package/dist/{chunk-BMDF4TLU.js → chunk-DKYEVHZH.js} +7 -10
  44. package/dist/chunk-DKYEVHZH.js.map +1 -0
  45. package/dist/{chunk-N7HOHWKF.js → chunk-DYASJSKI.js} +8 -11
  46. package/dist/{chunk-N7HOHWKF.js.map → chunk-DYASJSKI.js.map} +1 -1
  47. package/dist/{chunk-OAWVM5L6.js → chunk-E6VDPBE3.js} +13 -15
  48. package/dist/chunk-E6VDPBE3.js.map +1 -0
  49. package/dist/{chunk-WBHQX6ME.js → chunk-E6WANBD6.js} +14 -15
  50. package/dist/chunk-E6WANBD6.js.map +1 -0
  51. package/dist/{chunk-VQQUOEON.js → chunk-EG6AQBYW.js} +10 -10
  52. package/dist/{chunk-GWI65NDQ.js → chunk-EJIVFOOQ.js} +6 -6
  53. package/dist/{chunk-YGJZLOSR.js → chunk-GDGTIWB4.js} +2 -2
  54. package/dist/{chunk-TQ7IRULX.js → chunk-GILI76SU.js} +2 -2
  55. package/dist/{chunk-4444HN72.js → chunk-GT72D4FO.js} +3 -3
  56. package/dist/{chunk-OXRPH6AR.js → chunk-GYUCRDAU.js} +15 -12
  57. package/dist/chunk-GYUCRDAU.js.map +1 -0
  58. package/dist/{chunk-JV2CNEX2.js → chunk-HGAR7H5M.js} +239 -188
  59. package/dist/chunk-HGAR7H5M.js.map +1 -0
  60. package/dist/{chunk-SGEI3IJK.js → chunk-HGJC7I5F.js} +2 -2
  61. package/dist/{chunk-C52CJDFO.js → chunk-HJRTFXAA.js} +7 -10
  62. package/dist/chunk-HJRTFXAA.js.map +1 -0
  63. package/dist/chunk-HK67PX4J.js +27 -0
  64. package/dist/chunk-HK67PX4J.js.map +1 -0
  65. package/dist/{chunk-V4M4BZNW.js → chunk-HTHRCGWP.js} +2 -2
  66. package/dist/{chunk-YVOW35HH.js → chunk-HTMQBBF3.js} +5 -7
  67. package/dist/chunk-HTMQBBF3.js.map +1 -0
  68. package/dist/{chunk-QC2HGYFX.js → chunk-HUYNPLTT.js} +4 -4
  69. package/dist/{chunk-APUP2J5M.js → chunk-I26TE27S.js} +7 -7
  70. package/dist/{chunk-DEP24EE3.js → chunk-ICCRAPWD.js} +4 -4
  71. package/dist/{chunk-ES36R3U2.js → chunk-IOURTXTM.js} +52 -65
  72. package/dist/chunk-IOURTXTM.js.map +1 -0
  73. package/dist/{chunk-JU3JKOY5.js → chunk-IPDS2TYW.js} +3 -3
  74. package/dist/{chunk-QJBXB4WU.js → chunk-JHO6FGZX.js} +25 -31
  75. package/dist/chunk-JHO6FGZX.js.map +1 -0
  76. package/dist/{chunk-YDJXGYYA.js → chunk-JIF3IBRK.js} +2 -2
  77. package/dist/{chunk-S6CP5FWF.js → chunk-KBOPY6W2.js} +2 -2
  78. package/dist/{chunk-RVTOCAHQ.js → chunk-KDX6VEYV.js} +2 -2
  79. package/dist/chunk-KDX6VEYV.js.map +1 -0
  80. package/dist/{chunk-H545OIWE.js → chunk-KM6YR5XF.js} +2 -2
  81. package/dist/{chunk-AFSMT3WI.js → chunk-KUXTWVAR.js} +3 -3
  82. package/dist/{chunk-466KGOQB.js → chunk-L2XQ776M.js} +2 -2
  83. package/dist/{chunk-QI2KXQOM.js → chunk-L6FSZFG7.js} +2 -2
  84. package/dist/{chunk-EEBMKMA7.js → chunk-LAFP5H5U.js} +35 -47
  85. package/dist/chunk-LAFP5H5U.js.map +1 -0
  86. package/dist/{chunk-I7JF5TNL.js → chunk-LBDTQM3R.js} +3 -3
  87. package/dist/{chunk-V3OLO4TK.js → chunk-M4IKEOJS.js} +20 -17
  88. package/dist/chunk-M4IKEOJS.js.map +1 -0
  89. package/dist/{chunk-5NKSNW25.js → chunk-MNMYHZVU.js} +2 -2
  90. package/dist/{chunk-IEA3TZJE.js → chunk-MNUTPZRQ.js} +31 -49
  91. package/dist/chunk-MNUTPZRQ.js.map +1 -0
  92. package/dist/{chunk-Z2OFE6IX.js → chunk-MQXYR65M.js} +15 -24
  93. package/dist/chunk-MQXYR65M.js.map +1 -0
  94. package/dist/{chunk-5VVBZ6E4.js → chunk-N2HKBESK.js} +4 -4
  95. package/dist/{chunk-HNOBRU24.js → chunk-N7YAQKAO.js} +2 -2
  96. package/dist/{chunk-6U7M7AX6.js → chunk-NH2MST6J.js} +2 -2
  97. package/dist/{chunk-JAHIL6WO.js → chunk-NRNTXBHT.js} +7 -10
  98. package/dist/chunk-NRNTXBHT.js.map +1 -0
  99. package/dist/{chunk-URVL4EKU.js → chunk-NYSD43OE.js} +15 -24
  100. package/dist/chunk-NYSD43OE.js.map +1 -0
  101. package/dist/{chunk-LUFZPROB.js → chunk-ODVIFBAQ.js} +16 -17
  102. package/dist/chunk-ODVIFBAQ.js.map +1 -0
  103. package/dist/{chunk-SJOK23XT.js → chunk-OIIAXFKM.js} +4 -4
  104. package/dist/chunk-OIIAXFKM.js.map +1 -0
  105. package/dist/{chunk-FSZPQCDR.js → chunk-OQLYMBJI.js} +3 -3
  106. package/dist/{chunk-EMFFWSAD.js → chunk-OWGEHDT2.js} +10 -10
  107. package/dist/chunk-OWGEHDT2.js.map +1 -0
  108. package/dist/{chunk-I64WQSN3.js → chunk-P7L3OQLL.js} +19 -2
  109. package/dist/chunk-P7L3OQLL.js.map +1 -0
  110. package/dist/{chunk-FZ2SSI5R.js → chunk-PG6PFMDC.js} +2 -2
  111. package/dist/{chunk-2RGQNFJB.js → chunk-PZSS7MUM.js} +11 -9
  112. package/dist/chunk-PZSS7MUM.js.map +1 -0
  113. package/dist/{chunk-UKKBKEUI.js → chunk-QPIUFRUC.js} +3 -3
  114. package/dist/{chunk-RJTGXZT6.js → chunk-REL4OLWW.js} +2 -2
  115. package/dist/{chunk-N4GAJSRQ.js → chunk-RNSC2ARR.js} +3 -3
  116. package/dist/{chunk-RWPNRCK2.js → chunk-RORE2GX2.js} +2 -2
  117. package/dist/{chunk-YH65A6WM.js → chunk-RSFG7XHM.js} +2 -2
  118. package/dist/{chunk-QLMUW7OC.js → chunk-S55DBWRC.js} +2 -2
  119. package/dist/{chunk-AKFNLRA2.js → chunk-SA77BQ7F.js} +27 -143
  120. package/dist/chunk-SA77BQ7F.js.map +1 -0
  121. package/dist/{chunk-RBTZLXZJ.js → chunk-SFD2LL7G.js} +2 -2
  122. package/dist/{chunk-XTC5EKST.js → chunk-SG3OQCRG.js} +3 -3
  123. package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
  124. package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
  125. package/dist/{chunk-P5ARVLNW.js → chunk-TC6MBEGH.js} +11 -8
  126. package/dist/chunk-TC6MBEGH.js.map +1 -0
  127. package/dist/{chunk-D6E5N2O3.js → chunk-TENLCGYD.js} +12 -10
  128. package/dist/{chunk-D6E5N2O3.js.map → chunk-TENLCGYD.js.map} +1 -1
  129. package/dist/{chunk-X2FXEEQT.js → chunk-VH2W6BOG.js} +7 -7
  130. package/dist/{chunk-FHFMWYGM.js → chunk-VHVMJWM6.js} +7 -7
  131. package/dist/{chunk-FHFMWYGM.js.map → chunk-VHVMJWM6.js.map} +1 -1
  132. package/dist/{chunk-QTDAPDDV.js → chunk-VJ4B3ZXY.js} +15 -3
  133. package/dist/chunk-VJ4B3ZXY.js.map +1 -0
  134. package/dist/{chunk-RDPZMUCX.js → chunk-W6NFONOV.js} +2 -2
  135. package/dist/{chunk-Z3U2YVNM.js → chunk-WBNXZU42.js} +4 -4
  136. package/dist/{chunk-7EIPPOEL.js → chunk-WKD5ESK4.js} +2 -2
  137. package/dist/{chunk-6VAM5THN.js → chunk-YEZW6UJA.js} +15 -15
  138. package/dist/{chunk-6VAM5THN.js.map → chunk-YEZW6UJA.js.map} +1 -1
  139. package/dist/chunk-YOT7D63X.js +190 -0
  140. package/dist/chunk-YOT7D63X.js.map +1 -0
  141. package/dist/{chunk-6JRIYG2C.js → chunk-YVTADFTC.js} +14 -15
  142. package/dist/chunk-YVTADFTC.js.map +1 -0
  143. package/dist/{chunk-C3YP5KKS.js → chunk-ZBDWKPBW.js} +15 -16
  144. package/dist/chunk-ZBDWKPBW.js.map +1 -0
  145. package/dist/{chunk-NWPR2V5W.js → chunk-ZPMXYPBR.js} +2 -2
  146. package/dist/{chunk-RGPB25DB.js → chunk-ZVAFJQZB.js} +25 -19
  147. package/dist/chunk-ZVAFJQZB.js.map +1 -0
  148. package/dist/{chunk-TQLYMYOK.js → chunk-ZWKF3CD3.js} +2 -2
  149. package/dist/classified/index.js +5 -5
  150. package/dist/{classified-marker-W2PUYC3K.js → classified-marker-PMDG3O36.js} +3 -3
  151. package/dist/collection-facade-ZJK5EB33.js +45 -0
  152. package/dist/{computed-5E2OM6EN.js → computed-UHCBRILW.js} +3 -3
  153. package/dist/consent/index.js +9 -9
  154. package/dist/cover/index.js +10 -3
  155. package/dist/custody/index.js +11 -11
  156. package/dist/{dead-filter-MVFQCLXY.js → dead-filter-777VWDER.js} +2 -2
  157. package/dist/debug/index.js +1 -1
  158. package/dist/{delegation-I7XXO5LL.js → delegation-4R5DU23X.js} +23 -24
  159. package/dist/delegation-4R5DU23X.js.map +1 -0
  160. package/dist/derivations/index.js +12 -12
  161. package/dist/derive-3WAS2G5T.js +22 -0
  162. package/dist/directory/index.js +10 -10
  163. package/dist/{dispatch-PY5RUHJF.js → dispatch-3EN6YCCS.js} +18 -18
  164. package/dist/{dispatch-K3MDLCXG.js → dispatch-ASL257KG.js} +5 -5
  165. package/dist/{enclave-77K7UDLS.js → enclave-ZJS5R5RH.js} +17 -9
  166. package/dist/executor-GPM6DNWV.js +9 -0
  167. package/dist/executor-LJSMZ4IB.js +9 -0
  168. package/dist/executor-SHUVRZUJ.js +29 -0
  169. package/dist/export-accessible-GNY6DC6U.js +23 -0
  170. package/dist/extract-partition-BG3AF4NZ.js +38 -0
  171. package/dist/{fanout-sidecar-JI3MUPQV.js → fanout-sidecar-TFPWDOME.js} +18 -27
  172. package/dist/fanout-sidecar-TFPWDOME.js.map +1 -0
  173. package/dist/find-KX6OKHDP.js +11 -0
  174. package/dist/forget/index.js +9 -9
  175. package/dist/guards/index.js +4 -4
  176. package/dist/history/index.js +23 -20
  177. package/dist/history/index.js.map +1 -1
  178. package/dist/i18n/index.js +14 -14
  179. package/dist/index.d.ts +16 -0
  180. package/dist/index.js +156 -154
  181. package/dist/index.js.map +1 -1
  182. package/dist/indexing/index.js +2 -2
  183. package/dist/introspection/index.js +11 -11
  184. package/dist/issue-PAUM7NCX.js +19 -0
  185. package/dist/kernel/enclave/index.d.ts +6 -5
  186. package/dist/kernel/enclave/record-aad.d.ts +79 -7
  187. package/dist/kernel/enclave/record-envelope.d.ts +54 -7
  188. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  189. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  190. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  191. package/dist/kernel/enclave/record-keys/rekey.d.ts +8 -2
  192. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
  193. package/dist/kernel/errors.d.ts +17 -1
  194. package/dist/kernel/merge-authority.d.ts +25 -0
  195. package/dist/kernel/tier-visibility.d.ts +15 -0
  196. package/dist/kernel/types.d.ts +8 -0
  197. package/dist/kernel/vault.d.ts +1 -1
  198. package/dist/kernel/via/index.d.ts +11 -2
  199. package/dist/{ledger-3RDSSMGD.js → ledger-62CEPRPX.js} +11 -11
  200. package/dist/liberate-7QY7TULB.js +24 -0
  201. package/dist/{link-set-VJIWWUZO.js → link-set-ZRYNUHN3.js} +11 -11
  202. package/dist/{managed-secret-XGGJ3BC3.js → managed-secret-T2WB4O47.js} +11 -3
  203. package/dist/materialized-views/index.js +22 -22
  204. package/dist/money/index.js +4 -4
  205. package/dist/noydb-VZIVPDXG.js +84 -0
  206. package/dist/overlay-views/index.js +4 -4
  207. package/dist/periods/index.js +12 -12
  208. package/dist/pod/index.js +58 -57
  209. package/dist/{pod-handle-7BVSWP5B.js → pod-handle-UPLXOGIK.js} +11 -11
  210. package/dist/{pod-handle-7BVSWP5B.js.map → pod-handle-UPLXOGIK.js.map} +1 -1
  211. package/dist/policy/index.js +11 -4
  212. package/dist/port/with/merge-authority.d.ts +52 -0
  213. package/dist/port/with/strategies.d.ts +2 -0
  214. package/dist/portability/index.js +8 -8
  215. package/dist/{post-register-W3T4U57K.js → post-register-J4DEVNXK.js} +6 -6
  216. package/dist/query/index.js +3 -3
  217. package/dist/reduce/index.js +4 -4
  218. package/dist/register-UPD4GKBC.js +32 -0
  219. package/dist/registry-7KX2HWFS.js +18 -0
  220. package/dist/registry-PKYYEHEW.js +9 -0
  221. package/dist/registry-XHCYMD34.js +19 -0
  222. package/dist/registry-XIRTZHPC.js +9 -0
  223. package/dist/request-withdrawal-XZSESWZV.js +31 -0
  224. package/dist/{reveal-G7W7N3AZ.js → reveal-525XWQU2.js} +6 -6
  225. package/dist/revoke-QI7YHQ2B.js +24 -0
  226. package/dist/satellites/index.js +1 -1
  227. package/dist/schema-update/index.js +2 -2
  228. package/dist/sealed-record/index.js +20 -13
  229. package/dist/sealed-record/index.js.map +1 -1
  230. package/dist/search/index.js +4 -4
  231. package/dist/{seed-2FUULTQV.js → seed-2KZDTFS4.js} +19 -22
  232. package/dist/seed-2KZDTFS4.js.map +1 -0
  233. package/dist/sequence/index.js +9 -9
  234. package/dist/session/index.js +9 -9
  235. package/dist/shadow/index.js +2 -2
  236. package/dist/signer-BZWDPGGN.js +25 -0
  237. package/dist/snapshots/index.js +10 -10
  238. package/dist/{stale-42FPALK2.js → stale-PQYPVCER.js} +10 -10
  239. package/dist/storage-MJHKNQRO.js +23 -0
  240. package/dist/{store-coordination-provider-Y3VXBHPL.js → store-coordination-provider-TFHZLKHG.js} +18 -12
  241. package/dist/store-coordination-provider-TFHZLKHG.js.map +1 -0
  242. package/dist/sync/index.js +11 -11
  243. package/dist/team/index.js +15 -14
  244. package/dist/tiers/index.js +11 -10
  245. package/dist/to/index.js +1 -1
  246. package/dist/transactions/index.js +3 -3
  247. package/dist/util/index.js +1 -1
  248. package/dist/vault-head/index.js +111 -0
  249. package/dist/vault-head/index.js.map +1 -0
  250. package/dist/{verify-SHJXGZGM.js → verify-J6DEOXP3.js} +5 -5
  251. package/dist/walk-BX4NSB5L.js +21 -0
  252. package/dist/with-audit/periods/periods.d.ts +1 -1
  253. package/dist/with-audit/periods/strategy.d.ts +1 -1
  254. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  255. package/dist/with-audit/tiers/index.d.ts +17 -2
  256. package/dist/with-commit/history/history.d.ts +26 -0
  257. package/dist/with-commit/history/index.d.ts +2 -1
  258. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  259. package/dist/with-commit/history/strategy.d.ts +11 -1
  260. package/dist/with-commit/vault-head/active.d.ts +2 -0
  261. package/dist/with-commit/vault-head/head.d.ts +28 -0
  262. package/dist/with-commit/vault-head/index.d.ts +10 -0
  263. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  264. package/dist/with-commit/vault-head/verify.d.ts +50 -0
  265. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  266. package/dist/with-party/directory/storage.d.ts +0 -11
  267. package/dist/with-party/directory/visibility.d.ts +0 -21
  268. package/dist/with-party/policy/storage.d.ts +0 -10
  269. package/dist/with-party/team/tiers.d.ts +2 -1
  270. package/dist/with-sync/engine.d.ts +33 -5
  271. package/dist/with-sync/strategy.d.ts +3 -0
  272. package/dist/withdraw-accessible-K4CPMH4C.js +28 -0
  273. package/package.json +7 -3
  274. package/dist/api-AEIN3KAQ.js +0 -20
  275. package/dist/chunk-2RGQNFJB.js.map +0 -1
  276. package/dist/chunk-4GR422R5.js.map +0 -1
  277. package/dist/chunk-5UGEGEIJ.js.map +0 -1
  278. package/dist/chunk-6JRIYG2C.js.map +0 -1
  279. package/dist/chunk-7TZTQS4H.js.map +0 -1
  280. package/dist/chunk-AFHQATY4.js +0 -47
  281. package/dist/chunk-AFHQATY4.js.map +0 -1
  282. package/dist/chunk-AKFNLRA2.js.map +0 -1
  283. package/dist/chunk-BKYQNNO3.js.map +0 -1
  284. package/dist/chunk-BMDF4TLU.js.map +0 -1
  285. package/dist/chunk-C3YP5KKS.js.map +0 -1
  286. package/dist/chunk-C52CJDFO.js.map +0 -1
  287. package/dist/chunk-EEBMKMA7.js.map +0 -1
  288. package/dist/chunk-EMFFWSAD.js.map +0 -1
  289. package/dist/chunk-ES36R3U2.js.map +0 -1
  290. package/dist/chunk-I64WQSN3.js.map +0 -1
  291. package/dist/chunk-IEA3TZJE.js.map +0 -1
  292. package/dist/chunk-JAHIL6WO.js.map +0 -1
  293. package/dist/chunk-JV2CNEX2.js.map +0 -1
  294. package/dist/chunk-LUFZPROB.js.map +0 -1
  295. package/dist/chunk-OAWVM5L6.js.map +0 -1
  296. package/dist/chunk-OXRPH6AR.js.map +0 -1
  297. package/dist/chunk-P5ARVLNW.js.map +0 -1
  298. package/dist/chunk-QJBXB4WU.js.map +0 -1
  299. package/dist/chunk-QKRJUPAC.js.map +0 -1
  300. package/dist/chunk-QTDAPDDV.js.map +0 -1
  301. package/dist/chunk-RGPB25DB.js.map +0 -1
  302. package/dist/chunk-RVTOCAHQ.js.map +0 -1
  303. package/dist/chunk-SJOK23XT.js.map +0 -1
  304. package/dist/chunk-UNR6G3EJ.js.map +0 -1
  305. package/dist/chunk-URVL4EKU.js.map +0 -1
  306. package/dist/chunk-V3OLO4TK.js.map +0 -1
  307. package/dist/chunk-VEA35MQP.js.map +0 -1
  308. package/dist/chunk-VUQZYVYX.js.map +0 -1
  309. package/dist/chunk-WBHQX6ME.js.map +0 -1
  310. package/dist/chunk-YVOW35HH.js.map +0 -1
  311. package/dist/chunk-Z2OFE6IX.js.map +0 -1
  312. package/dist/collection-facade-CRXN72DU.js +0 -45
  313. package/dist/delegation-I7XXO5LL.js.map +0 -1
  314. package/dist/derive-NL7X2EFT.js +0 -22
  315. package/dist/executor-FNGVGDW3.js +0 -29
  316. package/dist/executor-PCZN2LTY.js +0 -9
  317. package/dist/executor-WFTHIDT7.js +0 -9
  318. package/dist/export-accessible-QWUYY2OY.js +0 -23
  319. package/dist/extract-partition-CGCURVS4.js +0 -38
  320. package/dist/fanout-sidecar-JI3MUPQV.js.map +0 -1
  321. package/dist/find-VBNMB42N.js +0 -11
  322. package/dist/issue-7IPUNAFA.js +0 -19
  323. package/dist/liberate-2DNJ7AJ7.js +0 -24
  324. package/dist/noydb-CLQP36JR.js +0 -83
  325. package/dist/register-YUVC4G27.js +0 -32
  326. package/dist/registry-BPKJX562.js +0 -19
  327. package/dist/registry-E4FM32KD.js +0 -9
  328. package/dist/registry-HACMULJJ.js +0 -9
  329. package/dist/registry-HRFRBFDV.js +0 -18
  330. package/dist/request-withdrawal-CXTQLMJK.js +0 -31
  331. package/dist/revoke-ZX3TZUI6.js +0 -24
  332. package/dist/seed-2FUULTQV.js.map +0 -1
  333. package/dist/signer-FPUIX63Z.js +0 -25
  334. package/dist/storage-6QODT6K5.js +0 -23
  335. package/dist/store-coordination-provider-Y3VXBHPL.js.map +0 -1
  336. package/dist/walk-5PGJI3ND.js +0 -21
  337. package/dist/withdraw-accessible-PFCQQGNP.js +0 -28
  338. /package/dist/{api-AEIN3KAQ.js.map → api-Z5VHH24A.js.map} +0 -0
  339. /package/dist/{chunk-5SK5AFYH.js.map → chunk-2E2MKBMI.js.map} +0 -0
  340. /package/dist/{chunk-7LLKPODL.js.map → chunk-437FDIHO.js.map} +0 -0
  341. /package/dist/{chunk-QWNYUTI2.js.map → chunk-5EJQNA26.js.map} +0 -0
  342. /package/dist/{chunk-C66T4W5P.js.map → chunk-5J5TTSGW.js.map} +0 -0
  343. /package/dist/{chunk-JHYISAID.js.map → chunk-5JT4Y5UE.js.map} +0 -0
  344. /package/dist/{chunk-IRHOQFA7.js.map → chunk-7RCZ436O.js.map} +0 -0
  345. /package/dist/{chunk-42IDLU5V.js.map → chunk-A3NTKHDB.js.map} +0 -0
  346. /package/dist/{chunk-3JQVA527.js.map → chunk-A4K5GLE6.js.map} +0 -0
  347. /package/dist/{chunk-K2MR7ROB.js.map → chunk-APV42WPR.js.map} +0 -0
  348. /package/dist/{chunk-MVG67SMN.js.map → chunk-AQF7JSQR.js.map} +0 -0
  349. /package/dist/{chunk-VTTRWLOR.js.map → chunk-BP4I7IBK.js.map} +0 -0
  350. /package/dist/{chunk-T7AEAFEE.js.map → chunk-BTNKPDZM.js.map} +0 -0
  351. /package/dist/{chunk-PCXAUC65.js.map → chunk-C7WJNVJG.js.map} +0 -0
  352. /package/dist/{chunk-67XA44HH.js.map → chunk-CVYXIN5B.js.map} +0 -0
  353. /package/dist/{chunk-HVR74IBG.js.map → chunk-DJ23QZIN.js.map} +0 -0
  354. /package/dist/{chunk-VQQUOEON.js.map → chunk-EG6AQBYW.js.map} +0 -0
  355. /package/dist/{chunk-GWI65NDQ.js.map → chunk-EJIVFOOQ.js.map} +0 -0
  356. /package/dist/{chunk-YGJZLOSR.js.map → chunk-GDGTIWB4.js.map} +0 -0
  357. /package/dist/{chunk-TQ7IRULX.js.map → chunk-GILI76SU.js.map} +0 -0
  358. /package/dist/{chunk-4444HN72.js.map → chunk-GT72D4FO.js.map} +0 -0
  359. /package/dist/{chunk-SGEI3IJK.js.map → chunk-HGJC7I5F.js.map} +0 -0
  360. /package/dist/{chunk-V4M4BZNW.js.map → chunk-HTHRCGWP.js.map} +0 -0
  361. /package/dist/{chunk-QC2HGYFX.js.map → chunk-HUYNPLTT.js.map} +0 -0
  362. /package/dist/{chunk-APUP2J5M.js.map → chunk-I26TE27S.js.map} +0 -0
  363. /package/dist/{chunk-DEP24EE3.js.map → chunk-ICCRAPWD.js.map} +0 -0
  364. /package/dist/{chunk-JU3JKOY5.js.map → chunk-IPDS2TYW.js.map} +0 -0
  365. /package/dist/{chunk-YDJXGYYA.js.map → chunk-JIF3IBRK.js.map} +0 -0
  366. /package/dist/{chunk-S6CP5FWF.js.map → chunk-KBOPY6W2.js.map} +0 -0
  367. /package/dist/{chunk-H545OIWE.js.map → chunk-KM6YR5XF.js.map} +0 -0
  368. /package/dist/{chunk-AFSMT3WI.js.map → chunk-KUXTWVAR.js.map} +0 -0
  369. /package/dist/{chunk-466KGOQB.js.map → chunk-L2XQ776M.js.map} +0 -0
  370. /package/dist/{chunk-QI2KXQOM.js.map → chunk-L6FSZFG7.js.map} +0 -0
  371. /package/dist/{chunk-I7JF5TNL.js.map → chunk-LBDTQM3R.js.map} +0 -0
  372. /package/dist/{chunk-5NKSNW25.js.map → chunk-MNMYHZVU.js.map} +0 -0
  373. /package/dist/{chunk-5VVBZ6E4.js.map → chunk-N2HKBESK.js.map} +0 -0
  374. /package/dist/{chunk-HNOBRU24.js.map → chunk-N7YAQKAO.js.map} +0 -0
  375. /package/dist/{chunk-6U7M7AX6.js.map → chunk-NH2MST6J.js.map} +0 -0
  376. /package/dist/{chunk-FSZPQCDR.js.map → chunk-OQLYMBJI.js.map} +0 -0
  377. /package/dist/{chunk-FZ2SSI5R.js.map → chunk-PG6PFMDC.js.map} +0 -0
  378. /package/dist/{chunk-UKKBKEUI.js.map → chunk-QPIUFRUC.js.map} +0 -0
  379. /package/dist/{chunk-RJTGXZT6.js.map → chunk-REL4OLWW.js.map} +0 -0
  380. /package/dist/{chunk-N4GAJSRQ.js.map → chunk-RNSC2ARR.js.map} +0 -0
  381. /package/dist/{chunk-RWPNRCK2.js.map → chunk-RORE2GX2.js.map} +0 -0
  382. /package/dist/{chunk-YH65A6WM.js.map → chunk-RSFG7XHM.js.map} +0 -0
  383. /package/dist/{chunk-QLMUW7OC.js.map → chunk-S55DBWRC.js.map} +0 -0
  384. /package/dist/{chunk-RBTZLXZJ.js.map → chunk-SFD2LL7G.js.map} +0 -0
  385. /package/dist/{chunk-XTC5EKST.js.map → chunk-SG3OQCRG.js.map} +0 -0
  386. /package/dist/{chunk-X2FXEEQT.js.map → chunk-VH2W6BOG.js.map} +0 -0
  387. /package/dist/{chunk-RDPZMUCX.js.map → chunk-W6NFONOV.js.map} +0 -0
  388. /package/dist/{chunk-Z3U2YVNM.js.map → chunk-WBNXZU42.js.map} +0 -0
  389. /package/dist/{chunk-7EIPPOEL.js.map → chunk-WKD5ESK4.js.map} +0 -0
  390. /package/dist/{chunk-NWPR2V5W.js.map → chunk-ZPMXYPBR.js.map} +0 -0
  391. /package/dist/{chunk-TQLYMYOK.js.map → chunk-ZWKF3CD3.js.map} +0 -0
  392. /package/dist/{classified-marker-W2PUYC3K.js.map → classified-marker-PMDG3O36.js.map} +0 -0
  393. /package/dist/{collection-facade-CRXN72DU.js.map → collection-facade-ZJK5EB33.js.map} +0 -0
  394. /package/dist/{computed-5E2OM6EN.js.map → computed-UHCBRILW.js.map} +0 -0
  395. /package/dist/{dead-filter-MVFQCLXY.js.map → dead-filter-777VWDER.js.map} +0 -0
  396. /package/dist/{derive-NL7X2EFT.js.map → derive-3WAS2G5T.js.map} +0 -0
  397. /package/dist/{dispatch-PY5RUHJF.js.map → dispatch-3EN6YCCS.js.map} +0 -0
  398. /package/dist/{dispatch-K3MDLCXG.js.map → dispatch-ASL257KG.js.map} +0 -0
  399. /package/dist/{enclave-77K7UDLS.js.map → enclave-ZJS5R5RH.js.map} +0 -0
  400. /package/dist/{executor-FNGVGDW3.js.map → executor-GPM6DNWV.js.map} +0 -0
  401. /package/dist/{executor-PCZN2LTY.js.map → executor-LJSMZ4IB.js.map} +0 -0
  402. /package/dist/{executor-WFTHIDT7.js.map → executor-SHUVRZUJ.js.map} +0 -0
  403. /package/dist/{export-accessible-QWUYY2OY.js.map → export-accessible-GNY6DC6U.js.map} +0 -0
  404. /package/dist/{extract-partition-CGCURVS4.js.map → extract-partition-BG3AF4NZ.js.map} +0 -0
  405. /package/dist/{find-VBNMB42N.js.map → find-KX6OKHDP.js.map} +0 -0
  406. /package/dist/{issue-7IPUNAFA.js.map → issue-PAUM7NCX.js.map} +0 -0
  407. /package/dist/{ledger-3RDSSMGD.js.map → ledger-62CEPRPX.js.map} +0 -0
  408. /package/dist/{liberate-2DNJ7AJ7.js.map → liberate-7QY7TULB.js.map} +0 -0
  409. /package/dist/{link-set-VJIWWUZO.js.map → link-set-ZRYNUHN3.js.map} +0 -0
  410. /package/dist/{managed-secret-XGGJ3BC3.js.map → managed-secret-T2WB4O47.js.map} +0 -0
  411. /package/dist/{noydb-CLQP36JR.js.map → noydb-VZIVPDXG.js.map} +0 -0
  412. /package/dist/{post-register-W3T4U57K.js.map → post-register-J4DEVNXK.js.map} +0 -0
  413. /package/dist/{register-YUVC4G27.js.map → register-UPD4GKBC.js.map} +0 -0
  414. /package/dist/{registry-BPKJX562.js.map → registry-7KX2HWFS.js.map} +0 -0
  415. /package/dist/{registry-E4FM32KD.js.map → registry-PKYYEHEW.js.map} +0 -0
  416. /package/dist/{registry-HACMULJJ.js.map → registry-XHCYMD34.js.map} +0 -0
  417. /package/dist/{registry-HRFRBFDV.js.map → registry-XIRTZHPC.js.map} +0 -0
  418. /package/dist/{request-withdrawal-CXTQLMJK.js.map → request-withdrawal-XZSESWZV.js.map} +0 -0
  419. /package/dist/{reveal-G7W7N3AZ.js.map → reveal-525XWQU2.js.map} +0 -0
  420. /package/dist/{revoke-ZX3TZUI6.js.map → revoke-QI7YHQ2B.js.map} +0 -0
  421. /package/dist/{signer-FPUIX63Z.js.map → signer-BZWDPGGN.js.map} +0 -0
  422. /package/dist/{stale-42FPALK2.js.map → stale-PQYPVCER.js.map} +0 -0
  423. /package/dist/{storage-6QODT6K5.js.map → storage-MJHKNQRO.js.map} +0 -0
  424. /package/dist/{verify-SHJXGZGM.js.map → verify-J6DEOXP3.js.map} +0 -0
  425. /package/dist/{walk-5PGJI3ND.js.map → walk-BX4NSB5L.js.map} +0 -0
  426. /package/dist/{withdraw-accessible-PFCQQGNP.js.map → withdraw-accessible-K4CPMH4C.js.map} +0 -0
@@ -2,19 +2,19 @@ import {
2
2
  buildRecordEnvelope,
3
3
  isDeleteMarker,
4
4
  isTombstone
5
- } from "./chunk-RGPB25DB.js";
5
+ } from "./chunk-ZVAFJQZB.js";
6
6
  import {
7
7
  blindedEqual,
8
8
  openVdigPayload,
9
9
  sealVdigPayload
10
- } from "./chunk-FSZPQCDR.js";
10
+ } from "./chunk-OQLYMBJI.js";
11
11
  import {
12
12
  dualReadSealedSlot,
13
13
  parseSealedSlot
14
- } from "./chunk-HVR74IBG.js";
14
+ } from "./chunk-DJ23QZIN.js";
15
15
  import {
16
16
  mintBidxTag
17
- } from "./chunk-RBTZLXZJ.js";
17
+ } from "./chunk-SFD2LL7G.js";
18
18
  import {
19
19
  VDIG_ITERATIONS,
20
20
  normalizeForVerify,
@@ -33,11 +33,11 @@ import {
33
33
  generateSalt,
34
34
  unwrapCek,
35
35
  wrapCek
36
- } from "./chunk-QTDAPDDV.js";
36
+ } from "./chunk-VJ4B3ZXY.js";
37
37
  import {
38
38
  NOYDB_FORMAT_VERSION,
39
39
  SealedHandle
40
- } from "./chunk-5UGEGEIJ.js";
40
+ } from "./chunk-3Y4OFWQJ.js";
41
41
  import {
42
42
  ClassifiedConfigError,
43
43
  ClassifiedRotationError,
@@ -46,7 +46,48 @@ import {
46
46
  SchemaValidationError,
47
47
  TamperedError,
48
48
  ValidationError
49
- } from "./chunk-I64WQSN3.js";
49
+ } from "./chunk-P7L3OQLL.js";
50
+
51
+ // src/kernel/enclave/record-aad.ts
52
+ var SCHEME = "noydb-aad/2";
53
+ var encoder = new TextEncoder();
54
+ function buildRecordAad(identity) {
55
+ if (!Number.isFinite(identity.version)) {
56
+ throw new TypeError(
57
+ `record AAD: version must be a finite number for "${identity.collection}/${identity.id}", received ${String(identity.version)}. Sealing without one produces a record no reader can open.`
58
+ );
59
+ }
60
+ const parts = [encoder.encode(SCHEME)];
61
+ const pushField = (value) => {
62
+ const bytes = encoder.encode(value);
63
+ const len = new Uint8Array(4);
64
+ new DataView(len.buffer).setUint32(0, bytes.length, false);
65
+ parts.push(len, bytes);
66
+ };
67
+ pushField(identity.collection);
68
+ pushField(identity.id);
69
+ pushField(String(identity.tier ?? 0));
70
+ parts.push(new Uint8Array([identity.by === void 0 ? 0 : 1]));
71
+ if (identity.by !== void 0) pushField(identity.by);
72
+ pushField(String(identity.version));
73
+ const total = parts.reduce((n, p) => n + p.length, 0);
74
+ const out = new Uint8Array(total);
75
+ let offset = 0;
76
+ for (const p of parts) {
77
+ out.set(p, offset);
78
+ offset += p.length;
79
+ }
80
+ return out;
81
+ }
82
+ function recordAadFor(ref, envelope) {
83
+ return buildRecordAad({
84
+ collection: ref.collection,
85
+ id: ref.id,
86
+ version: envelope._v,
87
+ tier: envelope._tier,
88
+ by: envelope._by
89
+ });
90
+ }
50
91
 
51
92
  // src/kernel/enclave/record-keys/lifecycle.ts
52
93
  async function resolveStableCek(deps, id) {
@@ -62,15 +103,17 @@ async function resolveStableCek(deps, id) {
62
103
  deps.cache?.set(id, fresh, 1);
63
104
  return fresh;
64
105
  }
65
- async function rewrapBodyToDek(envelope, fromDek, toDek) {
106
+ async function rewrapBodyToDek(from, to, envelope, fromDek, toDek) {
107
+ const openAad = buildRecordAad(from);
108
+ const sealAad = buildRecordAad(to);
66
109
  if (envelope._cek !== void 0) {
67
110
  const cek = await unwrapCek(envelope._cek, fromDek);
68
- const plaintext2 = await decrypt(envelope._iv, envelope._data, cek);
69
- const { iv: iv2, data: data2 } = await encrypt(plaintext2, cek);
111
+ const plaintext2 = await decrypt(envelope._iv, envelope._data, cek, openAad);
112
+ const { iv: iv2, data: data2 } = await encrypt(plaintext2, cek, sealAad);
70
113
  return { _iv: iv2, _data: data2, _cek: await wrapCek(cek, toDek), cek };
71
114
  }
72
- const plaintext = await decrypt(envelope._iv, envelope._data, fromDek);
73
- const { iv, data } = await encrypt(plaintext, toDek);
115
+ const plaintext = await decrypt(envelope._iv, envelope._data, fromDek, openAad);
116
+ const { iv, data } = await encrypt(plaintext, toDek, sealAad);
74
117
  return { _iv: iv, _data: data, cek: null };
75
118
  }
76
119
  function applyRewrappedBody(envelope, body) {
@@ -85,15 +128,15 @@ function applyRewrappedBody(envelope, body) {
85
128
  }
86
129
  return next;
87
130
  }
88
- async function rewrapEnvelope(envelope, fromDek, toDek) {
89
- return applyRewrappedBody(envelope, await rewrapBodyToDek(envelope, fromDek, toDek));
131
+ async function rewrapEnvelope(identity, envelope, fromDek, toDek) {
132
+ return applyRewrappedBody(envelope, await rewrapBodyToDek(identity, identity, envelope, fromDek, toDek));
90
133
  }
91
- async function isRewrappedUnder(envelope, dek) {
134
+ async function isRewrappedUnder(identity, envelope, dek) {
92
135
  try {
93
136
  if (envelope._cek !== void 0) {
94
137
  await unwrapCek(envelope._cek, dek);
95
138
  } else {
96
- await decrypt(envelope._iv, envelope._data, dek);
139
+ await decrypt(envelope._iv, envelope._data, dek, buildRecordAad(identity));
97
140
  }
98
141
  return true;
99
142
  } catch {
@@ -102,24 +145,25 @@ async function isRewrappedUnder(envelope, dek) {
102
145
  }
103
146
 
104
147
  // src/kernel/enclave/record-keys/rekey.ts
105
- async function rekeyEnvelopeToDek(envelope, oldDek, newDek) {
148
+ async function rekeyEnvelopeToDek(ref, envelope, oldDek, newDek) {
149
+ const aad = recordAadFor(ref, envelope);
106
150
  const { _bidx, ...carried } = envelope;
107
151
  void _bidx;
108
152
  if (envelope._cek !== void 0) {
109
153
  const cek = await unwrapCek(envelope._cek, oldDek);
110
154
  return { ...carried, _cek: await wrapCek(cek, newDek) };
111
155
  }
112
- const plaintext = await decrypt(envelope._iv, envelope._data, oldDek);
113
- const { iv, data } = await encrypt(plaintext, newDek);
156
+ const plaintext = await decrypt(envelope._iv, envelope._data, oldDek, aad);
157
+ const { iv, data } = await encrypt(plaintext, newDek, aad);
114
158
  return { ...carried, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data };
115
159
  }
116
- async function rekeyEnvelopeIfNeeded(envelope, oldDek, newDek) {
160
+ async function rekeyEnvelopeIfNeeded(ref, envelope, oldDek, newDek) {
117
161
  try {
118
- return await rekeyEnvelopeToDek(envelope, oldDek, newDek);
162
+ return await rekeyEnvelopeToDek(ref, envelope, oldDek, newDek);
119
163
  } catch (errUnderOld) {
120
164
  try {
121
165
  if (envelope._cek !== void 0) await unwrapCek(envelope._cek, newDek);
122
- else await decrypt(envelope._iv, envelope._data, newDek);
166
+ else await decrypt(envelope._iv, envelope._data, newDek, recordAadFor(ref, envelope));
123
167
  return null;
124
168
  } catch {
125
169
  throw errUnderOld;
@@ -127,32 +171,6 @@ async function rekeyEnvelopeIfNeeded(envelope, oldDek, newDek) {
127
171
  }
128
172
  }
129
173
 
130
- // src/kernel/enclave/record-aad.ts
131
- var SCHEME = "noydb-aad/1";
132
- var encoder = new TextEncoder();
133
- function buildRecordAad(identity) {
134
- const parts = [encoder.encode(SCHEME)];
135
- const pushField = (value) => {
136
- const bytes = encoder.encode(value);
137
- const len = new Uint8Array(4);
138
- new DataView(len.buffer).setUint32(0, bytes.length, false);
139
- parts.push(len, bytes);
140
- };
141
- pushField(identity.collection);
142
- pushField(identity.id);
143
- pushField(String(identity.tier ?? 0));
144
- parts.push(new Uint8Array([identity.by === void 0 ? 0 : 1]));
145
- if (identity.by !== void 0) pushField(identity.by);
146
- const total = parts.reduce((n, p) => n + p.length, 0);
147
- const out = new Uint8Array(total);
148
- let offset = 0;
149
- for (const p of parts) {
150
- out.set(p, offset);
151
- offset += p.length;
152
- }
153
- return out;
154
- }
155
-
156
174
  // src/kernel/enclave/record-keys/sealed-slots.ts
157
175
  async function sealOneFieldWithDek(field, value, dek, keyMaterial) {
158
176
  const fieldKey = keyMaterial.cek !== void 0 ? await deriveSealedFieldKeyFromCek(keyMaterial.cek, keyMaterial.collection, field) : await deriveSealedFieldKey(dek, keyMaterial.collection, field);
@@ -228,22 +246,17 @@ function makeReservedEnvelopes(dekResolver, declaredPrefixes) {
228
246
  );
229
247
  }
230
248
  };
231
- const encryptForPrefix = async (collection, json, v) => {
232
- assertPrefixed(collection, "encrypt");
233
- const dek = await dekResolver(collection);
234
- const { iv, data } = await encrypt(json, dek);
235
- return {
236
- _noydb: NOYDB_FORMAT_VERSION,
237
- _v: v,
238
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
239
- _iv: iv,
240
- _data: data
241
- };
249
+ const encryptForPrefix = async (ref, json, v) => {
250
+ assertPrefixed(ref.collection, "encrypt");
251
+ const dek = await dekResolver(ref.collection);
252
+ const identity = { ...ref, version: v };
253
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
254
+ return buildRecordEnvelope(identity, { iv, data });
242
255
  };
243
- const decryptForPrefix = async (collection, env) => {
256
+ const decryptForPrefix = async (collection, id, env) => {
244
257
  assertPrefixed(collection, "decrypt");
245
258
  const dek = await dekResolver(collection);
246
- return decrypt(env._iv, env._data, dek);
259
+ return decrypt(env._iv, env._data, dek, recordAadFor({ collection, id }, env));
247
260
  };
248
261
  return { encrypt: encryptForPrefix, decrypt: decryptForPrefix };
249
262
  };
@@ -373,30 +386,12 @@ var RecordCodec = class _RecordCodec {
373
386
  * parts. Pure, no crypto. Each call stamps its own `_ts` — provenance carries
374
387
  * a SEPARATE timestamp (computed by the caller), so the two never share one.
375
388
  */
376
- static buildEnvelope(p) {
377
- return {
378
- _noydb: NOYDB_FORMAT_VERSION,
379
- _v: p.version,
380
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
381
- _iv: p.iv,
382
- _data: p.data,
383
- ...p.by !== void 0 ? { _by: p.by } : {},
384
- ...p.cek !== void 0 ? { _cek: p.cek } : {},
385
- ...p.provenance !== void 0 ? { _source: p.provenance.source, _sourceTs: p.provenance.sourceTs } : {},
386
- ...p.extra ?? {}
387
- };
389
+ static buildEnvelope(identity, p) {
390
+ return buildRecordEnvelope(identity, p);
388
391
  }
389
392
  /** Plaintext (`_iv:''`) body envelope — the `!storeCiphertext` shape. */
390
- static buildPlaintextEnvelope(p) {
391
- return {
392
- _noydb: NOYDB_FORMAT_VERSION,
393
- _v: p.version,
394
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
395
- _iv: "",
396
- _data: p.data,
397
- ...p.by !== void 0 ? { _by: p.by } : {},
398
- ...p.provenance !== void 0 ? { _source: p.provenance.source, _sourceTs: p.provenance.sourceTs } : {}
399
- };
393
+ static buildPlaintextEnvelope(identity, p) {
394
+ return buildRecordEnvelope(identity, { ...p, iv: "" });
400
395
  }
401
396
  // ──────────────────────────────────────────────────────────────────────
402
397
  // Write path
@@ -409,22 +404,20 @@ var RecordCodec = class _RecordCodec {
409
404
  * (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
410
405
  * would collide with the reserved metadata namespace.
411
406
  */
412
- buildDebugEnvelope(record, version, source, sourceTs) {
407
+ buildDebugEnvelope(id, record, version, source, sourceTs) {
413
408
  const rec = record;
414
409
  for (const key of Object.keys(rec)) {
415
410
  if (key.startsWith("_")) throw new DebugReservedFieldError(this.ctx.name, key);
416
411
  }
417
- return {
418
- _noydb: NOYDB_FORMAT_VERSION,
419
- _v: version,
420
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
421
- _iv: "",
422
- _data: "",
423
- _by: this.ctx.actor,
424
- _debug: NOYDB_FORMAT_VERSION,
425
- ...this.ctx.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {},
426
- ...rec
427
- };
412
+ const base = buildRecordEnvelope(
413
+ { collection: this.ctx.name, id, by: this.ctx.actor, version },
414
+ {
415
+ iv: "",
416
+ data: "",
417
+ ...this.ctx.provenance && source !== void 0 ? { provenance: { source, sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } } : {}
418
+ }
419
+ );
420
+ return { ...base, _debug: NOYDB_FORMAT_VERSION, ...rec };
428
421
  }
429
422
  /**
430
423
  * Encrypt a JSON body into an envelope.
@@ -435,24 +428,56 @@ var RecordCodec = class _RecordCodec {
435
428
  * path encrypts the body directly under the collection DEK — byte-identical
436
429
  * to pre-CEK behaviour, so non-adopting collections pay nothing.
437
430
  */
438
- async encryptJsonString(json, version, cek, source, sourceTs) {
439
- const by = this.ctx.actor;
431
+ /**
432
+ * `ref` is the identity the envelope is sealed against, and it is **the
433
+ * location the bytes are stored at** — not necessarily this codec's own
434
+ * collection (#1051).
435
+ *
436
+ * That distinction was discovered here rather than assumed. Several callers
437
+ * put the result somewhere else entirely: search's vector sidecar lands in
438
+ * `_vec` under `encodeVecId(name, id)`, the lexical index under `_ft/<name>`,
439
+ * indexing's entries under a synthetic `idxId`. A codec that supplied
440
+ * `this.ctx.name` for those would seal them against a collection they are not
441
+ * in, and once AAD binds identity every one of them would fail to verify.
442
+ *
443
+ * ⚠️ **`_history` is the open case, and it is #1041's to settle.** Snapshots
444
+ * are produced with the LIVE record's identity here and then re-homed by
445
+ * `saveHistory` into `_history/<historyId(collection,id,_v)>`. Both readings
446
+ * are defensible — bind where it lives, or bind what it is a copy of — and
447
+ * the choice must be made before AAD is switched on, not inferred from this
448
+ * migration.
449
+ */
450
+ async encryptJsonString(ref, json, version, cek, source, sourceTs) {
451
+ const identity = { ...ref, version, by: this.ctx.actor };
440
452
  const provenance = this.ctx.provenance && source !== void 0 ? { source, sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : void 0;
441
453
  if (!this.ctx.storeCiphertext) {
442
- return _RecordCodec.buildPlaintextEnvelope({ version, data: json, by, provenance });
454
+ return _RecordCodec.buildPlaintextEnvelope(identity, { data: json, provenance });
443
455
  }
444
456
  const dek = await this.ctx.getDEK();
457
+ const aad = buildRecordAad(identity);
445
458
  if (cek !== void 0) {
446
- const { iv: iv2, data: data2 } = await encrypt(json, cek);
459
+ const { iv: iv2, data: data2 } = await encrypt(json, cek, aad);
447
460
  const wrapped = await wrapCek(cek, dek);
448
- return _RecordCodec.buildEnvelope({ version, iv: iv2, data: data2, by, cek: wrapped, provenance });
461
+ return _RecordCodec.buildEnvelope(identity, { iv: iv2, data: data2, cek: wrapped, provenance });
449
462
  }
450
- const { iv, data } = await encrypt(json, dek);
451
- return _RecordCodec.buildEnvelope({ version, iv, data, by, provenance });
463
+ const { iv, data } = await encrypt(json, dek, aad);
464
+ return _RecordCodec.buildEnvelope(identity, { iv, data, provenance });
452
465
  }
453
- async encryptRecord(record, version, cek, source, sourceTs, vdig, id) {
466
+ /**
467
+ * `ref` is FIRST and required (#1051). It was previously a trailing optional
468
+ * `id?: string`, which TypeScript cannot promote to required because it sits
469
+ * after other optionals — so the migration would have needed an `id ?? ''`
470
+ * fallback. That is exactly the silent default this issue exists to remove:
471
+ * once identity is bound into the AEAD, every record written with an empty id
472
+ * binds to the SAME identity and becomes interchangeable with the others.
473
+ * An object, not a bare string, so a swap with `version`/`source` cannot
474
+ * compile on the hottest write path. Carries the collection too — see
475
+ * {@link encryptJsonString} for why the codec must not assume its own.
476
+ */
477
+ async encryptRecord(ref, record, version, cek, source, sourceTs, vdig) {
478
+ const id = ref.id;
454
479
  if (!this.ctx.storeCiphertext && this.ctx.debugPlaintext && !this.ctx.name.startsWith("_")) {
455
- return this.buildDebugEnvelope(record, version, source, sourceTs);
480
+ return this.buildDebugEnvelope(id, record, version, source, sourceTs);
456
481
  }
457
482
  if (this.ctx.storeCiphertext) {
458
483
  const declared = this.ctx.vdigFields;
@@ -479,9 +504,9 @@ var RecordCodec = class _RecordCodec {
479
504
  let openRecord = record;
480
505
  let sealed;
481
506
  if (this.ctx.storeCiphertext && this.ctx.via?.hasAtRestHooks) {
482
- if (id === void 0) {
507
+ if (id === "") {
483
508
  throw new Error(
484
- `RecordCodec.encryptRecord: collection "${this.ctx.name}" has via at-rest hooks but this write path supplied no record id (needed to scope the sealed-slot capability) \u2014 caller bug.`
509
+ `RecordCodec.encryptRecord: collection "${this.ctx.name}" has via at-rest hooks but this write path supplied an empty record id (needed to scope the sealed-slot capability) \u2014 caller bug.`
485
510
  );
486
511
  }
487
512
  const src = record;
@@ -489,7 +514,7 @@ var RecordCodec = class _RecordCodec {
489
514
  openRecord = result.record;
490
515
  if (result.sealed !== void 0) {
491
516
  sealed = {};
492
- for (const [field, ref] of Object.entries(result.sealed)) sealed[field] = `${ref.iv}:${ref.data}`;
517
+ for (const [field, ref2] of Object.entries(result.sealed)) sealed[field] = `${ref2.iv}:${ref2.data}`;
493
518
  }
494
519
  } else if (this.ctx.storeCiphertext && this.ctx.sensitiveFields.size > 0) {
495
520
  const src = record;
@@ -554,7 +579,7 @@ var RecordCodec = class _RecordCodec {
554
579
  if (Object.keys(out).length > 0) vdigOut = out;
555
580
  if (Object.keys(bidxOut).length > 0) bidxOutMap = bidxOut;
556
581
  }
557
- const base = await this.encryptJsonString(JSON.stringify(openRecord), version, cek, source, sourceTs);
582
+ const base = await this.encryptJsonString(ref, JSON.stringify(openRecord), version, cek, source, sourceTs);
558
583
  const withSealed = sealed ? { ...base, _sealed: sealed } : base;
559
584
  const withVdig = vdigOut ? { ...withSealed, _vdig: vdigOut } : withSealed;
560
585
  const withBidx = bidxOutMap ? { ...withVdig, _bidx: bidxOutMap } : withVdig;
@@ -609,7 +634,15 @@ var RecordCodec = class _RecordCodec {
609
634
  * The optional `id` lets reads populate the CEK cache; it is omitted by
610
635
  * callers (history, conflict merge) that have only the envelope.
611
636
  */
612
- async decryptJsonString(envelope, id) {
637
+ /**
638
+ * `ref` must be the SAME identity the writer sealed against — which is the
639
+ * storage address, not necessarily this codec's own collection. Search's
640
+ * vector sidecar lives in `_vec`, its lexical index in `_ft`; passing
641
+ * `this.ctx.name` for those would recompute the wrong AAD and fail to open a
642
+ * perfectly good record (#1041).
643
+ */
644
+ async decryptJsonString(ref, envelope) {
645
+ const id = ref.id;
613
646
  if (isTombstone(envelope, this.ctx.storeCiphertext) || isDeleteMarker(envelope)) return null;
614
647
  if (!this.ctx.storeCiphertext) {
615
648
  if (envelope._debug !== void 0) {
@@ -621,10 +654,11 @@ var RecordCodec = class _RecordCodec {
621
654
  }
622
655
  return envelope._data === "" ? null : envelope._data;
623
656
  }
657
+ const aad = recordAadFor(ref, envelope);
624
658
  const cek = await this.resolveEnvelopeCek(envelope, id);
625
- if (cek !== void 0) return decrypt(envelope._iv, envelope._data, cek);
659
+ if (cek !== void 0) return decrypt(envelope._iv, envelope._data, cek, aad);
626
660
  const dek = await this.ctx.getDEK();
627
- return decrypt(envelope._iv, envelope._data, dek);
661
+ return decrypt(envelope._iv, envelope._data, dek, aad);
628
662
  }
629
663
  /**
630
664
  * Unseal a single `_sealed[field]` slot to its plaintext value: derive the
@@ -748,7 +782,7 @@ var RecordCodec = class _RecordCodec {
748
782
  */
749
783
  async applySealedSlots(record, sealed, cek, opts = {}) {
750
784
  if (this.ctx.via?.hasAtRestHooks) {
751
- if (opts.id === void 0) {
785
+ if (opts.id === void 0 || opts.id === "") {
752
786
  throw new Error(
753
787
  `RecordCodec.decryptRecord: collection "${this.ctx.name}" has via at-rest hooks but this read path supplied no record id (needed to scope the sealed-slot capability) \u2014 caller bug.`
754
788
  );
@@ -798,15 +832,17 @@ var RecordCodec = class _RecordCodec {
798
832
  * output-recompute path, not the public per-record read surface schema
799
833
  * validation guards.
800
834
  */
801
- async decryptRecordAtDek(envelope, dek, id) {
835
+ async decryptRecordAtDek(ref, envelope, dek) {
836
+ const id = ref.id;
802
837
  if (isTombstone(envelope, this.ctx.storeCiphertext) || isDeleteMarker(envelope)) return null;
803
838
  let plaintext;
804
839
  let cek;
840
+ const aad = recordAadFor(ref, envelope);
805
841
  if (envelope._cek !== void 0) {
806
842
  cek = await unwrapCek(envelope._cek, dek);
807
- plaintext = await decrypt(envelope._iv, envelope._data, cek);
843
+ plaintext = await decrypt(envelope._iv, envelope._data, cek, aad);
808
844
  } else {
809
- plaintext = await decrypt(envelope._iv, envelope._data, dek);
845
+ plaintext = await decrypt(envelope._iv, envelope._data, dek, aad);
810
846
  }
811
847
  let record = JSON.parse(plaintext);
812
848
  if (envelope._sealed !== void 0 && this.ctx.storeCiphertext) {
@@ -829,8 +865,8 @@ var RecordCodec = class _RecordCodec {
829
865
  * that may predate a schema change, so validating it would be a
830
866
  * false positive. Every non-history read leaves this flag `false`.
831
867
  */
832
- async decryptRecord(envelope, opts = {}) {
833
- const json = await this.decryptJsonString(envelope, opts.id);
868
+ async decryptRecord(ref, envelope, opts = {}) {
869
+ const json = await this.decryptJsonString(ref, envelope);
834
870
  if (json === null) return null;
835
871
  let parsed = JSON.parse(json);
836
872
  if (this.ctx.crdtMode && parsed !== null && typeof parsed === "object" && "_crdt" in parsed) {
@@ -838,9 +874,9 @@ var RecordCodec = class _RecordCodec {
838
874
  }
839
875
  let record = parsed;
840
876
  if (envelope._sealed !== void 0 && this.ctx.storeCiphertext) {
841
- const sealedCek = await this.resolveEnvelopeCek(envelope, opts.id);
877
+ const sealedCek = await this.resolveEnvelopeCek(envelope, ref.id);
842
878
  record = await this.applySealedSlots(record, envelope._sealed, sealedCek, {
843
- ...opts.id !== void 0 ? { id: opts.id } : {},
879
+ id: ref.id,
844
880
  ...opts.sealedAsHandles !== void 0 ? { sealedAsHandles: opts.sealedAsHandles } : {}
845
881
  });
846
882
  }
@@ -895,9 +931,8 @@ async function sealRecordToHost(ctx, collection, id, hostSealer, opts) {
895
931
  const envelopeKey = `${collection}/${id}/${hint.pid}`;
896
932
  const prior = await ctx.adapter.get(ctx.vault, SEALED_CEK_NS, envelopeKey);
897
933
  const env = buildRecordEnvelope(
898
- { collection: SEALED_CEK_NS, id: envelopeKey },
934
+ { collection: SEALED_CEK_NS, id: envelopeKey, version: (prior?._v ?? 0) + 1 },
899
935
  {
900
- version: (prior?._v ?? 0) + 1,
901
936
  // AES-GCM bypassed — the sealing layer is the security boundary, exactly
902
937
  // like the managed-secret `_meta/sealed-secret` envelope.
903
938
  iv: "",
@@ -922,9 +957,26 @@ async function rotateRecordCek(ctx, collection, id) {
922
957
  }
923
958
  const dek = await ctx.getDEK(collection);
924
959
  const oldCek = await unwrapCek(live._cek, dek);
925
- const json = await decrypt(live._iv, live._data, oldCek);
960
+ const openAad = recordAadFor({ collection, id }, live);
961
+ const json = await decrypt(live._iv, live._data, oldCek, openAad);
962
+ const rotatedIdentity = {
963
+ // A CEK rotation DOES bump `_v` (asserted in `record-scoped-cek-sealing`:
964
+ // "the live envelope was re-keyed — new `_cek`, bumped `_v`"), so it seals
965
+ // at the new version, not the one it just opened.
966
+ //
967
+ // ⚠️ Do not confuse this with `rekeyEnvelopeToDek`, the DEK-rotation helper,
968
+ // which PRESERVES `_v` (#1074) because it re-keys a record without writing
969
+ // one. Two rotations, opposite answers — and with `_v` bound (#1093) getting
970
+ // it backwards no longer produces a wrong number, it produces an
971
+ // unreadable record.
972
+ collection,
973
+ id,
974
+ version: live._v + 1,
975
+ ...live._tier !== void 0 ? { tier: live._tier } : {},
976
+ ...ctx.actor ? { by: ctx.actor } : live._by !== void 0 ? { by: live._by } : {}
977
+ };
926
978
  const newCek = await generateDEK();
927
- const { iv, data } = await encrypt(json, newCek);
979
+ const { iv, data } = await encrypt(json, newCek, buildRecordAad(rotatedIdentity));
928
980
  let sealedOut;
929
981
  if (live._sealed !== void 0) {
930
982
  const out = {};
@@ -944,14 +996,11 @@ async function rotateRecordCek(ctx, collection, id) {
944
996
  }
945
997
  vdigOut = out;
946
998
  }
947
- const env = buildRecordEnvelope({ collection, id }, {
948
- version: live._v + 1,
999
+ const env = buildRecordEnvelope(rotatedIdentity, {
949
1000
  iv,
950
1001
  data,
951
1002
  cek: await wrapCek(newCek, dek),
952
- ...ctx.actor ? { by: ctx.actor } : {},
953
1003
  extra: {
954
- ...live._tier !== void 0 ? { _tier: live._tier } : {},
955
1004
  ...live._det !== void 0 ? { _det: live._det } : {},
956
1005
  // `_bidx` (equality-index tag) is DEK-rooted and CEK-independent, so it is
957
1006
  // carried forward VERBATIM — not recomputed — unlike `_vdig`/`_sealed`
@@ -1011,7 +1060,7 @@ async function findByDet(ctx, field, value) {
1011
1060
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1012
1061
  if (!env || !env._det || (env._tier ?? 0) > 0) continue;
1013
1062
  if (env._det[field] === target || env._det[field] === legacyTarget) {
1014
- return ctx.codec.decryptRecord(env, { id });
1063
+ return ctx.codec.decryptRecord({ collection: ctx.name, id }, env);
1015
1064
  }
1016
1065
  }
1017
1066
  return null;
@@ -1025,7 +1074,7 @@ async function queryByDet(ctx, field, value) {
1025
1074
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1026
1075
  if (!env || !env._det || (env._tier ?? 0) > 0) continue;
1027
1076
  if (env._det[field] === target || env._det[field] === legacyTarget) {
1028
- const rec = await ctx.codec.decryptRecord(env, { id });
1077
+ const rec = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env);
1029
1078
  if (rec !== null) matches.push(rec);
1030
1079
  }
1031
1080
  }
@@ -1033,23 +1082,25 @@ async function queryByDet(ctx, field, value) {
1033
1082
  }
1034
1083
 
1035
1084
  // src/kernel/enclave/record-keys/envelope-body.ts
1036
- async function openEnvelopeJson(env, key, opts) {
1085
+ async function openEnvelopeJson(ref, env, key, opts) {
1037
1086
  if (opts?.encrypted === false) return env._data;
1087
+ const aad = recordAadFor(ref, env);
1038
1088
  if (env._cek !== void 0) {
1039
1089
  const cek = await unwrapCek(env._cek, key);
1040
- return decrypt(env._iv, env._data, cek);
1090
+ return decrypt(env._iv, env._data, cek, aad);
1041
1091
  }
1042
- return decrypt(env._iv, env._data, key);
1092
+ return decrypt(env._iv, env._data, key, aad);
1043
1093
  }
1044
- async function writeEnvelopeBody(json, key, opts) {
1094
+ async function writeEnvelopeBody(identity, json, key, opts) {
1045
1095
  if (opts?.encrypted === false) return { _iv: "", _data: json };
1096
+ const aad = buildRecordAad(identity);
1046
1097
  if (opts?.perRecordKey === true) {
1047
1098
  const cek = await generateDEK();
1048
- const { iv: iv2, data: data2 } = await encrypt(json, cek);
1099
+ const { iv: iv2, data: data2 } = await encrypt(json, cek, aad);
1049
1100
  const wrapped = await wrapCek(cek, key);
1050
1101
  return { _iv: iv2, _data: data2, _cek: wrapped };
1051
1102
  }
1052
- const { iv, data } = await encrypt(json, key);
1103
+ const { iv, data } = await encrypt(json, key, aad);
1053
1104
  return { _iv: iv, _data: data };
1054
1105
  }
1055
1106
  function envelopeBodySize(env) {
@@ -1072,6 +1123,18 @@ function envelopeBodyForHash(env) {
1072
1123
  if (env._bidx !== void 0) segments.push(mapPart("_bidx", env._bidx));
1073
1124
  return `{${segments.join(",")}}`;
1074
1125
  }
1126
+ function hasSealedBody(env) {
1127
+ return env._iv !== "";
1128
+ }
1129
+ async function verifyRecordIdentity(ref, env, key) {
1130
+ if (!hasSealedBody(env)) return true;
1131
+ try {
1132
+ await openEnvelopeJson(ref, env, key);
1133
+ return true;
1134
+ } catch {
1135
+ return false;
1136
+ }
1137
+ }
1075
1138
 
1076
1139
  // src/kernel/enclave/broker/proof.ts
1077
1140
  var subtle2 = globalThis.crypto.subtle;
@@ -1157,6 +1220,8 @@ async function verifyBrokerProof(args) {
1157
1220
  }
1158
1221
 
1159
1222
  export {
1223
+ buildRecordAad,
1224
+ recordAadFor,
1160
1225
  resolveStableCek,
1161
1226
  rewrapBodyToDek,
1162
1227
  applyRewrappedBody,
@@ -1164,7 +1229,6 @@ export {
1164
1229
  isRewrappedUnder,
1165
1230
  rekeyEnvelopeToDek,
1166
1231
  rekeyEnvelopeIfNeeded,
1167
- buildRecordAad,
1168
1232
  makeReservedEnvelopes,
1169
1233
  validateSchemaInput,
1170
1234
  validateSchemaOutput,
@@ -1180,10 +1244,12 @@ export {
1180
1244
  envelopeBodySize,
1181
1245
  hasPerRecordKey,
1182
1246
  envelopeBodyForHash,
1247
+ hasSealedBody,
1248
+ verifyRecordIdentity,
1183
1249
  deriveBrokerProofBits,
1184
1250
  deriveBrokerProofKey,
1185
1251
  computeBrokerProof,
1186
1252
  issueChallenge,
1187
1253
  verifyBrokerProof
1188
1254
  };
1189
- //# sourceMappingURL=chunk-BKYQNNO3.js.map
1255
+ //# sourceMappingURL=chunk-D5UDZANO.js.map