@noy-db/hub 0.6.0 → 0.7.0-pre.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.
- package/CHANGELOG.md +48 -0
- package/README.md +1 -1
- package/codemods/0.4.0-pre.json +24 -0
- package/codemods/0.6.0-pre.json +18 -0
- package/codemods/0.7.0-pre.json +258 -0
- package/dist/api-EQYRTZO2.js +20 -0
- package/dist/as/index.js +146 -0
- package/dist/as/index.js.map +1 -0
- package/dist/at/index.js +23 -0
- package/dist/attestation/index.js +18 -18
- package/dist/{backup-VL4GRIEW.js → backup-Z7ZBTAQ6.js} +12 -12
- package/dist/blobs/index.js +13 -13
- package/dist/broker/index.js +12 -12
- package/dist/by/index.js +11 -0
- package/dist/cargo/index.js +35 -31
- package/dist/{chunk-JKATP6OE.js → chunk-225O5CXQ.js} +2 -2
- package/dist/{chunk-XINT4VJA.js → chunk-2GXEQUEX.js} +2 -2
- package/dist/chunk-2GXEQUEX.js.map +1 -0
- package/dist/{chunk-CXPOG3ZY.js → chunk-2LPVI4PX.js} +8 -8
- package/dist/{chunk-2J5IT37K.js → chunk-3L2MVE36.js} +5 -5
- package/dist/{chunk-HOPNIR5R.js → chunk-3QARDAYW.js} +2 -2
- package/dist/{chunk-HSJBJIB2.js → chunk-467SKJ65.js} +4 -4
- package/dist/{chunk-YCGLAANM.js → chunk-4A4TYISP.js} +2 -2
- package/dist/{chunk-2CBFYXJX.js → chunk-4G25SDQL.js} +4 -4
- package/dist/{chunk-5LZZQMIC.js → chunk-4LPF226H.js} +5 -5
- package/dist/{chunk-GANFIM2M.js → chunk-4ZPE6SKS.js} +3 -3
- package/dist/{chunk-65JXA63J.js → chunk-5263OEM3.js} +2 -2
- package/dist/{chunk-FNYCT27B.js → chunk-57JTHWLQ.js} +4 -4
- package/dist/{chunk-5IHGJHWC.js → chunk-5ACAVJUI.js} +2 -2
- package/dist/{chunk-3OE2QNSM.js → chunk-5AFMP532.js} +6 -6
- package/dist/{chunk-J6I5VR6P.js → chunk-5W7YXFV5.js} +8 -8
- package/dist/chunk-5W7YXFV5.js.map +1 -0
- package/dist/{chunk-7ZGPQOFV.js → chunk-6EW2UCVF.js} +3 -3
- package/dist/{chunk-GCU42IG7.js → chunk-6FOGTKBY.js} +7 -7
- package/dist/chunk-6FOGTKBY.js.map +1 -0
- package/dist/{chunk-36CEG6CM.js → chunk-7LYUJNU3.js} +2 -2
- package/dist/{chunk-D6SXRMZZ.js → chunk-A2YW5EMU.js} +5 -5
- package/dist/{chunk-OQMCFHUX.js → chunk-AB5P32RE.js} +2 -2
- package/dist/{chunk-JMJSCI7U.js → chunk-ALB64CZM.js} +7 -7
- package/dist/{chunk-RPRASGEY.js → chunk-ALUNQEBY.js} +2 -2
- package/dist/{chunk-ZYZJLYNS.js → chunk-ATV637J7.js} +7 -7
- package/dist/{chunk-LC6NE4IQ.js → chunk-CBRS2NEK.js} +2 -11
- package/dist/chunk-CBRS2NEK.js.map +1 -0
- package/dist/{chunk-W3HAIN6U.js → chunk-CN6B5PEN.js} +5 -5
- package/dist/{chunk-JIHWBKMQ.js → chunk-DBNYPLWY.js} +3 -3
- package/dist/{chunk-ZJUZOJVW.js → chunk-DFAUMLD7.js} +5 -5
- package/dist/{chunk-S6PJ6ZKE.js → chunk-DKWPJOYH.js} +2 -2
- package/dist/{chunk-MPKP6L5E.js → chunk-E6YA6UAP.js} +2 -2
- package/dist/{chunk-LIR2DJWP.js → chunk-F23WQK3G.js} +9 -9
- package/dist/chunk-F23WQK3G.js.map +1 -0
- package/dist/{chunk-S7PM7Z4K.js → chunk-F7ZFRPGQ.js} +2 -2
- package/dist/{chunk-CKKN25P2.js → chunk-FOG7YEJP.js} +3 -3
- package/dist/{chunk-AJGGBXWA.js → chunk-GK4DRVUD.js} +6 -6
- package/dist/chunk-GK4DRVUD.js.map +1 -0
- package/dist/{chunk-4ATF4BLF.js → chunk-H36KSN6X.js} +7 -7
- package/dist/{chunk-YTUFV7U7.js → chunk-H4M7ADXY.js} +10 -10
- package/dist/chunk-H4M7ADXY.js.map +1 -0
- package/dist/{chunk-QQRRKO7W.js → chunk-H7HP56F6.js} +5 -5
- package/dist/{chunk-RJZQ2PVD.js → chunk-HM4JSXX2.js} +3 -3
- package/dist/{chunk-3YGUHUJA.js → chunk-HTGRQZFB.js} +3 -3
- package/dist/{chunk-JXHNUYQO.js → chunk-IESNYJXZ.js} +6 -6
- package/dist/{chunk-OCJ3JA4O.js → chunk-J4MN6XIU.js} +2 -2
- package/dist/{chunk-HWI7GHJZ.js → chunk-J4UJ5FRV.js} +4 -4
- package/dist/{chunk-Z3BZXPRO.js → chunk-JBIV4FLR.js} +1 -1
- package/dist/chunk-JBIV4FLR.js.map +1 -0
- package/dist/{chunk-QVXZFJBU.js → chunk-JVLSU7S2.js} +2 -2
- package/dist/{chunk-7Q3RHOA5.js → chunk-KDJGJR7F.js} +2 -2
- package/dist/{chunk-PJX72ICF.js → chunk-KN4W2OQ4.js} +7 -7
- package/dist/chunk-KN4W2OQ4.js.map +1 -0
- package/dist/{chunk-M7WBE3OR.js → chunk-L6GTLZRK.js} +5 -5
- package/dist/{chunk-2ZT4INZ4.js → chunk-LF6DMX4C.js} +3 -3
- package/dist/chunk-LFUID7OW.js +163 -0
- package/dist/chunk-LFUID7OW.js.map +1 -0
- package/dist/{chunk-4K6BIMLF.js → chunk-LKFKXS5K.js} +2 -2
- package/dist/{chunk-POFYIGQ2.js → chunk-LR4Z47QD.js} +3 -3
- package/dist/{chunk-LUYPYCHY.js → chunk-MTBXJAS4.js} +4 -4
- package/dist/{chunk-FX3UIDCS.js → chunk-N4CNVSUF.js} +2 -2
- package/dist/{chunk-FU5VYEYK.js → chunk-NLKLXXTO.js} +2 -2
- package/dist/{chunk-YYV53EHO.js → chunk-OPXR4PB2.js} +2 -2
- package/dist/{chunk-5F7BZAGV.js → chunk-OWLVBOWO.js} +10 -10
- package/dist/{chunk-6NR36UNB.js → chunk-P6ASQOZR.js} +2 -2
- package/dist/{chunk-5ATC6UT4.js → chunk-PCQDY6QN.js} +6 -6
- package/dist/{chunk-EQOTJL76.js → chunk-PGFKIOR3.js} +3 -3
- package/dist/{chunk-D2YFQ7XG.js → chunk-POS53FG6.js} +2 -2
- package/dist/{chunk-ZY6P7M52.js → chunk-PQ6Z2TAP.js} +2 -2
- package/dist/{chunk-5OT4G5N5.js → chunk-PUJTKLPL.js} +3 -3
- package/dist/{chunk-64WHKBMP.js → chunk-QGJ4XIA7.js} +8 -8
- package/dist/{chunk-DECNV4QK.js → chunk-QHJKK77B.js} +6 -6
- package/dist/{chunk-JHYKSMVX.js → chunk-QI5NWLVW.js} +7 -7
- package/dist/{chunk-BZ3WMOYX.js → chunk-RC4BROYR.js} +3 -3
- package/dist/{chunk-IWQPYT6S.js → chunk-RDHUZ674.js} +4 -4
- package/dist/{chunk-UJ4Z67UQ.js → chunk-RK7N4OQ5.js} +1 -1
- package/dist/chunk-RK7N4OQ5.js.map +1 -0
- package/dist/{chunk-EHW7NLGD.js → chunk-S2VG3ABP.js} +3 -3
- package/dist/chunk-S2VG3ABP.js.map +1 -0
- package/dist/{chunk-7OBIBPCV.js → chunk-S35S77YU.js} +10 -10
- package/dist/{chunk-22GR3O4J.js → chunk-SHILAQH5.js} +2 -2
- package/dist/{chunk-WPZ5FVAS.js → chunk-T3PHCEN4.js} +3 -3
- package/dist/{chunk-GKTW3KLV.js → chunk-TOV6VMHF.js} +5 -5
- package/dist/chunk-TOV6VMHF.js.map +1 -0
- package/dist/{chunk-6RH7PRTL.js → chunk-TVIFAHZR.js} +6 -6
- package/dist/chunk-UBSFPGVJ.js +1 -0
- package/dist/{chunk-323MN67Z.js → chunk-UCUALOSM.js} +2 -2
- package/dist/{chunk-B4CRUZPR.js → chunk-VAG47QHV.js} +2 -2
- package/dist/{chunk-QH47SQLD.js → chunk-VFIWDPXZ.js} +3 -3
- package/dist/{chunk-K6CPIK3R.js → chunk-VTG7327U.js} +4 -4
- package/dist/chunk-VTG7327U.js.map +1 -0
- package/dist/{chunk-ONPVHX2Y.js → chunk-W5LHQXZU.js} +2 -2
- package/dist/{chunk-ZIMQDXTQ.js → chunk-WK5FSW7T.js} +8 -8
- package/dist/{chunk-PFWE7FJG.js → chunk-WLLUM35R.js} +2 -2
- package/dist/{chunk-IWKCJCLP.js → chunk-X62MEF2O.js} +5 -5
- package/dist/chunk-X62MEF2O.js.map +1 -0
- package/dist/{chunk-XPEPMK4Y.js → chunk-X67FCULK.js} +5 -5
- package/dist/chunk-X67FCULK.js.map +1 -0
- package/dist/{chunk-C3XWJCG7.js → chunk-XDVVBETV.js} +2 -2
- package/dist/chunk-XDVVBETV.js.map +1 -0
- package/dist/chunk-XJ3FEKEY.js +15 -0
- package/dist/chunk-XJ3FEKEY.js.map +1 -0
- package/dist/{chunk-EV2TDHQZ.js → chunk-XSN63FUS.js} +2 -2
- package/dist/{chunk-OR2FYRYR.js → chunk-XVU7J43V.js} +2 -2
- package/dist/{chunk-JYPRZWCZ.js → chunk-Y3YLJORD.js} +167 -133
- package/dist/chunk-Y3YLJORD.js.map +1 -0
- package/dist/{chunk-DNKVKO7K.js → chunk-Y6GZ2P4M.js} +2 -2
- package/dist/{chunk-ATY3ZASK.js → chunk-YCSM3GZU.js} +2 -2
- package/dist/{chunk-BMU2DS3S.js → chunk-YKPGQJFU.js} +12 -171
- package/dist/chunk-YKPGQJFU.js.map +1 -0
- package/dist/{chunk-RDB66EKD.js → chunk-YMLQBZFJ.js} +6 -6
- package/dist/{chunk-EHRIDNZX.js → chunk-YPSOHDNC.js} +2 -2
- package/dist/{chunk-KM6ZXG7U.js → chunk-YXA2TCTZ.js} +4 -4
- package/dist/{chunk-TKBB62DN.js → chunk-Z2PWOSCJ.js} +2 -2
- package/dist/{chunk-S2I5MYSA.js → chunk-Z2WK53N6.js} +42 -15
- package/dist/chunk-Z2WK53N6.js.map +1 -0
- package/dist/{chunk-5O5ZSW7N.js → chunk-Z7ZXZL6Y.js} +2 -2
- package/dist/{chunk-2ZCWHCLF.js → chunk-ZO252Q5S.js} +6 -6
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-AZDSDG6V.js → classified-marker-BSQHU4JT.js} +3 -3
- package/dist/collection-facade-LG3NYZVB.js +45 -0
- package/dist/{computed-VG2PCM4L.js → computed-ASBNTLOK.js} +3 -3
- package/dist/consent/index.js +9 -9
- package/dist/cover/index.js +9 -9
- package/dist/custody/index.js +12 -12
- package/dist/{dead-filter-JNQNB3TA.js → dead-filter-QKU56XTQ.js} +2 -2
- package/dist/debug/index.js +1 -1
- package/dist/{delegation-5F36DRDH.js → delegation-XWRPYODW.js} +11 -11
- package/dist/derivations/index.js +12 -12
- package/dist/derive-CXHCY46K.js +22 -0
- package/dist/directory/index.js +10 -10
- package/dist/{dispatch-3ZA733EY.js → dispatch-4AP4PUZU.js} +18 -18
- package/dist/{dispatch-TNM5CRLZ.js → dispatch-VR4LRXZ7.js} +5 -5
- package/dist/{enclave-Y2ALNDRD.js → enclave-NYPT7WA7.js} +9 -9
- package/dist/executor-3KFRQETS.js +29 -0
- package/dist/executor-AFHQYRAU.js +9 -0
- package/dist/executor-YYDW6XQI.js +9 -0
- package/dist/export-accessible-BX2ILB4C.js +23 -0
- package/dist/extract-partition-UPOVITFI.js +38 -0
- package/dist/{fanout-sidecar-3QZU7ZZX.js → fanout-sidecar-IWP3R4RC.js} +9 -9
- package/dist/{fence-watcher-DHQ775JB.js → fence-watcher-ZVSMLKQD.js} +1 -1
- package/dist/fence-watcher-ZVSMLKQD.js.map +1 -0
- package/dist/find-SZBL2HPB.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +7 -7
- package/dist/history/index.js +13 -13
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +5 -5
- package/dist/index.js +134 -131
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/introspection/index.js +12 -11
- package/dist/issue-G53NB6EW.js +19 -0
- package/dist/kernel/collection-config.d.ts +9 -9
- package/dist/kernel/collection.d.ts +1 -1
- package/dist/kernel/errors.d.ts +2 -2
- package/dist/kernel/noydb.d.ts +6 -6
- package/dist/kernel/secret-mode.d.ts +1 -1
- package/dist/kernel/types.d.ts +34 -15
- package/dist/kernel/vault.d.ts +10 -1
- package/dist/kernel/via/compose.d.ts +3 -3
- package/dist/kernel/via/index.d.ts +4 -4
- package/dist/kernel/via/pipeline.d.ts +6 -6
- package/dist/kernel/via/reconcile.d.ts +2 -2
- package/dist/kernel/via/taint-binding.d.ts +3 -3
- package/dist/{ledger-MQIIOTZB.js → ledger-T5K4P2D7.js} +11 -11
- package/dist/liberate-VEOZRESE.js +25 -0
- package/dist/{link-set-5PJBBR63.js → link-set-76JZ6YB4.js} +11 -11
- package/dist/{managed-secret-ETDG6AAE.js → managed-secret-6YC32VXG.js} +12 -12
- package/dist/materialized-views/index.js +25 -25
- package/dist/{migrate-cek-V3VDRV24.js → migrate-cek-LBRKYUZZ.js} +2 -2
- package/dist/money/index.js +4 -4
- package/dist/noydb-EDJA4JNJ.js +86 -0
- package/dist/on/index.js +1 -0
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +12 -12
- package/dist/pod/index.js +58 -57
- package/dist/{pod-handle-AZ3CXY5Y.js → pod-handle-P6DPBM5U.js} +9 -9
- package/dist/policy/index.js +10 -10
- package/dist/port/as/active.d.ts +10 -0
- package/dist/port/as/index.d.ts +32 -0
- package/dist/port/as/types.d.ts +113 -0
- package/dist/port/at/index.d.ts +37 -0
- package/dist/port/by/default-provider.d.ts +3 -3
- package/dist/port/by/index.d.ts +32 -10
- package/dist/port/by/types.d.ts +29 -11
- package/dist/port/on/index.d.ts +50 -0
- package/dist/port/with/computed-strategy.d.ts +1 -1
- package/dist/port/with/device-seal-strategy.d.ts +2 -2
- package/dist/port/with/formats-strategy.d.ts +76 -0
- package/dist/port/with/strategies.d.ts +11 -5
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-QCJYRMIK.js → post-register-53O7AJRZ.js} +6 -6
- package/dist/query/index.js +3 -3
- package/dist/reduce/index.js +4 -4
- package/dist/register-6TCBR6XD.js +32 -0
- package/dist/registry-DH2L4O2V.js +18 -0
- package/dist/registry-IWFMXCHX.js +9 -0
- package/dist/registry-Q3FG3OAX.js +9 -0
- package/dist/registry-YC3IFG3A.js +19 -0
- package/dist/request-withdrawal-NM5VYR6F.js +31 -0
- package/dist/{reveal-W7BKZSUP.js → reveal-XBIMHAXR.js} +6 -6
- package/dist/revoke-MJNYWO72.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/schema-update/index.js +2 -2
- package/dist/sealed-record/index.js +12 -12
- package/dist/search/index.js +4 -4
- package/dist/{seed-55FPOMYP.js → seed-NSNIGYXE.js} +12 -12
- package/dist/sequence/index.js +9 -9
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-6XVS2AU3.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/{stale-TH7SSVRV.js → stale-MCS46TFO.js} +10 -10
- package/dist/stale-MCS46TFO.js.map +1 -0
- package/dist/storage-ZXUT476I.js +23 -0
- package/dist/storage-ZXUT476I.js.map +1 -0
- package/dist/{store-coordination-provider-R27VRD6K.js → store-coordination-provider-6FM26VQM.js} +14 -13
- package/dist/store-coordination-provider-6FM26VQM.js.map +1 -0
- package/dist/sync/index.js +10 -10
- package/dist/team/index.js +17 -17
- package/dist/tiers/index.js +11 -11
- package/dist/to/index.js +1 -1
- package/dist/transactions/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/vault-diff-FE5J35NJ.js +9 -0
- package/dist/vault-diff-FE5J35NJ.js.map +1 -0
- package/dist/vault-head/index.js +8 -8
- package/dist/{verify-M5LQH43C.js → verify-WYOFLSNA.js} +5 -5
- package/dist/via/blob/binding.d.ts +6 -6
- package/dist/via/classified/binding.d.ts +9 -9
- package/dist/via/computed/binding.d.ts +2 -2
- package/dist/via/i18n/binding.d.ts +4 -4
- package/dist/via/lookup/binding.d.ts +5 -5
- package/dist/via/lookup/index.d.ts +1 -1
- package/dist/via/lookup/snapshot.d.ts +1 -1
- package/dist/via/money/binding.d.ts +3 -3
- package/dist/via/money/normalize.d.ts +1 -1
- package/dist/via/money/where.d.ts +3 -3
- package/dist/walk-JNEOYCAU.js +21 -0
- package/dist/walk-JNEOYCAU.js.map +1 -0
- package/dist/with-cargo/adopt-partition.d.ts +6 -6
- package/dist/with-cargo/floor.d.ts +1 -1
- package/dist/with-cargo/index.d.ts +1 -1
- package/dist/with-party/team/deed.d.ts +4 -4
- package/dist/with-party/team/device-seal.d.ts +5 -5
- package/dist/with-party/team/echo-ceremony.d.ts +2 -2
- package/dist/with-party/team/echo-secret.d.ts +4 -4
- package/dist/with-party/team/index.d.ts +2 -2
- package/dist/with-party/team/keyring.d.ts +2 -2
- package/dist/with-party/team/managed-secret.d.ts +21 -11
- package/dist/with-party/team/noydb-facade.d.ts +2 -2
- package/dist/with-party/team/{shamir-recovery-provider.d.ts → noydb-shamir.d.ts} +1 -1
- package/dist/with-party/team/recovery.d.ts +3 -3
- package/dist/with-party/team/rotate-recover.d.ts +5 -5
- package/dist/with-pod/format.d.ts +1 -1
- package/dist/with-pod/pod.d.ts +6 -6
- package/dist/with-shape/introspection/describe.d.ts +2 -2
- package/dist/with-shape/schema-update/fence-controller.d.ts +4 -4
- package/dist/with-shape/schema-update/fence-watcher.d.ts +4 -4
- package/dist/with-shape/schema-update/store-coordination-provider.d.ts +7 -6
- package/dist/withdraw-accessible-ILTSXTIE.js +28 -0
- package/dist/withdraw-accessible-ILTSXTIE.js.map +1 -0
- package/package.json +23 -5
- package/dist/api-6X2VLZ7J.js +0 -20
- package/dist/chunk-AJGGBXWA.js.map +0 -1
- package/dist/chunk-BMU2DS3S.js.map +0 -1
- package/dist/chunk-C3XWJCG7.js.map +0 -1
- package/dist/chunk-EHW7NLGD.js.map +0 -1
- package/dist/chunk-GCU42IG7.js.map +0 -1
- package/dist/chunk-GKTW3KLV.js.map +0 -1
- package/dist/chunk-IWKCJCLP.js.map +0 -1
- package/dist/chunk-J6I5VR6P.js.map +0 -1
- package/dist/chunk-JYPRZWCZ.js.map +0 -1
- package/dist/chunk-K6CPIK3R.js.map +0 -1
- package/dist/chunk-LC6NE4IQ.js.map +0 -1
- package/dist/chunk-LIR2DJWP.js.map +0 -1
- package/dist/chunk-PJX72ICF.js.map +0 -1
- package/dist/chunk-S2I5MYSA.js.map +0 -1
- package/dist/chunk-UJ4Z67UQ.js.map +0 -1
- package/dist/chunk-XINT4VJA.js.map +0 -1
- package/dist/chunk-XPEPMK4Y.js.map +0 -1
- package/dist/chunk-YTUFV7U7.js.map +0 -1
- package/dist/chunk-Z3BZXPRO.js.map +0 -1
- package/dist/collection-facade-WSUAYFJ4.js +0 -45
- package/dist/derive-MPOGZ4NR.js +0 -22
- package/dist/executor-BBEEUFO3.js +0 -9
- package/dist/executor-G6G3YEWR.js +0 -9
- package/dist/executor-ZUTUMTPA.js +0 -29
- package/dist/export-accessible-S3KEB763.js +0 -23
- package/dist/extract-partition-KVCTSUVE.js +0 -38
- package/dist/fence-watcher-DHQ775JB.js.map +0 -1
- package/dist/find-V4FN5ITT.js +0 -11
- package/dist/issue-5CFBWBRX.js +0 -19
- package/dist/liberate-LW7OKVBH.js +0 -25
- package/dist/noydb-LFDRMYZ5.js +0 -85
- package/dist/register-JBOEHTVX.js +0 -32
- package/dist/registry-5DYHQFJS.js +0 -9
- package/dist/registry-EANV44W2.js +0 -9
- package/dist/registry-J25H6VB4.js +0 -19
- package/dist/registry-R23SQUQH.js +0 -18
- package/dist/request-withdrawal-KQ4W4UT5.js +0 -31
- package/dist/revoke-H3VSTAIE.js +0 -24
- package/dist/signer-53AQ3BU2.js +0 -25
- package/dist/storage-WSF7ZKTL.js +0 -23
- package/dist/store-coordination-provider-R27VRD6K.js.map +0 -1
- package/dist/walk-NABCHDZN.js +0 -21
- package/dist/withdraw-accessible-VCINIG6V.js +0 -28
- /package/dist/{api-6X2VLZ7J.js.map → api-EQYRTZO2.js.map} +0 -0
- /package/dist/{collection-facade-WSUAYFJ4.js.map → at/index.js.map} +0 -0
- /package/dist/{backup-VL4GRIEW.js.map → backup-Z7ZBTAQ6.js.map} +0 -0
- /package/dist/{computed-VG2PCM4L.js.map → by/index.js.map} +0 -0
- /package/dist/{chunk-JKATP6OE.js.map → chunk-225O5CXQ.js.map} +0 -0
- /package/dist/{chunk-CXPOG3ZY.js.map → chunk-2LPVI4PX.js.map} +0 -0
- /package/dist/{chunk-2J5IT37K.js.map → chunk-3L2MVE36.js.map} +0 -0
- /package/dist/{chunk-HOPNIR5R.js.map → chunk-3QARDAYW.js.map} +0 -0
- /package/dist/{chunk-HSJBJIB2.js.map → chunk-467SKJ65.js.map} +0 -0
- /package/dist/{chunk-YCGLAANM.js.map → chunk-4A4TYISP.js.map} +0 -0
- /package/dist/{chunk-2CBFYXJX.js.map → chunk-4G25SDQL.js.map} +0 -0
- /package/dist/{chunk-5LZZQMIC.js.map → chunk-4LPF226H.js.map} +0 -0
- /package/dist/{chunk-GANFIM2M.js.map → chunk-4ZPE6SKS.js.map} +0 -0
- /package/dist/{chunk-65JXA63J.js.map → chunk-5263OEM3.js.map} +0 -0
- /package/dist/{chunk-FNYCT27B.js.map → chunk-57JTHWLQ.js.map} +0 -0
- /package/dist/{chunk-5IHGJHWC.js.map → chunk-5ACAVJUI.js.map} +0 -0
- /package/dist/{chunk-3OE2QNSM.js.map → chunk-5AFMP532.js.map} +0 -0
- /package/dist/{chunk-7ZGPQOFV.js.map → chunk-6EW2UCVF.js.map} +0 -0
- /package/dist/{chunk-36CEG6CM.js.map → chunk-7LYUJNU3.js.map} +0 -0
- /package/dist/{chunk-D6SXRMZZ.js.map → chunk-A2YW5EMU.js.map} +0 -0
- /package/dist/{chunk-OQMCFHUX.js.map → chunk-AB5P32RE.js.map} +0 -0
- /package/dist/{chunk-JMJSCI7U.js.map → chunk-ALB64CZM.js.map} +0 -0
- /package/dist/{chunk-RPRASGEY.js.map → chunk-ALUNQEBY.js.map} +0 -0
- /package/dist/{chunk-ZYZJLYNS.js.map → chunk-ATV637J7.js.map} +0 -0
- /package/dist/{chunk-W3HAIN6U.js.map → chunk-CN6B5PEN.js.map} +0 -0
- /package/dist/{chunk-JIHWBKMQ.js.map → chunk-DBNYPLWY.js.map} +0 -0
- /package/dist/{chunk-ZJUZOJVW.js.map → chunk-DFAUMLD7.js.map} +0 -0
- /package/dist/{chunk-S6PJ6ZKE.js.map → chunk-DKWPJOYH.js.map} +0 -0
- /package/dist/{chunk-MPKP6L5E.js.map → chunk-E6YA6UAP.js.map} +0 -0
- /package/dist/{chunk-S7PM7Z4K.js.map → chunk-F7ZFRPGQ.js.map} +0 -0
- /package/dist/{chunk-CKKN25P2.js.map → chunk-FOG7YEJP.js.map} +0 -0
- /package/dist/{chunk-4ATF4BLF.js.map → chunk-H36KSN6X.js.map} +0 -0
- /package/dist/{chunk-QQRRKO7W.js.map → chunk-H7HP56F6.js.map} +0 -0
- /package/dist/{chunk-RJZQ2PVD.js.map → chunk-HM4JSXX2.js.map} +0 -0
- /package/dist/{chunk-3YGUHUJA.js.map → chunk-HTGRQZFB.js.map} +0 -0
- /package/dist/{chunk-JXHNUYQO.js.map → chunk-IESNYJXZ.js.map} +0 -0
- /package/dist/{chunk-OCJ3JA4O.js.map → chunk-J4MN6XIU.js.map} +0 -0
- /package/dist/{chunk-HWI7GHJZ.js.map → chunk-J4UJ5FRV.js.map} +0 -0
- /package/dist/{chunk-QVXZFJBU.js.map → chunk-JVLSU7S2.js.map} +0 -0
- /package/dist/{chunk-7Q3RHOA5.js.map → chunk-KDJGJR7F.js.map} +0 -0
- /package/dist/{chunk-M7WBE3OR.js.map → chunk-L6GTLZRK.js.map} +0 -0
- /package/dist/{chunk-2ZT4INZ4.js.map → chunk-LF6DMX4C.js.map} +0 -0
- /package/dist/{chunk-4K6BIMLF.js.map → chunk-LKFKXS5K.js.map} +0 -0
- /package/dist/{chunk-POFYIGQ2.js.map → chunk-LR4Z47QD.js.map} +0 -0
- /package/dist/{chunk-LUYPYCHY.js.map → chunk-MTBXJAS4.js.map} +0 -0
- /package/dist/{chunk-FX3UIDCS.js.map → chunk-N4CNVSUF.js.map} +0 -0
- /package/dist/{chunk-FU5VYEYK.js.map → chunk-NLKLXXTO.js.map} +0 -0
- /package/dist/{chunk-YYV53EHO.js.map → chunk-OPXR4PB2.js.map} +0 -0
- /package/dist/{chunk-5F7BZAGV.js.map → chunk-OWLVBOWO.js.map} +0 -0
- /package/dist/{chunk-6NR36UNB.js.map → chunk-P6ASQOZR.js.map} +0 -0
- /package/dist/{chunk-5ATC6UT4.js.map → chunk-PCQDY6QN.js.map} +0 -0
- /package/dist/{chunk-EQOTJL76.js.map → chunk-PGFKIOR3.js.map} +0 -0
- /package/dist/{chunk-D2YFQ7XG.js.map → chunk-POS53FG6.js.map} +0 -0
- /package/dist/{chunk-ZY6P7M52.js.map → chunk-PQ6Z2TAP.js.map} +0 -0
- /package/dist/{chunk-5OT4G5N5.js.map → chunk-PUJTKLPL.js.map} +0 -0
- /package/dist/{chunk-64WHKBMP.js.map → chunk-QGJ4XIA7.js.map} +0 -0
- /package/dist/{chunk-DECNV4QK.js.map → chunk-QHJKK77B.js.map} +0 -0
- /package/dist/{chunk-JHYKSMVX.js.map → chunk-QI5NWLVW.js.map} +0 -0
- /package/dist/{chunk-BZ3WMOYX.js.map → chunk-RC4BROYR.js.map} +0 -0
- /package/dist/{chunk-IWQPYT6S.js.map → chunk-RDHUZ674.js.map} +0 -0
- /package/dist/{chunk-7OBIBPCV.js.map → chunk-S35S77YU.js.map} +0 -0
- /package/dist/{chunk-22GR3O4J.js.map → chunk-SHILAQH5.js.map} +0 -0
- /package/dist/{chunk-WPZ5FVAS.js.map → chunk-T3PHCEN4.js.map} +0 -0
- /package/dist/{chunk-6RH7PRTL.js.map → chunk-TVIFAHZR.js.map} +0 -0
- /package/dist/{derive-MPOGZ4NR.js.map → chunk-UBSFPGVJ.js.map} +0 -0
- /package/dist/{chunk-323MN67Z.js.map → chunk-UCUALOSM.js.map} +0 -0
- /package/dist/{chunk-B4CRUZPR.js.map → chunk-VAG47QHV.js.map} +0 -0
- /package/dist/{chunk-QH47SQLD.js.map → chunk-VFIWDPXZ.js.map} +0 -0
- /package/dist/{chunk-ONPVHX2Y.js.map → chunk-W5LHQXZU.js.map} +0 -0
- /package/dist/{chunk-ZIMQDXTQ.js.map → chunk-WK5FSW7T.js.map} +0 -0
- /package/dist/{chunk-PFWE7FJG.js.map → chunk-WLLUM35R.js.map} +0 -0
- /package/dist/{chunk-EV2TDHQZ.js.map → chunk-XSN63FUS.js.map} +0 -0
- /package/dist/{chunk-OR2FYRYR.js.map → chunk-XVU7J43V.js.map} +0 -0
- /package/dist/{chunk-DNKVKO7K.js.map → chunk-Y6GZ2P4M.js.map} +0 -0
- /package/dist/{chunk-ATY3ZASK.js.map → chunk-YCSM3GZU.js.map} +0 -0
- /package/dist/{chunk-RDB66EKD.js.map → chunk-YMLQBZFJ.js.map} +0 -0
- /package/dist/{chunk-EHRIDNZX.js.map → chunk-YPSOHDNC.js.map} +0 -0
- /package/dist/{chunk-KM6ZXG7U.js.map → chunk-YXA2TCTZ.js.map} +0 -0
- /package/dist/{chunk-TKBB62DN.js.map → chunk-Z2PWOSCJ.js.map} +0 -0
- /package/dist/{chunk-5O5ZSW7N.js.map → chunk-Z7ZXZL6Y.js.map} +0 -0
- /package/dist/{chunk-2ZCWHCLF.js.map → chunk-ZO252Q5S.js.map} +0 -0
- /package/dist/{classified-marker-AZDSDG6V.js.map → classified-marker-BSQHU4JT.js.map} +0 -0
- /package/dist/{enclave-Y2ALNDRD.js.map → collection-facade-LG3NYZVB.js.map} +0 -0
- /package/dist/{executor-BBEEUFO3.js.map → computed-ASBNTLOK.js.map} +0 -0
- /package/dist/{dead-filter-JNQNB3TA.js.map → dead-filter-QKU56XTQ.js.map} +0 -0
- /package/dist/{delegation-5F36DRDH.js.map → delegation-XWRPYODW.js.map} +0 -0
- /package/dist/{executor-G6G3YEWR.js.map → derive-CXHCY46K.js.map} +0 -0
- /package/dist/{dispatch-3ZA733EY.js.map → dispatch-4AP4PUZU.js.map} +0 -0
- /package/dist/{dispatch-TNM5CRLZ.js.map → dispatch-VR4LRXZ7.js.map} +0 -0
- /package/dist/{executor-ZUTUMTPA.js.map → enclave-NYPT7WA7.js.map} +0 -0
- /package/dist/{export-accessible-S3KEB763.js.map → executor-3KFRQETS.js.map} +0 -0
- /package/dist/{extract-partition-KVCTSUVE.js.map → executor-AFHQYRAU.js.map} +0 -0
- /package/dist/{find-V4FN5ITT.js.map → executor-YYDW6XQI.js.map} +0 -0
- /package/dist/{issue-5CFBWBRX.js.map → export-accessible-BX2ILB4C.js.map} +0 -0
- /package/dist/{ledger-MQIIOTZB.js.map → extract-partition-UPOVITFI.js.map} +0 -0
- /package/dist/{fanout-sidecar-3QZU7ZZX.js.map → fanout-sidecar-IWP3R4RC.js.map} +0 -0
- /package/dist/{liberate-LW7OKVBH.js.map → find-SZBL2HPB.js.map} +0 -0
- /package/dist/{link-set-5PJBBR63.js.map → issue-G53NB6EW.js.map} +0 -0
- /package/dist/{managed-secret-ETDG6AAE.js.map → ledger-T5K4P2D7.js.map} +0 -0
- /package/dist/{noydb-LFDRMYZ5.js.map → liberate-VEOZRESE.js.map} +0 -0
- /package/dist/{register-JBOEHTVX.js.map → link-set-76JZ6YB4.js.map} +0 -0
- /package/dist/{registry-5DYHQFJS.js.map → managed-secret-6YC32VXG.js.map} +0 -0
- /package/dist/{migrate-cek-V3VDRV24.js.map → migrate-cek-LBRKYUZZ.js.map} +0 -0
- /package/dist/{registry-EANV44W2.js.map → noydb-EDJA4JNJ.js.map} +0 -0
- /package/dist/{registry-J25H6VB4.js.map → on/index.js.map} +0 -0
- /package/dist/{pod-handle-AZ3CXY5Y.js.map → pod-handle-P6DPBM5U.js.map} +0 -0
- /package/dist/{post-register-QCJYRMIK.js.map → post-register-53O7AJRZ.js.map} +0 -0
- /package/dist/{registry-R23SQUQH.js.map → register-6TCBR6XD.js.map} +0 -0
- /package/dist/{request-withdrawal-KQ4W4UT5.js.map → registry-DH2L4O2V.js.map} +0 -0
- /package/dist/{revoke-H3VSTAIE.js.map → registry-IWFMXCHX.js.map} +0 -0
- /package/dist/{signer-53AQ3BU2.js.map → registry-Q3FG3OAX.js.map} +0 -0
- /package/dist/{stale-TH7SSVRV.js.map → registry-YC3IFG3A.js.map} +0 -0
- /package/dist/{storage-WSF7ZKTL.js.map → request-withdrawal-NM5VYR6F.js.map} +0 -0
- /package/dist/{reveal-W7BKZSUP.js.map → reveal-XBIMHAXR.js.map} +0 -0
- /package/dist/{walk-NABCHDZN.js.map → revoke-MJNYWO72.js.map} +0 -0
- /package/dist/{seed-55FPOMYP.js.map → seed-NSNIGYXE.js.map} +0 -0
- /package/dist/{withdraw-accessible-VCINIG6V.js.map → signer-6XVS2AU3.js.map} +0 -0
- /package/dist/{verify-M5LQH43C.js.map → verify-WYOFLSNA.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-pod/format.ts","../src/with-pod/signature.ts","../src/with-pod/pod.ts"],"sourcesContent":["/**\n * `.noydb` container format — byte layout, header schema, validators.\n *\n *. Wraps a `vault.dump()` JSON string in a thin\n * binary container with a magic-byte prefix, a minimum-disclosure\n * unencrypted header, and a compressed body.\n *\n * **Byte layout** (read in order from offset 0):\n *\n * ```\n * +--------+--------+--------+--------+\n * | N=78 | D=68 | B=66 | 1=49 | Magic 'NDB1' (4 bytes)\n * +--------+--------+--------+--------+\n * | flags | compr | header_length (uint32 BE) |\n * +--------+--------+--------+--------+--------+--------+--------+\n * | header_length bytes of UTF-8 JSON header ...\n * +--------+--------+\n * | compressed body bytes ...\n * ```\n *\n * Total fixed prefix before the header JSON is **10 bytes**:\n * - 4 bytes magic\n * - 1 byte flags\n * - 1 byte compression algorithm\n * - 4 bytes header length (uint32 big-endian)\n *\n * **Why a binary container** at all? `vault.dump()` already\n * produces a JSON string with encrypted records inside. Wrapping it\n * again seems redundant — but the wrap is what makes the file safe\n * to drop into cloud storage (Drive, Dropbox, iCloud) without\n * leaking the vault name and exporter identity through the\n * cloud's metadata API. The minimum-disclosure header is the only\n * thing visible without downloading and decompressing the body.\n * The dump JSON inside the body still contains the original\n * metadata, but that's only readable by someone who already has the\n * file bytes — the same person who could read the encrypted records\n * with the right secret.\n *\n * **Why minimum disclosure** in the header? Because consumers will\n * inevitably store these in services where the filename, file size,\n * and any unencrypted metadata are indexed for search. A field like\n * `vault: \"Acme Corp\"` would let an attacker (or a curious\n * cloud admin) enumerate which compartments exist and who exported\n * them, even with zero access to the encrypted body. The header\n * carries only what's needed to identify the file as a NOYDB\n * bundle and verify its integrity — nothing about the contents.\n */\n\nimport type { Cover } from '../with-party/directory/cover/types.js'\nimport type { Redirect } from './redirect.js'\n\n/** Magic bytes 'NDB1' (ASCII) — `NoyDB 1` — identifying a NOYDB pod (`.noydb` container). */\nexport const NOYDB_POD_MAGIC = new Uint8Array([0x4e, 0x44, 0x42, 0x31])\n\n/** Total fixed prefix before the header JSON: 4+1+1+4 bytes. */\nexport const NOYDB_POD_PREFIX_BYTES = 10\n\n/** Current bundle format version. Bumped on layout changes. Default for unsigned pods. */\nexport const NOYDB_POD_FORMAT_VERSION = 1\n\n/** Format version for pods carrying a header signature (`sig`/`keyId`/`sigAlg`). */\nexport const NOYDB_POD_FORMAT_VERSION_SIGNED = 2\n\n/**\n * Bitfield interpretation of the flags byte.\n *\n * Bit 0 — body is compressed (0 = raw, 1 = compressed)\n * Bit 1 — header carries an integrity hash over the body bytes\n * Bits 2-7 — reserved, must be 0 in\n */\nexport const FLAG_COMPRESSED = 0b0000_0001\nexport const FLAG_HAS_INTEGRITY_HASH = 0b0000_0010\n\n/**\n * Compression algorithm encoding for the byte at offset 5.\n *\n * `none` is admitted for round-trip testing and for callers that\n * want to bundle without compression (e.g. when piping into a\n * separately compressed transport). `gzip` is the universally\n * available baseline (Node 18+, all modern browsers). `brotli` is\n * preferred when the runtime supports it — typically 30-50% smaller\n * for JSON payloads — but Node 22+ / Chrome 124+ / Firefox 122+\n * are required, so the writer feature-detects at runtime and falls\n * back to gzip. The reader must handle all three.\n */\nexport const COMPRESSION_NONE = 0\nexport const COMPRESSION_GZIP = 1\nexport const COMPRESSION_BROTLI = 2\n\nexport type CompressionAlgo = 0 | 1 | 2\n\n/**\n * The unencrypted header carried in every `.noydb` bundle.\n *\n * **Minimum-disclosure rules:** these are the ONLY allowed keys.\n * Any other key in a parsed header causes\n * `validatePodHeaderFields` to throw. The set is kept short to\n * minimize attack surface from cloud-storage metadata indexing —\n * see the file-level doc comment for the rationale.\n *\n * Forbidden in particular:\n * - `vault` / `_compartment` — would leak the tenant name\n * - `exporter` / `_exported_by` — would leak user identity\n * - `timestamp` / `_exported_at` — would leak activity timing\n * - `kdfParams` / salt fields — would leak crypto config that\n * could narrow brute-force search space\n * - any field starting with `_` (reserved by the dump format)\n */\nexport interface NoydbPodHeader {\n /** Bundle format version — bumped on layout changes. */\n readonly formatVersion: number\n /**\n * Opaque ULID identifier — generated once per vault and\n * stable across re-exports of the same vault. Does not\n * leak any information about contents (the timestamp prefix is\n * just monotonicity for sortability, not exporter activity —\n * see `bundle/ulid.ts` for the design notes).\n */\n readonly handle: string\n /** Compressed body length in bytes. Lets readers verify completeness without decompressing. */\n readonly bodyBytes: number\n /** SHA-256 of the compressed body bytes (lowercase hex). Lets readers verify integrity without decompressing. */\n readonly bodySha256: string\n /**\n * Owner-curated cover (`https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md`).\n * Optional — present only when the source vault has a\n * `_meta/public-envelope` document AND the writer's hub is opted\n * into the feature. Treat as **untrusted hint**; the body's\n * encrypted contents remain the source of truth.\n *\n * The JSON key keeps its frozen wire name `publicEnvelope` (#799\n * renamed only the developer surface — existing bundles stay\n * readable byte-for-byte).\n *\n * The cover deliberately widens the minimum-disclosure rule\n * for explicit, owner-curated label fields (name, icon, …). Every\n * other unknown header key still rejects at parse time.\n */\n readonly publicEnvelope?: Cover\n /**\n * Auto-unlock material indicator. When present, the bundle\n * body wraps the dump JSON in a structure carrying per-user\n * secrets — either plaintext (`'unsealed'`, public-by-design)\n * or sealed under a `NoydbSealer` (`'sealed'`, requires\n * matching provider on the recipient side).\n *\n * Visible pre-decompression so cloud listing UIs can warn before\n * download: \"this bundle opens itself for anyone holding the file\"\n * (unsealed) or \"this bundle is sealed for a specific provider\"\n * (sealed).\n *\n * Absent → the body is a raw `vault.dump()` JSON string (the\n * the legacy shape; back-compatible).\n */\n readonly autoUnlock?: 'unsealed' | 'sealed'\n /**\n * Bundle's role in the source → destination lifecycle.\n * - omitted / 'snapshot' (default): backup/copy of an existing vault.\n * - 'extracted-partition': re-keyed projection awaiting adoption.\n */\n readonly bundleKind?: 'snapshot' | 'extracted-partition'\n /**\n * Transfer-seal INDICATOR — metadata only, no payload (the\n * sealed DEKs live in the body). Present iff\n * bundleKind === 'extracted-partition'.\n */\n readonly transferSeal?: {\n readonly v: 1\n readonly alg: 'aes-256-gcm-pre-shared'\n readonly sealId: string\n }\n /**\n * Non-secret 16-hex-char fingerprint identifying the signing key\n * used for `sig`. A hash prefix, not the key itself — discloses no\n * crypto config, safe under minimum-disclosure. Present iff `sig`\n * and `sigAlg` are also present (all-or-nothing 3-tuple), and only\n * on `formatVersion === 2` headers.\n */\n readonly keyId?: string\n /**\n * Signature authenticating the rest of the header (base64url,\n * no padding). Verifies the header wasn't tampered with in\n * transit/storage — see `with-pod/signature.ts`. Part of the\n * sig/keyId/sigAlg 3-tuple.\n */\n readonly sig?: string\n /**\n * Signature algorithm for `sig`. Named `sigAlg` (not `alg`) to\n * avoid confusion with `transferSeal.alg`. Part of the\n * sig/keyId/sigAlg 3-tuple.\n */\n readonly sigAlg?: 'ed25519'\n /**\n * Engine version range that wrote (and can read) this pod, e.g.\n * `'^0.5.0'`. Discloses only a semver range — no timestamps, no\n * identities — so a version-skew triage step (open a decade-old\n * pod → route to a version-matched read-only player instead of a\n * hard failure) or a landing page can branch before any library\n * code runs. Safe under minimum-disclosure: a range says nothing\n * about who wrote the pod or when.\n */\n readonly engineRange?: string\n /**\n * Declared unlock method(s), e.g. `['password', 'webauthn']`. Lets\n * a landing/player present the right unlock UI pre-library, and is\n * ALL a shared connection pod may disclose about its bootstrap\n * (auth method + endpoint class). Safe under minimum-disclosure: it\n * names a method family, not a credential, key, or identity.\n *\n * The member set mirrors the `@noy-db/on-*` package family\n * (`on-password`, `on-webauthn`, `on-oidc`, `on-totp`,\n * `on-email-otp`, `on-magic-link`, `on-pin`, `on-recovery`,\n * `on-shamir`) — the top-level \"which on-* package to load\" method\n * name, not the finer-grained `FactorKind` used by policy gates\n * (which splits WebAuthn into `webauthn-roaming` /\n * `webauthn-platform` for factor-proof freshness). `on-threat` is\n * excluded — it's a lockout/duress helper, not an unlock method a\n * landing page would present.\n */\n readonly unlockMethods?: readonly UnlockMethod[]\n /**\n * App-manifest presence flag. Lets a landing fork between\n * \"orphan pod → read-only browse\" and \"linked app → launch flow\"\n * without reading the body. Safe under minimum-disclosure: a\n * boolean, not the app's identity or contents.\n */\n readonly hasApp?: boolean\n /**\n * Artifact species hint for dispatcher branching, cloud tooling,\n * and the share-flow guard that warns when a data-bearing pod is\n * shared where a pointer was intended. An \"orphan\" pod is derived\n * (`species: 'full'` + `hasApp: false`), not a separate species.\n * Safe under minimum-disclosure: a coarse artifact-shape label, not\n * contents or identity.\n */\n readonly species?: 'full' | 'connection' | 'snapshot' | 'redirect' | 'group'\n /**\n * Whether the app pointer (if any) is disclosed pre-auth. Default\n * is `'private'` by product decision (recorded in #942) — absence\n * means private by convention; this field is never auto-injected,\n * only an author's explicit opt-in writes `'public'`. Safe under\n * minimum-disclosure: a disclosure-policy flag, not the pointer\n * itself.\n */\n readonly pointerMode?: 'public' | 'private'\n /**\n * Signed \"this moved, go there\" pointer (#944). Carried in the\n * PLAINTEXT header (not the encrypted body) so a dispatcher can follow\n * it pre-auth — no secret, no decompression. Structurally validated\n * here (shape only); the record's OWN signature is a separate\n * verification step (`verifyRedirect`) since a parser has no\n * `trustedKeys`. `readPodRedirect` returns this field UNVERIFIED.\n */\n readonly redirect?: Redirect\n}\n\n/**\n * Declared unlock method names — mirrors the `@noy-db/on-*` package\n * family (see `unlockMethods` doc comment on `NoydbPodHeader`).\n */\nexport type UnlockMethod =\n | 'password'\n | 'webauthn'\n | 'oidc'\n | 'totp'\n | 'email-otp'\n | 'magic-link'\n | 'pin'\n | 'recovery'\n | 'shamir'\n\n\n/**\n * Allowlist of header keys. Any key not in this set is forbidden\n * and causes `validatePodHeaderFields` to throw. Kept as a Set for\n * O(1) lookup; the validator iterates over the parsed header and\n * checks each key against this set.\n */\nconst ALLOWED_HEADER_KEYS: ReadonlySet<string> = new Set([\n 'formatVersion',\n 'handle',\n 'bodyBytes',\n 'bodySha256',\n 'publicEnvelope',\n 'autoUnlock',\n 'bundleKind',\n 'transferSeal',\n 'sig',\n 'keyId',\n 'sigAlg',\n 'engineRange',\n 'unlockMethods',\n 'hasApp',\n 'species',\n 'pointerMode',\n 'redirect',\n])\n\n/** Valid `unlockMethods` member values — see `UnlockMethod`. */\nconst UNLOCK_METHODS: ReadonlySet<string> = new Set([\n 'password',\n 'webauthn',\n 'oidc',\n 'totp',\n 'email-otp',\n 'magic-link',\n 'pin',\n 'recovery',\n 'shamir',\n])\n\n/** Valid `species` values — see `NoydbPodHeader.species`. */\nconst POD_SPECIES: ReadonlySet<string> = new Set([\n 'full',\n 'connection',\n 'snapshot',\n 'redirect',\n 'group',\n])\n\n/** Valid `redirect.reason` values — see `Redirect['reason']`. */\nconst REDIRECT_REASONS: ReadonlySet<string> = new Set([\n 'moved',\n 'release',\n 'tombstone',\n 'repoint',\n])\n\n/**\n * Validate a parsed bundle header. Throws on any deviation from\n * the minimum-disclosure schema:\n *\n * - Missing required field\n * - Wrong type for any field\n * - Any extra key not in `ALLOWED_HEADER_KEYS`\n * - Unsupported `formatVersion`\n * - Negative or non-integer `bodyBytes`\n * - Malformed `handle` (must be 26-char Crockford base32)\n * - Malformed `bodySha256` (must be 64-char lowercase hex)\n *\n * The error messages name the offending field so consumers can\n * fix the producer rather than the reader.\n */\nexport function validatePodHeaderFields(\n parsed: unknown,\n): asserts parsed is NoydbPodHeader {\n if (parsed === null || typeof parsed !== 'object') {\n throw new Error(\n `.noydb bundle header must be a JSON object, got ${parsed === null ? 'null' : typeof parsed}`,\n )\n }\n // Disallow any unknown key — minimum disclosure means we reject\n // forward-compat extension keys at the format layer; new fields\n // require a format version bump and a new validator.\n for (const key of Object.keys(parsed)) {\n if (!ALLOWED_HEADER_KEYS.has(key)) {\n throw new Error(\n `.noydb bundle header contains forbidden key \"${key}\". ` +\n `Only minimum-disclosure fields are allowed: ` +\n `${[...ALLOWED_HEADER_KEYS].join(', ')}.`,\n )\n }\n }\n const h = parsed as Record<string, unknown>\n if (\n typeof h['formatVersion'] !== 'number' ||\n (h['formatVersion'] !== NOYDB_POD_FORMAT_VERSION && h['formatVersion'] !== NOYDB_POD_FORMAT_VERSION_SIGNED)\n ) {\n throw new Error(\n `.noydb bundle header.formatVersion must be ${NOYDB_POD_FORMAT_VERSION} or ${NOYDB_POD_FORMAT_VERSION_SIGNED}, ` +\n `got ${String(h['formatVersion'])}. The reader does not support ` +\n `forward-compat versions; upgrade the reader to handle newer bundles.`,\n )\n }\n if (typeof h['handle'] !== 'string' || !/^[0-9A-HJKMNP-TV-Z]{26}$/.test(h['handle'])) {\n throw new Error(\n `.noydb bundle header.handle must be a 26-character Crockford base32 ULID, ` +\n `got ${typeof h['handle'] === 'string' ? `\"${h['handle']}\"` : String(h['handle'])}.`,\n )\n }\n if (typeof h['bodyBytes'] !== 'number' || !Number.isInteger(h['bodyBytes']) || h['bodyBytes'] < 0) {\n throw new Error(\n `.noydb bundle header.bodyBytes must be a non-negative integer, ` +\n `got ${String(h['bodyBytes'])}.`,\n )\n }\n if (typeof h['bodySha256'] !== 'string' || !/^[0-9a-f]{64}$/.test(h['bodySha256'])) {\n throw new Error(\n `.noydb bundle header.bodySha256 must be a 64-character lowercase hex string, ` +\n `got ${typeof h['bodySha256'] === 'string' ? `\"${h['bodySha256']}\"` : String(h['bodySha256'])}.`,\n )\n }\n if (h['publicEnvelope'] !== undefined) {\n const env = h['publicEnvelope']\n if (env === null || typeof env !== 'object' || Array.isArray(env)) {\n throw new Error(\n `.noydb bundle header.publicEnvelope must be a JSON object when present, got ${typeof env}.`,\n )\n }\n const e = env as Record<string, unknown>\n if (e['_noydb_public'] !== 1) {\n throw new Error(\n `.noydb bundle header.publicEnvelope._noydb_public must be 1, got ${String(e['_noydb_public'])}.`,\n )\n }\n if (typeof e['version'] !== 'number' || !Number.isInteger(e['version']) || e['version'] < 1) {\n throw new Error(\n `.noydb bundle header.publicEnvelope.version must be a positive integer, got ${String(e['version'])}.`,\n )\n }\n }\n if (h['autoUnlock'] !== undefined) {\n if (h['autoUnlock'] !== 'unsealed' && h['autoUnlock'] !== 'sealed') {\n const got = typeof h['autoUnlock'] === 'string' ? `\"${h['autoUnlock']}\"` : typeof h['autoUnlock']\n throw new Error(\n `.noydb bundle header.autoUnlock must be 'unsealed' or 'sealed' when present, got ${got}.`,\n )\n }\n }\n if (h['bundleKind'] !== undefined) {\n if (h['bundleKind'] !== 'snapshot' && h['bundleKind'] !== 'extracted-partition') {\n const got = typeof h['bundleKind'] === 'string' ? `\"${h['bundleKind']}\"` : typeof h['bundleKind']\n throw new Error(\n `.noydb bundle header.bundleKind must be 'snapshot' or 'extracted-partition' when present, got ${got}.`,\n )\n }\n }\n if (h['transferSeal'] !== undefined) {\n const ts = h['transferSeal']\n if (ts === null || typeof ts !== 'object' || Array.isArray(ts)) {\n throw new Error(`.noydb bundle header.transferSeal must be a JSON object when present, got ${typeof ts}.`)\n }\n const t = ts as Record<string, unknown>\n if (t['v'] !== 1) {\n throw new Error(`.noydb bundle header.transferSeal.v must be 1, got ${String(t['v'])}.`)\n }\n if (t['alg'] !== 'aes-256-gcm-pre-shared') {\n throw new Error(`.noydb bundle header.transferSeal.alg must be 'aes-256-gcm-pre-shared', got ${String(t['alg'])}.`)\n }\n if (typeof t['sealId'] !== 'string' || t['sealId'].length === 0) {\n throw new Error(`.noydb bundle header.transferSeal.sealId must be a non-empty string, got ${String(t['sealId'])}.`)\n }\n }\n if (h['keyId'] !== undefined) {\n if (typeof h['keyId'] !== 'string' || !/^[0-9a-f]{16}$/.test(h['keyId'])) {\n throw new Error(\n `.noydb bundle header.keyId must be a 16-character lowercase hex fingerprint, ` +\n `got ${typeof h['keyId'] === 'string' ? `\"${h['keyId']}\"` : typeof h['keyId']}.`,\n )\n }\n }\n if (h['sig'] !== undefined) {\n if (typeof h['sig'] !== 'string' || h['sig'].length === 0 || !/^[A-Za-z0-9_-]+$/.test(h['sig'])) {\n throw new Error(\n `.noydb bundle header.sig must be a non-empty base64url string, ` +\n `got ${typeof h['sig'] === 'string' ? `\"${h['sig']}\"` : typeof h['sig']}.`,\n )\n }\n }\n if (h['sigAlg'] !== undefined) {\n if (h['sigAlg'] !== 'ed25519') {\n const got = typeof h['sigAlg'] === 'string' ? `\"${h['sigAlg']}\"` : typeof h['sigAlg']\n throw new Error(`.noydb bundle header.sigAlg must be 'ed25519' when present, got ${got}.`)\n }\n }\n if (h['engineRange'] !== undefined) {\n if (typeof h['engineRange'] !== 'string' || h['engineRange'].length === 0) {\n throw new Error(\n `.noydb bundle header.engineRange must be a string when present, ` +\n `got ${typeof h['engineRange']}.`,\n )\n }\n }\n if (h['unlockMethods'] !== undefined) {\n const methods = h['unlockMethods']\n if (!Array.isArray(methods)) {\n throw new Error(\n `.noydb bundle header.unlockMethods must be an array when present, got ${typeof methods}.`,\n )\n }\n for (let i = 0; i < methods.length; i++) {\n if (!UNLOCK_METHODS.has(methods[i])) {\n throw new Error(\n `.noydb bundle header.unlockMethods[${i}] must be one of: ` +\n `${[...UNLOCK_METHODS].join(', ')}, got ${String(methods[i])}.`,\n )\n }\n }\n }\n if (h['hasApp'] !== undefined) {\n if (typeof h['hasApp'] !== 'boolean') {\n throw new Error(\n `.noydb bundle header.hasApp must be a boolean when present, got ${typeof h['hasApp']}.`,\n )\n }\n }\n if (h['species'] !== undefined) {\n if (!POD_SPECIES.has(h['species'] as string)) {\n const got = typeof h['species'] === 'string' ? `\"${h['species']}\"` : typeof h['species']\n throw new Error(\n `.noydb bundle header.species must be one of: ${[...POD_SPECIES].join(', ')}, got ${got}.`,\n )\n }\n }\n if (h['pointerMode'] !== undefined) {\n if (h['pointerMode'] !== 'public' && h['pointerMode'] !== 'private') {\n const got = typeof h['pointerMode'] === 'string' ? `\"${h['pointerMode']}\"` : typeof h['pointerMode']\n throw new Error(`.noydb bundle header.pointerMode must be 'public' or 'private' when present, got ${got}.`)\n }\n }\n if (h['redirect'] !== undefined) {\n const r = h['redirect']\n if (r === null || typeof r !== 'object' || Array.isArray(r)) {\n throw new Error(`.noydb bundle header.redirect must be a JSON object when present, got ${typeof r}.`)\n }\n const rec = r as Record<string, unknown>\n if (rec['v'] !== 1) {\n throw new Error(`.noydb bundle header.redirect.v must be 1, got ${String(rec['v'])}.`)\n }\n if (typeof rec['target'] !== 'string' || rec['target'].length === 0) {\n throw new Error(\n `.noydb bundle header.redirect.target must be a non-empty string, got ${String(rec['target'])}.`,\n )\n }\n if (!REDIRECT_REASONS.has(rec['reason'] as string)) {\n throw new Error(\n `.noydb bundle header.redirect.reason must be one of: ${[...REDIRECT_REASONS].join(', ')}, got ${String(rec['reason'])}.`,\n )\n }\n if (typeof rec['issuedBy'] !== 'string' || !/^[0-9a-f]{16}$/.test(rec['issuedBy'])) {\n throw new Error(\n `.noydb bundle header.redirect.issuedBy must be a 16-character lowercase hex fingerprint, ` +\n `got ${typeof rec['issuedBy'] === 'string' ? `\"${rec['issuedBy']}\"` : typeof rec['issuedBy']}.`,\n )\n }\n if (typeof rec['sig'] !== 'string' || rec['sig'].length === 0 || !/^[A-Za-z0-9_-]+$/.test(rec['sig'])) {\n throw new Error(\n `.noydb bundle header.redirect.sig must be a non-empty base64url string, ` +\n `got ${typeof rec['sig'] === 'string' ? `\"${rec['sig']}\"` : typeof rec['sig']}.`,\n )\n }\n }\n // Cross-field invariant: the seal indicator and the extracted-partition\n // kind imply each other. An extracted partition is unlocked via its\n // transfer seal; a seal without the kind is a malformed header.\n const isExtracted = h['bundleKind'] === 'extracted-partition'\n const hasSeal = h['transferSeal'] !== undefined\n if (hasSeal && !isExtracted) {\n throw new Error(\n `.noydb bundle header.transferSeal requires bundleKind === 'extracted-partition'.`,\n )\n }\n if (isExtracted && !hasSeal) {\n throw new Error(\n `.noydb bundle header with bundleKind === 'extracted-partition' must carry a transferSeal indicator.`,\n )\n }\n // An extracted partition's unlock path IS the transfer seal. A parallel\n // autoUnlock credential would create two unlock paths and weaken the\n // one-time-seal guarantee. Reject the combination.\n if (isExtracted && h['autoUnlock'] !== undefined) {\n throw new Error(\n `.noydb bundle header cannot carry both autoUnlock and bundleKind === 'extracted-partition' — `\n + `an extracted partition is unlocked via its transfer seal, not an auto-credential.`,\n )\n }\n // Cross-field invariant: sig/keyId/sigAlg authenticate the header as a\n // unit — a partial tuple (e.g. sig without keyId) is a malformed or\n // truncated signature, not a valid unsigned header. Signed headers also\n // require formatVersion 2 so older readers refuse them instead of\n // silently ignoring the signature.\n const sigFieldsPresent = [h['sig'], h['keyId'], h['sigAlg']].filter((v) => v !== undefined).length\n if (sigFieldsPresent > 0 && sigFieldsPresent < 3) {\n throw new Error(\n `.noydb bundle header.sig, .keyId, and .sigAlg must be present together or not at all ` +\n `(got ${sigFieldsPresent} of 3).`,\n )\n }\n if (sigFieldsPresent === 3 && h['formatVersion'] !== NOYDB_POD_FORMAT_VERSION_SIGNED) {\n throw new Error(\n `.noydb bundle header with sig/keyId/sigAlg must have formatVersion === ${NOYDB_POD_FORMAT_VERSION_SIGNED}, ` +\n `got ${String(h['formatVersion'])}.`,\n )\n }\n}\n\n/**\n * Encode a header object to UTF-8 JSON bytes after validating\n * minimum disclosure. Used by the writer to serialize the header\n * region of the container.\n */\nexport function encodePodHeader(header: NoydbPodHeader): Uint8Array {\n validatePodHeaderFields(header)\n // Stable key ordering — JSON.stringify with no replacer uses\n // insertion order, which is fine here because we control the\n // object construction. Stable ordering means two bundles with\n // identical contents produce byte-identical headers.\n const json = JSON.stringify({\n formatVersion: header.formatVersion,\n handle: header.handle,\n bodyBytes: header.bodyBytes,\n bodySha256: header.bodySha256,\n ...(header.publicEnvelope !== undefined ? { publicEnvelope: header.publicEnvelope } : {}),\n ...(header.autoUnlock !== undefined ? { autoUnlock: header.autoUnlock } : {}),\n ...(header.bundleKind !== undefined ? { bundleKind: header.bundleKind } : {}),\n ...(header.transferSeal !== undefined ? { transferSeal: header.transferSeal } : {}),\n // Encode order here is the WIRE-byte contract only — it does NOT\n // affect the signature. The signer (Task 4/5) signs the header\n // object via canonicalJson, which re-sorts keys independent of\n // this insertion order.\n ...(header.sig !== undefined ? { sig: header.sig } : {}),\n ...(header.keyId !== undefined ? { keyId: header.keyId } : {}),\n ...(header.sigAlg !== undefined ? { sigAlg: header.sigAlg } : {}),\n ...(header.engineRange !== undefined ? { engineRange: header.engineRange } : {}),\n ...(header.unlockMethods !== undefined ? { unlockMethods: header.unlockMethods } : {}),\n ...(header.hasApp !== undefined ? { hasApp: header.hasApp } : {}),\n ...(header.species !== undefined ? { species: header.species } : {}),\n ...(header.pointerMode !== undefined ? { pointerMode: header.pointerMode } : {}),\n ...(header.redirect !== undefined ? { redirect: header.redirect } : {}),\n })\n return new TextEncoder().encode(json)\n}\n\n/**\n * Parse a bundle header from its UTF-8 JSON bytes. Throws on\n * invalid JSON or any minimum-disclosure violation.\n */\nexport function decodePodHeader(bytes: Uint8Array): NoydbPodHeader {\n const json = new TextDecoder('utf-8', { fatal: true }).decode(bytes)\n let parsed: unknown\n try {\n parsed = JSON.parse(json)\n } catch (err) {\n throw new Error(\n `.noydb bundle header is not valid JSON: ${(err as Error).message}`,\n )\n }\n validatePodHeaderFields(parsed)\n return parsed\n}\n\n/**\n * Read a uint32 from `bytes` at `offset` in big-endian byte order.\n * No bounds check — callers must guarantee `offset + 4 <= bytes.length`.\n * Used to decode the header length field; kept inline so the parser\n * doesn't depend on DataView allocation per call.\n */\nexport function readUint32BE(bytes: Uint8Array, offset: number): number {\n return (\n (bytes[offset]! << 24 >>> 0) +\n (bytes[offset + 1]! << 16) +\n (bytes[offset + 2]! << 8) +\n bytes[offset + 3]!\n )\n}\n\n/**\n * Write a uint32 to `bytes` at `offset` in big-endian byte order.\n * No bounds check — callers must guarantee `offset + 4 <= bytes.length`.\n */\nexport function writeUint32BE(bytes: Uint8Array, offset: number, value: number): void {\n bytes[offset] = (value >>> 24) & 0xff\n bytes[offset + 1] = (value >>> 16) & 0xff\n bytes[offset + 2] = (value >>> 8) & 0xff\n bytes[offset + 3] = value & 0xff\n}\n\n/**\n * Verify the magic prefix of a bundle. Returns true if the first\n * 4 bytes match `NDB1`. Used by readers as a fast file-type check\n * before any further parsing.\n */\nexport function hasNoydbPodMagic(bytes: Uint8Array): boolean {\n if (bytes.length < NOYDB_POD_MAGIC.length) return false\n for (let i = 0; i < NOYDB_POD_MAGIC.length; i++) {\n if (bytes[i] !== NOYDB_POD_MAGIC[i]) return false\n }\n return true\n}\n","/**\n * The ONE signing convention for the noy-db family — pod header, the\n * Redirect record (#944), and manifest writes (#941) all sign through\n * this module rather than inventing their own scheme.\n *\n * Convention: `canonicalJson(payload minus sig)` → `utf8` → Ed25519, over\n * the published `@noy-db/attestation` primitives. The caller is\n * responsible for excluding the `sig` field from `payload` before\n * signing/verifying — this module never strips it for you, so a payload\n * that still carries a stray field (or `undefined`) fails loudly via\n * `canonicalJson` rather than silently signing the wrong bytes.\n *\n * No pod/vault imports here — this is a family-wide primitive.\n */\nimport { canonicalJson, ed25519Sign, ed25519Verify, utf8 } from '@noy-db/attestation'\n\nexport const POD_SIG_ALG = 'ed25519' as const\n\n/** The exact bytes a signature covers: utf8(canonicalJson(payload)). Exported for cross-checking. */\nexport function signedBytes(payload: Record<string, unknown>): Uint8Array {\n return utf8(canonicalJson(payload))\n}\n\n/**\n * Sign an arbitrary canonical record. `payload` MUST already exclude any\n * `sig` field.\n */\nexport async function signRecord(privateKeyPkcs8B64: string, payload: Record<string, unknown>): Promise<string> {\n return ed25519Sign(privateKeyPkcs8B64, signedBytes(payload))\n}\n\n/**\n * Verify. `payload` is the record WITHOUT `sig`. Fails closed (false) on\n * any malformed input.\n */\nexport async function verifyRecord(publicKeyB64: string, sig: string, payload: Record<string, unknown>): Promise<boolean> {\n return ed25519Verify(publicKeyB64, sig, signedBytes(payload))\n}\n","/**\n * `.noydb` container primitives — write, read, header-only read.\n *\n *. Wraps a `vault.dump()` JSON string in the\n * binary container described in `format.ts`.\n *\n * **Three primitives:**\n *\n * - `writePod(vault, opts?)` — produces the\n * full container bytes ready to write to disk or upload\n * - `readPodHeader(bytes)` — parses just the header\n * without decompressing the body, fast file-type and\n * metadata read for cloud listing UIs\n * - `readPod(bytes)` — full read: validates magic,\n * header, integrity hash, and decompresses the body to\n * return the original `dump()` JSON string for use with\n * `vault.load()`\n *\n * **Compression strategy:** brotli when available (Node 22+,\n * Chrome 124+, Firefox 122+), gzip fallback elsewhere. The\n * algorithm choice is encoded in the format byte at offset 5,\n * so readers handle either transparently. Brotli wins ~30-50%\n * on JSON payloads with repeated keys (which vault dumps\n * are).\n *\n * **Why split read/load?** `readPod` returns the\n * *unwrapped JSON string*, not a Vault object. The caller\n * is responsible for piping that JSON into\n * `vault.load(json, secret)`. Splitting the layers\n * keeps the bundle module free of any crypto/secret\n * concerns — it's purely a format layer. The same `readPod`\n * call can also feed verification tools, format inspectors, or\n * archive utilities that don't care about decryption.\n */\n\nimport {\n COMPRESSION_BROTLI,\n COMPRESSION_GZIP,\n COMPRESSION_NONE,\n FLAG_COMPRESSED,\n FLAG_HAS_INTEGRITY_HASH,\n NOYDB_POD_FORMAT_VERSION,\n NOYDB_POD_FORMAT_VERSION_SIGNED,\n NOYDB_POD_MAGIC,\n NOYDB_POD_PREFIX_BYTES,\n decodePodHeader,\n encodePodHeader,\n hasNoydbPodMagic,\n readUint32BE,\n writeUint32BE,\n type CompressionAlgo,\n type NoydbPodHeader,\n type UnlockMethod,\n} from './format.js'\nimport { signRecord, verifyRecord } from './signature.js'\nimport type { Redirect } from './redirect.js'\nimport type { DocSigner } from '../with-audit/attestation/signer.js'\nimport { sha256Hex as sha256HexBytes } from '../kernel/enclave/index.js'\nimport { PodIntegrityError, PodSealMismatchError, ValidationError } from '../kernel/errors.js'\nimport type { Vault } from '../kernel/vault.js'\nimport type { PodRecipient } from '../with-party/team/keyring.js'\nimport { pickLocale } from '../with-party/directory/cover/storage.js'\nimport type { Cover } from '../with-party/directory/cover/types.js'\nimport type { NoydbSealer, RecipientSealer, RecipientHint } from '../with-party/team/managed-secret.js'\n\n// ─── Auto-credential types ────────────────────────────────────────────────────\n\n/**\n * The credential kinds that can be bundled for auto-unlock.\n * WebAuthn is intentionally excluded — it is hardware-bound and\n * cannot be embedded as a portable credential.\n */\nexport type AutoCredentialKind = 'secret' | 'password' | 'pin'\n\n/**\n * A typed credential for auto-unlock. Carries the credential `kind`\n * alongside the plaintext `value`, so consumers can dispatch the\n * correct login/prefill path rather than treating all credentials\n * as secrets.\n *\n * `bundle.ts` is a pure format layer — it carries the credential\n * without interpreting it. The consumer is responsible for\n * dispatching on `kind`.\n */\nexport interface AutoCredential {\n readonly kind: AutoCredentialKind\n readonly value: string\n}\n\n/**\n * Options accepted by `writePod`.\n *\n * - `compression: 'auto'` (default) — try brotli, fall back to gzip\n * - `compression: 'brotli'` — force brotli, throw if unsupported\n * - `compression: 'gzip'` — force gzip\n * - `compression: 'none'` — no compression (round-trip testing only)\n *\n * **Slice filtering:**\n * - `collections` — allowlist of collection names to include. Internal\n * collections (keyrings, ledger) and excluded user collections are\n * dropped from the bundle. Records inside included collections are\n * carried through verbatim.\n * - `since` — only records whose envelope `_ts` is on/after the given\n * instant survive. Operates on the unencrypted envelope timestamp,\n * so plaintext access to records is not required.\n *\n * Both filters intersect (AND). When neither is provided the bundle is\n * a whole-vault snapshot, identical to today's behaviour.\n */\nexport interface WritePodOptions {\n readonly compression?: 'auto' | 'brotli' | 'gzip' | 'none'\n /** Allowlist of user-collection names to include. */\n readonly collections?: readonly string[]\n /**\n * Drop records whose envelope `_ts` is strictly older than this\n * instant. Accepts a `Date` or any ISO-8601 string parseable by\n * `new Date()`.\n */\n readonly since?: Date | string\n /**\n * Plaintext-pipeline record predicate. Decrypts each record\n * with the vault's per-collection DEK, runs the predicate, and\n * keeps the original ciphertext for survivors (no re-encrypt —\n * preserves zero-knowledge cleanly). Records the predicate returns\n * `false` for are dropped from the bundle.\n *\n * Async predicates are supported. Mutating the record from inside\n * the predicate is undefined behaviour.\n */\n readonly where?: (\n record: unknown,\n ctx: { collection: string; id: string },\n ) => boolean | Promise<boolean>\n /**\n * Hierarchical-tier ceiling. Records whose envelope `_tier`\n * is strictly greater than this number are dropped. Operates on the\n * envelope `_tier` (no decryption needed) — vault.exportStream is\n * referenced in the issue body for symmetry, but the tier value\n * lives on the unencrypted envelope. Vault without tiers is a no-op.\n */\n readonly tierAtMost?: number\n /**\n * Single-recipient re-keying shorthand. When set, the\n * bundle's keyring is replaced with one freshly-derived entry sealed\n * with this secret. The recipient inherits the source keyring's\n * userId, role, and permissions. Mutually exclusive with `recipients`.\n */\n readonly exportSecret?: string\n /**\n * Multi-recipient re-keying. Replaces the bundle's keyring\n * map with one slot per recipient, each sealed with its own\n * secret. DEKs are unwrapped from the source keyring once and\n * re-wrapped per recipient — record ciphertext is unchanged.\n *\n * Mutually exclusive with `exportSecret`. When neither is set,\n * the bundle inherits the source keyring as-is (today's behaviour,\n * suited to personal backup-and-restore).\n */\n readonly recipients?: readonly PodRecipient[]\n /**\n * Auto-unlock — unsealed per-user credentials.\n *\n * Generalises `autoSecrets` to support any bundleable credential\n * kind (`secret` | `password` | `pin`).\n *\n * Public-by-design: anyone holding the bundle bytes can read these\n * plaintext credentials. Use for demo data, sample vaults,\n * prospect onboarding.\n *\n * The `policy: 'public-by-design'` discriminant is mandatory. A\n * bare `{ perUser }` without it is rejected at write time — the\n * safety net against a careless call against a production vault.\n *\n * Mutually exclusive with `sealedCredentials`, `autoSecrets`,\n * and `sealedSecrets`.\n */\n readonly autoCredentials?: {\n readonly policy: 'public-by-design'\n readonly perUser: Record<string, AutoCredential>\n }\n /**\n * Auto-unlock — per-user credentials sealed under a\n * {@link NoydbSealer}.\n *\n * Generalises `sealedSecrets` to support any bundleable\n * credential kind (`secret` | `password` | `pin`).\n *\n * The hub seals each user's plaintext credential under `provider`\n * and embeds the resulting sealed envelopes in the bundle. The\n * recipient must hold a provider with a matching `pid` (i.e.,\n * `provider.id`) to auto-unseal on import.\n *\n * `mode: 'self-target'` — sender and recipient share the same\n * provider identity (same iCloud Keychain entry, same\n * MDM-provisioned bundle id, same KMS account, etc.).\n *\n * `mode: 'recipient-target'` — asymmetric sealing via a\n * {@link RecipientSealer}. Each user entry carries a\n * `credential` and a `hint` (the recipient's public material).\n * The bundle can only be unsealed by the holder of the matching\n * private key.\n *\n * Mutually exclusive with `autoCredentials`, `autoSecrets`,\n * and `sealedSecrets`.\n */\n readonly sealedCredentials?:\n | {\n readonly mode: 'self-target'\n readonly provider: NoydbSealer\n readonly perUser: Record<string, AutoCredential>\n }\n | {\n readonly mode: 'recipient-target'\n readonly provider: RecipientSealer\n readonly perUser: Record<string, { readonly credential: AutoCredential; readonly hint: RecipientHint }>\n }\n /**\n * @deprecated Use `autoCredentials` instead.\n *\n * Auto-unlock — unsealed per-user secrets.\n *\n * Public-by-design: anyone holding the bundle bytes can read these\n * plaintext credentials. Use for demo data, sample vaults,\n * prospect onboarding.\n *\n * The `policy: 'public-by-design'` discriminant is mandatory. A\n * bare `{ perUser }` without it is rejected at write time — the\n * safety net against a careless call against a production vault.\n *\n * Mutually exclusive with `autoCredentials`, `sealedCredentials`,\n * and `sealedSecrets`.\n */\n readonly autoSecrets?: {\n readonly policy: 'public-by-design'\n readonly perUser: Record<string, string>\n }\n /**\n * @deprecated Use `sealedCredentials` instead.\n *\n * Auto-unlock — per-user secrets sealed under a\n * {@link NoydbSealer} (self-target only).\n *\n * The hub seals each user's plaintext secret under `provider`\n * and embeds the resulting sealed envelopes in the bundle. The\n * recipient must hold a provider with a matching `pid` (i.e.,\n * `provider.id`) to auto-unseal on import.\n *\n * `mode: 'self-target'` is the only mode for `sealedSecrets` — sender\n * and recipient share the same provider identity (same iCloud Keychain\n * entry, same MDM-provisioned bundle id, same KMS account, etc.).\n * For recipient-target sealing via the `RecipientSealer` interface,\n * use `sealedCredentials` with `mode: 'recipient-target'` (§11.4).\n *\n * Mutually exclusive with `autoCredentials`, `sealedCredentials`,\n * and `autoSecrets`.\n */\n readonly sealedSecrets?: {\n readonly mode: 'self-target'\n readonly provider: NoydbSealer\n readonly perUser: Record<string, string>\n }\n /**\n * Pod-header signing control (#943).\n *\n * - omitted (default) — sign the header iff the source vault has a\n * persisted document signer (`vault._loadPodSigner()` returns\n * non-null). A vault that never minted a signer produces an\n * unsigned `formatVersion: 1` header, exactly as before.\n * - `false` — never sign, even if a signer is persisted.\n * - an explicit {@link DocSigner} — sign with the supplied keypair\n * without touching the vault's persisted signer (test / advanced\n * injection). Does not mint or persist anything.\n *\n * Signing NEVER mints a signer as a side effect of export: an absent\n * signer means an unsigned pod, not an on-the-fly key generation.\n */\n readonly sign?: false | DocSigner\n /**\n * Header L2 fields (#942) — pre-auth dispatch metadata written verbatim\n * into the pod header. See `NoydbPodHeader` for the disclosure rationale\n * of each. All optional; absence produces a legacy-shaped header exactly\n * as before.\n */\n readonly engineRange?: string\n readonly unlockMethods?: readonly UnlockMethod[]\n readonly hasApp?: boolean\n readonly species?: 'full' | 'connection' | 'snapshot' | 'redirect' | 'group'\n readonly pointerMode?: 'public' | 'private'\n /**\n * Signed \"this moved, go there\" pointer (#944), written verbatim into\n * the plaintext header. Pass an already-signed {@link Redirect}\n * (mint one via `signRedirect`) — `writePod` does not sign it for you.\n */\n readonly redirect?: Redirect\n}\n\n\n/**\n * Every key `writePod` reads, in declaration order (#991).\n *\n * A pod is a wire artifact, so an option this list doesn't name is refused\n * rather than ignored: a dropped write option produces a structurally valid\n * bundle that is missing something, and the defect surfaces later — in\n * whoever imports it — with nothing left to trace it back to.\n *\n * `bundle-option-keys.test.ts` parses `WritePodOptions` out of this file and\n * fails if the two ever drift, so adding an option is enough; you do not have\n * to remember to update this list, only to keep the interface shape parseable.\n *\n * @internal\n */\nexport const WRITE_POD_OPTION_KEYS = [\n 'compression',\n 'collections',\n 'since',\n 'where',\n 'tierAtMost',\n 'exportSecret',\n 'recipients',\n 'autoCredentials',\n 'sealedCredentials',\n 'autoSecrets',\n 'sealedSecrets',\n 'sign',\n 'engineRange',\n 'unlockMethods',\n 'hasApp',\n 'species',\n 'pointerMode',\n 'redirect',\n] as const satisfies readonly (keyof WritePodOptions)[]\n\n/**\n * Write options that were renamed away, mapped to what replaced them.\n *\n * These get a better message than a bare unknown key: `autoPassphrases` →\n * `autoSecrets` (§3) → `autoCredentials` (#215) is two hops, and a caller\n * arriving from `0.3.0` has no way to guess the far end.\n */\nconst RETIRED_WRITE_POD_OPTIONS: Readonly<Record<string, string>> = {\n autoPassphrases: 'autoCredentials',\n sealedPassphrases: 'sealedCredentials',\n exportPassphrase: 'exportSecret',\n}\n\n/**\n * Refuse any option key `writePod` does not read.\n *\n * Keys explicitly set to `undefined` pass — spreading a partially-built\n * options object is a normal call shape and carries no intent.\n */\nfunction assertKnownWritePodOptions(opts: WritePodOptions): void {\n const known = new Set<string>(WRITE_POD_OPTION_KEYS)\n for (const [key, value] of Object.entries(opts)) {\n if (value === undefined || known.has(key)) continue\n const replacement = RETIRED_WRITE_POD_OPTIONS[key]\n throw new Error(\n replacement !== undefined\n ? `writePod: \\`${key}\\` was renamed to \\`${replacement}\\`. `\n + 'Passing the old key would have written a pod without that '\n + 'slot — see the 0.4.0-pre migration note.'\n : `writePod: unknown option \\`${key}\\`. Options are not ignored — a `\n + 'dropped write option produces a pod that is silently missing '\n + `something. Known keys: ${WRITE_POD_OPTION_KEYS.join(', ')}.`,\n )\n }\n}\n\n/**\n * Result returned by `readPod`. The caller is expected to\n * pass `dumpJson` into `vault.load(json, secret)` to\n * actually restore a vault. Splitting the layers keeps the\n * bundle module free of crypto concerns — see file-level docs.\n */\nexport interface PodReadResult {\n readonly header: NoydbPodHeader\n readonly dumpJson: string\n /**\n * Auto-unlock material. Present only when\n * the header's `autoUnlock` flag is set AND the body's wrapped\n * structure survived parsing. Values are typed credentials — either\n * delivered plain (`kind: 'unsealed'`) or unsealed at read time\n * using one of the supplied `sealingProviders` (`kind: 'sealed'`).\n *\n * Consumers dispatch on `cred.kind` to choose the correct login /\n * prefill path. Pre-0.2 bundles (bare string entries) are coerced\n * to `{ kind: 'secret', value }` on read for back-compat.\n *\n * For `kind: 'sealed'` bundles read without `sealingProviders`, the\n * `value` field is the raw base64 sealed bytes — opaque to the\n * consumer until unsealed elsewhere.\n */\n readonly autoUnlock?: {\n readonly kind: 'unsealed' | 'sealed'\n readonly perUser: Record<string, AutoCredential>\n }\n}\n\n/**\n * Sealed credential entry as it appears in the bundle body's\n * `_autoUnlock.perUser` map when the bundle was written with\n * `sealedCredentials` (or the deprecated `sealedSecrets`).\n * Provider's sealed output is base64-encoded; the `pid` is the\n * dispatch key matched against recipient-supplied\n * `NoydbSealer.id`. The `kind` carries the plaintext-tier\n * metadata so the consumer can dispatch on credential type without\n * unsealing first.\n *\n * Back-compat: `kind` is absent in older bundles — readers must\n * default to `'secret'` when not present.\n */\ninterface SealedAutoUnlockEntry {\n readonly pid: string\n readonly sealed: string\n readonly alg: 'aes-256-gcm'\n readonly kind?: AutoCredentialKind\n /**\n * Recipient-target only: the RecipientHint the sender used to seal.\n * Carried for recipient verifiability (\"yes this was sealed against\n * my published hint\"). Self-target entries omit it. Pre-0.2 readers\n * ignore unknown fields, so this is back-compatible.\n */\n readonly hint?: RecipientHint\n}\n\n/**\n * Discriminated wrapper carried in the bundle body when the header's\n * `autoUnlock` flag is set. Without the flag, the body is the raw\n * `vault.dump()` JSON string.\n *\n * Back-compat: older bundles carry bare `string` values in the\n * unsealed `perUser` map. Readers must coerce those to\n * `{ kind: 'secret', value }`.\n */\ninterface AutoUnlockBody {\n readonly _noydb_bundle_body: 1\n readonly dump: string\n readonly _autoUnlock:\n | { readonly kind: 'unsealed'; readonly perUser: Record<string, AutoCredential | string> }\n | { readonly kind: 'sealed'; readonly perUser: Record<string, SealedAutoUnlockEntry> }\n}\n\n/**\n * Options accepted by {@link readPod} for the\n * auto-unlock paths. Without these the reader behaves exactly as before\n * (header parsed; body returned as `dumpJson`).\n */\nexport interface ReadPodOptions {\n /**\n * Recipient-side sealing providers used to unseal entries from\n * `sealedSecrets`. The reader picks the one whose `.id`\n * matches each entry's `pid`. Multiple providers may be supplied\n * (different users may seal under different identities).\n *\n * When unset and the bundle carries sealed envelopes, the\n * `autoUnlock.perUser` map remains the SEALED entries unmodified\n * — callers can inspect them or unseal elsewhere.\n */\n readonly sealingProviders?: readonly NoydbSealer[]\n /**\n * Opt-in trial mode for unsealing — when an entry's `pid` doesn't\n * match a registered provider, try each provider whose alg\n * matches. Default `false` (strict-pid dispatch per foundation\n * §11.9.2). Surfaces extra credential prompts; use deliberately.\n */\n readonly attemptUnsealAcrossProviders?: boolean\n}\n\n// ─── Auto-unlock helpers ──────────────────────────────────────────────────────\n\n/**\n * Internal normalized form of the auto-unlock options, computed once\n * from the four public-facing fields (autoCredentials, sealedCredentials,\n * autoSecrets, sealedSecrets). Callers work against this shape\n * so the build + validate paths share a single normalizer.\n */\ninterface NormalizedAutoUnlock {\n readonly mode: 'unsealed' | 'sealed-self' | 'sealed-recipient'\n readonly provider?: NoydbSealer | RecipientSealer\n readonly perUser: Record<string, AutoCredential>\n /** Present only for `sealed-recipient`. Same key set as `perUser`. */\n readonly hints?: Record<string, RecipientHint>\n}\n\n/**\n * Coerce a `Record<string, string>` (legacy secret-only map) into\n * a `Record<string, AutoCredential>` by tagging each entry as\n * `kind: 'secret'`. Used by the normalizer to promote the deprecated\n * `autoSecrets`/`sealedSecrets` sugar.\n */\nfunction toAutoCredentials(m: Record<string, string>): Record<string, AutoCredential> {\n return Object.fromEntries(\n Object.entries(m).map(([u, value]) => [u, { kind: 'secret' as const, value }]),\n )\n}\n\n/**\n * Normalize the four auto-unlock option fields into a single\n * `NormalizedAutoUnlock` (or `null` when none is set). Enforces mutual\n * exclusion — exactly one of the four may be present. Promotes the\n * deprecated sugar fields to `AutoCredential` shape.\n *\n * Does NOT validate field-level constraints (policy marker, perUser\n * length, mode, provider presence, kind allowlist) — those are checked\n * in `validateAutoUnlockOptions` after normalization.\n */\nfunction normalizeAutoUnlock(opts: WritePodOptions): NormalizedAutoUnlock | null {\n const set = [\n opts.autoCredentials,\n opts.sealedCredentials,\n opts.autoSecrets,\n opts.sealedSecrets,\n ].filter(v => v !== undefined).length\n if (set === 0) return null\n if (set > 1) {\n throw new ValidationError(\n 'writePod: only one of autoCredentials / sealedCredentials / '\n + 'autoSecrets / sealedSecrets may be set.',\n )\n }\n if (opts.autoCredentials !== undefined) {\n return { mode: 'unsealed', perUser: opts.autoCredentials.perUser }\n }\n if (opts.autoSecrets !== undefined) {\n return { mode: 'unsealed', perUser: toAutoCredentials(opts.autoSecrets.perUser) }\n }\n if (opts.sealedCredentials !== undefined) {\n if (opts.sealedCredentials.mode === 'recipient-target') {\n const perUser: Record<string, AutoCredential> = {}\n const hints: Record<string, RecipientHint> = {}\n for (const [userId, entry] of Object.entries(opts.sealedCredentials.perUser)) {\n perUser[userId] = entry.credential\n hints[userId] = entry.hint\n }\n return { mode: 'sealed-recipient', provider: opts.sealedCredentials.provider, perUser, hints }\n }\n return { mode: 'sealed-self', provider: opts.sealedCredentials.provider, perUser: opts.sealedCredentials.perUser }\n }\n // sealedSecrets — only remaining option\n return {\n mode: 'sealed-self',\n provider: opts.sealedSecrets!.provider,\n perUser: toAutoCredentials(opts.sealedSecrets!.perUser),\n }\n}\n\n/**\n * Validate the auto-unlock options and return the resulting header\n * `autoUnlock` value (or null when no auto-unlock requested).\n *\n * Takes the pre-computed `NormalizedAutoUnlock` so the caller (i.e.\n * `writePod`) can pass the same object to `buildAutoUnlockWrapper`\n * without a second `normalizeAutoUnlock` call.\n *\n * Validation per spec (§3):\n * - (mutual exclusion already enforced by normalizeAutoUnlock)\n * - unsealed path: `policy: 'public-by-design'` marker required\n * - non-empty `perUser` maps\n * - sealed path: provider present; both `mode: 'self-target'` and `mode: 'recipient-target'` accepted; recipient-target requires a `RecipientSealer` provider and per-user `hint` (§11.4)\n * - every AutoCredential.kind ∈ {secret, password, pin}\n * (WebAuthn is hardware-bound and cannot be bundled)\n *\n * Throws {@link ValidationError} on any violation.\n */\nfunction validateAutoUnlockOptions(\n opts: WritePodOptions,\n normalized: NormalizedAutoUnlock | null,\n): 'unsealed' | 'sealed' | null {\n if (normalized === null) return null\n\n const VALID_KINDS: ReadonlySet<string> = new Set(['secret', 'password', 'pin'])\n\n // Validate every credential kind before any further checks.\n for (const [userId, cred] of Object.entries(normalized.perUser)) {\n if (!VALID_KINDS.has(cred.kind)) {\n throw new ValidationError(\n `writePod: credential for user '${userId}' has unsupported kind '${cred.kind}'. `\n + 'auto-unlock supports secret/password/pin only; WebAuthn is hardware-bound '\n + 'and cannot be bundled.',\n )\n }\n }\n\n if (normalized.mode === 'unsealed') {\n // Read the policy marker from whichever active option carries it.\n const policy = opts.autoCredentials?.policy ?? opts.autoSecrets?.policy\n if (policy !== 'public-by-design') {\n throw new ValidationError(\n 'writePod: `autoCredentials` (or `autoSecrets`) requires '\n + '`policy: \"public-by-design\"`. '\n + 'This is an explicit opt-in marker — bundling plaintext credentials is '\n + 'safe only when those credentials are intended to be public (demo data, '\n + 'sample vaults). For production credentials, use `sealedCredentials` instead.',\n )\n }\n const userCount = Object.keys(normalized.perUser).length\n if (userCount === 0) {\n throw new ValidationError(\n 'writePod: `autoCredentials.perUser` (or `autoSecrets.perUser`) '\n + 'must have at least one entry.',\n )\n }\n return 'unsealed'\n }\n\n // Sealed path — branch on mode.\n if (normalized.mode === 'sealed-recipient') {\n const provider = normalized.provider\n if (provider === undefined || typeof (provider as RecipientSealer).publishRecipientHint !== 'function'\n || typeof (provider as RecipientSealer).sealForRecipient !== 'function') {\n throw new ValidationError(\n 'writePod: `sealedCredentials.provider` for mode \\'recipient-target\\' must be a '\n + 'RecipientSealer (publishRecipientHint + sealForRecipient). Self-only providers '\n + '(MemorySealer, at-macos-keychain, etc.) do not satisfy this contract.',\n )\n }\n const hints = normalized.hints\n if (hints === undefined) {\n throw new Error('unreachable — sealed-recipient normalization must populate hints')\n }\n for (const userId of Object.keys(normalized.perUser)) {\n const hint = hints[userId]\n if (hint === undefined) {\n throw new ValidationError(\n `writePod: \\`sealedCredentials.perUser['${userId}']\\` missing required \\`hint\\` for mode 'recipient-target'.`,\n )\n }\n if (hint.v !== 1) {\n throw new ValidationError(\n `writePod: \\`sealedCredentials.perUser['${userId}'].hint.v\\` must be 1 (got ${String(hint.v)}).`,\n )\n }\n if (typeof hint.pid !== 'string' || hint.pid.length === 0) {\n throw new ValidationError(\n `writePod: \\`sealedCredentials.perUser['${userId}'].hint.pid\\` must be a non-empty string identifying the recipient.`,\n )\n }\n if (hint.alg !== 'rsa-oaep-sha256') {\n throw new ValidationError(\n `writePod: \\`sealedCredentials.perUser['${userId}'].hint.alg\\` must be 'rsa-oaep-sha256' in slice 1 (got '${String(hint.alg)}').`,\n )\n }\n // Note: hint.pid identifies the recipient, not the sender — no pid===sender.id check here.\n // The sender holds a RecipientSealer that calls sealForRecipient(plaintext, hint);\n // the hint's pid is the dispatch key on the reader side (matched against recipient providers).\n }\n const userCount = Object.keys(normalized.perUser).length\n if (userCount === 0) {\n throw new ValidationError(\n 'writePod: `sealedCredentials.perUser` must have at least one entry.',\n )\n }\n return 'sealed'\n }\n\n // mode === 'sealed-self'\n const selfTargetMode = opts.sealedCredentials?.mode ?? opts.sealedSecrets?.mode\n if (selfTargetMode !== 'self-target') {\n throw new ValidationError(\n `writePod: \\`sealedCredentials.mode\\` (or \\`sealedSecrets.mode\\`) must be `\n + `'self-target' or 'recipient-target' (got '${String(selfTargetMode)}').`,\n )\n }\n if (normalized.provider === undefined) {\n throw new ValidationError(\n 'writePod: `sealedCredentials.provider` (or `sealedSecrets.provider`) '\n + 'is required (a `NoydbSealer`).',\n )\n }\n const userCount = Object.keys(normalized.perUser).length\n if (userCount === 0) {\n throw new ValidationError(\n 'writePod: `sealedCredentials.perUser` (or `sealedSecrets.perUser`) '\n + 'must have at least one entry.',\n )\n }\n return 'sealed'\n}\n\n/**\n * Build the body wrapper carrying the dump + `_autoUnlock` blob.\n * Takes the pre-computed `NormalizedAutoUnlock` so both validate and\n * build work off the same normalized form (no double-normalize).\n */\nasync function buildAutoUnlockWrapper(\n dumpJson: string,\n normalized: NormalizedAutoUnlock,\n): Promise<AutoUnlockBody> {\n if (normalized.mode === 'unsealed') {\n return {\n _noydb_bundle_body: 1,\n dump: dumpJson,\n _autoUnlock: {\n kind: 'unsealed',\n perUser: { ...normalized.perUser },\n },\n }\n }\n // Sealed path — branch on mode.\n const provider = normalized.provider\n if (provider === undefined) {\n throw new Error('unreachable — validation should have caught this')\n }\n const sealedPerUser: Record<string, SealedAutoUnlockEntry> = {}\n const encoder = new TextEncoder()\n\n if (normalized.mode === 'sealed-recipient') {\n const recipientSealer = provider as RecipientSealer\n const hints = normalized.hints\n if (hints === undefined) {\n throw new Error('unreachable — sealed-recipient normalization must populate hints')\n }\n for (const [userId, cred] of Object.entries(normalized.perUser)) {\n const hint = hints[userId]!\n const sealed = await recipientSealer.sealForRecipient(encoder.encode(cred.value), hint)\n sealedPerUser[userId] = {\n pid: hint.pid, // use the recipient's pid, not the sender's\n sealed: bytesToBase64(sealed),\n alg: 'aes-256-gcm',\n kind: cred.kind,\n hint,\n }\n }\n } else {\n // mode === 'sealed-self'\n const selfSealer = provider as NoydbSealer\n for (const [userId, cred] of Object.entries(normalized.perUser)) {\n const sealed = await selfSealer.seal(encoder.encode(cred.value))\n sealedPerUser[userId] = {\n pid: selfSealer.id,\n sealed: bytesToBase64(sealed),\n alg: 'aes-256-gcm',\n kind: cred.kind,\n }\n }\n }\n\n return {\n _noydb_bundle_body: 1,\n dump: dumpJson,\n _autoUnlock: { kind: 'sealed', perUser: sealedPerUser },\n }\n}\n\n/**\n * Parse the body bytes when the header signaled an auto-unlock.\n * Returns the inner `dump` JSON string + the `_autoUnlock` blob;\n * throws if the wrapper structure is malformed.\n */\nfunction parseAutoUnlockBody(bodyString: string): { dump: string; blob: AutoUnlockBody['_autoUnlock'] } {\n let parsed: unknown\n try {\n parsed = JSON.parse(bodyString)\n } catch (err) {\n throw new PodIntegrityError(\n 'header declared autoUnlock but body could not be parsed as JSON wrapper: '\n + (err instanceof Error ? err.message : String(err)),\n )\n }\n if (typeof parsed !== 'object' || parsed === null) {\n throw new PodIntegrityError('autoUnlock body is not a JSON object')\n }\n const obj = parsed as Record<string, unknown>\n if (obj['_noydb_bundle_body'] !== 1) {\n throw new PodIntegrityError(\n 'autoUnlock body missing `_noydb_bundle_body: 1` discriminator',\n )\n }\n if (typeof obj['dump'] !== 'string') {\n throw new PodIntegrityError('autoUnlock body must carry a string `dump` field')\n }\n const blob = obj['_autoUnlock']\n if (typeof blob !== 'object' || blob === null) {\n throw new PodIntegrityError('autoUnlock body missing `_autoUnlock` blob')\n }\n const blobObj = blob as Record<string, unknown>\n const kind = blobObj['kind']\n if (kind !== 'unsealed' && kind !== 'sealed') {\n throw new PodIntegrityError(\n `autoUnlock blob has invalid kind ${String(kind)}; expected 'unsealed' or 'sealed'`,\n )\n }\n return {\n dump: obj['dump'],\n blob: blob as AutoUnlockBody['_autoUnlock'],\n }\n}\n\n/**\n * Transfer-seal payload. The destination DEKs, exported to raw\n * bytes and AES-256-GCM-sealed *as a set* under the one-time transfer\n * key. `adoptPartition` unseals this; `createOwnerOnAdoptedPartition`\n * re-wraps the raw DEKs under the recipient's KEK.\n */\nexport interface TransferSealPayload {\n readonly v: 1\n readonly alg: 'aes-256-gcm-pre-shared'\n readonly sealId: string\n /** base64(AES-256-GCM(transferKey, JSON of { collection: base64(rawDEK) })) — iv ‖ ct ‖ tag. */\n readonly payload: string\n}\n\n/**\n * Body wrapper for an extracted, transfer-sealed partition.\n * Sibling to {@link AutoUnlockBody}; selected by `header.bundleKind ===\n * 'extracted-partition'`. The inner `dump` is a re-keyed projection with\n * an empty `keyrings` map.\n */\nexport interface ExtractedPartitionBody {\n readonly _noydb_bundle_body: 1\n readonly dump: string\n readonly _transferSeal: TransferSealPayload\n}\n\nexport function buildExtractedPartitionWrapper(\n dumpJson: string,\n seal: TransferSealPayload,\n): ExtractedPartitionBody {\n return { _noydb_bundle_body: 1, dump: dumpJson, _transferSeal: seal }\n}\n\nexport function parseExtractedPartitionBody(\n bodyString: string,\n): { dump: string; seal: TransferSealPayload } {\n let parsed: unknown\n try {\n parsed = JSON.parse(bodyString)\n } catch (err) {\n throw new PodIntegrityError(\n 'header declared extracted-partition but body could not be parsed as JSON wrapper: '\n + (err instanceof Error ? err.message : String(err)),\n )\n }\n if (typeof parsed !== 'object' || parsed === null) {\n throw new PodIntegrityError('extracted-partition body is not a JSON object')\n }\n const obj = parsed as Record<string, unknown>\n if (obj['_noydb_bundle_body'] !== 1) {\n throw new PodIntegrityError(\n 'extracted-partition body missing `_noydb_bundle_body: 1` discriminator',\n )\n }\n if (typeof obj['dump'] !== 'string') {\n throw new PodIntegrityError('extracted-partition body must carry a string `dump` field')\n }\n const seal = obj['_transferSeal']\n if (typeof seal !== 'object' || seal === null) {\n throw new PodIntegrityError('extracted-partition body missing `_transferSeal` blob')\n }\n const s = seal as Record<string, unknown>\n if (s['v'] !== 1 || s['alg'] !== 'aes-256-gcm-pre-shared'\n || typeof s['sealId'] !== 'string' || typeof s['payload'] !== 'string') {\n throw new PodIntegrityError('extracted-partition `_transferSeal` blob is malformed')\n }\n return { dump: obj['dump'], seal: seal as TransferSealPayload }\n}\n\n/**\n * Coerce an unsealed perUser entry to `AutoCredential`. Older bundles\n * store bare strings; newer bundles store `{ kind, value }` objects.\n */\nfunction coerceUnsealed(entry: AutoCredential | string): AutoCredential {\n if (typeof entry === 'string') return { kind: 'secret', value: entry }\n return entry\n}\n\n/**\n * Resolve the `_autoUnlock` blob into a typed per-user credential map.\n *\n * - For `kind: 'unsealed'`: pass through, coercing pre-0.2 bare strings\n * to `{ kind: 'secret', value }`.\n * - For `kind: 'sealed'`: pick a `NoydbSealer` from\n * `opts.sealingProviders` whose `.id` matches each entry's `pid`;\n * unseal to `AutoCredential`. When no provider matches AND strict mode\n * (default), throw `PodSealMismatchError`. With\n * `attemptUnsealAcrossProviders: true`, try each provider whose\n * `alg` matches the envelope.\n * Exception: if an unmatched entry carries a `hint` field (recipient-target\n * entries), it passes through as `{ kind, value: base64sealed }` rather than\n * throwing — multi-recipient bundles have N-1 unmatched entries from each\n * recipient's perspective, and the consumer is expected to ignore entries\n * not addressed to them.\n * - When `sealingProviders` is unset entirely on a `'sealed'` bundle,\n * pass through the SEALED entries as `{ kind, value: base64sealed }` —\n * the caller can inspect or unseal elsewhere.\n *\n * Pre-0.2 sealed entries missing `kind` default to `'secret'`.\n */\nasync function resolveAutoUnlock(\n blob: AutoUnlockBody['_autoUnlock'],\n opts: ReadPodOptions,\n): Promise<{ kind: 'unsealed' | 'sealed'; perUser: Record<string, AutoCredential> }> {\n if (blob.kind === 'unsealed') {\n const resolved: Record<string, AutoCredential> = {}\n for (const [userId, entry] of Object.entries(blob.perUser)) {\n resolved[userId] = coerceUnsealed(entry)\n }\n return { kind: 'unsealed', perUser: resolved }\n }\n // Sealed path.\n if (opts.sealingProviders === undefined || opts.sealingProviders.length === 0) {\n // Inspection mode — pass the sealed payload through as a typed\n // credential whose `value` is the opaque base64 sealed bytes.\n // The caller is signalled by `kind: 'sealed'` on the outer result.\n const passthrough: Record<string, AutoCredential> = {}\n for (const [userId, entry] of Object.entries(blob.perUser)) {\n passthrough[userId] = { kind: entry.kind ?? 'secret', value: entry.sealed }\n }\n return { kind: 'sealed', perUser: passthrough }\n }\n const providersByPid = new Map<string, NoydbSealer>()\n for (const p of opts.sealingProviders) providersByPid.set(p.id, p)\n\n const decoder = new TextDecoder()\n const unsealedMap: Record<string, AutoCredential> = {}\n\n for (const [userId, entry] of Object.entries(blob.perUser)) {\n const credKind: AutoCredentialKind = entry.kind ?? 'secret'\n const provider = providersByPid.get(entry.pid)\n if (provider === undefined) {\n if (opts.attemptUnsealAcrossProviders === true) {\n // Try each provider; first that succeeds wins.\n let opened: string | null = null\n for (const candidate of opts.sealingProviders) {\n try {\n const plaintextBytes = await candidate.unseal(base64ToBytes(entry.sealed))\n opened = decoder.decode(plaintextBytes)\n break\n } catch {\n // try next\n }\n }\n if (opened === null) {\n if (entry.hint !== undefined) {\n // Recipient-target entry not addressed to any held key — pass through sealed.\n // Other recipients' entries in a multi-recipient bundle are opaque to us.\n unsealedMap[userId] = { kind: credKind, value: entry.sealed }\n continue\n }\n throw new PodSealMismatchError(userId, entry.pid)\n }\n unsealedMap[userId] = { kind: credKind, value: opened }\n continue\n }\n if (entry.hint !== undefined) {\n // Recipient-target entry not addressed to any held key — pass through sealed.\n // Multi-recipient bundles deliberately seal each user's entry under their own\n // public key; a reader holding only alice's key will not match bob's pid.\n unsealedMap[userId] = { kind: credKind, value: entry.sealed }\n continue\n }\n throw new PodSealMismatchError(userId, entry.pid)\n }\n const plaintextBytes = await provider.unseal(base64ToBytes(entry.sealed))\n unsealedMap[userId] = { kind: credKind, value: decoder.decode(plaintextBytes) }\n }\n return { kind: 'sealed', perUser: unsealedMap }\n}\n\nfunction bytesToBase64(bytes: Uint8Array): string {\n let binary = ''\n for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]!)\n return btoa(binary)\n}\n\nfunction base64ToBytes(b64: string): Uint8Array {\n const binary = atob(b64)\n const out = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i)\n return out\n}\n\n/**\n * Detect whether the runtime's `CompressionStream` supports brotli.\n *\n * Brotli requires Node 22+ / Chrome 124+ / Firefox 122+. The\n * detection runs the `CompressionStream` constructor in a\n * try/catch — unsupported formats throw `TypeError` synchronously,\n * making this a safe one-shot check that we cache for the\n * lifetime of the process.\n */\nlet cachedBrotliSupport: boolean | null = null\nfunction supportsBrotliCompression(): boolean {\n if (cachedBrotliSupport !== null) return cachedBrotliSupport\n try {\n new CompressionStream('br' as CompressionFormat)\n cachedBrotliSupport = true\n } catch {\n cachedBrotliSupport = false\n }\n return cachedBrotliSupport\n}\n\n/** Test-only: reset the brotli detection cache between tests. */\nexport function resetBrotliSupportCache(): void {\n cachedBrotliSupport = null\n}\n\n/**\n * Pick the compression algorithm and the corresponding format byte\n * from a user option. Throws if the user explicitly requests brotli\n * on a runtime that doesn't support it — a silent fallback would\n * make the produced bundle smaller-than-expected and confuse\n * size-bound tests.\n */\nfunction selectCompression(option: WritePodOptions['compression']): {\n format: CompressionAlgo\n streamFormat: CompressionFormat | null\n} {\n const choice = option ?? 'auto'\n if (choice === 'none') return { format: COMPRESSION_NONE, streamFormat: null }\n if (choice === 'gzip') return { format: COMPRESSION_GZIP, streamFormat: 'gzip' }\n if (choice === 'brotli') {\n if (!supportsBrotliCompression()) {\n throw new Error(\n `writePod({ compression: 'brotli' }) is not supported on this ` +\n `runtime. Brotli requires Node 22+, Chrome 124+, or Firefox 122+. ` +\n `Use { compression: 'auto' } to fall back to gzip silently, or ` +\n `{ compression: 'gzip' } to be explicit.`,\n )\n }\n return { format: COMPRESSION_BROTLI, streamFormat: 'br' as CompressionFormat }\n }\n // 'auto' — prefer brotli, fall back to gzip\n if (supportsBrotliCompression()) {\n return { format: COMPRESSION_BROTLI, streamFormat: 'br' as CompressionFormat }\n }\n return { format: COMPRESSION_GZIP, streamFormat: 'gzip' }\n}\n\n/**\n * Pump a Uint8Array through a CompressionStream / DecompressionStream\n * and collect the output. Both APIs are universally available in\n * Node 18+ and modern browsers; the only variance is which\n * formats they support, handled by `selectCompression` above.\n *\n * Implementation: build a single-chunk ReadableStream from the\n * input, pipe through the transform, then drain the resulting\n * ReadableStream into a single concatenated Uint8Array. This is\n * O(N) memory in the input + output sizes, which is fine for the\n * dump-sized payloads (typically <50MB) targets.\n */\nasync function pumpThroughStream(\n input: Uint8Array,\n stream: CompressionStream | DecompressionStream,\n): Promise<Uint8Array> {\n const readable = new Blob([input as BlobPart]).stream().pipeThrough(stream)\n const reader = readable.getReader()\n const chunks: Uint8Array[] = []\n let total = 0\n for (;;) {\n const { value, done } = await reader.read()\n if (done) break\n if (value) {\n chunks.push(value as Uint8Array)\n total += value.length\n }\n }\n const out = new Uint8Array(total)\n let offset = 0\n for (const chunk of chunks) {\n out.set(chunk, offset)\n offset += chunk.length\n }\n return out\n}\n\n/**\n * SHA-256 hex digest of `bytes`. Used for the bundle integrity\n * hash carried in the header. Web Crypto API only — no Node\n * crypto module, no third-party hash library.\n *\n * The output format is lowercase hex (64 chars for SHA-256). The\n * format validator pins this — uppercase or mixed-case digests\n * are rejected, so the writer and reader agree on canonicalization.\n */\nasync function sha256Hex(bytes: Uint8Array): Promise<string> {\n // Copy into a fresh ArrayBuffer-backed Uint8Array. The\n // underlying buffer of `bytes` may be SharedArrayBuffer (e.g.\n // from a worker), which `subtle.digest` rejects via TypeScript's\n // BufferSource type. Allocating a fresh ArrayBuffer-backed view\n // sidesteps the type narrowing and is portable across all\n // runtimes — the copy cost is O(N) but bundle bodies are\n // typically <50MB, well below the threshold where the copy\n // matters.\n const copy = new Uint8Array(bytes.length)\n copy.set(bytes)\n return sha256HexBytes(copy)\n}\n\n/**\n * Concatenate any number of Uint8Arrays into a single new buffer.\n * Used to assemble the final bundle from its prefix + header +\n * body parts.\n */\nfunction concatBytes(parts: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const p of parts) total += p.length\n const out = new Uint8Array(total)\n let offset = 0\n for (const p of parts) {\n out.set(p, offset)\n offset += p.length\n }\n return out\n}\n\n/**\n * Replace the bundle's keyrings with freshly built recipient slots,\n * one per supplied recipient. No-op when neither `exportSecret`\n * nor `recipients` is set — the source keyring is inherited as-is.\n *\n * The single-secret shorthand creates a one-recipient list whose\n * id, role, and permissions inherit from the source vault — useful\n * for \"back up to a different secret\" without changing role\n * semantics. The multi-recipient form wraps each slot independently\n * with its declared role + permissions.\n *\n * @internal\n */\nasync function applyRecipientRewrap(\n vault: Vault,\n dumpJson: string,\n opts: WritePodOptions,\n): Promise<string> {\n if (opts.exportSecret === undefined && opts.recipients === undefined) {\n return dumpJson\n }\n\n const recipients: readonly PodRecipient[] =\n opts.recipients ?? [\n {\n id: vault.userId,\n secret: opts.exportSecret as string,\n role: vault.role,\n },\n ]\n\n const recipientKeyrings = await vault.buildBundleRecipientKeyrings(recipients)\n\n const backup = JSON.parse(dumpJson) as { keyrings: unknown; [k: string]: unknown }\n backup.keyrings = recipientKeyrings\n return JSON.stringify(backup)\n}\n\n/**\n * Apply opt-in slice filters to a vault dump JSON string. Filters that\n * narrow the bundle without crossing the encryption boundary — both\n * operate on metadata (collection name, envelope `_ts`) and never need\n * to decrypt records. When neither filter is set, the dump is returned\n * unchanged so the no-arg path stays a pure passthrough.\n *\n * Internal-collection filtering: when a `collections` allowlist is\n * provided, the bundle still carries `_internal` (ledger entries) and\n * the keyrings — they're necessary for the receiver to verify and\n * unlock the bundle. The allowlist applies to the user-collection\n * map only.\n *\n * @internal\n */\nfunction applySliceFilters(\n dumpJson: string,\n opts: WritePodOptions,\n): string {\n const collectionsFilter = opts.collections\n ? new Set(opts.collections)\n : null\n const sinceMs =\n opts.since !== undefined ? new Date(opts.since).getTime() : null\n if (collectionsFilter === null && sinceMs === null) return dumpJson\n\n // Parse, prune, re-serialize. The dump shape is stable\n // (VaultBackup) so this is a one-off allocation; for vaults beyond\n // the documented 1K–50K target a streaming variant would be a\n // follow-up, but the simple parse path keeps the slice path\n // type-safe and trivially auditable.\n const backup = JSON.parse(dumpJson) as {\n collections?: Record<string, Record<string, { _ts?: string }>>\n [k: string]: unknown\n }\n\n if (backup.collections && typeof backup.collections === 'object') {\n const next: Record<string, Record<string, unknown>> = {}\n for (const [name, records] of Object.entries(backup.collections)) {\n if (collectionsFilter && !collectionsFilter.has(name)) continue\n if (sinceMs === null) {\n next[name] = records\n continue\n }\n const kept: Record<string, unknown> = {}\n for (const [id, env] of Object.entries(records)) {\n const envTs = env._ts ? new Date(env._ts).getTime() : NaN\n if (Number.isFinite(envTs) && envTs >= sinceMs) {\n kept[id] = env\n }\n }\n next[name] = kept\n }\n backup.collections = next as typeof backup.collections\n }\n\n return JSON.stringify(backup)\n}\n\n/**\n * Unconditionally drop satellite-collection records whose base row is dead\n * (absent or tombstoned — existence.ts rule 1) from a vault dump. Unlike\n * `applySliceFilters` / `applyPlaintextFilters`, this isn't opt-in: a\n * satellite envelope that outlived its base is dead ciphertext (plus its\n * wrapped keys) that should never leave the vault in a `.noydb` backup\n * (#591 Task 10 — closes the last enumerated existence-authority surface).\n *\n * Pairing info comes from the persisted `_schemas/<name>` marker rather\n * than the in-memory `SatelliteRegistry` — that registry is private to\n * `Vault` and the bundle-export path only has `Vault._introspectState()`\n * (adapter + vault name + per-collection DEK accessor), so it reads the\n * marker instead of widening the kernel's surface. See\n * `with-shape/satellites/dead-filter.ts`.\n *\n * No-ops (returns `dumpJson` unchanged) when the vault has no detectable\n * satellite collections at all, so vaults that never use satellites pay\n * no extra parse/reserialize cost. Also no-ops when `vault` doesn't\n * implement `_introspectState()` at all — some call sites pass a minimal\n * duck-typed vault-like object for unit tests (e.g.\n * `snapshots.test.ts`'s `makeMockVault`, which implements only\n * `getPodHandle`/`dump`/`load`/`getCover`); a real `Vault`\n * always implements it.\n *\n * @internal\n */\nasync function applySatelliteLivenessFilter(\n vault: Vault,\n dumpJson: string,\n): Promise<string> {\n const backup = JSON.parse(dumpJson) as {\n collections?: Record<string, Record<string, unknown>>\n [k: string]: unknown\n }\n if (!backup.collections || typeof backup.collections !== 'object') return dumpJson\n if (typeof vault._introspectState !== 'function') return dumpJson\n\n const { adapter, name, getDEK } = vault._introspectState()\n const { liveBaseIdSetsForBundle } = await import('../with-shape/satellites/dead-filter.js')\n const satLive = await liveBaseIdSetsForBundle(adapter, name, Object.keys(backup.collections), getDEK)\n if (satLive.size === 0) return dumpJson\n\n const next: Record<string, Record<string, unknown>> = {}\n for (const [collName, records] of Object.entries(backup.collections)) {\n const live = satLive.get(collName)\n if (!live) { next[collName] = records; continue }\n const kept: Record<string, unknown> = {}\n for (const [id, env] of Object.entries(records)) {\n if (live.has(id)) kept[id] = env\n }\n next[collName] = kept\n }\n backup.collections = next\n return JSON.stringify(backup)\n}\n\n/**\n * Apply opt-in plaintext-tier filters\n * to a vault dump. Operates BEFORE `applySliceFilters` so the metadata\n * pass sees the trimmed record set.\n *\n * The filter never re-encrypts: surviving records carry their original\n * envelope unchanged. Failing records are dropped from the\n * `collections` map. Internal collections (ledger, deltas) and the\n * keyrings map are untouched.\n *\n * @internal\n */\nasync function applyPlaintextFilters(\n vault: Vault,\n dumpJson: string,\n opts: WritePodOptions,\n): Promise<string> {\n if (opts.where === undefined && opts.tierAtMost === undefined) {\n return dumpJson\n }\n\n type Env = { _ts?: string; _tier?: number; _iv: string; _data: string }\n const backup = JSON.parse(dumpJson) as {\n collections?: Record<string, Record<string, Env>>\n [k: string]: unknown\n }\n if (!backup.collections || typeof backup.collections !== 'object') {\n return dumpJson\n }\n\n const tierCeiling = opts.tierAtMost\n const where = opts.where\n\n const next: Record<string, Record<string, Env>> = {}\n for (const [collName, records] of Object.entries(backup.collections)) {\n const kept: Record<string, Env> = {}\n for (const [id, env] of Object.entries(records)) {\n // Tier ceiling — runs FIRST so we don't waste a decrypt on\n // records about to be dropped anyway. Envelope tier defaults to\n // 0 when absent (matches Vault's tier-0 conventions).\n if (tierCeiling !== undefined) {\n const tier = env._tier ?? 0\n if (tier > tierCeiling) continue\n }\n // Plaintext predicate — decrypt, run, keep on truthy. Errors\n // from inside the predicate propagate (callers want to see why\n // their filter blew up rather than getting a silent passthrough).\n if (where !== undefined) {\n const record = await vault._decryptEnvelopeForBundleFilter(\n env as never,\n collName,\n id,\n )\n const ok = await where(record, { collection: collName, id })\n if (!ok) continue\n }\n kept[id] = env\n }\n next[collName] = kept\n }\n backup.collections = next\n return JSON.stringify(backup)\n}\n\n/**\n * Write a `.noydb` bundle for the given vault.\n *\n * Pipeline:\n * 1. Resolve or create the compartment's stable bundle handle\n * via `vault.getPodHandle()` — same handle on\n * every export from the same vault instance, so cloud\n * adapters can use it as a primary key.\n * 2. `vault.dump()` → JSON string with encrypted records\n * inside.\n * 3. UTF-8 encode the dump string.\n * 4. Compress (brotli if available, gzip fallback by default).\n * 5. Compute SHA-256 of the compressed body for integrity.\n * 6. Build the minimum-disclosure header from format version,\n * handle, body length, body sha.\n * 7. Serialize: magic (4) + flags (1) + algo (1) + headerLen (4)\n * + header JSON (N) + compressed body (M).\n *\n * The output is a single `Uint8Array`. Consumers writing to disk\n * pass it to `fs.writeFile`; consumers uploading to cloud storage\n * pass it as the request body. The `@noy-db/file` adapter wraps\n * this with a `saveBundle(path, vault)` helper.\n */\n/**\n * Assemble the final `.noydb` container bytes from a body JSON string +\n * header extras. Shared by `writePod` and `extractPartition`\n * so both producers go through one compress/hash/prefix path.\n *\n * @internal\n */\nexport async function assemblePodContainer(opts: {\n handle: string\n bodyJsonStr: string\n compression: WritePodOptions['compression']\n /** Header fields beyond the always-present four. */\n headerExtras?: Partial<Pick<NoydbPodHeader,\n | 'publicEnvelope' | 'autoUnlock' | 'bundleKind' | 'transferSeal'\n | 'engineRange' | 'unlockMethods' | 'hasApp' | 'species' | 'pointerMode' | 'redirect'\n >>\n /**\n * When present, the assembled header is signed (#943): the header is\n * bumped to `formatVersion: 2` and carries the sig/keyId/sigAlg tuple.\n * Absent → an unsigned `formatVersion: 1` header (partitions, and pods\n * from vaults without a signer, stay unsigned).\n */\n signer?: DocSigner\n}): Promise<Uint8Array> {\n const dumpBytes = new TextEncoder().encode(opts.bodyJsonStr)\n const { format, streamFormat } = selectCompression(opts.compression)\n const body = streamFormat === null\n ? dumpBytes\n : await pumpThroughStream(dumpBytes, new CompressionStream(streamFormat))\n const bodySha256 = await sha256Hex(body)\n\n const header: NoydbPodHeader = {\n formatVersion: NOYDB_POD_FORMAT_VERSION,\n handle: opts.handle,\n bodyBytes: body.length,\n bodySha256,\n ...(opts.headerExtras?.publicEnvelope !== undefined ? { publicEnvelope: opts.headerExtras.publicEnvelope } : {}),\n ...(opts.headerExtras?.autoUnlock !== undefined ? { autoUnlock: opts.headerExtras.autoUnlock } : {}),\n ...(opts.headerExtras?.bundleKind !== undefined ? { bundleKind: opts.headerExtras.bundleKind } : {}),\n ...(opts.headerExtras?.transferSeal !== undefined ? { transferSeal: opts.headerExtras.transferSeal } : {}),\n ...(opts.headerExtras?.engineRange !== undefined ? { engineRange: opts.headerExtras.engineRange } : {}),\n ...(opts.headerExtras?.unlockMethods !== undefined ? { unlockMethods: opts.headerExtras.unlockMethods } : {}),\n ...(opts.headerExtras?.hasApp !== undefined ? { hasApp: opts.headerExtras.hasApp } : {}),\n ...(opts.headerExtras?.species !== undefined ? { species: opts.headerExtras.species } : {}),\n ...(opts.headerExtras?.pointerMode !== undefined ? { pointerMode: opts.headerExtras.pointerMode } : {}),\n ...(opts.headerExtras?.redirect !== undefined ? { redirect: opts.headerExtras.redirect } : {}),\n }\n // Header signing (#943): sign the header object as it will stand at\n // formatVersion 2 WITH keyId + sigAlg but WITHOUT `sig`, then attach the\n // resulting 3-tuple + bump the version. `signRecord`/`canonicalJson`\n // throw on any `undefined`, so the signed payload is built with only the\n // fields actually present (spread of the header carries no undefined\n // keys). Only produce formatVersion 2 WHEN signing — an unsigned pod\n // stays formatVersion 1 with no sig fields.\n const signed: NoydbPodHeader = opts.signer === undefined\n ? header\n : await (async (s: DocSigner): Promise<NoydbPodHeader> => {\n const toSign = { ...header, formatVersion: NOYDB_POD_FORMAT_VERSION_SIGNED, keyId: s.keyId, sigAlg: 'ed25519' as const }\n const sig = await signRecord(s.privateKeyPkcs8B64, toSign)\n return { ...toSign, sig }\n })(opts.signer)\n const headerBytes = encodePodHeader(signed)\n\n const prefix = new Uint8Array(NOYDB_POD_PREFIX_BYTES)\n prefix.set(NOYDB_POD_MAGIC, 0)\n prefix[4] = (streamFormat === null ? 0 : FLAG_COMPRESSED) | FLAG_HAS_INTEGRITY_HASH\n prefix[5] = format\n writeUint32BE(prefix, 6, headerBytes.length)\n\n return concatBytes([prefix, headerBytes, body])\n}\n\nexport async function writePod(\n vault: Vault,\n opts: WritePodOptions = {},\n): Promise<Uint8Array> {\n assertKnownWritePodOptions(opts)\n if (opts.exportSecret !== undefined && opts.recipients !== undefined) {\n throw new Error(\n 'writePod: pass either exportSecret or recipients, not both',\n )\n }\n\n // Auto-unlock: normalize once, validate + build from the\n // same NormalizedAutoUnlock object so there's no double-normalize call.\n const normalizedAutoUnlock = normalizeAutoUnlock(opts)\n const autoUnlockMode = validateAutoUnlockOptions(opts, normalizedAutoUnlock)\n\n const handle = await vault.getPodHandle()\n const dumpJson = await vault.dump()\n\n // Satellite existence-authority filter (#591 Task 10) — unconditional,\n // runs before every other filter so dead-ciphertext satellite records\n // never reach recipient rewrap or the opt-in filters below.\n const satelliteFiltered = await applySatelliteLivenessFilter(vault, dumpJson)\n\n // Re-keying: when caller supplied recipients (or the single-recipient\n // shorthand), substitute the bundle's `keyrings` map with freshly\n // built recipient slots before slice filters run.\n const rekeyed = await applyRecipientRewrap(vault, satelliteFiltered, opts)\n // Plaintext-tier filters run BEFORE\n // the metadata-only slice — that way the metadata pass sees the\n // already-trimmed record set and the two filter chains compose\n // cleanly.\n const plainFiltered = await applyPlaintextFilters(vault, rekeyed, opts)\n const filtered = applySliceFilters(plainFiltered, opts)\n\n // If no auto-unlock requested, body remains the raw dump JSON.\n // Otherwise build the wrapped body containing the\n // dump + `_autoUnlock` blob and serialize.\n const bodyJsonStr = normalizedAutoUnlock === null\n ? filtered\n : JSON.stringify(await buildAutoUnlockWrapper(filtered, normalizedAutoUnlock))\n // Snapshot the source vault's cover into the header when one is\n // persisted. `Vault.getCover` tolerates a missing document and\n // returns undefined, which we propagate as \"no cover in the\n // header.\" Vaults without a `_meta/public-envelope` document\n // (the frozen wire name) produce minimum-disclosure headers\n // exactly like before, preserving back-compat.\n const cover = await vault.getCover()\n\n // Resolve the header signer (#943): explicit `false` disables signing;\n // an explicit DocSigner is used verbatim (no vault touch); otherwise fall\n // back to the vault's persisted signer, which is `null` (unsigned) when\n // none was ever minted — export never mints one.\n const signer = opts.sign === false\n ? undefined\n : opts.sign !== undefined\n ? opts.sign\n : (await vault._loadPodSigner()) ?? undefined\n\n return assemblePodContainer({\n handle,\n bodyJsonStr,\n compression: opts.compression,\n headerExtras: {\n // `publicEnvelope` is the frozen wire key for the cover (#799).\n ...(cover !== undefined ? { publicEnvelope: cover } : {}),\n ...(autoUnlockMode !== null ? { autoUnlock: autoUnlockMode } : {}),\n // Header L2 fields (#942) — passed through verbatim from opts.\n ...(opts.engineRange !== undefined ? { engineRange: opts.engineRange } : {}),\n ...(opts.unlockMethods !== undefined ? { unlockMethods: opts.unlockMethods } : {}),\n ...(opts.hasApp !== undefined ? { hasApp: opts.hasApp } : {}),\n ...(opts.species !== undefined ? { species: opts.species } : {}),\n ...(opts.pointerMode !== undefined ? { pointerMode: opts.pointerMode } : {}),\n ...(opts.redirect !== undefined ? { redirect: opts.redirect } : {}),\n },\n ...(signer !== undefined ? { signer } : {}),\n })\n}\n\n\n/**\n * Internal helper shared by both readers — parses just the prefix\n * + header region of a bundle without touching the body. Returns\n * the parsed header plus the offset where the body starts and the\n * compression algorithm needed to decompress it.\n *\n * Throws on any format violation: missing/invalid magic, truncated\n * prefix, header length larger than the file, or unknown\n * compression algorithm.\n */\nfunction parsePrefixAndHeader(bytes: Uint8Array): {\n header: NoydbPodHeader\n bodyOffset: number\n algo: CompressionAlgo\n flags: number\n} {\n if (!hasNoydbPodMagic(bytes)) {\n throw new Error(\n `Not a .noydb bundle: missing 'NDB1' magic prefix. The first 4 bytes ` +\n `are ${[...bytes.slice(0, 4)].map((b) => b.toString(16).padStart(2, '0')).join(' ')}.`,\n )\n }\n if (bytes.length < NOYDB_POD_PREFIX_BYTES) {\n throw new Error(\n `Truncated .noydb bundle: file is only ${bytes.length} bytes, ` +\n `which is less than the ${NOYDB_POD_PREFIX_BYTES}-byte fixed prefix.`,\n )\n }\n const flags = bytes[4]!\n const algo = bytes[5]!\n if (algo !== COMPRESSION_NONE && algo !== COMPRESSION_GZIP && algo !== COMPRESSION_BROTLI) {\n throw new Error(\n `.noydb bundle declares unknown compression algorithm ${algo}. ` +\n `Known values: 0 (none), 1 (gzip), 2 (brotli).`,\n )\n }\n const headerLength = readUint32BE(bytes, 6)\n const bodyOffset = NOYDB_POD_PREFIX_BYTES + headerLength\n if (bodyOffset > bytes.length) {\n throw new Error(\n `Truncated .noydb bundle: declared header length ${headerLength} ` +\n `would extend past end of file (${bytes.length} bytes).`,\n )\n }\n const headerBytes = bytes.slice(NOYDB_POD_PREFIX_BYTES, bodyOffset)\n const header = decodePodHeader(headerBytes)\n return { header, bodyOffset, algo: algo as CompressionAlgo, flags }\n}\n\n/**\n * Read just the bundle header — no body decompression, no\n * integrity verification. Intended for cloud-listing UIs that want\n * to show the handle and size before downloading the full body.\n *\n * Returns the same `NoydbPodHeader` shape as the writer, with\n * minimum-disclosure validation already applied.\n *\n * **Cost** — O(prefix + header bytes). The header is normally well\n * under 1 KB, but may grow to roughly 256 KB when a `publicEnvelope`\n * with an inline icon is present. Cloud-listing UIs that previously\n * assumed sub-KB header reads should account for this when sizing\n * range requests against bundles that may carry icons.\n */\nexport function readPodHeader(bytes: Uint8Array): NoydbPodHeader {\n return parsePrefixAndHeader(bytes).header\n}\n\n\n/**\n * Outcome of {@link verifyPodHeader}.\n *\n * - `verified` — the header carried a sig-tuple, its `keyId` is in\n * `trustedKeys`, and the signature checks out over the canonical\n * header bytes.\n * - `unsigned` — the header carried no signature (a legacy v1 pod, or a\n * v2 pod written with `{ sign: false }`). Not an error; just unauthenticated.\n * - `untrusted` — the header is signed but its `keyId` is not one the\n * caller trusts. The signature was NOT checked.\n * - `tampered` — the header is signed by a trusted key but the signature\n * does not verify: the signed bytes were altered, or the mapped public\n * key is not the one that actually signed.\n */\nexport interface PodVerifyResult {\n readonly status: 'verified' | 'unsigned' | 'untrusted' | 'tampered'\n /** The header's `keyId`, present whenever the header carried a sig-tuple. */\n readonly keyId?: string\n}\n\n/**\n * Authenticate a pod header (#943) — a pure, dependency-free, WebCrypto-only\n * verifier. Given only the raw pod bytes and a `trustedKeys` map\n * (`keyId → publicKeyB64` the caller already trusts), it reports whether the\n * header was signed by a trusted document signer.\n *\n * Pairs with the signing half in `assemblePodContainer`/`writePod`: the\n * signed payload is the final wire header with `sig` removed, so verification\n * reconstructs it by stripping EXACTLY the `sig` field — `keyId`, `sigAlg`,\n * and every other header field stay in the verified payload.\n *\n * No store, enclave, or vault dependency — reachable from a static page with\n * only the pod bytes, the trusted-key map, and `globalThis.crypto`.\n *\n * SECURITY — authenticity is not integrity. A `verified` result proves the\n * header (which includes the *claimed* `bodySha256`) is signed by a trusted\n * key; it does NOT prove the body matches that hash. To trust the pod's\n * BODY you MUST also confirm the body hashes to `header.bodySha256` — call\n * `readPod`, which throws `PodIntegrityError` on mismatch. A `verified`\n * header paired with a swapped body is caught only by that integrity check.\n * This function stays body-free by design so a static page can authenticate a\n * header without decompressing the body; composing the two checks is the\n * caller's responsibility. See `docs/subsystems/pod-signature.md`.\n */\nexport async function verifyPodHeader(\n bytes: Uint8Array,\n trustedKeys: Readonly<Record<string, string>>,\n): Promise<PodVerifyResult> {\n const { header } = parsePrefixAndHeader(bytes)\n\n // No signature tuple → unsigned, regardless of formatVersion. The format\n // layer guarantees sig/keyId/sigAlg are all-or-nothing, so any one being\n // absent means the header is unsigned.\n if (header.sig === undefined || header.keyId === undefined || header.sigAlg === undefined) {\n return { status: 'unsigned' }\n }\n\n const publicKeyB64 = trustedKeys[header.keyId]\n if (publicKeyB64 === undefined) {\n return { status: 'untrusted', keyId: header.keyId }\n }\n\n // Reconstruct the signed payload: the FINAL wire header minus EXACTLY `sig`.\n const payload: Record<string, unknown> = { ...header }\n delete payload['sig']\n\n const ok = await verifyRecord(publicKeyB64, header.sig, payload)\n return { status: ok ? 'verified' : 'tampered', keyId: header.keyId }\n}\n\n/**\n * Read just the bundle's cover (`https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md`)\n * — without verifying the body or even parsing the dump JSON. Pass\n * the raw bundle bytes; receive the owner-curated metadata or\n * `undefined` if the bundle was written without one.\n *\n * Locale-resolves any `name` / `description` map fields when `locale`\n * is supplied. Omitting `locale` returns the raw cover.\n *\n * Same security caveat as the on-vault read path — the cover is an\n * **untrusted hint** in v1; the encrypted body remains\n * the source of truth for vault contents.\n */\nexport function readPodCover(\n bytes: Uint8Array,\n opts: { readonly locale?: string } = {},\n): Cover | undefined {\n const header = parsePrefixAndHeader(bytes).header\n const env = header.publicEnvelope\n if (!env) return undefined\n if (opts.locale === undefined) return env\n return {\n ...env,\n ...(env.name !== undefined ? { name: pickLocale(env.name, opts.locale, env.defaultLocale) } : {}),\n ...(env.description !== undefined ? { description: pickLocale(env.description, opts.locale, env.defaultLocale) } : {}),\n }\n}\n\n/**\n * Read just the bundle's Redirect record (#944) — without verifying the\n * body or even parsing the dump JSON. Pass the raw bundle bytes; receive\n * the header's `redirect` field or `undefined` if the bundle was written\n * without one.\n *\n * The record is returned UNVERIFIED: `validatePodHeaderFields` only checks\n * its shape at parse time (a parser has no `trustedKeys`). Callers that\n * intend to follow the redirect MUST separately call `verifyRedirect`\n * (`redirect.js`) before trusting `target`.\n */\nexport function readPodRedirect(bytes: Uint8Array): Redirect | undefined {\n return parsePrefixAndHeader(bytes).header.redirect\n}\n\n/**\n * Read a full `.noydb` bundle: validate magic + header, verify\n * integrity hash over the body bytes, decompress, and return the\n * original `vault.dump()` JSON string ready to pass to\n * `vault.load()`.\n *\n * Throws `PodIntegrityError` if the body's actual SHA-256 does\n * not match the value declared in the header. Distinct from a\n * format error so consumers can pattern-match in catch blocks\n * (corrupted-in-transit vs malformed-by-producer).\n *\n * Note: this function does NOT take a secret. The dump JSON\n * inside the body still contains encrypted records — restoring\n * the vault requires `vault.load(dumpJson, secret)`\n * after this call. Splitting the layers keeps the bundle module\n * free of crypto concerns and lets the same code feed format\n * inspectors that never decrypt anything.\n */\nexport async function readPod(\n bytes: Uint8Array,\n opts: ReadPodOptions = {},\n): Promise<PodReadResult> {\n const { header, bodyOffset, algo } = parsePrefixAndHeader(bytes)\n const body = bytes.slice(bodyOffset)\n\n // Length check before hash check — a length mismatch is the\n // cheapest tamper signal and produces a more actionable error.\n if (body.length !== header.bodyBytes) {\n throw new PodIntegrityError(\n `body length ${body.length} does not match header.bodyBytes ` +\n `${header.bodyBytes}. The bundle was truncated or padded ` +\n `between write and read.`,\n )\n }\n\n const actualSha = await sha256Hex(body)\n if (actualSha !== header.bodySha256) {\n throw new PodIntegrityError(\n `body sha256 ${actualSha} does not match header.bodySha256 ` +\n `${header.bodySha256}. The bundle bytes were modified between ` +\n `write and read — refuse to decompress.`,\n )\n }\n\n let dumpBytes: Uint8Array\n if (algo === COMPRESSION_NONE) {\n dumpBytes = body\n } else {\n const streamFormat: CompressionFormat =\n algo === COMPRESSION_BROTLI ? ('br' as CompressionFormat) : 'gzip'\n try {\n dumpBytes = await pumpThroughStream(body, new DecompressionStream(streamFormat))\n } catch (err) {\n throw new PodIntegrityError(\n `decompression failed: ${(err as Error).message}. The bundle ` +\n `passed the integrity hash but the body is not valid ` +\n `${streamFormat} data — likely a producer bug.`,\n )\n }\n }\n\n const bodyString = new TextDecoder('utf-8', { fatal: true }).decode(dumpBytes)\n\n // When the header signals auto-unlock, the body is a\n // JSON wrapper carrying the dump string + the auto-unlock blob.\n // When absent, the body IS the raw dump JSON.\n if (header.autoUnlock === undefined) {\n return { header, dumpJson: bodyString }\n }\n const { dump, blob } = parseAutoUnlockBody(bodyString)\n const autoUnlock = await resolveAutoUnlock(blob, opts)\n return { header, dumpJson: dump, autoUnlock }\n}\n\n"],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U;AAInC,MAAI,KAAK,WAAW,OAAO,WAAW;AACpC,UAAM,IAAI;AAAA,MACR,eAAe,KAAK,MAAM,oCACrB,OAAO,SAAS;AAAA,IAEvB;AAAA,EACF;AAEA,QAAM,YAAY,MAAMA,WAAU,IAAI;AACtC,MAAI,cAAc,OAAO,YAAY;AACnC,UAAM,IAAI;AAAA,MACR,eAAe,SAAS,qCACnB,OAAO,UAAU;AAAA,IAExB;AAAA,EACF;AAEA,MAAI;AACJ,MAAI,SAAS,kBAAkB;AAC7B,gBAAY;AAAA,EACd,OAAO;AACL,UAAM,eACJ,SAAS,qBAAsB,OAA6B;AAC9D,QAAI;AACF,kBAAY,MAAM,kBAAkB,MAAM,IAAI,oBAAoB,YAAY,CAAC;AAAA,IACjF,SAAS,KAAK;AACZ,YAAM,IAAI;AAAA,QACR,yBAA0B,IAAc,OAAO,oEAE1C,YAAY;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC,EAAE,OAAO,SAAS;AAK7E,MAAI,OAAO,eAAe,QAAW;AACnC,WAAO,EAAE,QAAQ,UAAU,WAAW;AAAA,EACxC;AACA,QAAM,EAAE,MAAM,KAAK,IAAI,oBAAoB,UAAU;AACrD,QAAM,aAAa,MAAM,kBAAkB,MAAM,IAAI;AACrD,SAAO,EAAE,QAAQ,UAAU,MAAM,WAAW;AAC9C;","names":["userCount","plaintextBytes","sha256Hex"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NoydbError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JBIV4FLR.js";
|
|
4
4
|
|
|
5
5
|
// src/with-formula/computed/index.ts
|
|
6
6
|
var ComputedFieldError = class extends NoydbError {
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
ComputedFieldError,
|
|
36
36
|
evalComputedFields
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-7LYUJNU3.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getHistory,
|
|
3
3
|
historyIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6EW2UCVF.js";
|
|
5
5
|
import {
|
|
6
6
|
liveRecordIsElevated
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-POS53FG6.js";
|
|
8
8
|
import {
|
|
9
9
|
openEnvelopeJson
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2LPVI4PX.js";
|
|
11
11
|
import {
|
|
12
12
|
ReadOnlyAtInstantError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JBIV4FLR.js";
|
|
14
14
|
|
|
15
15
|
// src/with-commit/history/time-machine.ts
|
|
16
16
|
var VaultInstant = class {
|
|
@@ -208,4 +208,4 @@ export {
|
|
|
208
208
|
VaultInstant,
|
|
209
209
|
CollectionInstant
|
|
210
210
|
};
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-A2YW5EMU.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldFrozenError,
|
|
3
3
|
InvariantError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JBIV4FLR.js";
|
|
5
5
|
|
|
6
6
|
// src/with-audit/guards/executor.ts
|
|
7
7
|
var GuardExecutor = {
|
|
@@ -77,4 +77,4 @@ function deepEqual(a, b) {
|
|
|
77
77
|
export {
|
|
78
78
|
GuardExecutor
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-AB5P32RE.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertTierAccess
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HTGRQZFB.js";
|
|
4
4
|
import {
|
|
5
5
|
dekKey,
|
|
6
6
|
liveRecordIsElevated,
|
|
7
7
|
liveRecordTier
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-POS53FG6.js";
|
|
9
9
|
import {
|
|
10
10
|
buildRecordAad,
|
|
11
11
|
openEnvelopeJson,
|
|
12
12
|
writeEnvelopeBody
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2LPVI4PX.js";
|
|
14
14
|
import {
|
|
15
15
|
buildRecordEnvelope,
|
|
16
16
|
buildSealedRecordEnvelope
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-N4CNVSUF.js";
|
|
18
18
|
import {
|
|
19
19
|
base64ToBuffer,
|
|
20
20
|
bufferToBase64,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
sha256Hex,
|
|
28
28
|
unwrapCek,
|
|
29
29
|
wrapCek
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-W5LHQXZU.js";
|
|
31
31
|
import {
|
|
32
32
|
BLOB_ADDRESS_KEY_ID,
|
|
33
33
|
BlobIntentPendingError,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
UnsupportedTierCompositionError,
|
|
40
40
|
ValidationError,
|
|
41
41
|
isConflictError
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-JBIV4FLR.js";
|
|
43
43
|
|
|
44
44
|
// src/with-shape/blobs/blob-pinning.ts
|
|
45
45
|
function memoryBlobPinStore() {
|
|
@@ -3137,4 +3137,4 @@ export {
|
|
|
3137
3137
|
DEFAULT_CHUNK_SIZE,
|
|
3138
3138
|
BlobSet
|
|
3139
3139
|
};
|
|
3140
|
-
//# sourceMappingURL=chunk-
|
|
3140
|
+
//# sourceMappingURL=chunk-ALB64CZM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LookupHandle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-57JTHWLQ.js";
|
|
4
4
|
|
|
5
5
|
// src/via/lookup/active.ts
|
|
6
6
|
function withLookup() {
|
|
@@ -33,4 +33,4 @@ function withLookup() {
|
|
|
33
33
|
export {
|
|
34
34
|
withLookup
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-ALUNQEBY.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNoydb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y3YLJORD.js";
|
|
4
4
|
import {
|
|
5
5
|
deriveSchemaManifest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QHJKK77B.js";
|
|
7
7
|
import {
|
|
8
8
|
loadFence
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y6GZ2P4M.js";
|
|
10
10
|
import {
|
|
11
11
|
readPod,
|
|
12
12
|
readPodRedirect,
|
|
13
13
|
signRecord,
|
|
14
14
|
verifyPodHeader,
|
|
15
15
|
verifyRecord
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6FOGTKBY.js";
|
|
17
17
|
import {
|
|
18
18
|
loadKeyring
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5W7YXFV5.js";
|
|
20
20
|
import {
|
|
21
21
|
ConflictError,
|
|
22
22
|
MigrationRequiredError,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
RedirectDepthExceededError,
|
|
27
27
|
RedirectLoopError,
|
|
28
28
|
RedirectUnreachableError
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JBIV4FLR.js";
|
|
30
30
|
|
|
31
31
|
// src/with-pod/pod-store.ts
|
|
32
32
|
var BUNDLE_STORE_VERSION = 1;
|
|
@@ -286,4 +286,4 @@ export {
|
|
|
286
286
|
followRedirects,
|
|
287
287
|
open
|
|
288
288
|
};
|
|
289
|
-
//# sourceMappingURL=chunk-
|
|
289
|
+
//# sourceMappingURL=chunk-ATV637J7.js.map
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CargoNotEnabledError,
|
|
3
2
|
QuiesceTimeoutError
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
|
|
6
|
-
// src/with-cargo/strategy.ts
|
|
7
|
-
var NO_CARGO = {
|
|
8
|
-
async extractPartition() {
|
|
9
|
-
throw new CargoNotEnabledError();
|
|
10
|
-
}
|
|
11
|
-
};
|
|
3
|
+
} from "./chunk-JBIV4FLR.js";
|
|
12
4
|
|
|
13
5
|
// src/port/by/types.ts
|
|
14
6
|
function isQuorum(writers, generation, excludeWriterId) {
|
|
@@ -56,8 +48,7 @@ async function runDrainBarrier(provider, o, run) {
|
|
|
56
48
|
}
|
|
57
49
|
|
|
58
50
|
export {
|
|
59
|
-
NO_CARGO,
|
|
60
51
|
isQuorum,
|
|
61
52
|
runDrainBarrier
|
|
62
53
|
};
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-CBRS2NEK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/port/by/types.ts"],"sourcesContent":["/**\n * Kernel coordination port — the injected `NoydbMesh` seam for the\n * schema-fence drain-barrier.\n *\n * The kernel defines this port; `@noy-db/by-tabs` / `@noy-db/by-peer` implement\n * it for real-time quorum, and an external orchestrator (`@klum-db/lobby`)\n * drives it through the `Noydb` handle without ever naming a `by-*` package.\n * The dependency arrow is `by-* → kernel ← klum`, the app at the apex.\n *\n * This module carries only the port TYPES plus two pure-ish helpers:\n * {@link isQuorum} (a pure quorum predicate extracted from the legacy\n * `activeQuiesced`) and {@link runDrainBarrier} (the reusable barrier protocol\n * the migration cutover and klum both call).\n *\n * @module\n */\n\nimport { QuiesceTimeoutError } from '../../kernel/errors.js'\nimport type { Unsubscribe } from '../with/write-hooks.js'\nimport type { FenceDoc } from '../../with-shape/schema-update/fence.js'\n\n/**\n * What the mesh carries about the fence: the vault's schema generation and its\n * drain phase. This is the vault's OWN fence document — `@noy-db/hub/by`\n * re-exports it rather than declaring a parallel type.\n *\n * Through 0.6 this port declared its own `FenceState` interface with the same\n * two fields. Two problems, and only the first was visible (#1188):\n *\n * 1. `FenceState` ALSO names an unrelated string union\n * (`'normal' | 'draining' | …`) on `.` and `./cargo`. A consumer importing\n * from `@noy-db/hub` and one importing from `@noy-db/hub/by` got different\n * types, both compiling, failing only where they met.\n * 2. It was a hand-copy — its own comment said \"the existing FenceDoc shape\" —\n * and it had already drifted, missing the `schemaHash` field #946 added.\n * Measured mutually assignable with `FenceDoc` under `--strict\n * --exactOptionalPropertyTypes`, so there was no type to preserve.\n *\n * Re-exporting fixes both: one name, one meaning, one definition to keep\n * current. `FenceState` on the root barrel is untouched and still means the\n * string union.\n */\nexport type { FenceDoc }\n\n\n/** A writer's presence + ack, tagged with the session that owns it. */\nexport interface WriterPresence {\n /** = today's clientId (one per tab/peer). */\n readonly writerId: string\n /** Groups one user's writers across vaults (consolidation is klum's job). */\n readonly sessionId: string\n readonly lastSeen: number\n readonly quiescedAtVersion: number | null\n}\n\n/** Session-addressable drain-barrier coordination transport. Per-vault ops. */\nexport interface NoydbMesh {\n /** orchestrator → all writers */\n setFence(vault: string, fence: FenceDoc): Promise<void>\n /**\n * Fresh one-shot fence read for the write-path gate (`assertWritable`).\n * A direct read (not a cached `observeFence` snapshot) avoids a staleness\n * window and keeps the timing-sensitive cutover gate exact. The store\n * default reads `_meta/schema-fence`; `by-*` return their last-pushed fence.\n */\n readFence(vault: string): Promise<FenceDoc>\n /** writer observes fence changes (default: poll-emit; by-*: push) */\n observeFence(vault: string, onChange: (f: FenceDoc) => void): Unsubscribe\n /** writer → orchestrator: presence + ack (heartbeat + quiescedAtVersion) */\n reportPresence(vault: string, p: WriterPresence): Promise<void>\n /** orchestrator observes presence changes (default: poll-emit; by-*: push) */\n observePresence(vault: string, onChange: (writers: readonly WriterPresence[]) => void): Unsubscribe\n /** orchestrator one-shot snapshot of reachable writers (quorum input) */\n reachableWriters(vault: string, o: { staleMs: number; now: number }): Promise<readonly WriterPresence[]>\n}\n\n/**\n * Pure quorum predicate: true when every writer (other than `excludeWriterId`)\n * has acked at exactly `generation`. An empty set is trivially a quorum.\n *\n * Extracted from the legacy `activeQuiesced` store-polling check so the\n * migration cutover, the store default provider, and `by-*` real-time\n * providers all share one definition of \"everyone has drained\".\n */\nexport function isQuorum(\n writers: readonly WriterPresence[],\n generation: number,\n excludeWriterId?: string,\n): boolean {\n return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation)\n}\n\n/** Inputs for {@link runDrainBarrier}. */\nexport interface DrainBarrierOptions {\n readonly vault: string\n readonly generation: number\n readonly writerId: string\n readonly onFlush: () => Promise<void>\n readonly staleMs: number\n readonly quiesceTimeoutMs: number\n readonly now: () => number\n /** Optional seam (mainly for deterministic tests) run before each poll tick. */\n readonly onPoll?: () => Promise<void>\n}\n\n/**\n * The reusable drain-barrier protocol shared by the migration cutover and klum:\n *\n * drain self → setFence(draining) → await quorum (presence push + isQuorum,\n * polling as a fallback, or timeout) → run() → release-by-caller.\n *\n * Resolves once every reachable writer (excluding `writerId`) has quiesced at\n * `generation`, at which point `run` is invoked exactly once. Rejects with\n * {@link QuiesceTimeoutError} if `quiesceTimeoutMs` elapses first.\n */\nexport async function runDrainBarrier(\n provider: NoydbMesh,\n o: DrainBarrierOptions,\n run: () => Promise<void>,\n): Promise<void> {\n await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: 'draining' })\n await o.onFlush()\n\n const deadline = o.now() + o.quiesceTimeoutMs\n const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (!isQuorum(seeded, o.generation, o.writerId)) {\n await new Promise<void>((resolve, reject) => {\n let settled = false\n const finish = (fn: () => void) => {\n if (!settled) {\n settled = true\n unsub()\n fn()\n }\n }\n const unsub = provider.observePresence(o.vault, (writers) => {\n if (isQuorum(writers, o.generation, o.writerId)) finish(resolve)\n })\n const tick = async () => {\n if (settled) return\n if (o.now() >= deadline) {\n finish(() =>\n reject(\n new QuiesceTimeoutError(\n `Cutover of vault \"${o.vault}\" to generation ${o.generation} timed out ` +\n `after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`,\n ),\n ),\n )\n return\n }\n if (o.onPoll) await o.onPoll()\n const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (isQuorum(w, o.generation, o.writerId)) finish(resolve)\n else setTimeout(() => void tick(), 25)\n }\n void tick()\n })\n }\n await run()\n}\n"],"mappings":";;;;;AAoFO,SAAS,SACd,SACA,YACA,iBACS;AACT,SAAO,QAAQ,OAAO,CAAC,MAAM,EAAE,aAAa,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,UAAU;AAC9G;AAyBA,eAAsB,gBACpB,UACA,GACA,KACe;AACf,QAAM,SAAS,SAAS,EAAE,OAAO,EAAE,sBAAsB,EAAE,YAAY,YAAY,WAAW,CAAC;AAC/F,QAAM,EAAE,QAAQ;AAEhB,QAAM,WAAW,EAAE,IAAI,IAAI,EAAE;AAC7B,QAAM,SAAS,MAAM,SAAS,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC;AAC5F,MAAI,CAAC,SAAS,QAAQ,EAAE,YAAY,EAAE,QAAQ,GAAG;AAC/C,UAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,UAAI,UAAU;AACd,YAAM,SAAS,CAAC,OAAmB;AACjC,YAAI,CAAC,SAAS;AACZ,oBAAU;AACV,gBAAM;AACN,aAAG;AAAA,QACL;AAAA,MACF;AACA,YAAM,QAAQ,SAAS,gBAAgB,EAAE,OAAO,CAAC,YAAY;AAC3D,YAAI,SAAS,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAG,QAAO,OAAO;AAAA,MACjE,CAAC;AACD,YAAM,OAAO,YAAY;AACvB,YAAI,QAAS;AACb,YAAI,EAAE,IAAI,KAAK,UAAU;AACvB;AAAA,YAAO,MACL;AAAA,cACE,IAAI;AAAA,gBACF,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,UAAU,oBAChD,EAAE,gBAAgB;AAAA,cAC/B;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AACA,YAAI,EAAE,OAAQ,OAAM,EAAE,OAAO;AAC7B,cAAM,IAAI,MAAM,SAAS,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC;AACvF,YAAI,SAAS,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAG,QAAO,OAAO;AAAA,YACpD,YAAW,MAAM,KAAK,KAAK,GAAG,EAAE;AAAA,MACvC;AACA,WAAK,KAAK;AAAA,IACZ,CAAC;AAAA,EACH;AACA,QAAM,IAAI;AACZ;","names":[]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildRecordAad,
|
|
3
3
|
openEnvelopeJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2LPVI4PX.js";
|
|
5
5
|
import {
|
|
6
6
|
buildRecordEnvelope
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N4CNVSUF.js";
|
|
8
8
|
import {
|
|
9
9
|
encrypt
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W5LHQXZU.js";
|
|
11
11
|
import {
|
|
12
12
|
SequenceContentionError,
|
|
13
13
|
SequenceNotEnabledError,
|
|
14
14
|
SequenceOfflineError,
|
|
15
15
|
ValidationError,
|
|
16
16
|
isConflictError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JBIV4FLR.js";
|
|
18
18
|
|
|
19
19
|
// src/with-commit/sequence/active.ts
|
|
20
20
|
function withSequence() {
|
|
@@ -201,4 +201,4 @@ export {
|
|
|
201
201
|
resolveSequenceKey,
|
|
202
202
|
SequenceStore
|
|
203
203
|
};
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
204
|
+
//# sourceMappingURL=chunk-CN6B5PEN.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
persistUserVisibility,
|
|
5
5
|
readUserVisibility,
|
|
6
6
|
saveUserEnvelope
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DFAUMLD7.js";
|
|
8
8
|
import {
|
|
9
9
|
PolicyDeniedError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JBIV4FLR.js";
|
|
11
11
|
|
|
12
12
|
// src/with-party/directory/user-envelope/api.ts
|
|
13
13
|
var UserApi = class {
|
|
@@ -379,4 +379,4 @@ export {
|
|
|
379
379
|
UserApi,
|
|
380
380
|
createUserApi
|
|
381
381
|
};
|
|
382
|
-
//# sourceMappingURL=chunk-
|
|
382
|
+
//# sourceMappingURL=chunk-DBNYPLWY.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildRecordAad,
|
|
3
3
|
openEnvelopeJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2LPVI4PX.js";
|
|
5
5
|
import {
|
|
6
6
|
buildRecordEnvelope
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N4CNVSUF.js";
|
|
8
8
|
import {
|
|
9
9
|
encrypt
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W5LHQXZU.js";
|
|
11
11
|
import {
|
|
12
12
|
ConflictError,
|
|
13
13
|
USER_ENVELOPE_COLLECTION,
|
|
14
14
|
USER_ENVELOPE_MAX_BYTES,
|
|
15
15
|
UserEnvelopeOversizedError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JBIV4FLR.js";
|
|
17
17
|
|
|
18
18
|
// src/with-party/directory/storage.ts
|
|
19
19
|
var META_COLLECTION = "_meta";
|
|
@@ -142,4 +142,4 @@ export {
|
|
|
142
142
|
deleteUserEnvelope,
|
|
143
143
|
listUserEnvelopeIds
|
|
144
144
|
};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-DFAUMLD7.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writePod
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6FOGTKBY.js";
|
|
4
4
|
|
|
5
5
|
// src/with-audit/portability/export-accessible.ts
|
|
6
6
|
function resolveAccessibleCollections(keyring, scope, writableOnly = false) {
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
buildAccessibleBundle,
|
|
43
43
|
exportAccessibleData
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-DKWPJOYH.js.map
|