@noy-db/hub 0.3.0-pre.8 → 0.3.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/dist/aggregate/index.js +9 -8
- package/dist/aggregate/index.js.map +1 -1
- package/dist/api-ZGS6LCOF.js +20 -0
- package/dist/as/index.js +11 -11
- package/dist/attestation/index.js +18 -18
- package/dist/backup-BJ57IKAO.js +242 -0
- package/dist/backup-BJ57IKAO.js.map +1 -0
- package/dist/blobs/index.js +13 -11
- package/dist/blobs/index.js.map +1 -1
- package/dist/broker/index.js +92 -0
- package/dist/broker/index.js.map +1 -0
- package/dist/bundle/index.js +25 -22
- package/dist/bundle/index.js.map +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +31 -31
- package/dist/chunk-2NVOWNI3.js +167 -0
- package/dist/chunk-2NVOWNI3.js.map +1 -0
- package/dist/chunk-3B5VVCNY.js +71 -0
- package/dist/chunk-3LQ2YKO4.js +230 -0
- package/dist/chunk-3QCRBHCY.js +54 -0
- package/dist/chunk-454JXE57.js +1697 -0
- package/dist/chunk-454JXE57.js.map +1 -0
- package/dist/chunk-4CTHCN4J.js +480 -0
- package/dist/chunk-4CTHCN4J.js.map +1 -0
- package/dist/chunk-4GPE63GU.js +111 -0
- package/dist/chunk-4GPE63GU.js.map +1 -0
- package/dist/chunk-4JBYV75E.js +150 -0
- package/dist/chunk-4NXKCLLQ.js +97 -0
- package/dist/chunk-4VNQOLML.js +29 -0
- package/dist/chunk-4VNQOLML.js.map +1 -0
- package/dist/chunk-5M5DVGV7.js +69 -0
- package/dist/chunk-5O3XF4DV.js +150 -0
- package/dist/chunk-5O3XF4DV.js.map +1 -0
- package/dist/chunk-5YOLBEQ6.js +30 -0
- package/dist/chunk-6CRIV7DE.js +129 -0
- package/dist/chunk-6JTIAGHD.js +621 -0
- package/dist/chunk-6JTIAGHD.js.map +1 -0
- package/dist/chunk-6QTNZJBS.js +255 -0
- package/dist/chunk-6T2SCQRU.js +86 -0
- package/dist/chunk-7DSTRQIJ.js +45 -0
- package/dist/chunk-AUSTCW2X.js +589 -0
- package/dist/chunk-B3HJYUOF.js +209 -0
- package/dist/chunk-BDVFPG6Y.js +164 -0
- package/dist/chunk-BIOUI4HL.js +1554 -0
- package/dist/chunk-BIOUI4HL.js.map +1 -0
- package/dist/chunk-CAF6WOK7.js +36 -0
- package/dist/chunk-CDUQTA3Z.js +381 -0
- package/dist/chunk-CDUQTA3Z.js.map +1 -0
- package/dist/chunk-CIE2BASH.js +404 -0
- package/dist/chunk-CRI4OUV4.js +42 -0
- package/dist/chunk-DLG74CNB.js +91 -0
- package/dist/chunk-E5ZQT5KX.js +30 -0
- package/dist/chunk-E5ZQT5KX.js.map +1 -0
- package/dist/chunk-EQO2UVP4.js +247 -0
- package/dist/chunk-EQO2UVP4.js.map +1 -0
- package/dist/chunk-ERJ7FU55.js +367 -0
- package/dist/chunk-EVVGJDRQ.js +205 -0
- package/dist/chunk-EVX47VBM.js +74 -0
- package/dist/chunk-EVX47VBM.js.map +1 -0
- package/dist/chunk-EXK7QRWF.js +59 -0
- package/dist/chunk-EYZ6IQ6X.js +202 -0
- package/dist/chunk-F64IRYG3.js +45 -0
- package/dist/chunk-FHS2HQSH.js +823 -0
- package/dist/chunk-FM3G3NOY.js +206 -0
- package/dist/chunk-FM3G3NOY.js.map +1 -0
- package/dist/chunk-FUG4SFN3.js +36 -0
- package/dist/chunk-FUG4SFN3.js.map +1 -0
- package/dist/chunk-GKEWXIV5.js +80 -0
- package/dist/chunk-GTGPO5KW.js +59 -0
- package/dist/chunk-HB3RFQSC.js +95 -0
- package/dist/chunk-HDMEGAQE.js +957 -0
- package/dist/chunk-HDMEGAQE.js.map +1 -0
- package/dist/chunk-HDQIIUPH.js +135 -0
- package/dist/chunk-HDQIIUPH.js.map +1 -0
- package/dist/chunk-HTJQYHZP.js +344 -0
- package/dist/chunk-HTJQYHZP.js.map +1 -0
- package/dist/chunk-I6GALP6E.js +99 -0
- package/dist/chunk-IGJCYUT5.js +99 -0
- package/dist/chunk-IGJCYUT5.js.map +1 -0
- package/dist/chunk-IL6POWCW.js +130 -0
- package/dist/chunk-IU6SNYX6.js +117 -0
- package/dist/chunk-J2ZX2XUV.js +778 -0
- package/dist/chunk-JIF24JPM.js +495 -0
- package/dist/chunk-JIF24JPM.js.map +1 -0
- package/dist/chunk-JK733I5V.js +23 -0
- package/dist/chunk-JK733I5V.js.map +1 -0
- package/dist/chunk-JKJOGPZN.js +29 -0
- package/dist/chunk-JNAI2HN2.js +32 -0
- package/dist/chunk-JNAI2HN2.js.map +1 -0
- package/dist/chunk-JZUV47FZ.js +41 -0
- package/dist/chunk-K5IMOGHB.js +30 -0
- package/dist/chunk-KPZS5QAQ.js +151 -0
- package/dist/chunk-KPZS5QAQ.js.map +1 -0
- package/dist/chunk-KSKBRKGJ.js +291 -0
- package/dist/chunk-KSKBRKGJ.js.map +1 -0
- package/dist/chunk-LASZKVMO.js +382 -0
- package/dist/chunk-LXEXBTKL.js +515 -0
- package/dist/chunk-LXEXBTKL.js.map +1 -0
- package/dist/chunk-M4CV6BRT.js +524 -0
- package/dist/chunk-M4CV6BRT.js.map +1 -0
- package/dist/chunk-MEFJPTZ4.js +371 -0
- package/dist/chunk-MEFJPTZ4.js.map +1 -0
- package/dist/chunk-MV43JSJF.js +265 -0
- package/dist/chunk-MV43JSJF.js.map +1 -0
- package/dist/chunk-NJ4EOKMB.js +392 -0
- package/dist/chunk-NJ4EOKMB.js.map +1 -0
- package/dist/chunk-NR5LT5RY.js +135 -0
- package/dist/chunk-NWSGI5C7.js +261 -0
- package/dist/chunk-NWSGI5C7.js.map +1 -0
- package/dist/chunk-OSDB5WW3.js +739 -0
- package/dist/chunk-OSDB5WW3.js.map +1 -0
- package/dist/chunk-PN2XMATY.js +37 -0
- package/dist/chunk-PN2XMATY.js.map +1 -0
- package/dist/chunk-Q5VNKNE5.js +70 -0
- package/dist/chunk-QLWMEXCT.js +21 -0
- package/dist/chunk-QRB7NAOJ.js +123 -0
- package/dist/chunk-R4ROFEYC.js +74 -0
- package/dist/chunk-RCVJZMFE.js +164 -0
- package/dist/chunk-RCVJZMFE.js.map +1 -0
- package/dist/chunk-RIX4V2TB.js +367 -0
- package/dist/chunk-RYCTDFUX.js +40 -0
- package/dist/chunk-RZ5SVOYR.js +155 -0
- package/dist/chunk-SLFHQTTW.js +99 -0
- package/dist/chunk-SNZ6URZZ.js +2782 -0
- package/dist/chunk-SNZ6URZZ.js.map +1 -0
- package/dist/chunk-T2FFWNPK.js +75 -0
- package/dist/chunk-T2FFWNPK.js.map +1 -0
- package/dist/chunk-UNFPPVNI.js +23 -0
- package/dist/chunk-VFUPHI2Z.js +333 -0
- package/dist/chunk-VFUPHI2Z.js.map +1 -0
- package/dist/chunk-VLFCJYTL.js +235 -0
- package/dist/chunk-VN3DBQAU.js +124 -0
- package/dist/chunk-VYYM3MEN.js +98 -0
- package/dist/chunk-VYYM3MEN.js.map +1 -0
- package/dist/chunk-VZRODIM3.js +49 -0
- package/dist/chunk-W22IKJE2.js +94 -0
- package/dist/chunk-X3YYQWOQ.js +155 -0
- package/dist/chunk-X7QBD67R.js +14405 -0
- package/dist/chunk-X7QBD67R.js.map +1 -0
- package/dist/chunk-XDYREZWE.js +1128 -0
- package/dist/chunk-XDYREZWE.js.map +1 -0
- package/dist/chunk-XWZVFISC.js +720 -0
- package/dist/chunk-XWZVFISC.js.map +1 -0
- package/dist/chunk-YFXZEAYK.js +85 -0
- package/dist/chunk-ZAJAVEXY.js +50 -0
- package/dist/chunk-ZICD77GM.js +34 -0
- package/dist/chunk-ZJ2AK4V7.js +38 -0
- package/dist/chunk-ZJ2AK4V7.js.map +1 -0
- package/dist/chunk-ZUODRVHY.js +14 -0
- package/dist/classified/index.js +5 -3
- package/dist/classified-marker-CZKA6ITE.js +28 -0
- package/dist/classified-marker-CZKA6ITE.js.map +1 -0
- package/dist/collection-facade-TLWIPI76.js +44 -0
- package/dist/computed-ZIQTYTDI.js +11 -0
- package/dist/consent/index.js +9 -9
- package/dist/crdt/index.js +1 -1
- package/dist/dead-filter-ESOBZZP5.js +28 -0
- package/dist/delegation-W7ZV2322.js +25 -0
- package/dist/derivations/index.js +12 -11
- package/dist/derive-H2BJTLUI.js +21 -0
- package/dist/enclave-AP3I5W7O.js +141 -0
- package/dist/executor-KGWTNEQD.js +9 -0
- package/dist/executor-OVEXR6RT.js +9 -0
- package/dist/executor-UNEH5ZYH.js +25 -0
- package/dist/export-accessible-PCMXSUZS.js +23 -0
- package/dist/extract-partition-SWHFSYJO.js +38 -0
- package/dist/fanout-sidecar-A765THMX.js +74 -0
- package/dist/find-N6345CNT.js +11 -0
- package/dist/forget/index.js +10 -10
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.js +6 -6
- package/dist/history/index.js +14 -11
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +50 -37
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +307 -1459
- package/dist/index.js +595 -198
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +7 -7
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-5OKB6I2R.js +19 -0
- package/dist/kernel/best-effort-revert.d.ts +52 -0
- package/dist/kernel/cache/index.d.ts +10 -0
- package/dist/kernel/cache/lru.d.ts +97 -0
- package/dist/kernel/cache/policy.d.ts +32 -0
- package/dist/kernel/collection-config.d.ts +809 -0
- package/dist/kernel/collection.d.ts +1522 -0
- package/dist/kernel/constants.d.ts +18 -0
- package/dist/kernel/debug.d.ts +25 -0
- package/dist/kernel/enclave/broker/proof.d.ts +154 -0
- package/dist/kernel/enclave/classify/bidx.d.ts +77 -0
- package/dist/kernel/enclave/classify/compare.d.ts +10 -0
- package/dist/kernel/enclave/classify/digest.d.ts +8 -0
- package/dist/kernel/enclave/classify/find.d.ts +36 -0
- package/dist/kernel/enclave/classify/kofn.d.ts +7 -0
- package/dist/kernel/enclave/classify/normalize.d.ts +7 -0
- package/dist/kernel/enclave/classify/reveal.d.ts +10 -0
- package/dist/kernel/enclave/classify/vdig.d.ts +39 -0
- package/dist/kernel/enclave/classify/verify.d.ts +36 -0
- package/dist/kernel/enclave/classify/write.d.ts +8 -0
- package/dist/kernel/enclave/crypto.d.ts +263 -0
- package/dist/kernel/enclave/index.d.ts +79 -0
- package/dist/kernel/enclave/record-keys/deterministic.d.ts +55 -0
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +79 -0
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +107 -0
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +328 -0
- package/dist/kernel/enclave/record-keys/sealed-slot.d.ts +14 -0
- package/dist/kernel/enclave/record-keys/sealed-slots.d.ts +123 -0
- package/dist/kernel/enclave/record-keys/sealing.d.ts +70 -0
- package/dist/kernel/enclave/record-keys/tombstone.d.ts +57 -0
- package/dist/kernel/env-check.d.ts +1 -0
- package/dist/kernel/errors.d.ts +1922 -0
- package/dist/kernel/events.d.ts +11 -0
- package/dist/kernel/lazy-count.d.ts +13 -0
- package/dist/kernel/memory-store.d.ts +17 -0
- package/dist/kernel/mutation.d.ts +14 -0
- package/dist/kernel/noydb.d.ts +826 -0
- package/dist/kernel/paths.d.ts +25 -0
- package/dist/kernel/query/builder.d.ts +520 -0
- package/dist/kernel/query/index.d.ts +31 -0
- package/dist/kernel/query/join.d.ts +205 -0
- package/dist/kernel/query/live.d.ts +111 -0
- package/dist/kernel/query/predicate.d.ts +139 -0
- package/dist/kernel/query/scan-builder.d.ts +334 -0
- package/dist/kernel/refs.d.ts +205 -0
- package/dist/kernel/schema.d.ts +134 -0
- package/dist/kernel/sync-policy.d.ts +188 -0
- package/dist/kernel/tier-visibility.d.ts +54 -0
- package/dist/kernel/types.d.ts +3239 -0
- package/dist/kernel/util/discriminant.d.ts +58 -0
- package/dist/kernel/util/index.d.ts +14 -0
- package/dist/kernel/util/sanitize-filename.d.ts +75 -0
- package/dist/kernel/validation.d.ts +130 -0
- package/dist/kernel/vault.d.ts +1740 -0
- package/dist/kernel/via/compose.d.ts +144 -0
- package/dist/kernel/via/dispatch.d.ts +195 -0
- package/dist/kernel/via/graph-wiring.d.ts +145 -0
- package/dist/kernel/via/graph.d.ts +166 -0
- package/dist/kernel/via/index.d.ts +200 -0
- package/dist/kernel/via/pipeline.d.ts +266 -0
- package/dist/kernel/via/reconcile.d.ts +153 -0
- package/dist/kernel/via/taint-binding.d.ts +66 -0
- package/dist/kernel/write-queue.d.ts +46 -0
- package/dist/ledger-GFBKVPV4.js +42 -0
- package/dist/legacy/bundle.d.ts +30 -0
- package/dist/legacy/kernel.d.ts +33 -0
- package/dist/liberate-3VDOT4KO.js +24 -0
- package/dist/link-set-Z7Q2ASFX.js +31 -0
- package/dist/materialized-views/index.js +19 -15
- package/dist/noydb-ZCJOYBDI.js +68 -0
- package/dist/on/index.js +9 -9
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +12 -12
- package/dist/pod/index.js +11 -11
- package/dist/policy-Z3RUAIY2.js +41 -0
- package/dist/port/as/index.d.ts +26 -0
- package/dist/port/at/index.d.ts +18 -0
- package/dist/port/by/default-provider.d.ts +9 -0
- package/dist/port/by/index.d.ts +17 -0
- package/dist/port/by/types.d.ts +86 -0
- package/dist/port/in/index.d.ts +21 -0
- package/dist/port/on/index.d.ts +27 -0
- package/dist/port/to/index.d.ts +19 -0
- package/dist/port/ui/index.d.ts +21 -0
- package/dist/port/with/blob-strategy.d.ts +98 -0
- package/dist/port/with/broker-strategy.d.ts +84 -0
- package/dist/port/with/capabilities.d.ts +31 -0
- package/dist/port/with/classified-marker.d.ts +9 -0
- package/dist/port/with/classified-strategy.d.ts +62 -0
- package/dist/port/with/computed-strategy.d.ts +19 -0
- package/dist/port/with/i18n-strategy.d.ts +175 -0
- package/dist/port/with/index.d.ts +18 -0
- package/dist/port/with/lazy-strategy.d.ts +48 -0
- package/dist/port/with/lookup-strategy.d.ts +129 -0
- package/dist/port/with/service-bus.d.ts +156 -0
- package/dist/port/with/team-strategy.d.ts +36 -0
- package/dist/port/with/write-hooks.d.ts +34 -0
- package/dist/portability/index.js +8 -8
- package/dist/post-register-JTH76BLY.js +60 -0
- package/dist/post-register-JTH76BLY.js.map +1 -0
- package/dist/public-envelope-B4KNWVUA.js +32 -0
- package/dist/purge-scope-FGNNLWHD.js +24 -0
- package/dist/purge-scope-FGNNLWHD.js.map +1 -0
- package/dist/query/index.js +9 -6
- package/dist/read-only-facade-CHCKSEPD.js +8 -0
- package/dist/register-VAHONCID.js +23 -0
- package/dist/registry-7MLVD3VO.js +19 -0
- package/dist/registry-EPKPD5SM.js +18 -0
- package/dist/registry-P5T7PS2U.js +9 -0
- package/dist/request-withdrawal-TI3A5WPS.js +31 -0
- package/dist/reveal-DIBHLUZX.js +38 -0
- package/dist/reveal-DIBHLUZX.js.map +1 -0
- package/dist/revoke-FDRD6GRW.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/seed-Q6M2IZFL.js +231 -0
- package/dist/seed-Q6M2IZFL.js.map +1 -0
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-MUWEIUI6.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/stale-OSQ7J3AA.js +29 -0
- package/dist/storage-MVFCGEQE.js +23 -0
- package/dist/store-coordination-provider-64OEZFGS.js +142 -0
- package/dist/sync/index.js +9 -9
- package/dist/team/index.js +15 -15
- package/dist/tiers/index.js +14 -10
- package/dist/to/index.js +1 -2
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/verify-ZASTRNPR.js +140 -0
- package/dist/verify-ZASTRNPR.js.map +1 -0
- package/dist/via/blob/active.d.ts +34 -0
- package/dist/via/blob/binding.d.ts +86 -0
- package/dist/via/blob/index.d.ts +34 -0
- package/dist/via/classified/active.d.ts +3 -0
- package/dist/via/classified/binding.d.ts +83 -0
- package/dist/via/classified/config-drift.d.ts +34 -0
- package/dist/via/classified/descriptor.d.ts +66 -0
- package/dist/via/classified/errors.d.ts +19 -0
- package/dist/via/classified/guards.d.ts +23 -0
- package/dist/via/classified/index.d.ts +11 -0
- package/dist/via/classified/presets.d.ts +65 -0
- package/dist/via/classified/resolve.d.ts +9 -0
- package/dist/via/classified/strategy.d.ts +11 -0
- package/dist/via/classified/validators.d.ts +3 -0
- package/dist/via/classified/write.d.ts +4 -0
- package/dist/via/computed/binding.d.ts +34 -0
- package/dist/via/computed/descriptor.d.ts +35 -0
- package/dist/via/i18n/active.d.ts +28 -0
- package/dist/via/i18n/binding.d.ts +36 -0
- package/dist/via/i18n/core.d.ts +267 -0
- package/dist/via/i18n/densify.d.ts +24 -0
- package/dist/via/i18n/dictionary.d.ts +200 -0
- package/dist/via/i18n/index.d.ts +21 -0
- package/dist/via/i18n/policy.d.ts +44 -0
- package/dist/via/i18n/script.d.ts +26 -0
- package/dist/via/i18n/strategy.d.ts +13 -0
- package/dist/via/lookup/active.d.ts +19 -0
- package/dist/via/lookup/binding.d.ts +99 -0
- package/dist/via/lookup/descriptor.d.ts +123 -0
- package/dist/via/lookup/handle.d.ts +220 -0
- package/dist/via/lookup/index.d.ts +17 -0
- package/dist/via/lookup/registry.d.ts +228 -0
- package/dist/via/lookup/snapshot.d.ts +67 -0
- package/dist/via/money/arith.d.ts +68 -0
- package/dist/via/money/binding.d.ts +21 -0
- package/dist/via/money/branded.d.ts +61 -0
- package/dist/via/money/descriptor.d.ts +73 -0
- package/dist/via/money/fixed-point.d.ts +51 -0
- package/dist/via/money/index.d.ts +15 -0
- package/dist/via/money/iso4217.d.ts +6 -0
- package/dist/via/money/money-reducer.d.ts +33 -0
- package/dist/via/money/normalize.d.ts +105 -0
- package/dist/via/money/paths.d.ts +61 -0
- package/dist/via/money/where.d.ts +127 -0
- package/dist/walk-SVNDIZ62.js +241 -0
- package/dist/with/index.js +11 -11
- package/dist/with-audit/attestation/active.d.ts +10 -0
- package/dist/with-audit/attestation/index.d.ts +16 -0
- package/dist/with-audit/attestation/issue.d.ts +29 -0
- package/dist/with-audit/attestation/revoke.d.ts +15 -0
- package/dist/with-audit/attestation/signer.d.ts +33 -0
- package/dist/with-audit/attestation/strategy.d.ts +44 -0
- package/dist/with-audit/attestation/vault-facade.d.ts +62 -0
- package/dist/with-audit/consent/active.d.ts +14 -0
- package/dist/with-audit/consent/consent.d.ts +114 -0
- package/dist/with-audit/consent/index.d.ts +14 -0
- package/dist/with-audit/consent/strategy.d.ts +36 -0
- package/dist/with-audit/forget/active.d.ts +31 -0
- package/dist/with-audit/forget/index.d.ts +28 -0
- package/dist/with-audit/forget/purge-scope.d.ts +54 -0
- package/dist/with-audit/forget/strategy.d.ts +199 -0
- package/dist/with-audit/forget/subject-index.d.ts +83 -0
- package/dist/with-audit/guards/executor.d.ts +26 -0
- package/dist/with-audit/guards/immutable-guard.d.ts +63 -0
- package/dist/with-audit/guards/index.d.ts +10 -0
- package/dist/with-audit/guards/read-only-facade.d.ts +31 -0
- package/dist/with-audit/guards/registry.d.ts +83 -0
- package/dist/with-audit/guards/transition-guard.d.ts +82 -0
- package/dist/with-audit/guards/types.d.ts +134 -0
- package/dist/with-audit/guards/with-guard.d.ts +15 -0
- package/dist/with-audit/periods/active.d.ts +11 -0
- package/dist/with-audit/periods/index.d.ts +18 -0
- package/dist/with-audit/periods/periods.d.ts +417 -0
- package/dist/with-audit/periods/strategy.d.ts +32 -0
- package/dist/with-audit/periods/vault-facade.d.ts +95 -0
- package/dist/with-audit/portability/active.d.ts +11 -0
- package/dist/with-audit/portability/export-accessible.d.ts +46 -0
- package/dist/with-audit/portability/index.d.ts +18 -0
- package/dist/with-audit/portability/request-withdrawal.d.ts +85 -0
- package/dist/with-audit/portability/strategy.d.ts +31 -0
- package/dist/with-audit/portability/withdraw-accessible.d.ts +82 -0
- package/dist/with-audit/sealed-record/active.d.ts +9 -0
- package/dist/with-audit/sealed-record/index.d.ts +55 -0
- package/dist/with-audit/sealed-record/strategy.d.ts +34 -0
- package/dist/with-audit/sealed-record/types.d.ts +27 -0
- package/dist/with-audit/tiers/active.d.ts +9 -0
- package/dist/with-audit/tiers/index.d.ts +394 -0
- package/dist/with-audit/tiers/strategy.d.ts +36 -0
- package/dist/with-cargo/active.d.ts +11 -0
- package/dist/with-cargo/adopt-partition.d.ts +81 -0
- package/dist/with-cargo/decrypt-partition.d.ts +19 -0
- package/dist/with-cargo/describe-extraction.d.ts +41 -0
- package/dist/with-cargo/extract-partition.d.ts +155 -0
- package/dist/with-cargo/index.d.ts +33 -0
- package/dist/with-cargo/strategy.d.ts +30 -0
- package/dist/with-cargo/vault-diff.d.ts +144 -0
- package/dist/with-cargo/walk-closure.d.ts +67 -0
- package/dist/with-commit/crdt/active.d.ts +25 -0
- package/dist/with-commit/crdt/crdt.d.ts +42 -0
- package/dist/with-commit/crdt/index.d.ts +16 -0
- package/dist/with-commit/crdt/strategy.d.ts +25 -0
- package/dist/with-commit/history/active.d.ts +40 -0
- package/dist/with-commit/history/diff.d.ts +23 -0
- package/dist/with-commit/history/history.d.ts +73 -0
- package/dist/with-commit/history/index.d.ts +30 -0
- package/dist/with-commit/history/ledger/constants.d.ts +37 -0
- package/dist/with-commit/history/ledger/entry.d.ts +195 -0
- package/dist/with-commit/history/ledger/hash.d.ts +30 -0
- package/dist/with-commit/history/ledger/index.d.ts +19 -0
- package/dist/with-commit/history/ledger/patch.d.ts +99 -0
- package/dist/with-commit/history/ledger/store.d.ts +356 -0
- package/dist/with-commit/history/strategy.d.ts +136 -0
- package/dist/with-commit/history/time-machine.d.ts +202 -0
- package/dist/with-commit/numbering/descriptor.d.ts +27 -0
- package/dist/with-commit/numbering/index.d.ts +69 -0
- package/dist/with-commit/sequence/active.d.ts +10 -0
- package/dist/with-commit/sequence/index.d.ts +150 -0
- package/dist/with-commit/sequence/strategy.d.ts +26 -0
- package/dist/with-commit/tx/active.d.ts +27 -0
- package/dist/with-commit/tx/dry-run.d.ts +29 -0
- package/dist/with-commit/tx/elevated-handle.d.ts +59 -0
- package/dist/with-commit/tx/index.d.ts +13 -0
- package/dist/with-commit/tx/invariants.d.ts +68 -0
- package/dist/with-commit/tx/strategy.d.ts +23 -0
- package/dist/with-commit/tx/transaction.d.ts +212 -0
- package/dist/with-fork/archive/engine.d.ts +71 -0
- package/dist/with-fork/archive/index.d.ts +23 -0
- package/dist/with-fork/shadow/active.d.ts +6 -0
- package/dist/with-fork/shadow/index.d.ts +14 -0
- package/dist/with-fork/shadow/strategy.d.ts +28 -0
- package/dist/with-fork/shadow/vault-frame.d.ts +93 -0
- package/dist/with-fork/snapshots/active.d.ts +20 -0
- package/dist/with-fork/snapshots/engine.d.ts +36 -0
- package/dist/with-fork/snapshots/index.d.ts +5 -0
- package/dist/with-fork/snapshots/noydb-facade.d.ts +64 -0
- package/dist/with-fork/snapshots/policy.d.ts +23 -0
- package/dist/with-fork/snapshots/scheduler.d.ts +34 -0
- package/dist/with-fork/snapshots/strategy.d.ts +48 -0
- package/dist/with-formula/computed/index.d.ts +48 -0
- package/dist/with-formula/computed/lazy.d.ts +13 -0
- package/dist/with-formula/derivations/executor.d.ts +61 -0
- package/dist/with-formula/derivations/fanout-sidecar.d.ts +75 -0
- package/dist/with-formula/derivations/index.d.ts +6 -0
- package/dist/with-formula/derivations/registry.d.ts +67 -0
- package/dist/with-formula/derivations/stale.d.ts +39 -0
- package/dist/with-formula/derivations/strategy-hash.d.ts +1 -0
- package/dist/with-formula/derivations/types.d.ts +248 -0
- package/dist/with-formula/derivations/with-derivation.d.ts +10 -0
- package/dist/with-formula/derivations/with-rollup.d.ts +34 -0
- package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +58 -0
- package/dist/with-formula/materialized-views/executor.d.ts +80 -0
- package/dist/with-formula/materialized-views/index.d.ts +11 -0
- package/dist/with-formula/materialized-views/query-hash.d.ts +23 -0
- package/dist/with-formula/materialized-views/registry.d.ts +99 -0
- package/dist/with-formula/materialized-views/stale.d.ts +113 -0
- package/dist/with-formula/materialized-views/types.d.ts +318 -0
- package/dist/with-formula/materialized-views/with-materialized-view.d.ts +24 -0
- package/dist/with-formula/overlay-views/index.d.ts +5 -0
- package/dist/with-formula/overlay-views/registry.d.ts +42 -0
- package/dist/with-formula/overlay-views/types.d.ts +97 -0
- package/dist/with-formula/overlay-views/virtual-collection.d.ts +90 -0
- package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +9 -0
- package/dist/with-lookup/aggregate/active.d.ts +33 -0
- package/dist/with-lookup/aggregate/aggregation.d.ts +166 -0
- package/dist/with-lookup/aggregate/canonical-key.d.ts +16 -0
- package/dist/with-lookup/aggregate/groupby.d.ts +280 -0
- package/dist/with-lookup/aggregate/index.d.ts +23 -0
- package/dist/with-lookup/aggregate/reducers.d.ts +257 -0
- package/dist/with-lookup/aggregate/strategy.d.ts +59 -0
- package/dist/with-lookup/embeddings/cosine.d.ts +2 -0
- package/dist/with-lookup/embeddings/descriptor.d.ts +8 -0
- package/dist/with-lookup/embeddings/index.d.ts +4 -0
- package/dist/with-lookup/embeddings/vec-id.d.ts +47 -0
- package/dist/with-lookup/embeddings/vector-set.d.ts +19 -0
- package/dist/with-lookup/indexing/active.d.ts +30 -0
- package/dist/with-lookup/indexing/collection-facade.d.ts +157 -0
- package/dist/with-lookup/indexing/eager-indexes.d.ts +122 -0
- package/dist/with-lookup/indexing/index.d.ts +27 -0
- package/dist/with-lookup/indexing/lazy-builder.d.ts +102 -0
- package/dist/with-lookup/indexing/persisted-indexes.d.ts +229 -0
- package/dist/with-lookup/indexing/strategy.d.ts +56 -0
- package/dist/with-lookup/indexing/unique-constraints.d.ts +74 -0
- package/dist/with-lookup/search/active.d.ts +10 -0
- package/dist/with-lookup/search/build-docs.d.ts +15 -0
- package/dist/with-lookup/search/collection-facade.d.ts +163 -0
- package/dist/with-lookup/search/fuse.d.ts +22 -0
- package/dist/with-lookup/search/index-store.d.ts +19 -0
- package/dist/with-lookup/search/index.d.ts +19 -0
- package/dist/with-lookup/search/inverted-index.d.ts +47 -0
- package/dist/with-lookup/search/persisted-index-store.d.ts +121 -0
- package/dist/with-lookup/search/retrieve-types.d.ts +29 -0
- package/dist/with-lookup/search/scan.d.ts +28 -0
- package/dist/with-lookup/search/segment.d.ts +15 -0
- package/dist/with-lookup/search/serialize.d.ts +4 -0
- package/dist/with-lookup/search/snippet.d.ts +5 -0
- package/dist/with-lookup/search/strategy.d.ts +41 -0
- package/dist/with-lookup/search/tokenize.d.ts +12 -0
- package/dist/with-party/auth-introspection/index.d.ts +44 -0
- package/dist/with-party/broker/active.d.ts +23 -0
- package/dist/with-party/broker/index.d.ts +28 -0
- package/dist/with-party/broker/seed.d.ts +77 -0
- package/dist/with-party/custody/active.d.ts +10 -0
- package/dist/with-party/custody/index.d.ts +69 -0
- package/dist/with-party/custody/liberate.d.ts +64 -0
- package/dist/with-party/custody/strategy.d.ts +48 -0
- package/dist/with-party/directory/index.d.ts +11 -0
- package/dist/with-party/directory/public-envelope/index.d.ts +12 -0
- package/dist/with-party/directory/public-envelope/schema.d.ts +24 -0
- package/dist/with-party/directory/public-envelope/storage.d.ts +59 -0
- package/dist/with-party/directory/public-envelope/types.d.ts +80 -0
- package/dist/with-party/directory/storage.d.ts +33 -0
- package/dist/with-party/directory/types.d.ts +43 -0
- package/dist/with-party/directory/user-envelope/api.d.ts +201 -0
- package/dist/with-party/directory/user-envelope/index.d.ts +12 -0
- package/dist/with-party/directory/user-envelope/storage.d.ts +54 -0
- package/dist/with-party/directory/visibility.d.ts +47 -0
- package/dist/with-party/policy/engine.d.ts +60 -0
- package/dist/with-party/policy/index.d.ts +15 -0
- package/dist/with-party/policy/noydb-facade.d.ts +39 -0
- package/dist/with-party/policy/presets.d.ts +38 -0
- package/dist/with-party/policy/storage.d.ts +31 -0
- package/dist/with-party/session/active.d.ts +34 -0
- package/dist/with-party/session/dev-unlock.d.ts +128 -0
- package/dist/with-party/session/index.d.ts +23 -0
- package/dist/with-party/session/session-policy.d.ts +92 -0
- package/dist/with-party/session/session.d.ts +131 -0
- package/dist/with-party/session/strategy.d.ts +42 -0
- package/dist/with-party/session/unlock-state.d.ts +47 -0
- package/dist/with-party/sync/index.d.ts +31 -0
- package/dist/with-party/tab-coordination.d.ts +73 -0
- package/dist/with-party/tab-write-relay.d.ts +39 -0
- package/dist/with-party/team/active.d.ts +13 -0
- package/dist/with-party/team/authenticators.d.ts +95 -0
- package/dist/with-party/team/deed.d.ts +97 -0
- package/dist/with-party/team/delegation.d.ts +88 -0
- package/dist/with-party/team/index.d.ts +38 -0
- package/dist/with-party/team/keyring.d.ts +318 -0
- package/dist/with-party/team/magic-link-grant.d.ts +152 -0
- package/dist/with-party/team/managed-passphrase.d.ts +280 -0
- package/dist/with-party/team/noydb-facade.d.ts +484 -0
- package/dist/with-party/team/peer-recover.d.ts +81 -0
- package/dist/with-party/team/presence.d.ts +81 -0
- package/dist/with-party/team/recovery.d.ts +191 -0
- package/dist/with-party/team/reserved-secret-collections.d.ts +41 -0
- package/dist/with-party/team/rotate-recover.d.ts +275 -0
- package/dist/with-party/team/shamir-recovery-provider.d.ts +15 -0
- package/dist/with-party/team/strategy.d.ts +9 -0
- package/dist/with-party/team/sync-active.d.ts +33 -0
- package/dist/with-party/team/sync-credentials.d.ts +113 -0
- package/dist/with-party/team/sync-strategy.d.ts +67 -0
- package/dist/with-party/team/sync-transaction.d.ts +39 -0
- package/dist/with-party/team/sync.d.ts +174 -0
- package/dist/with-party/team/tiers.d.ts +39 -0
- package/dist/with-party/team/wrapped-deks.d.ts +86 -0
- package/dist/with-pod/backup.d.ts +74 -0
- package/dist/with-pod/bundle.d.ts +414 -0
- package/dist/with-pod/format.d.ts +203 -0
- package/dist/with-pod/index.d.ts +20 -0
- package/dist/with-pod/pod-store.d.ts +54 -0
- package/dist/with-pod/ulid.d.ts +64 -0
- package/dist/with-shape/blobs/blob-compaction.d.ts +170 -0
- package/dist/with-shape/blobs/blob-intent.d.ts +153 -0
- package/dist/with-shape/blobs/blob-set.d.ts +1286 -0
- package/dist/with-shape/blobs/export-blobs.d.ts +110 -0
- package/dist/with-shape/blobs/import-external.d.ts +50 -0
- package/dist/with-shape/blobs/mime-magic.d.ts +48 -0
- package/dist/with-shape/blobs/object-projection.d.ts +70 -0
- package/dist/with-shape/introspection/describe.d.ts +237 -0
- package/dist/with-shape/introspection/field-meta.d.ts +61 -0
- package/dist/with-shape/introspection/fields.d.ts +14 -0
- package/dist/with-shape/introspection/index.d.ts +12 -0
- package/dist/with-shape/introspection/json-schema.d.ts +13 -0
- package/dist/with-shape/introspection/meta.d.ts +22 -0
- package/dist/with-shape/introspection/projection.d.ts +13 -0
- package/dist/with-shape/introspection/types.d.ts +154 -0
- package/dist/with-shape/introspection/walk.d.ts +50 -0
- package/dist/with-shape/links/lazy-handle.d.ts +36 -0
- package/dist/with-shape/links/link-set.d.ts +67 -0
- package/dist/with-shape/links/names.d.ts +65 -0
- package/dist/with-shape/links/vault-facade.d.ts +211 -0
- package/dist/with-shape/persisted-schemas/canonicalize.d.ts +11 -0
- package/dist/with-shape/persisted-schemas/derive.d.ts +29 -0
- package/dist/with-shape/persisted-schemas/index.d.ts +21 -0
- package/dist/with-shape/persisted-schemas/register.d.ts +66 -0
- package/dist/with-shape/persisted-schemas/storage.d.ts +61 -0
- package/dist/with-shape/persisted-schemas/types.d.ts +54 -0
- package/dist/with-shape/satellites/dead-filter.d.ts +21 -0
- package/dist/with-shape/satellites/declare.d.ts +60 -0
- package/dist/with-shape/satellites/existence.d.ts +5 -0
- package/dist/with-shape/satellites/fanout.d.ts +38 -0
- package/dist/with-shape/satellites/forget.d.ts +47 -0
- package/dist/with-shape/satellites/index.d.ts +3 -0
- package/dist/with-shape/satellites/joined.d.ts +19 -0
- package/dist/with-shape/satellites/marker.d.ts +10 -0
- package/dist/with-shape/satellites/migrate-cek.d.ts +26 -0
- package/dist/with-shape/satellites/post-register.d.ts +6 -0
- package/dist/with-shape/satellites/proxy.d.ts +37 -0
- package/dist/with-shape/satellites/raw-target.d.ts +14 -0
- package/dist/with-shape/satellites/registry.d.ts +19 -0
- package/dist/with-shape/satellites/types.d.ts +37 -0
- package/dist/with-shape/satellites/validate.d.ts +17 -0
- package/dist/with-shape/schema-update/client-registry.d.ts +35 -0
- package/dist/with-shape/schema-update/cutover.d.ts +5 -0
- package/dist/with-shape/schema-update/delta.d.ts +2 -0
- package/dist/with-shape/schema-update/dispatch.d.ts +3 -0
- package/dist/with-shape/schema-update/fence-controller.d.ts +62 -0
- package/dist/with-shape/schema-update/fence-watcher.d.ts +37 -0
- package/dist/with-shape/schema-update/fence.d.ts +15 -0
- package/dist/with-shape/schema-update/gate.d.ts +16 -0
- package/dist/with-shape/schema-update/index.d.ts +6 -0
- package/dist/with-shape/schema-update/store-coordination-provider.d.ts +29 -0
- package/dist/with-shape/schema-update/strategies.d.ts +12 -0
- package/dist/with-shape/schema-update/types.d.ts +53 -0
- package/dist/with-store/index.d.ts +15 -0
- package/dist/with-store/lazy/active.d.ts +12 -0
- package/dist/with-store/lazy/index.d.ts +14 -0
- package/dist/with-store/lazy/strategy.d.ts +9 -0
- package/dist/with-store/route-store.d.ts +259 -0
- package/dist/with-store/store-middleware.d.ts +189 -0
- package/dist/withdraw-accessible-WZIEVWSR.js +28 -0
- package/package.json +47 -55
- package/dist/adapter/index.d.ts +0 -5
- package/dist/adapter/index.js +0 -15
- package/dist/aggregate/index.d.ts +0 -42
- package/dist/api-JDWL67WL.js +0 -20
- package/dist/as/index.d.ts +0 -7
- package/dist/at/index.d.ts +0 -5
- package/dist/attestation/index.d.ts +0 -20
- package/dist/backup-WRGNTGJF.js +0 -225
- package/dist/backup-WRGNTGJF.js.map +0 -1
- package/dist/blobs/index.d.ts +0 -44
- package/dist/bundle/index.d.ts +0 -122
- package/dist/bundle-DzWtVw7w.d.ts +0 -548
- package/dist/by/index.d.ts +0 -1
- package/dist/cargo/index.d.ts +0 -9
- package/dist/chunk-25G7PUTA.js +0 -235
- package/dist/chunk-26FSVNBL.js +0 -34
- package/dist/chunk-2PJB6H3H.js +0 -167
- package/dist/chunk-2PJB6H3H.js.map +0 -1
- package/dist/chunk-37JZR7CY.js +0 -91
- package/dist/chunk-3KBK5LU4.js +0 -117
- package/dist/chunk-3YKBGS3I.js +0 -686
- package/dist/chunk-3YKBGS3I.js.map +0 -1
- package/dist/chunk-44DV37ZV.js +0 -75
- package/dist/chunk-44DV37ZV.js.map +0 -1
- package/dist/chunk-47C4CI7R.js +0 -108
- package/dist/chunk-47C4CI7R.js.map +0 -1
- package/dist/chunk-4VDFUBTS.js +0 -275
- package/dist/chunk-4VDFUBTS.js.map +0 -1
- package/dist/chunk-55LSDABW.js +0 -94
- package/dist/chunk-56JB2BGI.js +0 -13003
- package/dist/chunk-56JB2BGI.js.map +0 -1
- package/dist/chunk-5GQE5IDB.js +0 -513
- package/dist/chunk-5GQE5IDB.js.map +0 -1
- package/dist/chunk-5HRJQSKN.js +0 -202
- package/dist/chunk-5HZULLHE.js +0 -404
- package/dist/chunk-5JQMX2EH.js +0 -50
- package/dist/chunk-5UOPIPZC.js +0 -95
- package/dist/chunk-5YBUFCFF.js +0 -135
- package/dist/chunk-62APEMF3.js +0 -280
- package/dist/chunk-62APEMF3.js.map +0 -1
- package/dist/chunk-6P5AJ2ZS.js +0 -120
- package/dist/chunk-6P5AJ2ZS.js.map +0 -1
- package/dist/chunk-6PALJTC2.js +0 -430
- package/dist/chunk-6PALJTC2.js.map +0 -1
- package/dist/chunk-6S7T6WC4.js +0 -111
- package/dist/chunk-6S7T6WC4.js.map +0 -1
- package/dist/chunk-6Z435B6N.js +0 -1656
- package/dist/chunk-6Z435B6N.js.map +0 -1
- package/dist/chunk-723XB5NX.js +0 -86
- package/dist/chunk-7CZ6YXMO.js +0 -124
- package/dist/chunk-7KTL4RHZ.js +0 -120
- package/dist/chunk-7KTL4RHZ.js.map +0 -1
- package/dist/chunk-7TAV3BFQ.js +0 -766
- package/dist/chunk-7TAV3BFQ.js.map +0 -1
- package/dist/chunk-BASCPHNM.js +0 -380
- package/dist/chunk-BASCPHNM.js.map +0 -1
- package/dist/chunk-BGIZAFY7.js +0 -1
- package/dist/chunk-BJ2XF2RC.js +0 -823
- package/dist/chunk-BM6E4MUT.js +0 -881
- package/dist/chunk-BM6E4MUT.js.map +0 -1
- package/dist/chunk-BTFTHF6Q.js +0 -42
- package/dist/chunk-C4NOLA5X.js +0 -132
- package/dist/chunk-C4NOLA5X.js.map +0 -1
- package/dist/chunk-CHK5VVMI.js +0 -155
- package/dist/chunk-DCVVCJVB.js +0 -45
- package/dist/chunk-EU7HDMT3.js +0 -54
- package/dist/chunk-F3EKFGUS.js +0 -99
- package/dist/chunk-FCOZ7DEC.js +0 -355
- package/dist/chunk-FCOZ7DEC.js.map +0 -1
- package/dist/chunk-FWART3VA.js +0 -205
- package/dist/chunk-FZK3JJJK.js +0 -150
- package/dist/chunk-GDOOG5YQ.js +0 -382
- package/dist/chunk-GLVXQU3E.js +0 -155
- package/dist/chunk-HU55NPHZ.js +0 -80
- package/dist/chunk-I6JJ6VJS.js +0 -97
- package/dist/chunk-I6URUNTD.js +0 -59
- package/dist/chunk-IARAK3PK.js +0 -14
- package/dist/chunk-II6DLDZM.js +0 -30
- package/dist/chunk-J5YUA6JB.js +0 -23
- package/dist/chunk-J7OH6R4K.js +0 -49
- package/dist/chunk-K2WCO3NX.js +0 -1
- package/dist/chunk-L6Q5NA22.js +0 -40
- package/dist/chunk-LFGJG4XZ.js +0 -30
- package/dist/chunk-M3OYTM5Z.js +0 -85
- package/dist/chunk-MOQ5M46U.js +0 -209
- package/dist/chunk-NTPWQH4S.js +0 -589
- package/dist/chunk-OJ64XMPJ.js +0 -1434
- package/dist/chunk-OJ64XMPJ.js.map +0 -1
- package/dist/chunk-OWGAXPRE.js +0 -129
- package/dist/chunk-P2PEPSPK.js +0 -230
- package/dist/chunk-P6TZ3IVN.js +0 -453
- package/dist/chunk-P6TZ3IVN.js.map +0 -1
- package/dist/chunk-PAJCRV7O.js +0 -123
- package/dist/chunk-PMMV5SQC.js +0 -416
- package/dist/chunk-PMMV5SQC.js.map +0 -1
- package/dist/chunk-PPPZIBKY.js +0 -261
- package/dist/chunk-PPPZIBKY.js.map +0 -1
- package/dist/chunk-PVC2FBCQ.js +0 -45
- package/dist/chunk-PYIUDUGS.js +0 -36
- package/dist/chunk-QABECTNN.js +0 -255
- package/dist/chunk-QYMMMKOO.js +0 -164
- package/dist/chunk-R4IVPJHN.js +0 -130
- package/dist/chunk-REWTMYSF.js +0 -32
- package/dist/chunk-REWTMYSF.js.map +0 -1
- package/dist/chunk-RNYDHIQL.js +0 -367
- package/dist/chunk-RUIMKQTA.js +0 -23
- package/dist/chunk-RUIMKQTA.js.map +0 -1
- package/dist/chunk-TCGVRKOS.js +0 -367
- package/dist/chunk-TIAYXOEI.js +0 -99
- package/dist/chunk-TQ3REHVF.js +0 -95
- package/dist/chunk-TQ3REHVF.js.map +0 -1
- package/dist/chunk-TUL5YQWF.js +0 -777
- package/dist/chunk-U7LV2DUN.js +0 -74
- package/dist/chunk-UB3XHGFG.js +0 -181
- package/dist/chunk-UB3XHGFG.js.map +0 -1
- package/dist/chunk-UMH35AQV.js +0 -70
- package/dist/chunk-UWZ7O4NR.js +0 -29
- package/dist/chunk-V76PHWLE.js +0 -41
- package/dist/chunk-VFQOE76I.js +0 -69
- package/dist/chunk-VIWOGJ2O.js +0 -71
- package/dist/chunk-VK6OC22R.js +0 -37
- package/dist/chunk-VK6OC22R.js.map +0 -1
- package/dist/chunk-VVLOWY74.js +0 -150
- package/dist/chunk-VVLOWY74.js.map +0 -1
- package/dist/chunk-W3JABOVB.js +0 -53
- package/dist/chunk-W3JABOVB.js.map +0 -1
- package/dist/chunk-WPNP3NF5.js +0 -1221
- package/dist/chunk-WPNP3NF5.js.map +0 -1
- package/dist/chunk-X5QZAJDB.js +0 -59
- package/dist/chunk-X6VNIRHS.js +0 -239
- package/dist/chunk-X6VNIRHS.js.map +0 -1
- package/dist/chunk-XBPUVQDO.js +0 -664
- package/dist/chunk-XBPUVQDO.js.map +0 -1
- package/dist/chunk-XW5LZYV4.js +0 -21
- package/dist/chunk-YTCCC6NG.js +0 -320
- package/dist/chunk-YTCCC6NG.js.map +0 -1
- package/dist/classified/index.d.ts +0 -17
- package/dist/collection-facade-EJVIN2BY.js +0 -39
- package/dist/computed-6FOFXQPE.js +0 -11
- package/dist/config-drift-RFEVGBKR.js +0 -24
- package/dist/config-drift-RFEVGBKR.js.map +0 -1
- package/dist/consent/index.d.ts +0 -23
- package/dist/crdt/index.d.ts +0 -34
- package/dist/dead-filter-RHMNYOXP.js +0 -28
- package/dist/decrypt-partition-IHtxEnTi.d.ts +0 -21
- package/dist/delegation-IHXOASHV.js +0 -25
- package/dist/derivations/index.d.ts +0 -70
- package/dist/derive-CD3ZVIXK.js +0 -21
- package/dist/describe/index.d.ts +0 -1
- package/dist/describe/index.js +0 -1
- package/dist/describe-C6iHNlqJ.d.ts +0 -162
- package/dist/dev-unlock-wgQ7Ci5I.d.ts +0 -263
- package/dist/discriminant-BN9REW3o.d.ts +0 -60
- package/dist/enclave-KGEUW2GL.js +0 -123
- package/dist/executor-EUPYHCLU.js +0 -9
- package/dist/executor-KZ4B3PRT.js +0 -9
- package/dist/executor-MHUM2VZK.js +0 -21
- package/dist/export-accessible-Z3NSZZHN.js +0 -23
- package/dist/extract-partition-VSKT35JG.js +0 -36
- package/dist/fanout-sidecar-NBDKKCHT.js +0 -74
- package/dist/find-OH4BEULF.js +0 -11
- package/dist/forget/index.d.ts +0 -36
- package/dist/guards/index.d.ts +0 -35
- package/dist/hash-CwHnoKyW.d.ts +0 -72
- package/dist/history/index.d.ts +0 -61
- package/dist/i18n/index.d.ts +0 -37
- package/dist/in/index.d.ts +0 -5
- package/dist/index-B9QdHytu.d.ts +0 -123
- package/dist/index-CTvUp94-.d.ts +0 -123
- package/dist/index-Dn5GzPg_.d.ts +0 -22138
- package/dist/indexing/index.d.ts +0 -39
- package/dist/issue-AEOL6RXA.js +0 -19
- package/dist/kernel/index.d.ts +0 -32
- package/dist/kernel/index.js +0 -59
- package/dist/lazy/index.d.ts +0 -21
- package/dist/ledger-3LR3YO2W.js +0 -42
- package/dist/liberate-XSEPRWEA.js +0 -24
- package/dist/link-set-NSUIX6BR.js +0 -31
- package/dist/materialized-views/index.d.ts +0 -173
- package/dist/mime-magic-CYbFNQ4h.d.ts +0 -103
- package/dist/noydb-POVTIVQ6.js +0 -62
- package/dist/on/index.d.ts +0 -5
- package/dist/overlay-views/index.d.ts +0 -98
- package/dist/periods/index.d.ts +0 -20
- package/dist/pod/index.d.ts +0 -63
- package/dist/policy-Y7HL2KGA.js +0 -41
- package/dist/portability/index.d.ts +0 -20
- package/dist/post-register-KOFRTCDD.js +0 -55
- package/dist/post-register-KOFRTCDD.js.map +0 -1
- package/dist/public-envelope-NC7SPNMV.js +0 -32
- package/dist/query/index.d.ts +0 -5
- package/dist/read-only-facade-5ADRJVTM.js +0 -8
- package/dist/register-3D6R2MKN.js +0 -23
- package/dist/registry-AI4E46PD.js +0 -19
- package/dist/registry-HSNQ4NBP.js +0 -9
- package/dist/registry-WIX6QCV5.js +0 -17
- package/dist/request-withdrawal-GU4XS2R5.js +0 -31
- package/dist/reveal-5Y777N5Q.js +0 -38
- package/dist/reveal-5Y777N5Q.js.map +0 -1
- package/dist/revoke-ZFETCLYV.js +0 -24
- package/dist/revoke-ZFETCLYV.js.map +0 -1
- package/dist/satellites/index.d.ts +0 -5
- package/dist/sealed-record/index.d.ts +0 -69
- package/dist/session/index.d.ts +0 -44
- package/dist/shadow/index.d.ts +0 -15
- package/dist/signer-GAIMQQ2J.js +0 -25
- package/dist/signer-GAIMQQ2J.js.map +0 -1
- package/dist/snapshots/index.d.ts +0 -26
- package/dist/stale-77LP2EEF.js +0 -14
- package/dist/stale-77LP2EEF.js.map +0 -1
- package/dist/storage-KEXIXLGM.js +0 -23
- package/dist/storage-KEXIXLGM.js.map +0 -1
- package/dist/store-coordination-provider-NJDDZ264.js +0 -142
- package/dist/subject-index-O75wKshW.d.ts +0 -362
- package/dist/sync/index.d.ts +0 -41
- package/dist/team/index.d.ts +0 -155
- package/dist/tiers/index.d.ts +0 -5
- package/dist/to/index.d.ts +0 -5
- package/dist/transition-guard-D5RLJv8S.d.ts +0 -165
- package/dist/tx/index.d.ts +0 -35
- package/dist/ui/index.d.ts +0 -1
- package/dist/ulid-DRH25k3y.d.ts +0 -66
- package/dist/util/index.d.ts +0 -79
- package/dist/validators-C3lrVF-c.d.ts +0 -101
- package/dist/vault-diff-_LSIcOMv.d.ts +0 -147
- package/dist/verify-CAYGXYNO.js +0 -139
- package/dist/verify-CAYGXYNO.js.map +0 -1
- package/dist/walk-SMAE4IEI.js +0 -241
- package/dist/with/index.d.ts +0 -38
- package/dist/with-materialized-view-Xv1-9Bh0.d.ts +0 -27
- package/dist/with-overlayed-view-CuWhq_-C.d.ts +0 -12
- package/dist/with-rollup-K_iwal4b.d.ts +0 -47
- package/dist/withdraw-accessible-Q7BULAN5.js +0 -28
- package/dist/withdraw-accessible-Q7BULAN5.js.map +0 -1
- /package/dist/{adapter/index.js.map → api-ZGS6LCOF.js.map} +0 -0
- /package/dist/{chunk-VIWOGJ2O.js.map → chunk-3B5VVCNY.js.map} +0 -0
- /package/dist/{chunk-P2PEPSPK.js.map → chunk-3LQ2YKO4.js.map} +0 -0
- /package/dist/{chunk-EU7HDMT3.js.map → chunk-3QCRBHCY.js.map} +0 -0
- /package/dist/{chunk-FZK3JJJK.js.map → chunk-4JBYV75E.js.map} +0 -0
- /package/dist/{chunk-I6JJ6VJS.js.map → chunk-4NXKCLLQ.js.map} +0 -0
- /package/dist/{chunk-VFQOE76I.js.map → chunk-5M5DVGV7.js.map} +0 -0
- /package/dist/{chunk-LFGJG4XZ.js.map → chunk-5YOLBEQ6.js.map} +0 -0
- /package/dist/{chunk-OWGAXPRE.js.map → chunk-6CRIV7DE.js.map} +0 -0
- /package/dist/{chunk-QABECTNN.js.map → chunk-6QTNZJBS.js.map} +0 -0
- /package/dist/{chunk-723XB5NX.js.map → chunk-6T2SCQRU.js.map} +0 -0
- /package/dist/{chunk-PVC2FBCQ.js.map → chunk-7DSTRQIJ.js.map} +0 -0
- /package/dist/{chunk-NTPWQH4S.js.map → chunk-AUSTCW2X.js.map} +0 -0
- /package/dist/{chunk-MOQ5M46U.js.map → chunk-B3HJYUOF.js.map} +0 -0
- /package/dist/{chunk-QYMMMKOO.js.map → chunk-BDVFPG6Y.js.map} +0 -0
- /package/dist/{chunk-PYIUDUGS.js.map → chunk-CAF6WOK7.js.map} +0 -0
- /package/dist/{chunk-5HZULLHE.js.map → chunk-CIE2BASH.js.map} +0 -0
- /package/dist/{chunk-BTFTHF6Q.js.map → chunk-CRI4OUV4.js.map} +0 -0
- /package/dist/{chunk-37JZR7CY.js.map → chunk-DLG74CNB.js.map} +0 -0
- /package/dist/{chunk-TCGVRKOS.js.map → chunk-ERJ7FU55.js.map} +0 -0
- /package/dist/{chunk-FWART3VA.js.map → chunk-EVVGJDRQ.js.map} +0 -0
- /package/dist/{chunk-X5QZAJDB.js.map → chunk-EXK7QRWF.js.map} +0 -0
- /package/dist/{chunk-5HRJQSKN.js.map → chunk-EYZ6IQ6X.js.map} +0 -0
- /package/dist/{chunk-DCVVCJVB.js.map → chunk-F64IRYG3.js.map} +0 -0
- /package/dist/{chunk-BJ2XF2RC.js.map → chunk-FHS2HQSH.js.map} +0 -0
- /package/dist/{chunk-HU55NPHZ.js.map → chunk-GKEWXIV5.js.map} +0 -0
- /package/dist/{chunk-I6URUNTD.js.map → chunk-GTGPO5KW.js.map} +0 -0
- /package/dist/{chunk-5UOPIPZC.js.map → chunk-HB3RFQSC.js.map} +0 -0
- /package/dist/{chunk-F3EKFGUS.js.map → chunk-I6GALP6E.js.map} +0 -0
- /package/dist/{chunk-R4IVPJHN.js.map → chunk-IL6POWCW.js.map} +0 -0
- /package/dist/{chunk-3KBK5LU4.js.map → chunk-IU6SNYX6.js.map} +0 -0
- /package/dist/{chunk-TUL5YQWF.js.map → chunk-J2ZX2XUV.js.map} +0 -0
- /package/dist/{chunk-UWZ7O4NR.js.map → chunk-JKJOGPZN.js.map} +0 -0
- /package/dist/{chunk-V76PHWLE.js.map → chunk-JZUV47FZ.js.map} +0 -0
- /package/dist/{chunk-II6DLDZM.js.map → chunk-K5IMOGHB.js.map} +0 -0
- /package/dist/{chunk-GDOOG5YQ.js.map → chunk-LASZKVMO.js.map} +0 -0
- /package/dist/{chunk-5YBUFCFF.js.map → chunk-NR5LT5RY.js.map} +0 -0
- /package/dist/{chunk-UMH35AQV.js.map → chunk-Q5VNKNE5.js.map} +0 -0
- /package/dist/{chunk-XW5LZYV4.js.map → chunk-QLWMEXCT.js.map} +0 -0
- /package/dist/{chunk-PAJCRV7O.js.map → chunk-QRB7NAOJ.js.map} +0 -0
- /package/dist/{chunk-U7LV2DUN.js.map → chunk-R4ROFEYC.js.map} +0 -0
- /package/dist/{chunk-RNYDHIQL.js.map → chunk-RIX4V2TB.js.map} +0 -0
- /package/dist/{chunk-L6Q5NA22.js.map → chunk-RYCTDFUX.js.map} +0 -0
- /package/dist/{chunk-CHK5VVMI.js.map → chunk-RZ5SVOYR.js.map} +0 -0
- /package/dist/{chunk-TIAYXOEI.js.map → chunk-SLFHQTTW.js.map} +0 -0
- /package/dist/{chunk-J5YUA6JB.js.map → chunk-UNFPPVNI.js.map} +0 -0
- /package/dist/{chunk-25G7PUTA.js.map → chunk-VLFCJYTL.js.map} +0 -0
- /package/dist/{chunk-7CZ6YXMO.js.map → chunk-VN3DBQAU.js.map} +0 -0
- /package/dist/{chunk-J7OH6R4K.js.map → chunk-VZRODIM3.js.map} +0 -0
- /package/dist/{chunk-55LSDABW.js.map → chunk-W22IKJE2.js.map} +0 -0
- /package/dist/{chunk-GLVXQU3E.js.map → chunk-X3YYQWOQ.js.map} +0 -0
- /package/dist/{chunk-M3OYTM5Z.js.map → chunk-YFXZEAYK.js.map} +0 -0
- /package/dist/{chunk-5JQMX2EH.js.map → chunk-ZAJAVEXY.js.map} +0 -0
- /package/dist/{chunk-26FSVNBL.js.map → chunk-ZICD77GM.js.map} +0 -0
- /package/dist/{chunk-IARAK3PK.js.map → chunk-ZUODRVHY.js.map} +0 -0
- /package/dist/{api-JDWL67WL.js.map → collection-facade-TLWIPI76.js.map} +0 -0
- /package/dist/{chunk-BGIZAFY7.js.map → computed-ZIQTYTDI.js.map} +0 -0
- /package/dist/{dead-filter-RHMNYOXP.js.map → dead-filter-ESOBZZP5.js.map} +0 -0
- /package/dist/{chunk-K2WCO3NX.js.map → delegation-W7ZV2322.js.map} +0 -0
- /package/dist/{collection-facade-EJVIN2BY.js.map → derive-H2BJTLUI.js.map} +0 -0
- /package/dist/{computed-6FOFXQPE.js.map → enclave-AP3I5W7O.js.map} +0 -0
- /package/dist/{delegation-IHXOASHV.js.map → executor-KGWTNEQD.js.map} +0 -0
- /package/dist/{derive-CD3ZVIXK.js.map → executor-OVEXR6RT.js.map} +0 -0
- /package/dist/{describe/index.js.map → executor-UNEH5ZYH.js.map} +0 -0
- /package/dist/{enclave-KGEUW2GL.js.map → export-accessible-PCMXSUZS.js.map} +0 -0
- /package/dist/{executor-EUPYHCLU.js.map → extract-partition-SWHFSYJO.js.map} +0 -0
- /package/dist/{fanout-sidecar-NBDKKCHT.js.map → fanout-sidecar-A765THMX.js.map} +0 -0
- /package/dist/{executor-KZ4B3PRT.js.map → find-N6345CNT.js.map} +0 -0
- /package/dist/{executor-MHUM2VZK.js.map → issue-5OKB6I2R.js.map} +0 -0
- /package/dist/{export-accessible-Z3NSZZHN.js.map → ledger-GFBKVPV4.js.map} +0 -0
- /package/dist/{extract-partition-VSKT35JG.js.map → liberate-3VDOT4KO.js.map} +0 -0
- /package/dist/{find-OH4BEULF.js.map → link-set-Z7Q2ASFX.js.map} +0 -0
- /package/dist/{issue-AEOL6RXA.js.map → noydb-ZCJOYBDI.js.map} +0 -0
- /package/dist/{kernel/index.js.map → policy-Z3RUAIY2.js.map} +0 -0
- /package/dist/{ledger-3LR3YO2W.js.map → public-envelope-B4KNWVUA.js.map} +0 -0
- /package/dist/{liberate-XSEPRWEA.js.map → read-only-facade-CHCKSEPD.js.map} +0 -0
- /package/dist/{link-set-NSUIX6BR.js.map → register-VAHONCID.js.map} +0 -0
- /package/dist/{noydb-POVTIVQ6.js.map → registry-7MLVD3VO.js.map} +0 -0
- /package/dist/{policy-Y7HL2KGA.js.map → registry-EPKPD5SM.js.map} +0 -0
- /package/dist/{public-envelope-NC7SPNMV.js.map → registry-P5T7PS2U.js.map} +0 -0
- /package/dist/{read-only-facade-5ADRJVTM.js.map → request-withdrawal-TI3A5WPS.js.map} +0 -0
- /package/dist/{register-3D6R2MKN.js.map → revoke-FDRD6GRW.js.map} +0 -0
- /package/dist/{registry-AI4E46PD.js.map → signer-MUWEIUI6.js.map} +0 -0
- /package/dist/{registry-HSNQ4NBP.js.map → stale-OSQ7J3AA.js.map} +0 -0
- /package/dist/{registry-WIX6QCV5.js.map → storage-MVFCGEQE.js.map} +0 -0
- /package/dist/{store-coordination-provider-NJDDZ264.js.map → store-coordination-provider-64OEZFGS.js.map} +0 -0
- /package/dist/{walk-SMAE4IEI.js.map → walk-SVNDIZ62.js.map} +0 -0
- /package/dist/{request-withdrawal-GU4XS2R5.js.map → withdraw-accessible-WZIEVWSR.js.map} +0 -0
|
@@ -0,0 +1,1128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isDeleteMarker,
|
|
3
|
+
isTombstone
|
|
4
|
+
} from "./chunk-7DSTRQIJ.js";
|
|
5
|
+
import {
|
|
6
|
+
blindedEqual,
|
|
7
|
+
openVdigPayload,
|
|
8
|
+
sealVdigPayload
|
|
9
|
+
} from "./chunk-HB3RFQSC.js";
|
|
10
|
+
import {
|
|
11
|
+
dualReadSealedSlot,
|
|
12
|
+
parseSealedSlot
|
|
13
|
+
} from "./chunk-JKJOGPZN.js";
|
|
14
|
+
import {
|
|
15
|
+
mintBidxTag
|
|
16
|
+
} from "./chunk-5M5DVGV7.js";
|
|
17
|
+
import {
|
|
18
|
+
VDIG_ITERATIONS,
|
|
19
|
+
normalizeForVerify,
|
|
20
|
+
pbkdf2VerifyDigest
|
|
21
|
+
} from "./chunk-LP7BEXCT.js";
|
|
22
|
+
import {
|
|
23
|
+
base64ToBuffer,
|
|
24
|
+
bufferToBase64,
|
|
25
|
+
decrypt,
|
|
26
|
+
deriveDeterministicKey,
|
|
27
|
+
deriveSealedFieldKey,
|
|
28
|
+
deriveSealedFieldKeyFromCek,
|
|
29
|
+
encrypt,
|
|
30
|
+
encryptDeterministic,
|
|
31
|
+
generateDEK,
|
|
32
|
+
generateSalt,
|
|
33
|
+
unwrapCek,
|
|
34
|
+
wrapCek
|
|
35
|
+
} from "./chunk-CIE2BASH.js";
|
|
36
|
+
import {
|
|
37
|
+
NOYDB_FORMAT_VERSION,
|
|
38
|
+
SealedHandle
|
|
39
|
+
} from "./chunk-JNAI2HN2.js";
|
|
40
|
+
import {
|
|
41
|
+
ClassifiedConfigError,
|
|
42
|
+
ClassifiedRotationError,
|
|
43
|
+
DebugReservedFieldError,
|
|
44
|
+
RecordCekNotFoundError,
|
|
45
|
+
SchemaValidationError,
|
|
46
|
+
TamperedError,
|
|
47
|
+
ValidationError
|
|
48
|
+
} from "./chunk-BIOUI4HL.js";
|
|
49
|
+
|
|
50
|
+
// src/kernel/enclave/record-keys/lifecycle.ts
|
|
51
|
+
async function resolveStableCek(deps, id) {
|
|
52
|
+
const cached = deps.cache?.get(id);
|
|
53
|
+
if (cached) return cached;
|
|
54
|
+
const live = await deps.getLive(id);
|
|
55
|
+
if (live?._cek !== void 0) {
|
|
56
|
+
const cek = await unwrapCek(live._cek, await deps.getDEK());
|
|
57
|
+
deps.cache?.set(id, cek, 1);
|
|
58
|
+
return cek;
|
|
59
|
+
}
|
|
60
|
+
const fresh = await generateDEK();
|
|
61
|
+
deps.cache?.set(id, fresh, 1);
|
|
62
|
+
return fresh;
|
|
63
|
+
}
|
|
64
|
+
async function rewrapBodyToDek(envelope, fromDek, toDek) {
|
|
65
|
+
if (envelope._cek !== void 0) {
|
|
66
|
+
const cek = await unwrapCek(envelope._cek, fromDek);
|
|
67
|
+
const plaintext2 = await decrypt(envelope._iv, envelope._data, cek);
|
|
68
|
+
const { iv: iv2, data: data2 } = await encrypt(plaintext2, cek);
|
|
69
|
+
return { _iv: iv2, _data: data2, _cek: await wrapCek(cek, toDek), cek };
|
|
70
|
+
}
|
|
71
|
+
const plaintext = await decrypt(envelope._iv, envelope._data, fromDek);
|
|
72
|
+
const { iv, data } = await encrypt(plaintext, toDek);
|
|
73
|
+
return { _iv: iv, _data: data, cek: null };
|
|
74
|
+
}
|
|
75
|
+
function applyRewrappedBody(envelope, body) {
|
|
76
|
+
const next = {
|
|
77
|
+
...envelope,
|
|
78
|
+
_iv: body._iv,
|
|
79
|
+
_data: body._data,
|
|
80
|
+
...body._cek !== void 0 ? { _cek: body._cek } : {}
|
|
81
|
+
};
|
|
82
|
+
if (body._cek === void 0 && envelope._cek !== void 0) {
|
|
83
|
+
delete next._cek;
|
|
84
|
+
}
|
|
85
|
+
return next;
|
|
86
|
+
}
|
|
87
|
+
async function rewrapEnvelope(envelope, fromDek, toDek) {
|
|
88
|
+
return applyRewrappedBody(envelope, await rewrapBodyToDek(envelope, fromDek, toDek));
|
|
89
|
+
}
|
|
90
|
+
async function isRewrappedUnder(envelope, dek) {
|
|
91
|
+
try {
|
|
92
|
+
if (envelope._cek !== void 0) {
|
|
93
|
+
await unwrapCek(envelope._cek, dek);
|
|
94
|
+
} else {
|
|
95
|
+
await decrypt(envelope._iv, envelope._data, dek);
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/kernel/enclave/record-keys/sealed-slots.ts
|
|
104
|
+
async function sealOneFieldWithDek(field, value, dek, keyMaterial) {
|
|
105
|
+
const fieldKey = keyMaterial.cek !== void 0 ? await deriveSealedFieldKeyFromCek(keyMaterial.cek, keyMaterial.collection, field) : await deriveSealedFieldKey(dek, keyMaterial.collection, field);
|
|
106
|
+
return encrypt(JSON.stringify(value), fieldKey);
|
|
107
|
+
}
|
|
108
|
+
async function sealOneField(field, value, keyMaterial) {
|
|
109
|
+
const dek = await keyMaterial.getDEK();
|
|
110
|
+
return sealOneFieldWithDek(field, value, dek, keyMaterial);
|
|
111
|
+
}
|
|
112
|
+
async function sealFields(record, sensitiveFields, keyMaterial) {
|
|
113
|
+
const dek = await keyMaterial.getDEK();
|
|
114
|
+
const open = { ...record };
|
|
115
|
+
const slots = {};
|
|
116
|
+
for (const field of sensitiveFields) {
|
|
117
|
+
if (!(field in record)) continue;
|
|
118
|
+
const value = record[field];
|
|
119
|
+
if (value === void 0) continue;
|
|
120
|
+
const { iv, data } = await sealOneFieldWithDek(field, value, dek, keyMaterial);
|
|
121
|
+
slots[field] = `${iv}:${data}`;
|
|
122
|
+
delete open[field];
|
|
123
|
+
}
|
|
124
|
+
if (Object.keys(slots).length === 0) return { openRecord: record, sealed: void 0 };
|
|
125
|
+
return { openRecord: open, sealed: slots };
|
|
126
|
+
}
|
|
127
|
+
async function unsealOneField(field, blob, keyMaterial) {
|
|
128
|
+
const dek = await keyMaterial.getDEK();
|
|
129
|
+
return JSON.parse(await dualReadSealedSlot(blob, field, keyMaterial.collection, keyMaterial.cek, dek));
|
|
130
|
+
}
|
|
131
|
+
function makeHandleProducer(keyMaterial) {
|
|
132
|
+
return (field, blob) => new SealedHandle(() => unsealOneField(field, blob, keyMaterial));
|
|
133
|
+
}
|
|
134
|
+
async function unsealFields(record, sealed, keyMaterial, opts) {
|
|
135
|
+
const makeHandle = opts?.asHandles === true ? makeHandleProducer(keyMaterial) : void 0;
|
|
136
|
+
for (const [field, blob] of Object.entries(sealed)) {
|
|
137
|
+
record[field] = makeHandle !== void 0 ? makeHandle(field, blob) : await unsealOneField(field, blob, keyMaterial);
|
|
138
|
+
}
|
|
139
|
+
return record;
|
|
140
|
+
}
|
|
141
|
+
function makeSealedSlotCapability(ctx, recordId, cek) {
|
|
142
|
+
const keyMaterial = {
|
|
143
|
+
collection: ctx.name,
|
|
144
|
+
...cek !== void 0 ? { cek } : {},
|
|
145
|
+
getDEK: () => ctx.getDEK()
|
|
146
|
+
};
|
|
147
|
+
const deletedFields = /* @__PURE__ */ new Set();
|
|
148
|
+
return {
|
|
149
|
+
async seal(field, plaintext) {
|
|
150
|
+
const ref = await sealOneField(field, plaintext, keyMaterial);
|
|
151
|
+
deletedFields.delete(field);
|
|
152
|
+
return ref;
|
|
153
|
+
},
|
|
154
|
+
async unseal(field, ref) {
|
|
155
|
+
if (deletedFields.has(field)) {
|
|
156
|
+
throw new ValidationError(`sealedSlots.unseal: field "${field}" on record "${recordId}" was deleted from this capability`);
|
|
157
|
+
}
|
|
158
|
+
return unsealOneField(field, `${ref.iv}:${ref.data}`, keyMaterial);
|
|
159
|
+
},
|
|
160
|
+
async delete(field) {
|
|
161
|
+
deletedFields.add(field);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function makeReservedEnvelopes(dekResolver, declaredPrefixes) {
|
|
166
|
+
const declared = new Set(declaredPrefixes);
|
|
167
|
+
return (prefix) => {
|
|
168
|
+
if (!declared.has(prefix)) {
|
|
169
|
+
throw new ValidationError(`reservedEnvelopes: prefix "${prefix}" is not declared by this binding's reservedPrefixes`);
|
|
170
|
+
}
|
|
171
|
+
const assertPrefixed = (collection, method) => {
|
|
172
|
+
if (!collection.startsWith(prefix)) {
|
|
173
|
+
throw new ValidationError(
|
|
174
|
+
`reservedEnvelopes('${prefix}').${method}: collection "${collection}" does not start with "${prefix}"`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const encryptForPrefix = async (collection, json, v) => {
|
|
179
|
+
assertPrefixed(collection, "encrypt");
|
|
180
|
+
const dek = await dekResolver(collection);
|
|
181
|
+
const { iv, data } = await encrypt(json, dek);
|
|
182
|
+
return {
|
|
183
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
184
|
+
_v: v,
|
|
185
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
186
|
+
_iv: iv,
|
|
187
|
+
_data: data
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
const decryptForPrefix = async (collection, env) => {
|
|
191
|
+
assertPrefixed(collection, "decrypt");
|
|
192
|
+
const dek = await dekResolver(collection);
|
|
193
|
+
return decrypt(env._iv, env._data, dek);
|
|
194
|
+
};
|
|
195
|
+
return { encrypt: encryptForPrefix, decrypt: decryptForPrefix };
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/kernel/enclave/classify/write.ts
|
|
200
|
+
async function mintVdigSlot(rawValue, policy, prevBlob, cek, collection, recordId, field) {
|
|
201
|
+
const normalized = normalizeForVerify(policy.normalize, rawValue);
|
|
202
|
+
let prev = null;
|
|
203
|
+
if (prevBlob !== void 0) {
|
|
204
|
+
try {
|
|
205
|
+
prev = await openVdigPayload(prevBlob, cek, collection, recordId, field);
|
|
206
|
+
} catch {
|
|
207
|
+
throw new TamperedError();
|
|
208
|
+
}
|
|
209
|
+
if (!Number.isInteger(prev.iter) || prev.iter < 1) {
|
|
210
|
+
throw new TamperedError();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (prev !== null && policy.notLastN > 0) {
|
|
214
|
+
const history = [prev.cur, ...prev.ring ?? []];
|
|
215
|
+
for (const entry of history) {
|
|
216
|
+
const digest = await pbkdf2VerifyDigest(normalized, base64ToBuffer(entry.salt), prev.iter);
|
|
217
|
+
if (await blindedEqual(digest, base64ToBuffer(entry.hash))) {
|
|
218
|
+
throw new ClassifiedRotationError(collection, field, "password was used recently");
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const salt = generateSalt();
|
|
223
|
+
const hash = await pbkdf2VerifyDigest(normalized, salt, VDIG_ITERATIONS);
|
|
224
|
+
const ring = prev !== null && policy.notLastN > 0 ? [...prev.ring ?? [], { salt: prev.cur.salt, hash: prev.cur.hash }].slice(-policy.notLastN) : void 0;
|
|
225
|
+
const payload = {
|
|
226
|
+
v: 1,
|
|
227
|
+
alg: "PBKDF2-SHA256",
|
|
228
|
+
iter: VDIG_ITERATIONS,
|
|
229
|
+
cur: { salt: bufferToBase64(salt), hash: bufferToBase64(hash), at: (/* @__PURE__ */ new Date()).toISOString() },
|
|
230
|
+
...ring !== void 0 && ring.length > 0 ? { ring } : {}
|
|
231
|
+
};
|
|
232
|
+
return sealVdigPayload(payload, cek, collection, recordId, field);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/kernel/schema.ts
|
|
236
|
+
async function validateSchemaInput(schema, value, context) {
|
|
237
|
+
const result = await schema["~standard"].validate(value);
|
|
238
|
+
if (result.issues !== void 0 && result.issues.length > 0) {
|
|
239
|
+
throw new SchemaValidationError(
|
|
240
|
+
`Schema validation failed on ${context}: ${summarizeIssues(result.issues)}`,
|
|
241
|
+
result.issues,
|
|
242
|
+
"input"
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
return result.value;
|
|
246
|
+
}
|
|
247
|
+
async function validateSchemaOutput(schema, value, context) {
|
|
248
|
+
const result = await schema["~standard"].validate(value);
|
|
249
|
+
if (result.issues !== void 0 && result.issues.length > 0) {
|
|
250
|
+
throw new SchemaValidationError(
|
|
251
|
+
`Stored data for ${context} does not match the current schema \u2014 schema drift? ${summarizeIssues(result.issues)}`,
|
|
252
|
+
result.issues,
|
|
253
|
+
"output"
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return result.value;
|
|
257
|
+
}
|
|
258
|
+
function summarizeIssues(issues) {
|
|
259
|
+
const shown = issues.slice(0, 3).map((issue) => {
|
|
260
|
+
const pathStr = formatPath(issue.path);
|
|
261
|
+
return `${pathStr}: ${issue.message}`;
|
|
262
|
+
});
|
|
263
|
+
const suffix = issues.length > 3 ? ` (+${issues.length - 3} more)` : "";
|
|
264
|
+
return shown.join("; ") + suffix;
|
|
265
|
+
}
|
|
266
|
+
function formatPath(path) {
|
|
267
|
+
if (!path || path.length === 0) return "root";
|
|
268
|
+
return path.map(
|
|
269
|
+
(segment) => typeof segment === "object" && segment !== null ? String(segment.key) : String(segment)
|
|
270
|
+
).join(".");
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// src/kernel/enclave/record-keys/record-codec.ts
|
|
274
|
+
var RecordCodec = class _RecordCodec {
|
|
275
|
+
constructor(ctx) {
|
|
276
|
+
this.ctx = ctx;
|
|
277
|
+
}
|
|
278
|
+
ctx;
|
|
279
|
+
/**
|
|
280
|
+
* @internal Update the live Via pipeline this codec's at-rest hooks read
|
|
281
|
+
* (#638 Task 3) — called by `via/graph-wiring.ts#applyTaintOverlay` right
|
|
282
|
+
* after it reassigns `Collection.via`, so `hasAtRestHooks`/`encodeAtRest`/
|
|
283
|
+
* `decodeAtRest` see the newly-added `taint` binding instead of the
|
|
284
|
+
* pipeline snapshot captured when this codec was constructed.
|
|
285
|
+
*/
|
|
286
|
+
setVia(via) {
|
|
287
|
+
this.ctx.via = via;
|
|
288
|
+
}
|
|
289
|
+
/** Sealed-slot key material for this codec's collection, for a given per-record CEK (or none). */
|
|
290
|
+
sealKeyMaterial(cek) {
|
|
291
|
+
return {
|
|
292
|
+
collection: this.ctx.name,
|
|
293
|
+
...cek !== void 0 ? { cek } : {},
|
|
294
|
+
getDEK: () => this.ctx.getDEK()
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Build the `ViaCryptoCtx` handed to a binding's `encodeAtRest`/
|
|
299
|
+
* `decodeAtRest` hook: `sealedSlots` pre-bound to `(this.ctx.name,
|
|
300
|
+
* recordId)` — always threading `cek` when the caller has one, so the
|
|
301
|
+
* capability's record-binding stays cryptographic rather than degrading
|
|
302
|
+
* to collection-scope. `reservedEnvelopes`'s DEK resolver forwards its
|
|
303
|
+
* `collection` argument straight to `this.ctx.getDEK` (#629 Task 4) — it
|
|
304
|
+
* resolves the RESERVED collection's own DEK (e.g. `_dict_status`), never
|
|
305
|
+
* `this.ctx.name`'s, matching `Vault.getDEK`'s per-collection-name
|
|
306
|
+
* resolution (the same resolver `DictionaryHandle` used pre-cutover).
|
|
307
|
+
*/
|
|
308
|
+
viaCryptoCtx(recordId, cek) {
|
|
309
|
+
const declaredPrefixes = this.ctx.via?.bindings.flatMap((b) => b.reservedPrefixes ?? []) ?? [];
|
|
310
|
+
return {
|
|
311
|
+
sealedSlots: makeSealedSlotCapability(this.ctx, recordId, cek),
|
|
312
|
+
reservedEnvelopes: makeReservedEnvelopes((collection) => this.ctx.getDEK(collection), declaredPrefixes)
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
316
|
+
// Low-level literal builders
|
|
317
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
318
|
+
/**
|
|
319
|
+
* Assemble a canonical ciphertext body envelope literal from already-computed
|
|
320
|
+
* parts. Pure, no crypto. Each call stamps its own `_ts` — provenance carries
|
|
321
|
+
* a SEPARATE timestamp (computed by the caller), so the two never share one.
|
|
322
|
+
*/
|
|
323
|
+
static buildEnvelope(p) {
|
|
324
|
+
return {
|
|
325
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
326
|
+
_v: p.version,
|
|
327
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
328
|
+
_iv: p.iv,
|
|
329
|
+
_data: p.data,
|
|
330
|
+
...p.by !== void 0 ? { _by: p.by } : {},
|
|
331
|
+
...p.cek !== void 0 ? { _cek: p.cek } : {},
|
|
332
|
+
...p.provenance !== void 0 ? { _source: p.provenance.source, _sourceTs: p.provenance.sourceTs } : {},
|
|
333
|
+
...p.extra ?? {}
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/** Plaintext (`_iv:''`) body envelope — the `!storeCiphertext` shape. */
|
|
337
|
+
static buildPlaintextEnvelope(p) {
|
|
338
|
+
return {
|
|
339
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
340
|
+
_v: p.version,
|
|
341
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
342
|
+
_iv: "",
|
|
343
|
+
_data: p.data,
|
|
344
|
+
...p.by !== void 0 ? { _by: p.by } : {},
|
|
345
|
+
...p.provenance !== void 0 ? { _source: p.provenance.source, _sourceTs: p.provenance.sourceTs } : {}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
349
|
+
// Write path
|
|
350
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
351
|
+
/**
|
|
352
|
+
* Build a debug-plaintext envelope: the record's own fields inlined as
|
|
353
|
+
* top-level keys beside the reserved `_`-metadata, with `_debug: 1` and an
|
|
354
|
+
* empty `_data`. Lets native store tooling read the record without
|
|
355
|
+
* unwrapping. Only reached for user collections under `debugPlaintext`
|
|
356
|
+
* (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
|
|
357
|
+
* would collide with the reserved metadata namespace.
|
|
358
|
+
*/
|
|
359
|
+
buildDebugEnvelope(record, version, source, sourceTs) {
|
|
360
|
+
const rec = record;
|
|
361
|
+
for (const key of Object.keys(rec)) {
|
|
362
|
+
if (key.startsWith("_")) throw new DebugReservedFieldError(this.ctx.name, key);
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
366
|
+
_v: version,
|
|
367
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
368
|
+
_iv: "",
|
|
369
|
+
_data: "",
|
|
370
|
+
_by: this.ctx.actor,
|
|
371
|
+
_debug: NOYDB_FORMAT_VERSION,
|
|
372
|
+
...this.ctx.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {},
|
|
373
|
+
...rec
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Encrypt a JSON body into an envelope.
|
|
378
|
+
*
|
|
379
|
+
* When `cek` is supplied (per-record CEK collections), the body is
|
|
380
|
+
* encrypted under the CEK and the CEK is AES-KW-wrapped under the
|
|
381
|
+
* collection DEK and stamped on `_cek`. When `cek` is omitted, the legacy
|
|
382
|
+
* path encrypts the body directly under the collection DEK — byte-identical
|
|
383
|
+
* to pre-CEK behaviour, so non-adopting collections pay nothing.
|
|
384
|
+
*/
|
|
385
|
+
async encryptJsonString(json, version, cek, source, sourceTs) {
|
|
386
|
+
const by = this.ctx.actor;
|
|
387
|
+
const provenance = this.ctx.provenance && source !== void 0 ? { source, sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : void 0;
|
|
388
|
+
if (!this.ctx.storeCiphertext) {
|
|
389
|
+
return _RecordCodec.buildPlaintextEnvelope({ version, data: json, by, provenance });
|
|
390
|
+
}
|
|
391
|
+
const dek = await this.ctx.getDEK();
|
|
392
|
+
if (cek !== void 0) {
|
|
393
|
+
const { iv: iv2, data: data2 } = await encrypt(json, cek);
|
|
394
|
+
const wrapped = await wrapCek(cek, dek);
|
|
395
|
+
return _RecordCodec.buildEnvelope({ version, iv: iv2, data: data2, by, cek: wrapped, provenance });
|
|
396
|
+
}
|
|
397
|
+
const { iv, data } = await encrypt(json, dek);
|
|
398
|
+
return _RecordCodec.buildEnvelope({ version, iv, data, by, provenance });
|
|
399
|
+
}
|
|
400
|
+
async encryptRecord(record, version, cek, source, sourceTs, vdig, id) {
|
|
401
|
+
if (!this.ctx.storeCiphertext && this.ctx.debugPlaintext && !this.ctx.name.startsWith("_")) {
|
|
402
|
+
return this.buildDebugEnvelope(record, version, source, sourceTs);
|
|
403
|
+
}
|
|
404
|
+
if (this.ctx.storeCiphertext) {
|
|
405
|
+
const declared = this.ctx.vdigFields;
|
|
406
|
+
const storedClassified = /* @__PURE__ */ new Set();
|
|
407
|
+
if (vdig?.prev?._vdig) for (const k of Object.keys(vdig.prev._vdig)) storedClassified.add(k);
|
|
408
|
+
if (vdig?.prev?._bidx) for (const k of Object.keys(vdig.prev._bidx)) storedClassified.add(k);
|
|
409
|
+
if (this.ctx.classifiedMarkerDigestOnly !== void 0) {
|
|
410
|
+
for (const k of await this.ctx.classifiedMarkerDigestOnly()) storedClassified.add(k);
|
|
411
|
+
}
|
|
412
|
+
let undeclared;
|
|
413
|
+
for (const field of storedClassified) {
|
|
414
|
+
if (declared === null || !declared.has(field)) {
|
|
415
|
+
undeclared = field;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (undeclared !== void 0) {
|
|
420
|
+
throw new ClassifiedConfigError(
|
|
421
|
+
this.ctx.name,
|
|
422
|
+
`this collection has classified digest-only field "${undeclared}" but this handle does not declare it \u2014 refusing to write (would drop its tag or serialize the secret as plaintext)`
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
let openRecord = record;
|
|
427
|
+
let sealed;
|
|
428
|
+
if (this.ctx.storeCiphertext && this.ctx.via?.hasAtRestHooks) {
|
|
429
|
+
if (id === void 0) {
|
|
430
|
+
throw new Error(
|
|
431
|
+
`RecordCodec.encryptRecord: collection "${this.ctx.name}" has via at-rest hooks but this write path supplied no record id (needed to scope the sealed-slot capability) \u2014 caller bug.`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
const src = record;
|
|
435
|
+
const result = await this.ctx.via.encodeAtRest(src, this.viaCryptoCtx(id, cek));
|
|
436
|
+
openRecord = result.record;
|
|
437
|
+
if (result.sealed !== void 0) {
|
|
438
|
+
sealed = {};
|
|
439
|
+
for (const [field, ref] of Object.entries(result.sealed)) sealed[field] = `${ref.iv}:${ref.data}`;
|
|
440
|
+
}
|
|
441
|
+
} else if (this.ctx.storeCiphertext && this.ctx.sensitiveFields.size > 0) {
|
|
442
|
+
const src = record;
|
|
443
|
+
const result = await sealFields(src, this.ctx.sensitiveFields, this.sealKeyMaterial(cek));
|
|
444
|
+
if (result.sealed !== void 0) {
|
|
445
|
+
sealed = result.sealed;
|
|
446
|
+
openRecord = result.openRecord;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
let vdigOut;
|
|
450
|
+
let bidxOutMap;
|
|
451
|
+
if (this.ctx.vdigFields !== null && this.ctx.vdigFields.size > 0 && this.ctx.storeCiphertext) {
|
|
452
|
+
if (vdig === void 0) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`RecordCodec.encryptRecord: collection "${this.ctx.name}" declares digest-only classified fields but this write path supplied no { id, prev } context \u2014 it would silently destroy _vdig (C6). Caller bug.`
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
if (cek === void 0) {
|
|
458
|
+
throw new Error(
|
|
459
|
+
`RecordCodec.encryptRecord: digest-only fields require a per-record CEK (R1 invariant) \u2014 collection "${this.ctx.name}" wrote without one. Caller bug.`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
const open = { ...openRecord };
|
|
463
|
+
const out = {};
|
|
464
|
+
const bidxOut = {};
|
|
465
|
+
let bidxDek;
|
|
466
|
+
for (const [field, policy] of this.ctx.vdigFields) {
|
|
467
|
+
const value = open[field];
|
|
468
|
+
const prevBlob = vdig.prev?._vdig?.[field];
|
|
469
|
+
if (vdig.prev?._sealed?.[field] !== void 0) {
|
|
470
|
+
throw new ClassifiedConfigError(
|
|
471
|
+
this.ctx.name,
|
|
472
|
+
`field "${field}" carries a recoverable _sealed slot from a previous storage form \u2014 recoverable \u2194 digest-only transitions are refused (R6); migrate explicitly`
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
if (value === void 0) {
|
|
476
|
+
if (prevBlob !== void 0) {
|
|
477
|
+
out[field] = prevBlob;
|
|
478
|
+
const prevTag = vdig.prev?._bidx?.[field];
|
|
479
|
+
if (prevTag !== void 0) bidxOut[field] = prevTag;
|
|
480
|
+
}
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
if (value === null) {
|
|
484
|
+
delete open[field];
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
if (typeof value !== "string") {
|
|
488
|
+
throw new ValidationError(
|
|
489
|
+
`digest-only classified field "${field}" in "${this.ctx.name}" must be a string (rotate) or null (clear), got ${typeof value}`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
out[field] = await mintVdigSlot(value, policy, prevBlob, cek, this.ctx.name, vdig.id, field);
|
|
493
|
+
if (policy.equatable === true) {
|
|
494
|
+
if (bidxDek === void 0) bidxDek = await this.ctx.getDEK();
|
|
495
|
+
const normalized = normalizeForVerify(policy.normalize, value);
|
|
496
|
+
bidxOut[field] = await mintBidxTag(normalized, bidxDek, this.ctx.name, field);
|
|
497
|
+
}
|
|
498
|
+
delete open[field];
|
|
499
|
+
}
|
|
500
|
+
openRecord = open;
|
|
501
|
+
if (Object.keys(out).length > 0) vdigOut = out;
|
|
502
|
+
if (Object.keys(bidxOut).length > 0) bidxOutMap = bidxOut;
|
|
503
|
+
}
|
|
504
|
+
const base = await this.encryptJsonString(JSON.stringify(openRecord), version, cek, source, sourceTs);
|
|
505
|
+
const withSealed = sealed ? { ...base, _sealed: sealed } : base;
|
|
506
|
+
const withVdig = vdigOut ? { ...withSealed, _vdig: vdigOut } : withSealed;
|
|
507
|
+
const withBidx = bidxOutMap ? { ...withVdig, _bidx: bidxOutMap } : withVdig;
|
|
508
|
+
if (!this.ctx.deterministicFields || !this.ctx.storeCiphertext) return withBidx;
|
|
509
|
+
const dek = await this.ctx.getDEK();
|
|
510
|
+
const detKey = await deriveDeterministicKey(dek);
|
|
511
|
+
const rec = record;
|
|
512
|
+
const det = {};
|
|
513
|
+
for (const field of this.ctx.deterministicFields) {
|
|
514
|
+
if (this.ctx.sensitiveFields.has(field)) continue;
|
|
515
|
+
if (this.ctx.vdigFields?.has(field)) continue;
|
|
516
|
+
const value = rec[field];
|
|
517
|
+
if (value === void 0 || value === null) continue;
|
|
518
|
+
const plaintext = typeof value === "string" ? value : JSON.stringify(value);
|
|
519
|
+
const { iv, data } = await encryptDeterministic(plaintext, detKey, `${this.ctx.name}/${field}`);
|
|
520
|
+
det[field] = `${iv}:${data}`;
|
|
521
|
+
}
|
|
522
|
+
if (Object.keys(det).length === 0) return withBidx;
|
|
523
|
+
return { ...withBidx, _det: det };
|
|
524
|
+
}
|
|
525
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
526
|
+
// Read path
|
|
527
|
+
// ──────────────────────────────────────────────────────────────────────
|
|
528
|
+
/**
|
|
529
|
+
* Resolve the per-record CEK for a stored envelope, or `undefined` for a
|
|
530
|
+
* legacy (`_cek`-absent) envelope. Unwraps `_cek` under the collection DEK and
|
|
531
|
+
* memoises it in the CEK cache under `id` (when supplied) so repeated reads of
|
|
532
|
+
* the same record skip the unwrap. Shared by the body-decrypt path
|
|
533
|
+
* ({@link decryptJsonString}) and the sealed-field path ({@link decryptRecord}
|
|
534
|
+
* / {@link toCacheRecord}) so both agree on the record's key.
|
|
535
|
+
*/
|
|
536
|
+
async resolveEnvelopeCek(envelope, id) {
|
|
537
|
+
if (envelope._cek === void 0) return void 0;
|
|
538
|
+
const cached = id !== void 0 ? this.ctx.cekCache?.get(id) : void 0;
|
|
539
|
+
if (cached !== void 0) return cached;
|
|
540
|
+
const dek = await this.ctx.getDEK();
|
|
541
|
+
const cek = await unwrapCek(envelope._cek, dek);
|
|
542
|
+
if (id !== void 0) this.ctx.cekCache?.set(id, cek, 1);
|
|
543
|
+
return cek;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Low-level: decrypt an envelope and return the raw JSON string.
|
|
547
|
+
*
|
|
548
|
+
* `_cek` presence is the format discriminant (NOT `this.perRecordCek`),
|
|
549
|
+
* so a mixed vault — and a recipient that never opted into
|
|
550
|
+
* `perRecordKeys` — decrypts both legacy and CEK records:
|
|
551
|
+
* - `_cek` present → unwrap the CEK under the collection DEK, decrypt the
|
|
552
|
+
* body under the CEK (cache the unwrapped CEK so repeated reads skip it).
|
|
553
|
+
* - `_cek` absent → legacy path, body decrypts directly under the
|
|
554
|
+
* collection DEK.
|
|
555
|
+
*
|
|
556
|
+
* The optional `id` lets reads populate the CEK cache; it is omitted by
|
|
557
|
+
* callers (history, conflict merge) that have only the envelope.
|
|
558
|
+
*/
|
|
559
|
+
async decryptJsonString(envelope, id) {
|
|
560
|
+
if (isTombstone(envelope, this.ctx.storeCiphertext) || isDeleteMarker(envelope)) return null;
|
|
561
|
+
if (!this.ctx.storeCiphertext) {
|
|
562
|
+
if (envelope._debug !== void 0) {
|
|
563
|
+
const rec = {};
|
|
564
|
+
for (const [key, value] of Object.entries(envelope)) {
|
|
565
|
+
if (!key.startsWith("_")) rec[key] = value;
|
|
566
|
+
}
|
|
567
|
+
return JSON.stringify(rec);
|
|
568
|
+
}
|
|
569
|
+
return envelope._data === "" ? null : envelope._data;
|
|
570
|
+
}
|
|
571
|
+
const cek = await this.resolveEnvelopeCek(envelope, id);
|
|
572
|
+
if (cek !== void 0) return decrypt(envelope._iv, envelope._data, cek);
|
|
573
|
+
const dek = await this.ctx.getDEK();
|
|
574
|
+
return decrypt(envelope._iv, envelope._data, dek);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Unseal a single `_sealed[field]` slot to its plaintext value: derive the
|
|
578
|
+
* per-field key off the collection DEK, AES-GCM-decrypt the `iv:data` blob,
|
|
579
|
+
* and JSON-parse the result. Shared by both the inline-decrypt path and a
|
|
580
|
+
* {@link Sealed} handle's `reveal()` — so the on-demand reveal and the eager
|
|
581
|
+
* materialisation always agree byte-for-byte.
|
|
582
|
+
*/
|
|
583
|
+
async unsealField(field, blob, cek) {
|
|
584
|
+
return unsealOneField(field, blob, this.sealKeyMaterial(cek));
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Build the `ViaCryptoCtx` for forget()'s per-ref via-erase fold (#629
|
|
588
|
+
* Task 10) — resolves the live envelope's CEK exactly like
|
|
589
|
+
* `decryptRecord` does, then delegates to the same capability factory
|
|
590
|
+
* `encodeAtRest`/`decodeAtRest` use.
|
|
591
|
+
*/
|
|
592
|
+
async eraseCryptoCtx(id, live) {
|
|
593
|
+
return this.viaCryptoCtx(id, await this.resolveEnvelopeCek(live, id));
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Classify a live envelope's `_sealed` slots for crypto-shred completeness.
|
|
597
|
+
* `forget()` drops `_cek`/`_sealed` but
|
|
598
|
+
* RETAINS the collection DEK, so only a slot keyed off the per-record CEK is
|
|
599
|
+
* genuinely shredded by the tombstone; a legacy slot keyed off the
|
|
600
|
+
* collection DEK survives in any synced/backup copy.
|
|
601
|
+
*
|
|
602
|
+
* Mirrors {@link unsealField}'s dual-read split: try the CEK-derived key per
|
|
603
|
+
* slot — success → `shreddable`, AES-GCM auth failure → `dekResidue`. With no
|
|
604
|
+
* `_cek` (pure legacy collection-DEK sealing) ALL slots are residue.
|
|
605
|
+
*/
|
|
606
|
+
async classifySealedShred(live) {
|
|
607
|
+
const slots = [];
|
|
608
|
+
if (live._vdig !== void 0 && live._cek !== void 0) {
|
|
609
|
+
for (const field of Object.keys(live._vdig)) {
|
|
610
|
+
slots.push({
|
|
611
|
+
field,
|
|
612
|
+
class: live._bidx?.[field] !== void 0 ? "live-shreddable+dekResidue-in-backups" : "shreddable"
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const sealed = live._sealed;
|
|
617
|
+
if (sealed === void 0) return { slots };
|
|
618
|
+
const cek = await this.resolveEnvelopeCek(live);
|
|
619
|
+
for (const [field, blob] of Object.entries(sealed)) {
|
|
620
|
+
if (cek === void 0) {
|
|
621
|
+
slots.push({ field, class: "dekResidue" });
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
const { iv, data } = parseSealedSlot(blob);
|
|
625
|
+
try {
|
|
626
|
+
await decrypt(iv, data, await deriveSealedFieldKeyFromCek(cek, this.ctx.name, field));
|
|
627
|
+
slots.push({ field, class: "shreddable" });
|
|
628
|
+
} catch {
|
|
629
|
+
slots.push({ field, class: "dekResidue" });
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return { slots };
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Build a non-leaking {@link Sealed} handle over a sealed field's ciphertext.
|
|
636
|
+
* The handle captures only the ciphertext `blob` and a closure to
|
|
637
|
+
* {@link unsealField}; the plaintext is never stored on it — so the handle
|
|
638
|
+
* may sit in the working-set cache (or be logged/serialised) without
|
|
639
|
+
* exposing the value, which decrypts only on `reveal()`.
|
|
640
|
+
*/
|
|
641
|
+
makeSealedHandle(field, blob, cek) {
|
|
642
|
+
return makeHandleProducer(this.sealKeyMaterial(cek))(field, blob);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Replace every field the just-written envelope actually sealed with a
|
|
646
|
+
* {@link Sealed} handle, leaving every other field as its plaintext value.
|
|
647
|
+
* Used to populate the cache on the write path without ever materialising
|
|
648
|
+
* sealed plaintext into it. Returns `record` untouched when nothing was
|
|
649
|
+
* sealed. Keys off `envelope._sealed` itself (#642 fix) — NOT
|
|
650
|
+
* `this.ctx.sensitiveFields`, which only names the inline `sensitive:[...]`/
|
|
651
|
+
* classified-recoverable field set: a collection whose sealing comes
|
|
652
|
+
* entirely from the `taint` via-binding (a derivation/MV output or rollup
|
|
653
|
+
* target folded sealed from a classified SOURCE collection, #642) declares
|
|
654
|
+
* no local `sensitiveFields` at all, so that stale gate skipped this
|
|
655
|
+
* conversion and left a just-written taint-sealed field as cached
|
|
656
|
+
* plaintext — read back correctly ONLY after a cold cache miss (`get()`'s
|
|
657
|
+
* own `decodeAtRest` call, unaffected by this gate) forced a fresh decrypt.
|
|
658
|
+
*/
|
|
659
|
+
async toCacheRecord(record, envelope, id) {
|
|
660
|
+
const sealed = envelope._sealed;
|
|
661
|
+
if (sealed === void 0 || !this.ctx.storeCiphertext) {
|
|
662
|
+
return record;
|
|
663
|
+
}
|
|
664
|
+
const cek = await this.resolveEnvelopeCek(envelope, id);
|
|
665
|
+
const clone = { ...record };
|
|
666
|
+
for (const [field, blob] of Object.entries(sealed)) {
|
|
667
|
+
clone[field] = this.makeSealedHandle(field, blob, cek);
|
|
668
|
+
}
|
|
669
|
+
return clone;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Apply `_sealed`-slot post-processing to an ALREADY-DECRYPTED `record`:
|
|
673
|
+
* restore each `_sealed[field]` blob inline (`sealedAsHandles` falsy) or
|
|
674
|
+
* as an opaque {@link Sealed} handle (`sealedAsHandles: true`), routing
|
|
675
|
+
* through a via pipeline's `decodeAtRest` hook when one is declared.
|
|
676
|
+
* Extracted byte-parity from `decryptRecord`'s inline block (#635) so a
|
|
677
|
+
* caller that resolves its OWN per-record CEK under a DIFFERENT DEK than
|
|
678
|
+
* this codec's `this.ctx.getDEK()` — namely the tier>0 `getAtTier` leg in
|
|
679
|
+
* `with-audit/tiers/index.ts`, whose `_cek` is wrapped under the TIER DEK,
|
|
680
|
+
* not the collection DEK `decryptRecord`/`resolveEnvelopeCek` always
|
|
681
|
+
* unwrap under — can still get correct sealed-slot handling without
|
|
682
|
+
* routing its whole read through `decryptRecord` (which would resolve the
|
|
683
|
+
* wrong DEK for it).
|
|
684
|
+
*
|
|
685
|
+
* Zero-knowledge: takes only the already-resolved per-record `cek` (or
|
|
686
|
+
* `undefined` for a legacy/no-CEK record) — the same shape `makeSealedHandle`
|
|
687
|
+
* already takes above. Never the keyring, never a raw DEK: the legacy
|
|
688
|
+
* fallback key stays fully internal to `sealKeyMaterial`/`viaCryptoCtx`,
|
|
689
|
+
* which close over THIS codec's own `getDEK` (permanently bound to
|
|
690
|
+
* `this.ctx.name`'s tier-0 DEK at construction) — so even when called from
|
|
691
|
+
* a tier>0 context, the legacy-fallback key resolution is correct: sealed
|
|
692
|
+
* fields are always sealed under the CEK or the collection's tier-0 DEK,
|
|
693
|
+
* never a tier DEK (tier writes don't seal fields; `_sealed` reaches a
|
|
694
|
+
* tiered envelope only via a tier-0 write later elevated).
|
|
695
|
+
*/
|
|
696
|
+
async applySealedSlots(record, sealed, cek, opts = {}) {
|
|
697
|
+
if (this.ctx.via?.hasAtRestHooks) {
|
|
698
|
+
if (opts.id === void 0) {
|
|
699
|
+
throw new Error(
|
|
700
|
+
`RecordCodec.decryptRecord: collection "${this.ctx.name}" has via at-rest hooks but this read path supplied no record id (needed to scope the sealed-slot capability) \u2014 caller bug.`
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
const sealedRefs = {};
|
|
704
|
+
for (const [field, blob] of Object.entries(sealed)) {
|
|
705
|
+
const { iv, data } = parseSealedSlot(blob);
|
|
706
|
+
sealedRefs[field] = { iv, data };
|
|
707
|
+
}
|
|
708
|
+
return await this.ctx.via.decodeAtRest(
|
|
709
|
+
record,
|
|
710
|
+
sealedRefs,
|
|
711
|
+
this.viaCryptoCtx(opts.id, cek),
|
|
712
|
+
{ asHandles: opts.sealedAsHandles === true }
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
return await unsealFields(
|
|
716
|
+
record,
|
|
717
|
+
sealed,
|
|
718
|
+
this.sealKeyMaterial(cek),
|
|
719
|
+
{ asHandles: opts.sealedAsHandles === true }
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Decrypt an envelope under an EXPLICIT `dek` instead of this codec's own
|
|
724
|
+
* `ctx.getDEK()` / cekCache resolution — for a from-tier>0 pre-move decode
|
|
725
|
+
* (`with-audit/tiers/index.ts`'s `putAtTier`/`elevate`/`demote` sites,
|
|
726
|
+
* #722 whole-branch review). Mirrors the manual unwrap-then-decrypt
|
|
727
|
+
* `getAtTier`'s own tier>0 leg performs there (same primitives, same
|
|
728
|
+
* `applySealedSlots` extraction point #635 built for exactly this caller).
|
|
729
|
+
*
|
|
730
|
+
* `decryptRecord` is tier-UNAWARE: `resolveEnvelopeCek` reads the cekCache
|
|
731
|
+
* or falls back to `ctx.getDEK()` — this codec's DEFAULT (tier-0/
|
|
732
|
+
* collection) DEK — never the envelope's OWN tier. That only happens to
|
|
733
|
+
* decrypt a from-tier>0 envelope correctly when some other call in the
|
|
734
|
+
* SAME op already primed the cekCache with this record's CEK (true for an
|
|
735
|
+
* ordinary put()-then-elevate(0→1); NOT true for a `putAtTier`-origin
|
|
736
|
+
* envelope, whose body is encrypted directly under its tier DEK with no
|
|
737
|
+
* `_cek` ever minted, or a non-`perRecordKeys` collection, which has no
|
|
738
|
+
* `_cek` at all) — those throw `TamperedError`. Decrypting under the
|
|
739
|
+
* caller-resolved `dek` is correct regardless of cache state or
|
|
740
|
+
* `perRecordKeys`.
|
|
741
|
+
*
|
|
742
|
+
* No CRDT resolution, no schema validation — same scope as `getAtTier`'s
|
|
743
|
+
* tier>0 branch (the established precedent for a tier-aware read), which
|
|
744
|
+
* skips both for the same reason: a tier>0 read is an internal/derived-
|
|
745
|
+
* output-recompute path, not the public per-record read surface schema
|
|
746
|
+
* validation guards.
|
|
747
|
+
*/
|
|
748
|
+
async decryptRecordAtDek(envelope, dek, id) {
|
|
749
|
+
if (isTombstone(envelope, this.ctx.storeCiphertext) || isDeleteMarker(envelope)) return null;
|
|
750
|
+
let plaintext;
|
|
751
|
+
let cek;
|
|
752
|
+
if (envelope._cek !== void 0) {
|
|
753
|
+
cek = await unwrapCek(envelope._cek, dek);
|
|
754
|
+
plaintext = await decrypt(envelope._iv, envelope._data, cek);
|
|
755
|
+
} else {
|
|
756
|
+
plaintext = await decrypt(envelope._iv, envelope._data, dek);
|
|
757
|
+
}
|
|
758
|
+
let record = JSON.parse(plaintext);
|
|
759
|
+
if (envelope._sealed !== void 0 && this.ctx.storeCiphertext) {
|
|
760
|
+
record = await this.applySealedSlots(record, envelope._sealed, cek, { ...id !== void 0 ? { id } : {}, sealedAsHandles: true });
|
|
761
|
+
}
|
|
762
|
+
return record;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Decrypt an envelope into a record of type `T`.
|
|
766
|
+
*
|
|
767
|
+
* When a schema is attached, the decrypted value is validated before
|
|
768
|
+
* being returned. A divergence between the stored bytes and the
|
|
769
|
+
* current schema throws `SchemaValidationError` with
|
|
770
|
+
* `direction: 'output'` — silently returning drifted data would
|
|
771
|
+
* propagate garbage into the UI and break the whole point of having
|
|
772
|
+
* a schema.
|
|
773
|
+
*
|
|
774
|
+
* `skipValidation` exists for history reads: when calling
|
|
775
|
+
* `getVersion()` the caller is explicitly asking for an old snapshot
|
|
776
|
+
* that may predate a schema change, so validating it would be a
|
|
777
|
+
* false positive. Every non-history read leaves this flag `false`.
|
|
778
|
+
*/
|
|
779
|
+
async decryptRecord(envelope, opts = {}) {
|
|
780
|
+
const json = await this.decryptJsonString(envelope, opts.id);
|
|
781
|
+
if (json === null) return null;
|
|
782
|
+
let parsed = JSON.parse(json);
|
|
783
|
+
if (this.ctx.crdtMode && parsed !== null && typeof parsed === "object" && "_crdt" in parsed) {
|
|
784
|
+
parsed = this.ctx.crdtStrategy.resolveCrdtSnapshot(parsed);
|
|
785
|
+
}
|
|
786
|
+
let record = parsed;
|
|
787
|
+
if (envelope._sealed !== void 0 && this.ctx.storeCiphertext) {
|
|
788
|
+
const sealedCek = await this.resolveEnvelopeCek(envelope, opts.id);
|
|
789
|
+
record = await this.applySealedSlots(record, envelope._sealed, sealedCek, {
|
|
790
|
+
...opts.id !== void 0 ? { id: opts.id } : {},
|
|
791
|
+
...opts.sealedAsHandles !== void 0 ? { sealedAsHandles: opts.sealedAsHandles } : {}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
const sealedAsHandles = opts.sealedAsHandles === true && envelope._sealed !== void 0;
|
|
795
|
+
if (this.ctx.schema !== void 0 && !opts.skipValidation && !sealedAsHandles) {
|
|
796
|
+
record = await validateSchemaOutput(
|
|
797
|
+
this.ctx.schema,
|
|
798
|
+
record,
|
|
799
|
+
`${this.ctx.name}@v${envelope._v}`
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
return record;
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
// src/kernel/enclave/record-keys/sealing.ts
|
|
807
|
+
var subtle = globalThis.crypto.subtle;
|
|
808
|
+
var SEALED_CEK_NS = "_sealed_cek";
|
|
809
|
+
async function sealRecordToHost(ctx, collection, id, hostSealer, opts) {
|
|
810
|
+
if (collection.includes("/")) throw new ValidationError(`sealRecordToHost: collection "${collection}" must not contain "/"`);
|
|
811
|
+
if (id.includes("/")) throw new ValidationError(`sealRecordToHost: id "${id}" must not contain "/"`);
|
|
812
|
+
if (Number.isNaN(Date.parse(opts.expiresAt))) {
|
|
813
|
+
throw new ValidationError(`sealRecordToHost: expiresAt "${opts.expiresAt}" is not a valid ISO 8601 timestamp`);
|
|
814
|
+
}
|
|
815
|
+
const live = await ctx.adapter.get(ctx.vault, collection, id);
|
|
816
|
+
if (!live || live._cek === void 0) {
|
|
817
|
+
throw new RecordCekNotFoundError(collection, id);
|
|
818
|
+
}
|
|
819
|
+
const dek = await ctx.getDEK(collection);
|
|
820
|
+
const cek = await unwrapCek(live._cek, dek);
|
|
821
|
+
const rawCek = await subtle.exportKey("raw", cek);
|
|
822
|
+
const cekB64 = bufferToBase64(rawCek);
|
|
823
|
+
const hint = await hostSealer.publishRecipientHint();
|
|
824
|
+
if (hint.pid.includes("/")) throw new ValidationError(`sealRecordToHost: recipient pid "${hint.pid}" must not contain "/"`);
|
|
825
|
+
const binding = {
|
|
826
|
+
collection,
|
|
827
|
+
id,
|
|
828
|
+
cek: cekB64,
|
|
829
|
+
expiresAt: opts.expiresAt
|
|
830
|
+
};
|
|
831
|
+
const sealed = await hostSealer.sealForRecipient(
|
|
832
|
+
new TextEncoder().encode(JSON.stringify(binding)),
|
|
833
|
+
hint
|
|
834
|
+
);
|
|
835
|
+
const delivery = {
|
|
836
|
+
v: 1,
|
|
837
|
+
_noydb_sealed_cek: 1,
|
|
838
|
+
pid: hint.pid,
|
|
839
|
+
payload: bufferToBase64(sealed),
|
|
840
|
+
expiresAt: opts.expiresAt
|
|
841
|
+
};
|
|
842
|
+
const envelopeKey = `${collection}/${id}/${hint.pid}`;
|
|
843
|
+
const prior = await ctx.adapter.get(ctx.vault, SEALED_CEK_NS, envelopeKey);
|
|
844
|
+
const env = {
|
|
845
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
846
|
+
_v: (prior?._v ?? 0) + 1,
|
|
847
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
848
|
+
// AES-GCM bypassed — the sealing layer is the security boundary, exactly
|
|
849
|
+
// like the managed-passphrase `_meta/sealed-passphrase` envelope.
|
|
850
|
+
_iv: "",
|
|
851
|
+
_data: JSON.stringify(delivery),
|
|
852
|
+
...ctx.actor ? { _by: ctx.actor } : {}
|
|
853
|
+
};
|
|
854
|
+
await ctx.adapter.put(ctx.vault, SEALED_CEK_NS, envelopeKey, env);
|
|
855
|
+
return { pid: hint.pid, envelopeKey };
|
|
856
|
+
}
|
|
857
|
+
async function revokeSealedRecord(ctx, collection, id, pid, opts) {
|
|
858
|
+
if (opts?.hard === true) {
|
|
859
|
+
await rotateRecordCek(ctx, collection, id);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
await ctx.adapter.delete(ctx.vault, SEALED_CEK_NS, `${collection}/${id}/${pid}`);
|
|
863
|
+
}
|
|
864
|
+
async function rotateRecordCek(ctx, collection, id) {
|
|
865
|
+
const live = await ctx.adapter.get(ctx.vault, collection, id);
|
|
866
|
+
if (!live || live._cek === void 0) {
|
|
867
|
+
throw new RecordCekNotFoundError(collection, id);
|
|
868
|
+
}
|
|
869
|
+
const dek = await ctx.getDEK(collection);
|
|
870
|
+
const oldCek = await unwrapCek(live._cek, dek);
|
|
871
|
+
const json = await decrypt(live._iv, live._data, oldCek);
|
|
872
|
+
const newCek = await generateDEK();
|
|
873
|
+
const { iv, data } = await encrypt(json, newCek);
|
|
874
|
+
let sealedOut;
|
|
875
|
+
if (live._sealed !== void 0) {
|
|
876
|
+
const out = {};
|
|
877
|
+
for (const [field, slot] of Object.entries(live._sealed)) {
|
|
878
|
+
const plaintext = await dualReadSealedSlot(slot, field, collection, oldCek, dek);
|
|
879
|
+
const resealed = await encrypt(plaintext, await deriveSealedFieldKeyFromCek(newCek, collection, field));
|
|
880
|
+
out[field] = `${resealed.iv}:${resealed.data}`;
|
|
881
|
+
}
|
|
882
|
+
sealedOut = out;
|
|
883
|
+
}
|
|
884
|
+
let vdigOut;
|
|
885
|
+
if (live._vdig !== void 0) {
|
|
886
|
+
const out = {};
|
|
887
|
+
for (const [field, blob] of Object.entries(live._vdig)) {
|
|
888
|
+
const payload = await openVdigPayload(blob, oldCek, collection, id, field);
|
|
889
|
+
out[field] = await sealVdigPayload(payload, newCek, collection, id, field);
|
|
890
|
+
}
|
|
891
|
+
vdigOut = out;
|
|
892
|
+
}
|
|
893
|
+
const env = {
|
|
894
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
895
|
+
_v: live._v + 1,
|
|
896
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
897
|
+
_iv: iv,
|
|
898
|
+
_data: data,
|
|
899
|
+
_cek: await wrapCek(newCek, dek),
|
|
900
|
+
...ctx.actor ? { _by: ctx.actor } : {},
|
|
901
|
+
...live._tier !== void 0 ? { _tier: live._tier } : {},
|
|
902
|
+
...live._det !== void 0 ? { _det: live._det } : {},
|
|
903
|
+
// `_bidx` (equality-index tag) is DEK-rooted and CEK-independent, so it is
|
|
904
|
+
// carried forward VERBATIM — not recomputed — unlike `_vdig`/`_sealed`
|
|
905
|
+
// below, which are CEK-bound and must be re-sealed under the new CEK.
|
|
906
|
+
// Dropping this line would silently orphan the equality index on rotation
|
|
907
|
+
// (the #306 Slice-A data-loss bug, replayed on the index).
|
|
908
|
+
...live._bidx !== void 0 ? { _bidx: live._bidx } : {},
|
|
909
|
+
// Re-encrypt sealed (`sensitive`) fields under the new CEK. Sealed
|
|
910
|
+
// keys derive off the per-record CEK, so the rotated record's old CEK is
|
|
911
|
+
// destroyed here — carrying the old `_sealed` slots forward verbatim would
|
|
912
|
+
// orphan them (unreadable under the new CEK). `sealedOut` holds the slots
|
|
913
|
+
// dual-read from the old CEK (or the legacy DEK) and re-sealed under newCek.
|
|
914
|
+
...sealedOut !== void 0 ? { _sealed: sealedOut } : {},
|
|
915
|
+
...vdigOut !== void 0 ? { _vdig: vdigOut } : {}
|
|
916
|
+
};
|
|
917
|
+
await ctx.adapter.put(ctx.vault, collection, id, env);
|
|
918
|
+
await ctx.invalidateRecordCaches(collection, id);
|
|
919
|
+
const prefix = `${collection}/${id}/`;
|
|
920
|
+
const keys = await ctx.adapter.list(ctx.vault, SEALED_CEK_NS);
|
|
921
|
+
for (const key of keys) {
|
|
922
|
+
if (key.startsWith(prefix)) {
|
|
923
|
+
await ctx.adapter.delete(ctx.vault, SEALED_CEK_NS, key);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// src/kernel/enclave/record-keys/deterministic.ts
|
|
929
|
+
async function detTargets(ctx, field, value) {
|
|
930
|
+
const dek = await ctx.getDEK();
|
|
931
|
+
const detKey = await deriveDeterministicKey(dek);
|
|
932
|
+
const plaintext = typeof value === "string" ? value : JSON.stringify(value);
|
|
933
|
+
const context = `${ctx.name}/${field}`;
|
|
934
|
+
const [current, legacy] = await Promise.all([
|
|
935
|
+
encryptDeterministic(plaintext, detKey, context),
|
|
936
|
+
encryptDeterministic(plaintext, dek, context)
|
|
937
|
+
]);
|
|
938
|
+
return [`${current.iv}:${current.data}`, `${legacy.iv}:${legacy.data}`];
|
|
939
|
+
}
|
|
940
|
+
function assertDetField(ctx, field, method) {
|
|
941
|
+
if (!ctx.deterministicFields || !ctx.deterministicFields.has(field)) {
|
|
942
|
+
throw new Error(
|
|
943
|
+
`Collection "${ctx.name}": field "${field}" is not declared in deterministicFields`
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
if (!ctx.storeCiphertext) {
|
|
947
|
+
throw new Error(
|
|
948
|
+
`Collection "${ctx.name}": ${method} is only meaningful on encrypted collections`
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
async function findByDet(ctx, field, value) {
|
|
953
|
+
assertDetField(ctx, field, "findByDet");
|
|
954
|
+
const [target, legacyTarget] = await detTargets(ctx, field, value);
|
|
955
|
+
const ids = await ctx.adapter.list(ctx.vault, ctx.name);
|
|
956
|
+
for (const id of ids) {
|
|
957
|
+
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
958
|
+
if (!env || !env._det || (env._tier ?? 0) > 0) continue;
|
|
959
|
+
if (env._det[field] === target || env._det[field] === legacyTarget) {
|
|
960
|
+
return ctx.codec.decryptRecord(env, { id });
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
async function queryByDet(ctx, field, value) {
|
|
966
|
+
assertDetField(ctx, field, "queryByDet");
|
|
967
|
+
const [target, legacyTarget] = await detTargets(ctx, field, value);
|
|
968
|
+
const ids = await ctx.adapter.list(ctx.vault, ctx.name);
|
|
969
|
+
const matches = [];
|
|
970
|
+
for (const id of ids) {
|
|
971
|
+
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
972
|
+
if (!env || !env._det || (env._tier ?? 0) > 0) continue;
|
|
973
|
+
if (env._det[field] === target || env._det[field] === legacyTarget) {
|
|
974
|
+
const rec = await ctx.codec.decryptRecord(env, { id });
|
|
975
|
+
if (rec !== null) matches.push(rec);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return matches;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/kernel/enclave/record-keys/envelope-body.ts
|
|
982
|
+
async function openEnvelopeJson(env, key, opts) {
|
|
983
|
+
if (opts?.encrypted === false) return env._data;
|
|
984
|
+
if (env._cek !== void 0) {
|
|
985
|
+
const cek = await unwrapCek(env._cek, key);
|
|
986
|
+
return decrypt(env._iv, env._data, cek);
|
|
987
|
+
}
|
|
988
|
+
return decrypt(env._iv, env._data, key);
|
|
989
|
+
}
|
|
990
|
+
async function writeEnvelopeBody(json, key, opts) {
|
|
991
|
+
if (opts?.encrypted === false) return { _iv: "", _data: json };
|
|
992
|
+
if (opts?.perRecordKey === true) {
|
|
993
|
+
const cek = await generateDEK();
|
|
994
|
+
const { iv: iv2, data: data2 } = await encrypt(json, cek);
|
|
995
|
+
const wrapped = await wrapCek(cek, key);
|
|
996
|
+
return { _iv: iv2, _data: data2, _cek: wrapped };
|
|
997
|
+
}
|
|
998
|
+
const { iv, data } = await encrypt(json, key);
|
|
999
|
+
return { _iv: iv, _data: data };
|
|
1000
|
+
}
|
|
1001
|
+
function hasPerRecordKey(env) {
|
|
1002
|
+
return env._cek !== void 0;
|
|
1003
|
+
}
|
|
1004
|
+
function envelopeBodyForHash(env) {
|
|
1005
|
+
if (env._sealed === void 0 && env._vdig === void 0 && env._bidx === void 0) return env._data;
|
|
1006
|
+
const mapPart = (key, map) => {
|
|
1007
|
+
const parts = Object.keys(map).sort().map(
|
|
1008
|
+
(k) => `${JSON.stringify(k)}:${JSON.stringify(map[k])}`
|
|
1009
|
+
);
|
|
1010
|
+
return `${JSON.stringify(key)}:{${parts.join(",")}}`;
|
|
1011
|
+
};
|
|
1012
|
+
const segments = [`"_data":${JSON.stringify(env._data)}`];
|
|
1013
|
+
if (env._sealed !== void 0) segments.push(mapPart("_sealed", env._sealed));
|
|
1014
|
+
if (env._vdig !== void 0) segments.push(mapPart("_vdig", env._vdig));
|
|
1015
|
+
if (env._bidx !== void 0) segments.push(mapPart("_bidx", env._bidx));
|
|
1016
|
+
return `{${segments.join(",")}}`;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// src/kernel/enclave/broker/proof.ts
|
|
1020
|
+
var subtle2 = globalThis.crypto.subtle;
|
|
1021
|
+
var BROKER_PROOF_DOMAIN = "noydb-broker-proof";
|
|
1022
|
+
var BROKER_PROOF_VERSION = "noydb-broker-proof-v1";
|
|
1023
|
+
var DEFAULT_CHALLENGE_TTL_MS = 6e4;
|
|
1024
|
+
function buildCanonical(vaultId, brokerId, parts) {
|
|
1025
|
+
return JSON.stringify([
|
|
1026
|
+
BROKER_PROOF_VERSION,
|
|
1027
|
+
vaultId,
|
|
1028
|
+
parts.endpointOrigin,
|
|
1029
|
+
brokerId,
|
|
1030
|
+
parts.profile ?? "",
|
|
1031
|
+
parts.instancePid ?? "",
|
|
1032
|
+
parts.challenge,
|
|
1033
|
+
parts.expiresAt
|
|
1034
|
+
]);
|
|
1035
|
+
}
|
|
1036
|
+
async function deriveBrokerProofBits(seed, vaultId, brokerId) {
|
|
1037
|
+
const hkdfKey = await subtle2.importKey("raw", seed, "HKDF", false, ["deriveBits"]);
|
|
1038
|
+
const salt = new TextEncoder().encode(BROKER_PROOF_DOMAIN);
|
|
1039
|
+
const info = new TextEncoder().encode(JSON.stringify([BROKER_PROOF_DOMAIN, vaultId, brokerId]));
|
|
1040
|
+
const bits = await subtle2.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdfKey, 256);
|
|
1041
|
+
return new Uint8Array(bits);
|
|
1042
|
+
}
|
|
1043
|
+
async function deriveBrokerProofKey(seed, vaultId, brokerId) {
|
|
1044
|
+
const proofBits = await deriveBrokerProofBits(seed, vaultId, brokerId);
|
|
1045
|
+
try {
|
|
1046
|
+
return await subtle2.importKey("raw", proofBits, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
1047
|
+
} finally {
|
|
1048
|
+
proofBits.fill(0);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
async function computeBrokerProof(seed, vaultId, brokerId, canonicalParts) {
|
|
1052
|
+
try {
|
|
1053
|
+
if (canonicalParts.instancePid === "") {
|
|
1054
|
+
throw new ValidationError(
|
|
1055
|
+
"computeBrokerProof: instancePid must not be an empty string \u2014 omit the field entirely for 'no instance' (F7); '' would alias onto a registered instance."
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
const canonical = buildCanonical(vaultId, brokerId, canonicalParts);
|
|
1059
|
+
const key = await deriveBrokerProofKey(seed, vaultId, brokerId);
|
|
1060
|
+
const mac = await subtle2.sign("HMAC", key, new TextEncoder().encode(canonical));
|
|
1061
|
+
return bufferToBase64(new Uint8Array(mac));
|
|
1062
|
+
} finally {
|
|
1063
|
+
seed.fill(0);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function issueChallenge(opts) {
|
|
1067
|
+
const ttlMs = opts?.ttlMs ?? DEFAULT_CHALLENGE_TTL_MS;
|
|
1068
|
+
const bytes = globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
1069
|
+
return {
|
|
1070
|
+
challenge: bufferToBase64(bytes),
|
|
1071
|
+
expiresAt: new Date(Date.now() + ttlMs).toISOString()
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
async function verifyBrokerProof(args) {
|
|
1075
|
+
const fresh = await args.consumeChallenge(args.challenge);
|
|
1076
|
+
if (!fresh) return false;
|
|
1077
|
+
if (args.instancePid === "") return false;
|
|
1078
|
+
const canonical = buildCanonical(args.vaultId, args.brokerId, {
|
|
1079
|
+
endpointOrigin: args.endpointOrigin,
|
|
1080
|
+
profile: args.profile,
|
|
1081
|
+
instancePid: args.instancePid,
|
|
1082
|
+
challenge: args.challenge,
|
|
1083
|
+
expiresAt: args.expiresAt
|
|
1084
|
+
});
|
|
1085
|
+
const key = await subtle2.importKey(
|
|
1086
|
+
"raw",
|
|
1087
|
+
args.registeredProofKey,
|
|
1088
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
1089
|
+
false,
|
|
1090
|
+
["verify"]
|
|
1091
|
+
);
|
|
1092
|
+
const ok = await subtle2.verify(
|
|
1093
|
+
"HMAC",
|
|
1094
|
+
key,
|
|
1095
|
+
base64ToBuffer(args.proof),
|
|
1096
|
+
new TextEncoder().encode(canonical)
|
|
1097
|
+
);
|
|
1098
|
+
if (!ok) return false;
|
|
1099
|
+
return Date.now() < Date.parse(args.expiresAt);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
export {
|
|
1103
|
+
resolveStableCek,
|
|
1104
|
+
rewrapBodyToDek,
|
|
1105
|
+
applyRewrappedBody,
|
|
1106
|
+
rewrapEnvelope,
|
|
1107
|
+
isRewrappedUnder,
|
|
1108
|
+
makeReservedEnvelopes,
|
|
1109
|
+
validateSchemaInput,
|
|
1110
|
+
validateSchemaOutput,
|
|
1111
|
+
RecordCodec,
|
|
1112
|
+
SEALED_CEK_NS,
|
|
1113
|
+
sealRecordToHost,
|
|
1114
|
+
revokeSealedRecord,
|
|
1115
|
+
rotateRecordCek,
|
|
1116
|
+
findByDet,
|
|
1117
|
+
queryByDet,
|
|
1118
|
+
openEnvelopeJson,
|
|
1119
|
+
writeEnvelopeBody,
|
|
1120
|
+
hasPerRecordKey,
|
|
1121
|
+
envelopeBodyForHash,
|
|
1122
|
+
deriveBrokerProofBits,
|
|
1123
|
+
deriveBrokerProofKey,
|
|
1124
|
+
computeBrokerProof,
|
|
1125
|
+
issueChallenge,
|
|
1126
|
+
verifyBrokerProof
|
|
1127
|
+
};
|
|
1128
|
+
//# sourceMappingURL=chunk-XDYREZWE.js.map
|