@noy-db/hub 0.7.0 → 0.7.1-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +22 -5
- package/dist/api-WYW4YEQG.js +19 -0
- package/dist/as/index.js +8 -8
- package/dist/at/index.js +5 -5
- package/dist/attestation/index.js +14 -14
- package/dist/{backup-IJTB4S4M.js → backup-XKCXVKV3.js} +17 -11
- package/dist/backup-XKCXVKV3.js.map +1 -0
- package/dist/blobs/index.js +7 -7
- package/dist/broker/index.js +8 -8
- package/dist/cargo/index.js +18 -18
- package/dist/{chunk-PT43Y56J.js → chunk-2ENE6445.js} +3 -3
- package/dist/{chunk-CHJBLCOG.js → chunk-2N5ML6HT.js} +4 -4
- package/dist/{chunk-KUJDV5QH.js → chunk-334WSVOW.js} +3 -3
- package/dist/{chunk-BSFNRLK2.js → chunk-3BVH633C.js} +3 -3
- package/dist/{chunk-CARABLSQ.js → chunk-3BZZJJMQ.js} +2 -2
- package/dist/{chunk-3RCJJBNR.js → chunk-3PGS7TYR.js} +7 -7
- package/dist/{chunk-G56KBWFY.js → chunk-3V4KWFX7.js} +4 -4
- package/dist/chunk-3V4KWFX7.js.map +1 -0
- package/dist/{chunk-K6LHRFBL.js → chunk-3VF3WQ4F.js} +5 -5
- package/dist/{chunk-VXGSWL6L.js → chunk-4GFX6MPA.js} +4 -4
- package/dist/{chunk-77K4PG6P.js → chunk-4ZS56W5S.js} +5 -5
- package/dist/{chunk-K7NTTA6P.js → chunk-6LKOJBV6.js} +2 -2
- package/dist/{chunk-AO42KJO6.js → chunk-7APJ6CO6.js} +4 -4
- package/dist/{chunk-ANSIZYEG.js → chunk-A2HKRLPV.js} +2 -2
- package/dist/{chunk-MUM7IANK.js → chunk-A66I4JOA.js} +2 -2
- package/dist/{chunk-REDOOY2Q.js → chunk-ACAQ2DSG.js} +2 -2
- package/dist/{chunk-X2DLENDQ.js → chunk-AYX7AINO.js} +2 -2
- package/dist/{chunk-BOWNCWZT.js → chunk-BRLKZUBT.js} +2 -2
- package/dist/{chunk-YSRUYAVU.js → chunk-BTDR2PXY.js} +2 -2
- package/dist/{chunk-5WDXHNSW.js → chunk-BVN6KXL2.js} +3 -3
- package/dist/chunk-BVN6KXL2.js.map +1 -0
- package/dist/{chunk-RMF67KCG.js → chunk-CHQCZZWC.js} +2 -2
- package/dist/{chunk-2C3AQB46.js → chunk-CUQPWYRX.js} +4 -4
- package/dist/{chunk-J6FXAEUG.js → chunk-DFMWUOU5.js} +9 -9
- package/dist/{chunk-HDOU6I2Y.js → chunk-F3W6YMDC.js} +3 -3
- package/dist/{chunk-KUX3OB6D.js → chunk-FET5XCAT.js} +3 -3
- package/dist/{chunk-ANATMFIO.js → chunk-G73UVHCA.js} +3 -3
- package/dist/{chunk-ZVO4QVPD.js → chunk-GPNTB4Y7.js} +3 -3
- package/dist/{chunk-BM5TWITZ.js → chunk-HIWCKBEY.js} +3 -3
- package/dist/{chunk-6X6SEMEE.js → chunk-HJUWN7JN.js} +2 -2
- package/dist/{chunk-SL3JAAKN.js → chunk-HPVZCW43.js} +29 -1
- package/dist/chunk-HPVZCW43.js.map +1 -0
- package/dist/{chunk-L7CIOOBW.js → chunk-JVIBCBC7.js} +2 -2
- package/dist/{chunk-CPWQB3N5.js → chunk-K23VKTN4.js} +3 -3
- package/dist/{chunk-NA2NIJZI.js → chunk-KKEESNPE.js} +3 -3
- package/dist/{chunk-UXWB3FPF.js → chunk-LH5A3ZPG.js} +8 -8
- package/dist/{chunk-KJIMGIWO.js → chunk-M4YPHYEH.js} +3 -3
- package/dist/{chunk-6GMZ7HEE.js → chunk-OTQZ7ZWU.js} +3 -3
- package/dist/{chunk-NKHRDYOR.js → chunk-P3MG6QCN.js} +3 -3
- package/dist/{chunk-QIBVIOXO.js → chunk-PPTHY5QO.js} +2 -2
- package/dist/{chunk-6I2RQCET.js → chunk-Q2MPFCQ7.js} +2 -2
- package/dist/{chunk-BOET4NA4.js → chunk-QPQUVOZ2.js} +3 -3
- package/dist/{chunk-WEQEYLCS.js → chunk-QTQUH4DS.js} +5 -5
- package/dist/{chunk-XTXOCYOJ.js → chunk-R42NSZI6.js} +3 -3
- package/dist/{chunk-U4FOQDY4.js → chunk-R7BX2NB3.js} +2 -2
- package/dist/{chunk-7V4TP3AF.js → chunk-RF6D3Y5E.js} +3 -3
- package/dist/{chunk-ELNXJMGB.js → chunk-RSGLUIO6.js} +4 -4
- package/dist/{chunk-2Y4IMKA6.js → chunk-SGZAIJCV.js} +3 -3
- package/dist/{chunk-2N4GY74U.js → chunk-UDHWDSRL.js} +4 -4
- package/dist/{chunk-GPEQUXHL.js → chunk-UHHPLO3I.js} +3 -3
- package/dist/{chunk-SPXXX5E4.js → chunk-UP4BECPY.js} +2 -2
- package/dist/{chunk-L742JPKZ.js → chunk-V7ZRRCRJ.js} +4 -4
- package/dist/{chunk-RRNRNANG.js → chunk-WQBG4SZS.js} +21 -52
- package/dist/chunk-WQBG4SZS.js.map +1 -0
- package/dist/{chunk-KG7TZKZG.js → chunk-XKWGNJ26.js} +3 -3
- package/dist/{chunk-EYBQEIUY.js → chunk-YJRT5UQM.js} +2 -2
- package/dist/{chunk-FXBIP2WD.js → chunk-YJX7EOJD.js} +6 -6
- package/dist/{chunk-FMZY5Q6L.js → chunk-ZHKOPKE3.js} +3 -3
- package/dist/{chunk-6GOE5PGN.js → chunk-ZYIYHJ5R.js} +120 -57
- package/dist/{chunk-6GOE5PGN.js.map → chunk-ZYIYHJ5R.js.map} +1 -1
- package/dist/classified/index.js +1 -1
- package/dist/{classified-marker-LI2SF2E4.js → classified-marker-BWOFVYAC.js} +3 -3
- package/dist/{collection-facade-4GRREZ6C.js → collection-facade-JSJYIKS4.js} +10 -10
- package/dist/consent/index.js +6 -6
- package/dist/cover/index.js +5 -5
- package/dist/custody/index.js +8 -8
- package/dist/{dead-filter-TSWZQRR5.js → dead-filter-PKQDLOT4.js} +2 -2
- package/dist/{delegation-OVIFFPG4.js → delegation-DS5NRILW.js} +6 -6
- package/dist/derivations/index.js +12 -12
- package/dist/{derive-6O5SWQKN.js → derive-E642AOUB.js} +7 -7
- package/dist/directory/index.js +7 -7
- package/dist/{dispatch-WC6X2M6C.js → dispatch-IEPAVQUM.js} +5 -5
- package/dist/{dispatch-S73TK3IY.js → dispatch-Q6MWLOJY.js} +12 -12
- package/dist/{enclave-KJOTOH7X.js → enclave-55PAM4YO.js} +12 -6
- package/dist/{executor-PUAO6AKJ.js → executor-7UQ3BZ4F.js} +12 -12
- package/dist/{export-accessible-72EQNBMR.js → export-accessible-ORMKLA3E.js} +8 -8
- package/dist/{extract-partition-PUYNU3UF.js → extract-partition-NKYO3WNG.js} +11 -11
- package/dist/{fanout-sidecar-WUFXNYP4.js → fanout-sidecar-S3QL53YX.js} +6 -6
- package/dist/{find-2ABFCZX4.js → find-NOGJ25VX.js} +3 -3
- package/dist/forget/index.js +6 -6
- package/dist/history/index.js +9 -9
- package/dist/i18n/index.js +8 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -50
- package/dist/introspection/index.js +8 -8
- package/dist/issue-3DTQ7VJJ.js +18 -0
- package/dist/kernel/enclave/crypto.d.ts +16 -0
- package/dist/kernel/enclave/index.d.ts +1 -1
- package/dist/kernel/memory-store.d.ts +35 -7
- package/dist/{ledger-F33ZVMTK.js → ledger-EDXFFZQL.js} +8 -8
- package/dist/liberate-V35QUHJP.js +24 -0
- package/dist/{link-set-FKNWAYKS.js → link-set-2TTM3IZC.js} +7 -7
- package/dist/{managed-secret-PQYKSR6T.js → managed-secret-NCWEMPUQ.js} +6 -6
- package/dist/materialized-views/index.js +13 -13
- package/dist/{noydb-DUXZPKSN.js → noydb-62MX4QUG.js} +28 -28
- package/dist/periods/index.js +8 -8
- package/dist/pod/index.js +30 -30
- package/dist/{pod-handle-Q736KYON.js → pod-handle-ECVCDIXW.js} +6 -6
- package/dist/policy/index.js +5 -5
- package/dist/portability/index.js +6 -6
- package/dist/{post-register-LNE2FE2A.js → post-register-3IPCSG6Q.js} +4 -4
- package/dist/{register-I2DZXGAR.js → register-HHLXEQDN.js} +12 -12
- package/dist/{registry-VSSQPIGF.js → registry-JS3YFQQM.js} +7 -7
- package/dist/{registry-YLEWMGAC.js → registry-XX2Z7B46.js} +13 -13
- package/dist/{request-withdrawal-KFQHEZ25.js → request-withdrawal-CHPATE4G.js} +10 -10
- package/dist/{reveal-67RDQRIN.js → reveal-QZDHSGD4.js} +3 -3
- package/dist/{revoke-DQDZAZZM.js → revoke-7M2VW4ON.js} +8 -8
- package/dist/sealed-record/index.js +8 -8
- package/dist/search/index.js +1 -1
- package/dist/{seed-G42JYN56.js → seed-X5CC22CQ.js} +8 -8
- package/dist/sequence/index.js +6 -6
- package/dist/session/index.js +6 -6
- package/dist/{signer-WAMDZHEN.js → signer-SJQJVSM6.js} +7 -7
- package/dist/snapshots/index.js +6 -6
- package/dist/{stale-DDL7WQEZ.js → stale-BZS6H2RY.js} +7 -7
- package/dist/{storage-FLR73HHF.js → storage-RW4QBS23.js} +7 -7
- package/dist/{store-coordination-provider-MEQ2MJQG.js → store-coordination-provider-4WZAIRHC.js} +6 -6
- package/dist/sync/index.js +6 -6
- package/dist/team/index.js +9 -9
- package/dist/tiers/index.js +6 -6
- package/dist/vault-head/index.js +5 -5
- package/dist/{verify-KOV2G5D6.js → verify-6MDTIUEV.js} +4 -4
- package/dist/walk-ZURCH6RZ.js +21 -0
- package/dist/with-party/team/keyring.d.ts +12 -5
- package/dist/with-party/team/wrapped-deks.d.ts +4 -4
- package/dist/with-pod/pod.d.ts +4 -4
- package/dist/{withdraw-accessible-EL5GXZBS.js → withdraw-accessible-PXR4IXDX.js} +9 -9
- package/package.json +3 -3
- package/dist/api-TXFOVOXX.js +0 -19
- package/dist/backup-IJTB4S4M.js.map +0 -1
- package/dist/chunk-5WDXHNSW.js.map +0 -1
- package/dist/chunk-G56KBWFY.js.map +0 -1
- package/dist/chunk-RRNRNANG.js.map +0 -1
- package/dist/chunk-SL3JAAKN.js.map +0 -1
- package/dist/issue-SIDORTSZ.js +0 -18
- package/dist/liberate-LCDPNAG2.js +0 -24
- package/dist/walk-3UQBRMDV.js +0 -21
- /package/dist/{api-TXFOVOXX.js.map → api-WYW4YEQG.js.map} +0 -0
- /package/dist/{chunk-PT43Y56J.js.map → chunk-2ENE6445.js.map} +0 -0
- /package/dist/{chunk-CHJBLCOG.js.map → chunk-2N5ML6HT.js.map} +0 -0
- /package/dist/{chunk-KUJDV5QH.js.map → chunk-334WSVOW.js.map} +0 -0
- /package/dist/{chunk-BSFNRLK2.js.map → chunk-3BVH633C.js.map} +0 -0
- /package/dist/{chunk-CARABLSQ.js.map → chunk-3BZZJJMQ.js.map} +0 -0
- /package/dist/{chunk-3RCJJBNR.js.map → chunk-3PGS7TYR.js.map} +0 -0
- /package/dist/{chunk-K6LHRFBL.js.map → chunk-3VF3WQ4F.js.map} +0 -0
- /package/dist/{chunk-VXGSWL6L.js.map → chunk-4GFX6MPA.js.map} +0 -0
- /package/dist/{chunk-77K4PG6P.js.map → chunk-4ZS56W5S.js.map} +0 -0
- /package/dist/{chunk-K7NTTA6P.js.map → chunk-6LKOJBV6.js.map} +0 -0
- /package/dist/{chunk-AO42KJO6.js.map → chunk-7APJ6CO6.js.map} +0 -0
- /package/dist/{chunk-ANSIZYEG.js.map → chunk-A2HKRLPV.js.map} +0 -0
- /package/dist/{chunk-MUM7IANK.js.map → chunk-A66I4JOA.js.map} +0 -0
- /package/dist/{chunk-REDOOY2Q.js.map → chunk-ACAQ2DSG.js.map} +0 -0
- /package/dist/{chunk-X2DLENDQ.js.map → chunk-AYX7AINO.js.map} +0 -0
- /package/dist/{chunk-BOWNCWZT.js.map → chunk-BRLKZUBT.js.map} +0 -0
- /package/dist/{chunk-YSRUYAVU.js.map → chunk-BTDR2PXY.js.map} +0 -0
- /package/dist/{chunk-RMF67KCG.js.map → chunk-CHQCZZWC.js.map} +0 -0
- /package/dist/{chunk-2C3AQB46.js.map → chunk-CUQPWYRX.js.map} +0 -0
- /package/dist/{chunk-J6FXAEUG.js.map → chunk-DFMWUOU5.js.map} +0 -0
- /package/dist/{chunk-HDOU6I2Y.js.map → chunk-F3W6YMDC.js.map} +0 -0
- /package/dist/{chunk-KUX3OB6D.js.map → chunk-FET5XCAT.js.map} +0 -0
- /package/dist/{chunk-ANATMFIO.js.map → chunk-G73UVHCA.js.map} +0 -0
- /package/dist/{chunk-ZVO4QVPD.js.map → chunk-GPNTB4Y7.js.map} +0 -0
- /package/dist/{chunk-BM5TWITZ.js.map → chunk-HIWCKBEY.js.map} +0 -0
- /package/dist/{chunk-6X6SEMEE.js.map → chunk-HJUWN7JN.js.map} +0 -0
- /package/dist/{chunk-L7CIOOBW.js.map → chunk-JVIBCBC7.js.map} +0 -0
- /package/dist/{chunk-CPWQB3N5.js.map → chunk-K23VKTN4.js.map} +0 -0
- /package/dist/{chunk-NA2NIJZI.js.map → chunk-KKEESNPE.js.map} +0 -0
- /package/dist/{chunk-UXWB3FPF.js.map → chunk-LH5A3ZPG.js.map} +0 -0
- /package/dist/{chunk-KJIMGIWO.js.map → chunk-M4YPHYEH.js.map} +0 -0
- /package/dist/{chunk-6GMZ7HEE.js.map → chunk-OTQZ7ZWU.js.map} +0 -0
- /package/dist/{chunk-NKHRDYOR.js.map → chunk-P3MG6QCN.js.map} +0 -0
- /package/dist/{chunk-QIBVIOXO.js.map → chunk-PPTHY5QO.js.map} +0 -0
- /package/dist/{chunk-6I2RQCET.js.map → chunk-Q2MPFCQ7.js.map} +0 -0
- /package/dist/{chunk-BOET4NA4.js.map → chunk-QPQUVOZ2.js.map} +0 -0
- /package/dist/{chunk-WEQEYLCS.js.map → chunk-QTQUH4DS.js.map} +0 -0
- /package/dist/{chunk-XTXOCYOJ.js.map → chunk-R42NSZI6.js.map} +0 -0
- /package/dist/{chunk-U4FOQDY4.js.map → chunk-R7BX2NB3.js.map} +0 -0
- /package/dist/{chunk-7V4TP3AF.js.map → chunk-RF6D3Y5E.js.map} +0 -0
- /package/dist/{chunk-ELNXJMGB.js.map → chunk-RSGLUIO6.js.map} +0 -0
- /package/dist/{chunk-2Y4IMKA6.js.map → chunk-SGZAIJCV.js.map} +0 -0
- /package/dist/{chunk-2N4GY74U.js.map → chunk-UDHWDSRL.js.map} +0 -0
- /package/dist/{chunk-GPEQUXHL.js.map → chunk-UHHPLO3I.js.map} +0 -0
- /package/dist/{chunk-SPXXX5E4.js.map → chunk-UP4BECPY.js.map} +0 -0
- /package/dist/{chunk-L742JPKZ.js.map → chunk-V7ZRRCRJ.js.map} +0 -0
- /package/dist/{chunk-KG7TZKZG.js.map → chunk-XKWGNJ26.js.map} +0 -0
- /package/dist/{chunk-EYBQEIUY.js.map → chunk-YJRT5UQM.js.map} +0 -0
- /package/dist/{chunk-FXBIP2WD.js.map → chunk-YJX7EOJD.js.map} +0 -0
- /package/dist/{chunk-FMZY5Q6L.js.map → chunk-ZHKOPKE3.js.map} +0 -0
- /package/dist/{classified-marker-LI2SF2E4.js.map → classified-marker-BWOFVYAC.js.map} +0 -0
- /package/dist/{collection-facade-4GRREZ6C.js.map → collection-facade-JSJYIKS4.js.map} +0 -0
- /package/dist/{dead-filter-TSWZQRR5.js.map → dead-filter-PKQDLOT4.js.map} +0 -0
- /package/dist/{delegation-OVIFFPG4.js.map → delegation-DS5NRILW.js.map} +0 -0
- /package/dist/{derive-6O5SWQKN.js.map → derive-E642AOUB.js.map} +0 -0
- /package/dist/{dispatch-WC6X2M6C.js.map → dispatch-IEPAVQUM.js.map} +0 -0
- /package/dist/{dispatch-S73TK3IY.js.map → dispatch-Q6MWLOJY.js.map} +0 -0
- /package/dist/{enclave-KJOTOH7X.js.map → enclave-55PAM4YO.js.map} +0 -0
- /package/dist/{executor-PUAO6AKJ.js.map → executor-7UQ3BZ4F.js.map} +0 -0
- /package/dist/{export-accessible-72EQNBMR.js.map → export-accessible-ORMKLA3E.js.map} +0 -0
- /package/dist/{extract-partition-PUYNU3UF.js.map → extract-partition-NKYO3WNG.js.map} +0 -0
- /package/dist/{fanout-sidecar-WUFXNYP4.js.map → fanout-sidecar-S3QL53YX.js.map} +0 -0
- /package/dist/{find-2ABFCZX4.js.map → find-NOGJ25VX.js.map} +0 -0
- /package/dist/{issue-SIDORTSZ.js.map → issue-3DTQ7VJJ.js.map} +0 -0
- /package/dist/{ledger-F33ZVMTK.js.map → ledger-EDXFFZQL.js.map} +0 -0
- /package/dist/{liberate-LCDPNAG2.js.map → liberate-V35QUHJP.js.map} +0 -0
- /package/dist/{link-set-FKNWAYKS.js.map → link-set-2TTM3IZC.js.map} +0 -0
- /package/dist/{managed-secret-PQYKSR6T.js.map → managed-secret-NCWEMPUQ.js.map} +0 -0
- /package/dist/{noydb-DUXZPKSN.js.map → noydb-62MX4QUG.js.map} +0 -0
- /package/dist/{pod-handle-Q736KYON.js.map → pod-handle-ECVCDIXW.js.map} +0 -0
- /package/dist/{post-register-LNE2FE2A.js.map → post-register-3IPCSG6Q.js.map} +0 -0
- /package/dist/{register-I2DZXGAR.js.map → register-HHLXEQDN.js.map} +0 -0
- /package/dist/{registry-VSSQPIGF.js.map → registry-JS3YFQQM.js.map} +0 -0
- /package/dist/{registry-YLEWMGAC.js.map → registry-XX2Z7B46.js.map} +0 -0
- /package/dist/{request-withdrawal-KFQHEZ25.js.map → request-withdrawal-CHPATE4G.js.map} +0 -0
- /package/dist/{reveal-67RDQRIN.js.map → reveal-QZDHSGD4.js.map} +0 -0
- /package/dist/{revoke-DQDZAZZM.js.map → revoke-7M2VW4ON.js.map} +0 -0
- /package/dist/{seed-G42JYN56.js.map → seed-X5CC22CQ.js.map} +0 -0
- /package/dist/{signer-WAMDZHEN.js.map → signer-SJQJVSM6.js.map} +0 -0
- /package/dist/{stale-DDL7WQEZ.js.map → stale-BZS6H2RY.js.map} +0 -0
- /package/dist/{storage-FLR73HHF.js.map → storage-RW4QBS23.js.map} +0 -0
- /package/dist/{store-coordination-provider-MEQ2MJQG.js.map → store-coordination-provider-4WZAIRHC.js.map} +0 -0
- /package/dist/{verify-KOV2G5D6.js.map → verify-6MDTIUEV.js.map} +0 -0
- /package/dist/{walk-3UQBRMDV.js.map → walk-ZURCH6RZ.js.map} +0 -0
- /package/dist/{withdraw-accessible-EL5GXZBS.js.map → withdraw-accessible-PXR4IXDX.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
walkClosure
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3PGS7TYR.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveManagedSecret
|
|
6
6
|
} from "./chunk-4GVM6QZA.js";
|
|
@@ -8,29 +8,29 @@ import {
|
|
|
8
8
|
parseExtractedPartitionBody,
|
|
9
9
|
readPod,
|
|
10
10
|
readPodHeader
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BVN6KXL2.js";
|
|
12
12
|
import {
|
|
13
13
|
createOwnerKeyring,
|
|
14
14
|
mintRosterTag,
|
|
15
15
|
nextRosterEpoch,
|
|
16
16
|
requireRosterKey
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3V4KWFX7.js";
|
|
18
18
|
import {
|
|
19
19
|
LedgerStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-V7ZRRCRJ.js";
|
|
21
21
|
import {
|
|
22
22
|
LEDGER_COLLECTION
|
|
23
23
|
} from "./chunk-I7FD46FF.js";
|
|
24
24
|
import {
|
|
25
25
|
openEnvelopeJson
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4ZS56W5S.js";
|
|
27
27
|
import {
|
|
28
28
|
buildRecordEnvelope
|
|
29
29
|
} from "./chunk-SZJ3DLZA.js";
|
|
30
30
|
import {
|
|
31
31
|
base64ToBuffer,
|
|
32
32
|
wrapKey
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-HPVZCW43.js";
|
|
34
34
|
import {
|
|
35
35
|
AdoptionStateError,
|
|
36
36
|
TransferSealError,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
function withCargo() {
|
|
42
42
|
return {
|
|
43
43
|
async extractPartition(vault, opts) {
|
|
44
|
-
const { extractPartitionCore } = await import("./extract-partition-
|
|
44
|
+
const { extractPartitionCore } = await import("./extract-partition-NKYO3WNG.js");
|
|
45
45
|
return extractPartitionCore(vault, opts);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -252,7 +252,7 @@ async function createOwnerOnAdoptedPartition(store, vaultName, opts) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
if (isManaged(opts)) {
|
|
255
|
-
const { createNoydb } = await import("./noydb-
|
|
255
|
+
const { createNoydb } = await import("./noydb-62MX4QUG.js");
|
|
256
256
|
const db = await createNoydb({
|
|
257
257
|
store,
|
|
258
258
|
user: userId,
|
|
@@ -307,4 +307,4 @@ export {
|
|
|
307
307
|
withCargo,
|
|
308
308
|
describeExtraction
|
|
309
309
|
};
|
|
310
|
-
//# sourceMappingURL=chunk-
|
|
310
|
+
//# sourceMappingURL=chunk-DFMWUOU5.js.map
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
ViaGraph,
|
|
7
7
|
matchTargetFieldNames,
|
|
8
8
|
schemaFieldKeys
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CUQPWYRX.js";
|
|
10
10
|
import {
|
|
11
11
|
sha256Hex
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HPVZCW43.js";
|
|
13
13
|
import {
|
|
14
14
|
DerivationCycleError,
|
|
15
15
|
DuplicateBehaviorNameError,
|
|
@@ -244,4 +244,4 @@ var DerivationRegistry = class {
|
|
|
244
244
|
export {
|
|
245
245
|
DerivationRegistry
|
|
246
246
|
};
|
|
247
|
-
//# sourceMappingURL=chunk-
|
|
247
|
+
//# sourceMappingURL=chunk-F3W6YMDC.js.map
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-VYYM3MEN.js";
|
|
7
7
|
import {
|
|
8
8
|
derivePersistedSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ACAQ2DSG.js";
|
|
10
10
|
import {
|
|
11
11
|
loadPersistedSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SGZAIJCV.js";
|
|
13
13
|
|
|
14
14
|
// src/with-shape/introspection/walk.ts
|
|
15
15
|
var INTERNAL_PREFIX = "_";
|
|
@@ -240,4 +240,4 @@ function summariseAggregateOp(value) {
|
|
|
240
240
|
export {
|
|
241
241
|
dumpVaultSchema
|
|
242
242
|
};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-FET5XCAT.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildRecordAad,
|
|
3
3
|
openEnvelopeJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ZS56W5S.js";
|
|
5
5
|
import {
|
|
6
6
|
buildRecordEnvelope
|
|
7
7
|
} from "./chunk-SZJ3DLZA.js";
|
|
8
8
|
import {
|
|
9
9
|
encrypt
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HPVZCW43.js";
|
|
11
11
|
import {
|
|
12
12
|
ConflictError
|
|
13
13
|
} from "./chunk-7O3Y4PPD.js";
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
loadSigner,
|
|
56
56
|
loadOrCreateSigner
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-G73UVHCA.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildRecordAad,
|
|
3
3
|
openEnvelopeJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ZS56W5S.js";
|
|
5
5
|
import {
|
|
6
6
|
buildRecordEnvelope
|
|
7
7
|
} from "./chunk-SZJ3DLZA.js";
|
|
8
8
|
import {
|
|
9
9
|
encrypt
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HPVZCW43.js";
|
|
11
11
|
import {
|
|
12
12
|
SequenceContentionError,
|
|
13
13
|
SequenceNotEnabledError,
|
|
@@ -201,4 +201,4 @@ export {
|
|
|
201
201
|
resolveSequenceKey,
|
|
202
202
|
SequenceStore
|
|
203
203
|
};
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
204
|
+
//# sourceMappingURL=chunk-GPNTB4Y7.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
buildRecordAad,
|
|
11
11
|
openEnvelopeJson,
|
|
12
12
|
writeEnvelopeBody
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4ZS56W5S.js";
|
|
14
14
|
import {
|
|
15
15
|
buildRecordEnvelope,
|
|
16
16
|
buildSealedRecordEnvelope
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
sha256Hex,
|
|
28
28
|
unwrapCek,
|
|
29
29
|
wrapCek
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HPVZCW43.js";
|
|
31
31
|
import {
|
|
32
32
|
BLOB_ADDRESS_KEY_ID,
|
|
33
33
|
BlobIntentPendingError,
|
|
@@ -3137,4 +3137,4 @@ export {
|
|
|
3137
3137
|
DEFAULT_CHUNK_SIZE,
|
|
3138
3138
|
BlobSet
|
|
3139
3139
|
};
|
|
3140
|
-
//# sourceMappingURL=chunk-
|
|
3140
|
+
//# sourceMappingURL=chunk-HIWCKBEY.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateProjectionLegs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PPTHY5QO.js";
|
|
4
4
|
import {
|
|
5
5
|
MaterializedViewConfigError,
|
|
6
6
|
ValidationError
|
|
@@ -183,4 +183,4 @@ function withMaterializedView(spec) {
|
|
|
183
183
|
export {
|
|
184
184
|
withMaterializedView
|
|
185
185
|
};
|
|
186
|
-
//# sourceMappingURL=chunk-
|
|
186
|
+
//# sourceMappingURL=chunk-HJUWN7JN.js.map
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
var PBKDF2_ITERATIONS = 6e5;
|
|
10
10
|
var SALT_BYTES = 32;
|
|
11
11
|
var IV_BYTES = 12;
|
|
12
|
+
var RECOVERY_SECRET_BYTES = 32;
|
|
12
13
|
var KEY_BITS = 256;
|
|
13
14
|
var subtle = globalThis.crypto.subtle;
|
|
14
15
|
async function deriveKey(secret, salt) {
|
|
@@ -87,6 +88,27 @@ async function generateDEK() {
|
|
|
87
88
|
["encrypt", "decrypt"]
|
|
88
89
|
);
|
|
89
90
|
}
|
|
91
|
+
async function exportDekSet(deks) {
|
|
92
|
+
const out = {};
|
|
93
|
+
for (const [coll, dek] of deks) {
|
|
94
|
+
out[coll] = bufferToBase64(await subtle.exportKey("raw", dek));
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
async function importDekSet(exported) {
|
|
99
|
+
const deks = /* @__PURE__ */ new Map();
|
|
100
|
+
for (const [coll, b64] of Object.entries(exported)) {
|
|
101
|
+
const key = await subtle.importKey(
|
|
102
|
+
"raw",
|
|
103
|
+
base64ToBuffer(b64),
|
|
104
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
105
|
+
true,
|
|
106
|
+
["encrypt", "decrypt"]
|
|
107
|
+
);
|
|
108
|
+
deks.set(coll, key);
|
|
109
|
+
}
|
|
110
|
+
return deks;
|
|
111
|
+
}
|
|
90
112
|
async function wrapKey(dek, kek) {
|
|
91
113
|
const wrapped = await subtle.wrapKey("raw", dek, kek, "AES-KW");
|
|
92
114
|
return bufferToBase64(wrapped);
|
|
@@ -400,6 +422,9 @@ function generateIV() {
|
|
|
400
422
|
function generateSalt() {
|
|
401
423
|
return globalThis.crypto.getRandomValues(new Uint8Array(SALT_BYTES));
|
|
402
424
|
}
|
|
425
|
+
function generateRecoverySecret() {
|
|
426
|
+
return globalThis.crypto.getRandomValues(new Uint8Array(RECOVERY_SECRET_BYTES));
|
|
427
|
+
}
|
|
403
428
|
function bufferToBase64(buffer) {
|
|
404
429
|
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
405
430
|
let binary = "";
|
|
@@ -423,6 +448,8 @@ export {
|
|
|
423
448
|
deriveEchoKey,
|
|
424
449
|
deriveSecretKey,
|
|
425
450
|
generateDEK,
|
|
451
|
+
exportDekSet,
|
|
452
|
+
importDekSet,
|
|
426
453
|
wrapKey,
|
|
427
454
|
unwrapKey,
|
|
428
455
|
wrapCek,
|
|
@@ -445,7 +472,8 @@ export {
|
|
|
445
472
|
decryptDeterministic,
|
|
446
473
|
generateIV,
|
|
447
474
|
generateSalt,
|
|
475
|
+
generateRecoverySecret,
|
|
448
476
|
bufferToBase64,
|
|
449
477
|
base64ToBuffer
|
|
450
478
|
};
|
|
451
|
-
//# sourceMappingURL=chunk-
|
|
479
|
+
//# sourceMappingURL=chunk-HPVZCW43.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kernel/enclave/crypto.ts"],"sourcesContent":["/**\n * Cryptographic primitives — thin wrappers around the Web Crypto API.\n *\n * ## Design principle\n *\n * **Zero npm crypto dependencies.** Every operation uses `globalThis.crypto.subtle`,\n * which is available natively in Node.js ≥ 18, all modern browsers, and\n * Deno/Bun. This avoids supply-chain risk from third-party crypto packages and\n * ensures the library stays auditable.\n *\n * ## Algorithms\n *\n * | Use case | Algorithm | Parameters |\n * |----------|-----------|------------|\n * | Key derivation | PBKDF2-SHA256 | 600,000 iterations, 32-byte salt |\n * | Record encryption | AES-256-GCM | 12-byte random IV per operation |\n * | DEK wrapping | AES-KW (RFC 3394) | 256-bit KEK |\n * | Binary encrypt | AES-256-GCM | same as record encryption |\n * | Integrity | HMAC-SHA256 | for presence channels |\n * | Content hash | SHA-256 | for ledger and bundle integrity |\n *\n * ## Key lifecycle\n *\n * ```\n * secret + salt\n * └─► deriveKey() → KEK (CryptoKey, extractable: false)\n * └─► wrapKey() → wrapped DEK bytes [stored in keyring]\n * └─► unwrapKey() → DEK (CryptoKey) [memory only during session]\n * └─► encrypt() / decrypt() → ciphertext / plaintext\n * ```\n *\n * IVs are generated fresh by {@link generateIV} on every encrypt call.\n * Reusing an IV with the same key would break GCM's authentication guarantee —\n * this function should be the only place IVs are produced.\n *\n * @module\n */\n\nimport { DecryptionError, InvalidKeyError, TamperedError, ValidationError } from '../errors.js'\n\n/**\n * **EnclaveKey** — the opaque key type at the enclave seam.\n *\n * In noy-db's reference enclave this is `CryptoKey` (the Web Crypto API's\n * key handle). A fork's enclave redefines this alias to its own key\n * representation (e.g. `type EnclaveKey = null` for a keyless HSM-backed\n * fork) — outside `kernel/enclave/**`, every consumer must treat it as\n * opaque: never construct, inspect, or serialize it directly, only pass it\n * between barrel functions (`encrypt`/`decrypt`/`wrapKey`/`unwrapKey`/…).\n */\nexport type EnclaveKey = CryptoKey\n\nconst PBKDF2_ITERATIONS = 600_000\nconst SALT_BYTES = 32\nconst IV_BYTES = 12\nconst RECOVERY_SECRET_BYTES = 32\nconst KEY_BITS = 256\n\nconst subtle = globalThis.crypto.subtle\n\n// ─── Key Derivation ────────────────────────────────────────────────────\n\n/** Derive a KEK from a secret and salt using PBKDF2-SHA256. */\nexport async function deriveKey(\n secret: string,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n return deriveKekFromMaterial(new TextEncoder().encode(secret), salt)\n}\n\n/**\n * Shared PBKDF2 → AES-KW derivation core. `material` is the raw\n * pre-KDF input bytes (a UTF-8 phrase for standard mode, an\n * AG-1-encoded 3-part structure for echo mode).\n */\nasync function deriveKekFromMaterial(\n material: Uint8Array,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n const keyMaterial = await subtle.importKey('raw', material as BufferSource, 'PBKDF2', false, ['deriveKey'])\n return subtle.deriveKey(\n { name: 'PBKDF2', salt: salt as BufferSource, iterations: PBKDF2_ITERATIONS, hash: 'SHA-256' },\n keyMaterial,\n { name: 'AES-KW', length: KEY_BITS },\n false,\n ['wrapKey', 'unwrapKey'],\n )\n}\n\n/** One three-part echo secret: prompt (typed) → echo (revealed) → key (typed). */\nexport interface EchoSecretParts {\n readonly prompt: string\n readonly echo: string\n readonly key: string\n}\n\n/**\n * Domain context for the AG-1 encoding. The leading `0xFF` is the load-bearing\n * byte: it is not a legal UTF-8 lead byte, so `TextEncoder` can never emit it —\n * no string's UTF-8 encoding can equal an AG-1 encoding, whatever the string.\n */\nconst ECHO_KDF_CONTEXT = new Uint8Array([0xff, ...new TextEncoder().encode('noydb-echo-secret-v1')])\n\n/**\n * AG-1 encoding: domain context + 4-byte big-endian length prefix per\n * part. Two independent guarantees make a single typed string unable to\n * derive an echo vault's KEK (spec AG-1):\n *\n * 1. The `0xFF` context prefix — UTF-8 never produces that byte, so the\n * encoding is provably not the encoding of ANY string (not merely of\n * no separator-joined form).\n * 2. Structural length prefixes — part boundaries are key material, so\n * re-splitting the same characters changes the derived KEK.\n *\n * @throws ValidationError when any part is not a string — the single\n * chokepoint every echo KEK derivation and block mint passes through, so a\n * malformed parts object cannot be `TextEncoder`-coerced into key material.\n */\nexport function encodeEchoParts(parts: EchoSecretParts): Uint8Array {\n for (const name of ['prompt', 'echo', 'key'] as const) {\n if (typeof parts?.[name] !== 'string') {\n throw new ValidationError('echo secret parts must be three strings: prompt, echo, key')\n }\n }\n const enc = new TextEncoder()\n const segments = [parts.prompt, parts.echo, parts.key].map((p) => enc.encode(p))\n const total = ECHO_KDF_CONTEXT.length + segments.reduce((n, s) => n + 4 + s.length, 0)\n const out = new Uint8Array(total)\n out.set(ECHO_KDF_CONTEXT, 0)\n let offset = ECHO_KDF_CONTEXT.length\n for (const s of segments) {\n new DataView(out.buffer).setUint32(offset, s.length, false)\n out.set(s, offset + 4)\n offset += 4 + s.length\n }\n return out\n}\n\n/** Derive the tier-1 KEK from a 3-part echo secret (spec: KEK from ALL parts). */\nexport async function deriveEchoKey(\n parts: EchoSecretParts,\n salt: Uint8Array,\n): Promise<CryptoKey> {\n return deriveKekFromMaterial(encodeEchoParts(parts), salt)\n}\n\n/**\n * Which AES algorithm/usage a {@link deriveSecretKey} result is for:\n * `'aes-kw'` mints a key-wrapping key (`wrapKey`/`unwrapKey`, e.g. for\n * KEK derivation); `'aes-gcm'` mints a direct encrypt/decrypt key (e.g.\n * for the wrap-DEKs primitive in `with-party/team/wrapped-deks.ts`).\n */\nexport type SecretKeyUsage = 'aes-kw' | 'aes-gcm'\n\n/**\n * Derive a non-extractable AES key from a secret/credential and salt\n * via PBKDF2-SHA256, generalizing {@link deriveKey}'s AES-KW derivation to\n * also cover AES-GCM-usage keys. Callers pin their own `iterations` and\n * `keyUsage` so an existing call site's exact parameters (and thus its\n * derived-key bytes) are preserved verbatim when migrated onto this\n * shared primitive — this is call-site consolidation, not a KDF change.\n */\nexport async function deriveSecretKey(\n secret: string,\n salt: Uint8Array,\n params: { iterations: number; keyUsage: SecretKeyUsage },\n): Promise<CryptoKey> {\n const keyMaterial = await subtle.importKey(\n 'raw',\n new TextEncoder().encode(secret),\n 'PBKDF2',\n false,\n ['deriveKey'],\n )\n\n return params.keyUsage === 'aes-gcm'\n ? subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt as BufferSource,\n iterations: params.iterations,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n : subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt as BufferSource,\n iterations: params.iterations,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-KW', length: KEY_BITS },\n false,\n ['wrapKey', 'unwrapKey'],\n )\n}\n\n// ─── DEK Generation ────────────────────────────────────────────────────\n\n/** Generate a random AES-256-GCM data encryption key. */\nexport async function generateDEK(): Promise<CryptoKey> {\n return subtle.generateKey(\n { name: 'AES-GCM', length: KEY_BITS },\n true, // extractable — needed for AES-KW wrapping\n ['encrypt', 'decrypt'],\n )\n}\n\n// ─── DEK-Set Codec ─────────────────────────────────────────────────────\n//\n// The portable form of a DEK set — `{ collection: base64(rawKey) }` — is the\n// plaintext body of every persisted WrappedDeksBlob (recovery-paper,\n// recovery-shamir, tier-2 password slots). It is an enclave door because it\n// is the one place a key's REPRESENTATION crosses into bytes: a fork with its\n// own EnclaveKey (hardware-backed, post-quantum, no encryption) decides here\n// what \"the bytes of a key\" means, and nothing outside kernel/enclave has to\n// know. Byte-for-byte what wrapped-deks.ts did inline before #1317.\n\n/** Serialize a DEK set to `{ collection: base64(rawKey) }`. */\nexport async function exportDekSet(deks: Map<string, CryptoKey>): Promise<Record<string, string>> {\n const out: Record<string, string> = {}\n for (const [coll, dek] of deks) {\n out[coll] = bufferToBase64(await subtle.exportKey('raw', dek))\n }\n return out\n}\n\n/**\n * Reverse of {@link exportDekSet}. Keys come back extractable AES-GCM\n * (`encrypt`/`decrypt`), matching what `generateDEK` mints.\n */\nexport async function importDekSet(exported: Record<string, string>): Promise<Map<string, CryptoKey>> {\n const deks = new Map<string, CryptoKey>()\n for (const [coll, b64] of Object.entries(exported)) {\n const key = await subtle.importKey(\n 'raw',\n base64ToBuffer(b64) as BufferSource,\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n deks.set(coll, key)\n }\n return deks\n}\n\n// ─── Key Wrapping ──────────────────────────────────────────────────────\n\n/** Wrap (encrypt) a DEK with a KEK using AES-KW. Returns base64 string. */\nexport async function wrapKey(dek: CryptoKey, kek: CryptoKey): Promise<string> {\n const wrapped = await subtle.wrapKey('raw', dek, kek, 'AES-KW')\n return bufferToBase64(wrapped)\n}\n\n/** Unwrap (decrypt) a DEK from base64 string using a KEK. */\nexport async function unwrapKey(\n wrappedBase64: string,\n kek: CryptoKey,\n): Promise<CryptoKey> {\n try {\n return await subtle.unwrapKey(\n 'raw',\n base64ToBuffer(wrappedBase64) as BufferSource,\n kek,\n 'AES-KW',\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n } catch {\n throw new InvalidKeyError()\n }\n}\n\n// ─── Per-record CEK wrapping ───────────────────────────────────────────\n\n/**\n * Derive a **dedicated** AES-KW wrapping key from a collection/tier DEK via\n * HKDF-SHA256, used to wrap/unwrap a per-record CEK.\n *\n * The collection/tier DEKs are AES-256-**GCM** keys (usages\n * `encrypt`/`decrypt`) and cannot themselves act as an AES-KW KEK. We do NOT\n * re-import the raw DEK bytes directly as an AES-KW key — that would reuse one\n * key across two primitives (AES-GCM for `_det`/presence, AES-KW for CEK\n * wrapping), violating key separation. Instead we HKDF-derive a domain-\n * separated KW key (salt `noydb-cek-wrap`), exactly as `derivePresenceKey`\n * derives a separate presence key. The derivation is deterministic, so\n * wrapping the same CEK under the same DEK always yields identical ciphertext\n * — which is what lets an update reuse a record's stable CEK and produce a\n * byte-identical `_cek`. The KW key is independent of the DEK's GCM key.\n *\n * The DEK must be extractable (it is — `generateDEK`/`unwrapKey` mint\n * extractable keys).\n */\nasync function asKwKey(dek: CryptoKey): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-cek-wrap')\n const info = new TextEncoder().encode('v1')\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey('raw', bits, 'AES-KW', false, ['wrapKey', 'unwrapKey'])\n}\n\n/**\n * AES-KW-wrap a per-record CEK under a collection/tier DEK. Returns base64.\n * Deterministic over `(cek, dek)`.\n */\nexport async function wrapCek(cek: CryptoKey, dek: CryptoKey): Promise<string> {\n const kw = await asKwKey(dek)\n const wrapped = await subtle.wrapKey('raw', cek, kw, 'AES-KW')\n return bufferToBase64(wrapped)\n}\n\n/**\n * Unwrap a per-record CEK from base64 under a collection/tier DEK. Throws\n * `InvalidKeyError` if the wrapped bytes do not authenticate under the DEK.\n */\nexport async function unwrapCek(wrappedBase64: string, dek: CryptoKey): Promise<CryptoKey> {\n const kw = await asKwKey(dek)\n try {\n return await subtle.unwrapKey(\n 'raw',\n base64ToBuffer(wrappedBase64) as BufferSource,\n kw,\n 'AES-KW',\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n } catch {\n throw new InvalidKeyError()\n }\n}\n\n/**\n * Import a raw 32-byte AES-256-GCM record CEK (e.g. from a sealed-CEK\n * delivery binding). Non-extractable, decrypt-only — the imported key is\n * used solely to open the record's `_iv`/`_data` body under `decrypt()`.\n */\nexport async function importCek(rawKey: Uint8Array): Promise<CryptoKey> {\n return subtle.importKey('raw', rawKey as BufferSource, { name: 'AES-GCM', length: KEY_BITS }, false, ['decrypt'])\n}\n\n// ─── Encrypt / Decrypt ─────────────────────────────────────────────────\n\nexport interface EncryptResult {\n iv: string // base64\n data: string // base64\n}\n\n/**\n * Encrypt plaintext JSON string with AES-256-GCM. Fresh IV per call.\n *\n * `aad` binds the record's identity into the auth tag (#1041) — see\n * `record-aad.ts` for what is bound and why `_v` is not. A body sealed with\n * AAD can only be opened by a reader supplying the identical bytes, which is\n * what stops an untrusted store from relocating or re-tiering an envelope.\n *\n * Optional **only while the call-site sweep is in progress**. It becomes\n * mandatory once every `encrypt`/`decrypt` pair supplies it, at which point\n * the format version bumps and the reader rejects anything unbound. Until\n * then an omitted `aad` reproduces the previous, unauthenticated behaviour.\n */\nexport async function encrypt(\n plaintext: string,\n dek: CryptoKey,\n aad?: Uint8Array,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const encoded = new TextEncoder().encode(plaintext)\n\n const ciphertext = await subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n ...(aad !== undefined && { additionalData: aad as BufferSource }),\n },\n dek,\n encoded,\n )\n\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext. Throws on wrong key or tampered data.\n *\n * `aad` must be byte-identical to what {@link encrypt} was given, or the auth\n * tag fails and this throws `TamperedError` (#1041). Note the asymmetry that\n * makes this useful: a mismatched identity is indistinguishable from a\n * corrupted body, so relocation fails **closed** rather than returning a\n * plausible record in the wrong place.\n */\nexport async function decrypt(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n aad?: Uint8Array,\n): Promise<string> {\n const iv = base64ToBuffer(ivBase64)\n const ciphertext = base64ToBuffer(dataBase64)\n\n try {\n const plaintext = await subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n ...(aad !== undefined && { additionalData: aad as BufferSource }),\n },\n dek,\n ciphertext as BufferSource,\n )\n return new TextDecoder().decode(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError(...(await classifyTagFailure(iv, ciphertext, dek, aad)))\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n\n/**\n * Distinguish a FORMAT TRANSITION from an attack, when the enclave can (#1103).\n *\n * ## The problem\n *\n * Since #1041 switched identity AAD on, one `TamperedError` covers at least\n * four situations: legitimate pre-binding data, a store that reconstructs an\n * envelope and drops a bound field, a CEK/rotation mismatch, and actual\n * tampering. `SECURITY.md` and the subsystem docs teach the LAST reading — so a\n * user who upgrades, hits this on their own honest data, and consults the docs\n * is told their store has been compromised.\n *\n * That is a false positive on the product's central security claim, and the\n * cost is not merely a confusing message: **a tamper alarm that cries wolf is\n * one users learn to ignore.**\n *\n * ## Why the probe is sound, and why it is NOT a downgrade\n *\n * A body sealed before #1041 carries no AAD, so it opens under an empty one.\n * Retrying that way is **positive evidence** of the legacy format rather than a\n * guess: forging a body that decrypts under this DEK requires the DEK, and an\n * untrusted store does not hold one.\n *\n * ⚠️ **Classification ONLY — the plaintext is discarded and the caller still\n * throws.** That is the entire safety argument: the outcome is identical either\n * way, so this cannot become the lenient path #1041 exists to remove. A variant\n * that RETURNED the retry's plaintext would be exactly the accept-without-AAD\n * downgrade the binding was built to prevent. Do not \"optimise\" it into one.\n *\n * Note what the honest message concedes: pre-#1041 data had no authenticated\n * metadata, so a legacy record that was ALSO tampered with reads as legacy.\n * That is not a weakening — it is an accurate statement about data that\n * genuinely never carried a binding.\n */\nasync function classifyTagFailure(\n iv: Uint8Array,\n ciphertext: Uint8Array,\n dek: CryptoKey,\n aad: Uint8Array | undefined,\n): Promise<[] | [string, 'unbound-legacy-format']> {\n // Only meaningful when AAD was supplied: with none there is no second\n // interpretation to test, and the failure is a plain tag mismatch.\n if (aad === undefined) return []\n try {\n await subtle.decrypt({ name: 'AES-GCM', iv: iv as BufferSource }, dek, ciphertext as BufferSource)\n } catch {\n return [] // no benign explanation — the security alert stands\n }\n return [\n 'This record was sealed BEFORE record-identity binding (#1041) and cannot be read by this ' +\n 'version. Its body decrypts correctly under the record key, so this is a data-format ' +\n 'transition, not tampering — but it also means the record predates authenticated metadata. ' +\n 'There is no migration path; see noy-db #1100.',\n 'unbound-legacy-format',\n ]\n}\n\n// ─── Binary Encrypt / Decrypt ────────\n\n/**\n * Encrypt raw bytes with AES-256-GCM using a fresh random IV.\n * Used by the attachment store so binary blobs avoid double base64 encoding\n * (the existing `encrypt()` function calls `TextEncoder` on a string — here\n * we pass the `Uint8Array` directly to `subtle.encrypt`).\n */\nexport async function encryptBytes(\n data: Uint8Array,\n dek: CryptoKey,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const ciphertext = await subtle.encrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n data as unknown as BufferSource,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext back to raw bytes.\n * Counterpart to `encryptBytes`. Throws `TamperedError` on auth-tag failure.\n */\nexport async function decryptBytes(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n): Promise<Uint8Array> {\n const iv = base64ToBuffer(ivBase64)\n const ciphertext = base64ToBuffer(dataBase64)\n try {\n const plaintext = await subtle.decrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n ciphertext as BufferSource,\n )\n return new Uint8Array(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError()\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n/**\n * SHA-256 hex digest of raw bytes. Used to derive content-addressed\n * eTags for blob deduplication. Computed on plaintext bytes\n * before compression and encryption so the eTag identifies content, not\n * ciphertext, and survives re-encryption (key rotation, re-upload).\n */\nexport async function sha256Hex(data: Uint8Array): Promise<string> {\n const hash = await subtle.digest('SHA-256', data as unknown as BufferSource)\n return Array.from(new Uint8Array(hash))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n}\n\n// ─── HMAC-SHA-256 ─────────────────────────────\n\n/**\n * Compute HMAC-SHA-256(key, data) and return hex string.\n *\n * Used to derive content-addressed eTags that are opaque to the store:\n * ```\n * eTag = hmacSha256Hex(blobDEK, plaintext)\n * ```\n *\n * Unlike a plain SHA-256, the HMAC is keyed by the vault-shared `_blob` DEK,\n * so an attacker with store access cannot pre-compute eTags for known files.\n * Deduplication still works within a vault (same key + same content = same eTag).\n */\n/**\n * Derive the blob CONTENT-ADDRESSING key for one tier (#1126).\n *\n * The blob eTag is an HMAC over the plaintext. It used to be keyed by the\n * `_blob` DEK — the very key `rotateKeys` replaces — so after any rotation\n * `HMAC(live DEK, plaintext) !== storedETag` for every blob written before it,\n * permanently. `decryptResponse()` checks that unconditionally, so the\n * presigned-URL read path raised `TamperedError` on legitimate data forever;\n * dedup also split, minting a second address for identical bytes.\n *\n * The fix is a `root` that rotation never touches (`_blob_addr`, refused by\n * `rotateKeys` exactly as `_roster` is). Rotation then re-keys chunk BODIES\n * while every address stays stable, which is what makes the AAD\n * `{eTag}:{i}:{count}` and every `_blob_index` / `_blob_slots_*` /\n * `_blob_versions_*` row survive it untouched.\n *\n * **Derived PER TIER, deliberately.** A single vault-wide address would make an\n * elevated blob and a tier-0 blob with identical content share an eTag,\n * leaking equality across a boundary the tier system exists to enforce — and\n * `rehomeForTier` re-addresses on a tier move precisely because the address is\n * tier-scoped today. Domain separation keeps that property while removing the\n * rotation coupling: the two are independent axes, and only one of them was\n * ever meant to change the address.\n *\n * Same HKDF idiom as `asKwKey`, with its own salt so the addressing key can\n * never coincide with a wrapping or encryption key.\n */\nexport async function deriveBlobAddressKey(root: CryptoKey, tier: number): Promise<CryptoKey> {\n const rawRoot = await subtle.exportKey('raw', root)\n const hkdfKey = await subtle.importKey('raw', rawRoot, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-blob-address')\n const info = new TextEncoder().encode(`tier:${tier}`)\n const bits = await subtle.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt, info }, hkdfKey, KEY_BITS)\n // Imported as AES-GCM only because `hmacSha256Hex` re-exports raw and\n // re-imports as HMAC; the algorithm tag here is a carrier, never used to\n // encrypt anything.\n return subtle.importKey('raw', bits, { name: 'AES-GCM' }, true, ['encrypt', 'decrypt'])\n}\n\nexport async function hmacSha256Hex(key: CryptoKey, data: Uint8Array): Promise<string> {\n // Export AES-GCM DEK raw bytes → import as HMAC key\n const rawKey = await subtle.exportKey('raw', key)\n const hmacKey = await subtle.importKey(\n 'raw',\n rawKey,\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n )\n const sig = await subtle.sign('HMAC', hmacKey, data as unknown as BufferSource)\n return Array.from(new Uint8Array(sig))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n}\n\n// ─── AAD-aware Binary Encrypt / Decrypt ──\n\n/**\n * Encrypt raw bytes with AES-256-GCM using Additional Authenticated Data.\n *\n * The AAD binds each chunk to its parent blob and position, preventing\n * chunk reorder, substitution, and truncation attacks:\n * ```\n * AAD = UTF-8(\"{eTag}:{chunkIndex}:{chunkCount}\")\n * ```\n *\n * The AAD is NOT stored — the reader reconstructs it from `BlobObject`\n * metadata and passes it to `decryptBytesWithAAD`.\n */\nexport async function encryptBytesWithAAD(\n data: Uint8Array,\n dek: CryptoKey,\n aad: Uint8Array,\n): Promise<EncryptResult> {\n const iv = generateIV()\n const ciphertext = await subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n additionalData: aad as BufferSource,\n },\n dek,\n data as unknown as BufferSource,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Decrypt AES-256-GCM ciphertext with AAD verification.\n *\n * If the AAD does not match the one used at encryption time (e.g. because\n * a chunk was reordered or substituted from another blob), the GCM auth\n * tag fails and this throws `TamperedError`.\n */\nexport async function decryptBytesWithAAD(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n aad: Uint8Array,\n): Promise<Uint8Array> {\n const iv = base64ToBuffer(ivBase64)\n const ciphertext = base64ToBuffer(dataBase64)\n try {\n const plaintext = await subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: iv as BufferSource,\n additionalData: aad as BufferSource,\n },\n dek,\n ciphertext as BufferSource,\n )\n return new Uint8Array(plaintext)\n } catch (err) {\n if (err instanceof Error && err.name === 'OperationError') {\n throw new TamperedError()\n }\n throw new DecryptionError(\n err instanceof Error ? err.message : 'Decryption failed',\n )\n }\n}\n\n// ─── Presence Key Derivation ──────────────────────────────\n\n/**\n * Derive an AES-256-GCM presence key from a collection DEK using HKDF-SHA256.\n *\n * The presence key is domain-separated from the data DEK by the fixed salt\n * `'noydb-presence'` and the `info` = collection name. This means:\n * - The adapter never sees the presence key.\n * - Presence payloads rotate automatically when the collection DEK is rotated.\n * - Revoked users cannot derive the new presence key after a DEK rotation.\n *\n * @param dek The collection's AES-256-GCM DEK (extractable).\n * @param collectionName Used as the HKDF `info` parameter for domain separation.\n * @returns A non-extractable AES-256-GCM key suitable for presence payload encryption.\n */\nexport async function derivePresenceKey(dek: CryptoKey, collectionName: string): Promise<CryptoKey> {\n // Step 1: export DEK raw bytes\n const rawDek = await subtle.exportKey('raw', dek)\n\n // Step 2: import as HKDF key material\n const hkdfKey = await subtle.importKey(\n 'raw',\n rawDek,\n 'HKDF',\n false,\n ['deriveBits'],\n )\n\n // Step 3: derive 256 bits with salt='noydb-presence' and info=collectionName\n const salt = new TextEncoder().encode('noydb-presence')\n const info = new TextEncoder().encode(collectionName)\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n\n // Step 4: import derived bits as AES-GCM key\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n// ─── Sealed Field Key Derivation ──────────────────────────\n\n/**\n * Derive a **per-field** AES-256-GCM key from a collection DEK using\n * HKDF-SHA256, used to encrypt a single sensitive field into its own\n * `_sealed[field]` envelope slot (structural group-encryption).\n *\n * Domain-separated from the data DEK (and from the presence/deterministic\n * channels) by the fixed salt `'noydb-sealed'` and an `info` of\n * `JSON.stringify(['noydb-sealed', collectionName, field])`. The JSON-array\n * encoding is injective — each element is separately quoted/escaped — so\n * collection `a/sealed/b` + field `c` cannot collide with collection `a` +\n * field `b/sealed/c`. Each sensitive field gets a **distinct** key, so a\n * `_sealed[a]` ciphertext does not authenticate under field `b`'s key —\n * sealed fields are cryptographically isolated from one another. The\n * collection name keeps the same field name in two collections from sharing a\n * key, mirroring how `derivePresenceKey` / `encryptDeterministic` domain-separate.\n *\n * @param dek The collection's AES-256-GCM DEK (extractable).\n * @param collectionName Part of the HKDF `info` for domain separation.\n * @param field Sensitive field name — the rest of the `info`.\n * @returns A non-extractable AES-256-GCM key for that field's sealed slot.\n */\nexport async function deriveSealedFieldKey(\n dek: CryptoKey,\n collectionName: string,\n field: string,\n): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-sealed')\n // JSON-array encoding is injective: each element is separately quoted/\n // escaped, so collection `a/sealed/b` + field `c` cannot collide with\n // collection `a` + field `b/sealed/c`.\n const info = new TextEncoder().encode(JSON.stringify(['noydb-sealed', collectionName, field]))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n/**\n * Derive a per-record sealed-field key from the record's **per-record CEK**\n * rather than the collection DEK. Same HKDF construction as\n * {@link deriveSealedFieldKey} but with salt `'noydb-sealed-cek'` (distinct\n * from `'noydb-sealed'`), so a CEK-derived key can never collide with a\n * DEK-derived one for the same `{collection, field}`.\n *\n * The point: the sealed ciphertext's only key now flows from the record's CEK.\n * Dropping the record's wrapped `_cek` (crypto-shred / `forget`) makes the key\n * — and thus `_sealed[field]` — unrecoverable, giving sealed fields the same\n * erasure guarantee `_data` already has. The CEK must be extractable (it is —\n * `unwrapCek`/`generateDEK` mint extractable keys).\n *\n * @param cek The record's AES-256-GCM CEK (extractable).\n * @param collectionName Part of the HKDF `info` for domain separation.\n * @param field Sensitive field name — the rest of the `info`.\n * @returns A non-extractable AES-256-GCM key for that field's sealed slot.\n */\nexport async function deriveSealedFieldKeyFromCek(\n cek: CryptoKey,\n collectionName: string,\n field: string,\n): Promise<CryptoKey> {\n const rawCek = await subtle.exportKey('raw', cek)\n const hkdfKey = await subtle.importKey('raw', rawCek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-sealed-cek')\n const info = new TextEncoder().encode(JSON.stringify(['noydb-sealed-cek', collectionName, field]))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n// ─── Deterministic Encryption ────────────────────────────\n\n/**\n * Derive the collection's **dedicated deterministic-index key** from its DEK\n * via HKDF-SHA256 (L-1, #554).\n *\n * `_det` slots previously encrypted under the raw collection DEK — the same\n * key `_data` uses with a *randomized*-IV regime while `_det` uses a\n * *deterministic*-IV regime. Two IV regimes on one key is avoidable hygiene\n * debt (~2^-96 theoretical collision), so the deterministic index now gets its\n * own HKDF-separated key: salt `'noydb-det'`, info\n * `JSON.stringify(['noydb-det'])` (the injective JSON-array domain tag, same\n * convention as {@link deriveSealedFieldKey}). Per-field separation still\n * comes from the `'<collection>/<field>'` context inside\n * {@link encryptDeterministic}, exactly as before.\n *\n * The derived key stays **DEK-derived (collection-level)** on purpose: `_det`\n * is carried verbatim through per-record CEK rotation (see\n * `record-keys/sealing.ts`), so its key must not depend on the CEK. It rotates\n * with the collection DEK, like the presence key.\n *\n * The key is minted **extractable** — {@link encryptDeterministic} derives its\n * per-value IV via HKDF over the raw key bytes (an `exportKey` under the\n * hood), which a non-extractable key would forbid. Same in-memory posture as\n * the DEK itself (`generateDEK` mints extractable keys).\n *\n * @param dek The collection's AES-256-GCM DEK (extractable).\n * @returns A dedicated AES-256-GCM key for the `_det` deterministic index.\n */\nexport async function deriveDeterministicKey(dek: CryptoKey): Promise<CryptoKey> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-det')\n const info = new TextEncoder().encode(JSON.stringify(['noydb-det']))\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n KEY_BITS,\n )\n return subtle.importKey(\n 'raw',\n bits,\n { name: 'AES-GCM', length: KEY_BITS },\n true,\n ['encrypt', 'decrypt'],\n )\n}\n\n/**\n * Derive a deterministic 12-byte IV from `{ DEK, context, plaintext }`\n * via HKDF-SHA256. Given the same three inputs, the IV is identical, so\n * `encryptDeterministic` produces the same ciphertext on every call —\n * which is precisely what enables blind equality search on encrypted\n * fields.\n *\n * **The side channel this opens.** Two records whose field value is the\n * same produce the same ciphertext. An observer with store access can\n * therefore tell which records share a value — not *what* the value is,\n * but the equivalence class. This is the well-known trade-off of\n * deterministic encryption and is why the feature is strictly opt-in\n * per field, guarded by `acknowledgeDeterministicRisk: true` at\n * collection creation.\n *\n * The context string MUST include the collection name and field name,\n * so:\n * - The same plaintext in two different fields encrypts differently\n * (no cross-field equality leak).\n * - The same plaintext in two different collections (different DEKs)\n * encrypts differently by virtue of the key, even before HKDF\n * domain separation kicks in.\n */\nasync function deriveDeterministicIV(\n dek: CryptoKey,\n context: string,\n plaintext: string,\n): Promise<Uint8Array> {\n const rawDek = await subtle.exportKey('raw', dek)\n const hkdfKey = await subtle.importKey('raw', rawDek, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode('noydb-deterministic-v1')\n const info = new TextEncoder().encode(`${context}\\x00${plaintext}`)\n const bits = await subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n hkdfKey,\n IV_BYTES * 8,\n )\n return new Uint8Array(bits)\n}\n\n/**\n * Encrypt a plaintext string with AES-256-GCM and a deterministic,\n * HKDF-derived IV.\n *\n * The same `{ dek, context, plaintext }` triple always produces the\n * same `{ iv, data }` — call this twice and you can string-compare the\n * ciphertexts to check equality of the inputs without decrypting them.\n *\n * @param context Domain-separation string — by convention\n * `'<collection>/<field>'`. Different contexts encrypt\n * the same plaintext to different ciphertexts, so\n * `email` in collection `users` does not collide with\n * `email` in collection `customers`.\n */\nexport async function encryptDeterministic(\n plaintext: string,\n dek: CryptoKey,\n context: string,\n): Promise<EncryptResult> {\n const iv = await deriveDeterministicIV(dek, context, plaintext)\n const encoded = new TextEncoder().encode(plaintext)\n const ciphertext = await subtle.encrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n dek,\n encoded,\n )\n return {\n iv: bufferToBase64(iv),\n data: bufferToBase64(ciphertext),\n }\n}\n\n/**\n * Counterpart to {@link encryptDeterministic}. The IV is stored\n * alongside the ciphertext (exactly like the randomized path), so\n * decrypt uses the stored IV and verifies the GCM auth tag — a tampered\n * ciphertext throws `TamperedError` just like randomized AES-GCM.\n */\nexport async function decryptDeterministic(\n ivBase64: string,\n dataBase64: string,\n dek: CryptoKey,\n): Promise<string> {\n return decrypt(ivBase64, dataBase64, dek)\n}\n\n// ─── Random Generation ─────────────────────────────────────────────────\n\n/** Generate a random 12-byte IV for AES-GCM. */\nexport function generateIV(): Uint8Array {\n return globalThis.crypto.getRandomValues(new Uint8Array(IV_BYTES))\n}\n\n/** Generate a random 32-byte salt for PBKDF2. */\nexport function generateSalt(): Uint8Array {\n return globalThis.crypto.getRandomValues(new Uint8Array(SALT_BYTES))\n}\n\n/**\n * Mint a fresh recovery secret — the high-entropy value a recovery profile\n * wraps the DEK set under and then hands out (Shamir splits it into shares;\n * paper prints it). Not a salt: a salt is public, this is not, and a fork\n * may size them differently. The reference enclave returns 32 bytes.\n *\n * Callers must zero the buffer once it has been wrapped and split.\n */\nexport function generateRecoverySecret(): Uint8Array {\n return globalThis.crypto.getRandomValues(new Uint8Array(RECOVERY_SECRET_BYTES))\n}\n\n// ─── Base64 Helpers ────────────────────────────────────────────────────\n\nexport function bufferToBase64(buffer: ArrayBuffer | Uint8Array): string {\n const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer)\n let binary = ''\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]!)\n }\n return btoa(binary)\n}\n\nexport function base64ToBuffer(base64: string): Uint8Array<ArrayBuffer> {\n const binary = atob(base64)\n const bytes = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i)\n }\n return bytes\n}\n"],"mappings":";;;;;;;;AAoDA,IAAM,oBAAoB;AAC1B,IAAM,aAAa;AACnB,IAAM,WAAW;AACjB,IAAM,wBA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WAAW,UAAU,CAAC;AACrE;AAUO,SAAS,yBAAqC;AACnD,SAAO,WAAW,OAAO,gBAAgB,IAAI,WAAW,qBAAqB,CAAC;AAChF;AAIO,SAAS,eAAe,QAA0C;AACvE,QAAM,QAAQ,kBAAkB,aAAa,SAAS,IAAI,WAAW,MAAM;AAC3E,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,cAAU,OAAO,aAAa,MAAM,CAAC,CAAE;AAAA,EACzC;AACA,SAAO,KAAK,MAAM;AACpB;AAEO,SAAS,eAAe,QAAyC;AACtE,QAAM,SAAS,KAAK,MAAM;AAC1B,QAAM,QAAQ,IAAI,WAAW,OAAO,MAAM;AAC1C,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,CAAC,IAAI,OAAO,WAAW,CAAC;AAAA,EAChC;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writePod
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BVN6KXL2.js";
|
|
4
4
|
|
|
5
5
|
// src/with-audit/portability/export-accessible.ts
|
|
6
6
|
function resolveAccessibleCollections(keyring, scope, writableOnly = false) {
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
buildAccessibleBundle,
|
|
43
43
|
exportAccessibleData
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-JVIBCBC7.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-FAHMLERK.js";
|
|
11
11
|
import {
|
|
12
12
|
envelopeBodySize
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4ZS56W5S.js";
|
|
14
14
|
import {
|
|
15
15
|
buildRecordEnvelope,
|
|
16
16
|
isDeleteMarker,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
decrypt,
|
|
21
21
|
derivePresenceKey,
|
|
22
22
|
encrypt
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HPVZCW43.js";
|
|
24
24
|
import {
|
|
25
25
|
NOYDB_SYNC_VERSION
|
|
26
26
|
} from "./chunk-7MG7SJT7.js";
|
|
@@ -1213,4 +1213,4 @@ export {
|
|
|
1213
1213
|
SyncEngine,
|
|
1214
1214
|
SyncTransaction
|
|
1215
1215
|
};
|
|
1216
|
-
//# sourceMappingURL=chunk-
|
|
1216
|
+
//# sourceMappingURL=chunk-K23VKTN4.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isCollectLeg,
|
|
3
3
|
resolveLegOwner,
|
|
4
4
|
wrapDbWithPredicates
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PPTHY5QO.js";
|
|
6
6
|
import {
|
|
7
7
|
canonicalizeMoneyFieldsAsDecimal,
|
|
8
8
|
decodeMoneyFields,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-VXANTWBJ.js";
|
|
11
11
|
import {
|
|
12
12
|
putDerivedOutput
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3BZZJJMQ.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_JOIN_MAX_ROWS
|
|
16
16
|
} from "./chunk-ZORTV6NH.js";
|
|
@@ -342,4 +342,4 @@ async function listOutputIds(outputColl) {
|
|
|
342
342
|
export {
|
|
343
343
|
MaterializedViewExecutor
|
|
344
344
|
};
|
|
345
|
-
//# sourceMappingURL=chunk-
|
|
345
|
+
//# sourceMappingURL=chunk-KKEESNPE.js.map
|
|
@@ -294,31 +294,31 @@ function buildBlobFieldEntries(filenamesByField) {
|
|
|
294
294
|
function withSearch() {
|
|
295
295
|
return {
|
|
296
296
|
async search(ctx, field, query, opts) {
|
|
297
|
-
const { search } = await import("./collection-facade-
|
|
297
|
+
const { search } = await import("./collection-facade-JSJYIKS4.js");
|
|
298
298
|
return search(ctx, field, query, opts);
|
|
299
299
|
},
|
|
300
300
|
async retrieve(ctx, query, opts) {
|
|
301
|
-
const { retrieve } = await import("./collection-facade-
|
|
301
|
+
const { retrieve } = await import("./collection-facade-JSJYIKS4.js");
|
|
302
302
|
return retrieve(ctx, query, opts);
|
|
303
303
|
},
|
|
304
304
|
async similarTo(ctx, vector, opts) {
|
|
305
|
-
const { similarTo } = await import("./collection-facade-
|
|
305
|
+
const { similarTo } = await import("./collection-facade-JSJYIKS4.js");
|
|
306
306
|
return similarTo(ctx, vector, opts);
|
|
307
307
|
},
|
|
308
308
|
async warmIndex(ctx) {
|
|
309
|
-
const { warmIndex } = await import("./collection-facade-
|
|
309
|
+
const { warmIndex } = await import("./collection-facade-JSJYIKS4.js");
|
|
310
310
|
return warmIndex(ctx);
|
|
311
311
|
},
|
|
312
312
|
async flushIndex(ctx) {
|
|
313
|
-
const { flushIndex } = await import("./collection-facade-
|
|
313
|
+
const { flushIndex } = await import("./collection-facade-JSJYIKS4.js");
|
|
314
314
|
return flushIndex(ctx);
|
|
315
315
|
},
|
|
316
316
|
async embedOnWrite(ctx, id, record, version) {
|
|
317
|
-
const { embedOnWrite } = await import("./collection-facade-
|
|
317
|
+
const { embedOnWrite } = await import("./collection-facade-JSJYIKS4.js");
|
|
318
318
|
return embedOnWrite(ctx, id, record, version);
|
|
319
319
|
},
|
|
320
320
|
async rebuildEmbeddings(ctx) {
|
|
321
|
-
const { rebuildEmbeddings } = await import("./collection-facade-
|
|
321
|
+
const { rebuildEmbeddings } = await import("./collection-facade-JSJYIKS4.js");
|
|
322
322
|
return rebuildEmbeddings(ctx);
|
|
323
323
|
}
|
|
324
324
|
};
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
buildBlobFieldEntries,
|
|
365
365
|
withSearch
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-LH5A3ZPG.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
buildRecordAad,
|
|
10
10
|
recordAadFor,
|
|
11
11
|
rewrapBodyToDek
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4ZS56W5S.js";
|
|
13
13
|
import {
|
|
14
14
|
buildRecordEnvelope,
|
|
15
15
|
isDeleteMarker,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
decrypt,
|
|
20
20
|
encrypt,
|
|
21
21
|
unwrapCek
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HPVZCW43.js";
|
|
23
23
|
import {
|
|
24
24
|
NOYDB_FORMAT_VERSION
|
|
25
25
|
} from "./chunk-7MG7SJT7.js";
|
|
@@ -435,4 +435,4 @@ export {
|
|
|
435
435
|
demote,
|
|
436
436
|
classifySealedShred
|
|
437
437
|
};
|
|
438
|
-
//# sourceMappingURL=chunk-
|
|
438
|
+
//# sourceMappingURL=chunk-M4YPHYEH.js.map
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
buildRecordAad,
|
|
7
7
|
openEnvelopeJson
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4ZS56W5S.js";
|
|
9
9
|
import {
|
|
10
10
|
buildRecordEnvelope
|
|
11
11
|
} from "./chunk-SZJ3DLZA.js";
|
|
12
12
|
import {
|
|
13
13
|
encrypt
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HPVZCW43.js";
|
|
15
15
|
import {
|
|
16
16
|
NoydbError
|
|
17
17
|
} from "./chunk-7O3Y4PPD.js";
|
|
@@ -130,4 +130,4 @@ export {
|
|
|
130
130
|
LinkSet,
|
|
131
131
|
LinkEndpointError
|
|
132
132
|
};
|
|
133
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-OTQZ7ZWU.js.map
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
buildRecordAad,
|
|
6
6
|
openEnvelopeJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4ZS56W5S.js";
|
|
8
8
|
import {
|
|
9
9
|
buildRecordEnvelope
|
|
10
10
|
} from "./chunk-SZJ3DLZA.js";
|
|
11
11
|
import {
|
|
12
12
|
encrypt
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HPVZCW43.js";
|
|
14
14
|
|
|
15
15
|
// src/with-audit/consent/consent.ts
|
|
16
16
|
var CONSENT_AUDIT_COLLECTION = "_consent_audit";
|
|
@@ -66,4 +66,4 @@ export {
|
|
|
66
66
|
writeConsentEntry,
|
|
67
67
|
loadConsentEntries
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-P3MG6QCN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sha256Hex
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HPVZCW43.js";
|
|
4
4
|
import {
|
|
5
5
|
MaterializedViewConfigError,
|
|
6
6
|
MaterializedViewSourceUnknownError,
|
|
@@ -483,4 +483,4 @@ export {
|
|
|
483
483
|
MaterializedViewRegistry,
|
|
484
484
|
wrapDbWithPredicates
|
|
485
485
|
};
|
|
486
|
-
//# sourceMappingURL=chunk-
|
|
486
|
+
//# sourceMappingURL=chunk-PPTHY5QO.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
envelopePayloadHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QPQUVOZ2.js";
|
|
4
4
|
import {
|
|
5
5
|
NOYDB_FORMAT_VERSION
|
|
6
6
|
} from "./chunk-7MG7SJT7.js";
|
|
@@ -392,4 +392,4 @@ export {
|
|
|
392
392
|
dictCollectionName,
|
|
393
393
|
LookupHandle
|
|
394
394
|
};
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
395
|
+
//# sourceMappingURL=chunk-Q2MPFCQ7.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
envelopeBodyForHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4ZS56W5S.js";
|
|
4
4
|
import {
|
|
5
5
|
sha256Hex
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HPVZCW43.js";
|
|
7
7
|
|
|
8
8
|
// src/with-commit/history/ledger/entry.ts
|
|
9
9
|
function canonicalJson(value) {
|
|
@@ -67,4 +67,4 @@ export {
|
|
|
67
67
|
parseIndex,
|
|
68
68
|
envelopePayloadHash
|
|
69
69
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-QPQUVOZ2.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNoydb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZYIYHJ5R.js";
|
|
4
4
|
import {
|
|
5
5
|
deriveSchemaManifest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4GFX6MPA.js";
|
|
7
7
|
import {
|
|
8
8
|
loadFence
|
|
9
9
|
} from "./chunk-453F654R.js";
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
signRecord,
|
|
14
14
|
verifyPodHeader,
|
|
15
15
|
verifyRecord
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BVN6KXL2.js";
|
|
17
17
|
import {
|
|
18
18
|
loadKeyring
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3V4KWFX7.js";
|
|
20
20
|
import {
|
|
21
21
|
ConflictError,
|
|
22
22
|
MigrationRequiredError,
|
|
@@ -286,4 +286,4 @@ export {
|
|
|
286
286
|
followRedirects,
|
|
287
287
|
open
|
|
288
288
|
};
|
|
289
|
-
//# sourceMappingURL=chunk-
|
|
289
|
+
//# sourceMappingURL=chunk-QTQUH4DS.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
freezeAndDeleteClosure,
|
|
3
3
|
randomId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3BVH633C.js";
|
|
5
5
|
import {
|
|
6
6
|
buildAccessibleBundle,
|
|
7
7
|
resolveAccessibleCollections
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JVIBCBC7.js";
|
|
9
9
|
import {
|
|
10
10
|
buildRecordEnvelope
|
|
11
11
|
} from "./chunk-SZJ3DLZA.js";
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
approveWithdrawal,
|
|
159
159
|
rejectWithdrawal
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-R42NSZI6.js.map
|