@noy-db/hub 0.10.0-pre.0 → 0.10.0-pre.2
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 +90 -0
- package/README.md +2 -2
- package/dist/api-QSEKT4KS.js +15 -0
- package/dist/as/index.js +19 -12
- package/dist/as/index.js.map +1 -1
- package/dist/at/index.js +6 -9
- package/dist/attestation/index.js +16 -19
- package/dist/attestation/index.js.map +1 -1
- package/dist/{backup-E3GBMNDA.js → backup-BHKVK5SD.js} +9 -12
- package/dist/{backup-E3GBMNDA.js.map → backup-BHKVK5SD.js.map} +1 -1
- package/dist/blobs/index.js +10 -13
- package/dist/blobs/index.js.map +1 -1
- package/dist/broker/index.js +11 -14
- package/dist/broker/index.js.map +1 -1
- package/dist/by/index.js +2 -2
- package/dist/capsule/contract.d.ts +176 -16
- package/dist/capsule/contract.js +35 -30
- package/dist/capsule/enclave-aes/bound.d.ts +11 -1
- package/dist/capsule/enclave-aes/classify/digest.d.ts +4 -2
- package/dist/capsule/enclave-aes/index.d.ts +9 -0
- package/dist/capsule/enclave-aes/index.js +643 -78
- package/dist/capsule/enclave-aes/index.js.map +1 -1
- package/dist/capsule/enclave-aes/primitives.d.ts +2 -2
- package/dist/capsule/index.d.ts +1 -1
- package/dist/capsule/plumbing/classify-reveal.d.ts +29 -0
- package/dist/capsule/plumbing/classify-verify.d.ts +53 -0
- package/dist/capsule/plumbing/index.d.ts +17 -0
- package/dist/{capsule-YQKQZPH7.js → capsule-YAITMH77.js} +16 -9
- package/dist/cargo/index.js +34 -36
- package/dist/{chunk-U43RSPPX.js → chunk-23A4SBRR.js} +3 -4
- package/dist/{chunk-U43RSPPX.js.map → chunk-23A4SBRR.js.map} +1 -1
- package/dist/{chunk-PREYKC76.js → chunk-24AGG4PP.js} +3 -3
- package/dist/{chunk-ZVJKHGE5.js → chunk-24IJZA4M.js} +14 -8
- package/dist/chunk-24IJZA4M.js.map +1 -0
- package/dist/{chunk-4N4OIVK3.js → chunk-2NVQ5SEA.js} +15 -5
- package/dist/chunk-2NVQ5SEA.js.map +1 -0
- package/dist/{chunk-ZNVBCKMV.js → chunk-2SIREKBR.js} +2 -2
- package/dist/{chunk-N6EWQ5VB.js → chunk-37FOG6AE.js} +14 -7
- package/dist/chunk-37FOG6AE.js.map +1 -0
- package/dist/{chunk-UQRKAM2R.js → chunk-3M2KK7O7.js} +3 -3
- package/dist/{chunk-P6FATPXQ.js → chunk-3ZCVY3T6.js} +2 -2
- package/dist/{chunk-PBEHTFUG.js → chunk-4CGWLHPQ.js} +6 -6
- package/dist/{chunk-PFHDQY5L.js → chunk-56Z4NOC6.js} +3 -3
- package/dist/{chunk-GLSCL74M.js → chunk-5AVIUJP4.js} +13 -9
- package/dist/chunk-5AVIUJP4.js.map +1 -0
- package/dist/{chunk-F7X7MPK4.js → chunk-5BGHAVBN.js} +2 -2
- package/dist/{chunk-QHG7GQKM.js → chunk-5JNEDW7I.js} +2 -2
- package/dist/{chunk-GHMINSER.js → chunk-5OWJSDTO.js} +4 -4
- package/dist/{chunk-GHMINSER.js.map → chunk-5OWJSDTO.js.map} +1 -1
- package/dist/{chunk-DYIR6RC3.js → chunk-5Y4MO7UQ.js} +4 -4
- package/dist/{chunk-TLIFNRU5.js → chunk-63LZLRWG.js} +2 -2
- package/dist/{chunk-GZISWBCJ.js → chunk-74W56QPY.js} +4 -4
- package/dist/{chunk-CLOSXHR4.js → chunk-7KNYLHVX.js} +3 -3
- package/dist/chunk-7KNYLHVX.js.map +1 -0
- package/dist/{chunk-LFUID7OW.js → chunk-7VJ2SIEI.js} +42 -22
- package/dist/chunk-7VJ2SIEI.js.map +1 -0
- package/dist/{chunk-WVQDY3UM.js → chunk-AHA7UALU.js} +4 -4
- package/dist/{chunk-U277K5GR.js → chunk-AIHBYQHF.js} +259 -123
- package/dist/chunk-AIHBYQHF.js.map +1 -0
- package/dist/{chunk-S2ORTQGS.js → chunk-ANYX2M6P.js} +3 -3
- package/dist/{chunk-6WEPFEMJ.js → chunk-ATKYMRBC.js} +4 -4
- package/dist/{chunk-7UHLO4ZN.js → chunk-B2HU55QD.js} +2 -2
- package/dist/{chunk-Y22JWHCP.js → chunk-BEKMLYQ4.js} +4 -4
- package/dist/{chunk-27NCEPKM.js → chunk-BPFXD4EX.js} +23 -3
- package/dist/chunk-BPFXD4EX.js.map +1 -0
- package/dist/{chunk-7C7OF26T.js → chunk-C2NXAR3D.js} +5 -5
- package/dist/{chunk-Z2KP6PNF.js → chunk-CJBWJO5P.js} +6 -6
- package/dist/{chunk-Z2KP6PNF.js.map → chunk-CJBWJO5P.js.map} +1 -1
- package/dist/{chunk-6WIFF46H.js → chunk-CQLMRCKX.js} +2 -2
- package/dist/{chunk-URGHKZPL.js → chunk-CR5UPYIJ.js} +1 -1
- package/dist/chunk-CR5UPYIJ.js.map +1 -0
- package/dist/{chunk-LMC5L3MM.js → chunk-DS2JXSUA.js} +6 -6
- package/dist/{chunk-X6Z2SIRF.js → chunk-E2JIE4S3.js} +2 -2
- package/dist/{chunk-EQ6C2ZPT.js → chunk-E7Y4J4GL.js} +2 -2
- package/dist/{chunk-LZN6DTFI.js → chunk-ECDM6YRX.js} +2 -2
- package/dist/{chunk-WRLWEYHY.js → chunk-EFINFZIF.js} +11 -1
- package/dist/chunk-EFINFZIF.js.map +1 -0
- package/dist/{chunk-2T2TGRWE.js → chunk-EM56MHN5.js} +6 -6
- package/dist/{chunk-NK4LGBGQ.js → chunk-EQXOJH6O.js} +4 -4
- package/dist/{chunk-OK44MD3C.js → chunk-ET3U2C3A.js} +2 -2
- package/dist/{chunk-RF5WDM25.js → chunk-EU4G7PQH.js} +2 -2
- package/dist/{chunk-K5JNK63R.js → chunk-EUCUYK5E.js} +10 -10
- package/dist/{chunk-2ODEFG6K.js → chunk-EWSIJDWO.js} +4 -4
- package/dist/{chunk-LJ744WXU.js → chunk-F2FD4LSB.js} +2 -2
- package/dist/{chunk-L4UL4IAR.js → chunk-F7ENMZYJ.js} +2 -2
- package/dist/{chunk-KBIS64X4.js → chunk-FIIVYQOW.js} +5 -5
- package/dist/{chunk-TBVDI3LY.js → chunk-FPK2LPLR.js} +8 -8
- package/dist/chunk-FPK2LPLR.js.map +1 -0
- package/dist/{chunk-BQJ5ORU5.js → chunk-FQEUJGBV.js} +2 -2
- package/dist/{chunk-UORWAG7K.js → chunk-FY4FFNKK.js} +2 -2
- package/dist/{chunk-MMWX5OT5.js → chunk-GDCYZGPB.js} +2 -2
- package/dist/{chunk-7ONMS7QI.js → chunk-H6Q7GKLI.js} +2 -2
- package/dist/{chunk-654RE5YC.js → chunk-HDAPQF6Q.js} +3 -3
- package/dist/{chunk-5SMCBPJ2.js → chunk-HRLMUZLI.js} +5 -5
- package/dist/{chunk-R4GLRJ55.js → chunk-HRNQYGLQ.js} +2 -2
- package/dist/{chunk-HTRLQ4ZZ.js → chunk-I4S7IZSS.js} +321 -235
- package/dist/chunk-I4S7IZSS.js.map +1 -0
- package/dist/{chunk-UNAMWK2Q.js → chunk-IN4XZJYD.js} +4 -3
- package/dist/{chunk-UNAMWK2Q.js.map → chunk-IN4XZJYD.js.map} +1 -1
- package/dist/{chunk-2RH5SEY7.js → chunk-ISIXU45J.js} +2 -2
- package/dist/chunk-ISIXU45J.js.map +1 -0
- package/dist/{chunk-NHEKQWFI.js → chunk-J4L4AS2W.js} +2 -2
- package/dist/{chunk-UMV5GBTJ.js → chunk-JPSOFWJR.js} +2 -2
- package/dist/{chunk-A52BK5AY.js → chunk-JRCO67NG.js} +2 -2
- package/dist/{chunk-FVKQ5QUC.js → chunk-JW3I3NNZ.js} +2 -2
- package/dist/{chunk-BNYDOF2Q.js → chunk-JZMPSQBH.js} +4 -4
- package/dist/{chunk-ZK2WT532.js → chunk-K5TVSOPQ.js} +5 -5
- package/dist/{chunk-2IASHJPS.js → chunk-K75SL74I.js} +2 -2
- package/dist/{chunk-O3NGOHXQ.js → chunk-KA4AAUST.js} +2 -2
- package/dist/chunk-KHSBMLQE.js +161 -0
- package/dist/chunk-KHSBMLQE.js.map +1 -0
- package/dist/{chunk-QQLXKDGC.js → chunk-KUGUML7H.js} +3 -3
- package/dist/{chunk-AMSSAOOB.js → chunk-L4J5NC2Q.js} +2 -2
- package/dist/{chunk-AYOQZJDB.js → chunk-LIX4QPMM.js} +2 -2
- package/dist/{chunk-WIUH6EJ7.js → chunk-LWQFGR34.js} +3 -3
- package/dist/{chunk-QNOWNCZS.js → chunk-MMSSHMHW.js} +2 -2
- package/dist/{chunk-T5EXREMW.js → chunk-N25Z6PR4.js} +6 -5
- package/dist/chunk-N25Z6PR4.js.map +1 -0
- package/dist/{chunk-ND6S2DKC.js → chunk-N5S2BCW3.js} +2 -2
- package/dist/{chunk-X5RGG3ZW.js → chunk-NIZH2TYZ.js} +2 -2
- package/dist/{chunk-SXPLIRQH.js → chunk-NLDBQHDV.js} +2 -2
- package/dist/{chunk-AI35LNWQ.js → chunk-NQQ4MOPC.js} +4 -4
- package/dist/{chunk-B6EWMGFX.js → chunk-NUBI6PYH.js} +2 -2
- package/dist/{chunk-ID4ZBC3X.js → chunk-NYEXUZDW.js} +4 -4
- package/dist/{chunk-GU6QXHPZ.js → chunk-OIBFIWVJ.js} +4 -4
- package/dist/chunk-OIBFIWVJ.js.map +1 -0
- package/dist/{chunk-PWAMX5KU.js → chunk-OOLF5FU2.js} +2 -2
- package/dist/{chunk-WQUIJPN4.js → chunk-OQA7UF2Q.js} +3 -3
- package/dist/{chunk-7JRLCP2J.js → chunk-ORJPICJI.js} +2 -2
- package/dist/{chunk-IF2M43G4.js → chunk-PBRD75JF.js} +2 -2
- package/dist/{chunk-RKBCUP5D.js → chunk-PDCBL23X.js} +39 -17
- package/dist/chunk-PDCBL23X.js.map +1 -0
- package/dist/{chunk-BSEPI3HD.js → chunk-PR36DD2X.js} +7 -7
- package/dist/{chunk-52ZFNK46.js → chunk-PV4HIC4E.js} +2 -2
- package/dist/{chunk-TU6ZJTYT.js → chunk-PZNK4HTV.js} +3 -3
- package/dist/{chunk-LUQBG637.js → chunk-QBLPLNPE.js} +3 -3
- package/dist/{chunk-UADW5NOU.js → chunk-QZXUISRF.js} +5 -5
- package/dist/{chunk-BMAXBTYH.js → chunk-RBXYO7MD.js} +5 -5
- package/dist/{chunk-PZN76MMV.js → chunk-RIACRFWA.js} +4 -4
- package/dist/{chunk-ICHHNI5E.js → chunk-RL6RNDJQ.js} +8 -8
- package/dist/{chunk-4WLI37WK.js → chunk-SJ2P7UXD.js} +7 -7
- package/dist/{chunk-2QH3I7QC.js → chunk-SWXS4LV3.js} +11 -11
- package/dist/{chunk-4KYKRYRT.js → chunk-TOTCZFRF.js} +2 -2
- package/dist/{chunk-CSAN22QG.js → chunk-TT4D52EK.js} +6 -6
- package/dist/{chunk-VLRY2UH4.js → chunk-U7CMJY5P.js} +10 -10
- package/dist/{chunk-NIUHKKMM.js → chunk-UNKTZDA2.js} +11 -11
- package/dist/{chunk-NIUHKKMM.js.map → chunk-UNKTZDA2.js.map} +1 -1
- package/dist/{chunk-QVUMKG3Z.js → chunk-UXH4AKH3.js} +95 -151
- package/dist/chunk-UXH4AKH3.js.map +1 -0
- package/dist/{chunk-PU5ZEV65.js → chunk-UZVHSYIF.js} +2 -2
- package/dist/{chunk-3EXQXOQ2.js → chunk-VHKAW5OI.js} +29 -5
- package/dist/chunk-VHKAW5OI.js.map +1 -0
- package/dist/{chunk-XQGKS4OW.js → chunk-VKZ3TDET.js} +3 -3
- package/dist/{chunk-ZOFNZLAA.js → chunk-VLZPUG5A.js} +4 -4
- package/dist/{chunk-OR3OHKU6.js → chunk-VSN5FLMI.js} +2 -2
- package/dist/{chunk-JQMEXCUZ.js → chunk-VYBBE7RN.js} +8 -8
- package/dist/chunk-VYBBE7RN.js.map +1 -0
- package/dist/{chunk-SVXFCCSX.js → chunk-WHK4JVKF.js} +8 -8
- package/dist/{chunk-YVA6UPRN.js → chunk-X4LDBALX.js} +2 -2
- package/dist/{chunk-35CNOVQE.js → chunk-X67E7NIJ.js} +3 -3
- package/dist/{chunk-IPF5ORDI.js → chunk-XMARKBUC.js} +3 -3
- package/dist/{chunk-B3B6HV5S.js → chunk-XMBBTETD.js} +2 -2
- package/dist/{chunk-GQ4MF3CM.js → chunk-XMBTAN5E.js} +28 -14
- package/dist/chunk-XMBTAN5E.js.map +1 -0
- package/dist/{chunk-FUHUGKDN.js → chunk-XROQP6IQ.js} +4 -4
- package/dist/chunk-XWWDZKLS.js +196 -0
- package/dist/chunk-XWWDZKLS.js.map +1 -0
- package/dist/{chunk-DL4GCSTS.js → chunk-Y2RYUWSQ.js} +10 -10
- package/dist/{chunk-7IV7GVOS.js → chunk-YCTSQV7K.js} +5 -5
- package/dist/{chunk-IFUYLIEY.js → chunk-YF7P2DG7.js} +2 -2
- package/dist/{chunk-PIO6NW7O.js → chunk-ZG7DBIVX.js} +2 -2
- package/dist/{chunk-NUZ7ROUZ.js → chunk-ZGJ775X7.js} +2 -2
- package/dist/{chunk-6BEBWHNL.js → chunk-ZQQLOEWN.js} +3 -3
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-7HXDMYHI.js → classified-marker-HKMRC7SC.js} +3 -3
- package/dist/{reveal-UAPBG743.js → classify-reveal-YSJKJEIR.js} +7 -12
- package/dist/classify-reveal-YSJKJEIR.js.map +1 -0
- package/dist/{verify-QWO5UKD6.js → classify-verify-ZCTKYQ43.js} +31 -41
- package/dist/classify-verify-ZCTKYQ43.js.map +1 -0
- package/dist/collection-facade-PPKNUR2J.js +38 -0
- package/dist/{computed-LZLSYOPG.js → computed-UCYVPMZA.js} +3 -3
- package/dist/consent/index.js +6 -9
- package/dist/consent/index.js.map +1 -1
- package/dist/cover/index.js +6 -9
- package/dist/custody/index.js +11 -13
- package/dist/{dead-filter-PZIJ4F4G.js → dead-filter-YOBWRG4O.js} +8 -11
- package/dist/{dead-filter-PZIJ4F4G.js.map → dead-filter-YOBWRG4O.js.map} +1 -1
- package/dist/debug/index.js +5 -8
- package/dist/debug/index.js.map +1 -1
- package/dist/delegation-SNALWRMO.js +24 -0
- package/dist/derivations/index.js +20 -23
- package/dist/derive-4GNU4E4I.js +17 -0
- package/dist/directory/index.js +7 -10
- package/dist/{dispatch-4BUYPWMJ.js → dispatch-QW32QBLW.js} +17 -20
- package/dist/{dispatch-4BUYPWMJ.js.map → dispatch-QW32QBLW.js.map} +1 -1
- package/dist/{dispatch-KOPDDPEQ.js → dispatch-V5WLDTVX.js} +5 -5
- package/dist/executor-7QN22OKI.js +8 -0
- package/dist/executor-BJZJNVBB.js +8 -0
- package/dist/executor-JEAAEJUM.js +32 -0
- package/dist/export-accessible-TVO2KQPG.js +20 -0
- package/dist/extract-partition-43CLDRN4.js +33 -0
- package/dist/{fanout-sidecar-FYDRL7F3.js → fanout-sidecar-DDONAFJT.js} +6 -9
- package/dist/{fanout-sidecar-FYDRL7F3.js.map → fanout-sidecar-DDONAFJT.js.map} +1 -1
- package/dist/forget/index.js +6 -9
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.js +4 -4
- package/dist/history/index.js +11 -14
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +11 -14
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +122 -123
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +5 -5
- package/dist/introspection/index.js +8 -11
- package/dist/issue-EIHEDAXM.js +16 -0
- package/dist/kernel/capsule-requirements.d.ts +84 -0
- package/dist/kernel/errors.d.ts +19 -3
- package/dist/kernel/export-scope.d.ts +28 -1
- package/dist/kernel/store-segment-guard.d.ts +29 -0
- package/dist/kernel/types.d.ts +169 -13
- package/dist/kernel/validation.d.ts +32 -0
- package/dist/kernel/vault.d.ts +5 -5
- package/dist/{ledger-UFJCB6T5.js → ledger-BMVUFQ3R.js} +8 -11
- package/dist/liberate-7KHXCLNJ.js +23 -0
- package/dist/link-set-PC2EJRKL.js +26 -0
- package/dist/{managed-secret-H5WYSJ46.js → managed-secret-RPRVEYZA.js} +7 -10
- package/dist/materialized-views/index.js +23 -26
- package/dist/{migrate-cek-SPESQAAO.js → migrate-cek-DTSCWGEF.js} +2 -2
- package/dist/money/index.js +5 -5
- package/dist/noydb-AYDNOXAX.js +98 -0
- package/dist/on/index.js +11 -13
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +9 -12
- package/dist/pod/index.js +65 -67
- package/dist/{pod-handle-GJLCOUGK.js → pod-handle-KBPQRN6Q.js} +6 -9
- package/dist/{pod-handle-GJLCOUGK.js.map → pod-handle-KBPQRN6Q.js.map} +1 -1
- package/dist/policy/index.js +7 -10
- package/dist/port/at/index.d.ts +1 -0
- package/dist/port/with/admission-authority.d.ts +2 -1
- package/dist/port/with/collection-registries.d.ts +37 -0
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-2AC2STHC.js → post-register-RITSNASO.js} +6 -6
- package/dist/query/all/index.js +15 -15
- package/dist/query/index.js +7 -7
- package/dist/query/live/index.js +7 -7
- package/dist/query/reduce/index.js +10 -10
- package/dist/query/relate/index.js +9 -9
- package/dist/reduce/index.js +8 -8
- package/dist/register-BB34SK7E.js +27 -0
- package/dist/registry-65L6V5TO.js +20 -0
- package/dist/registry-HU62GPWA.js +32 -0
- package/dist/registry-SMNK6UM4.js +8 -0
- package/dist/registry-X5VPBKCO.js +8 -0
- package/dist/request-withdrawal-4SKAH46W.js +26 -0
- package/dist/{restore-to-OOPKLAPU.js → restore-to-VQHT67OH.js} +7 -10
- package/dist/{restore-to-OOPKLAPU.js.map → restore-to-VQHT67OH.js.map} +1 -1
- package/dist/revoke-IF5PX2JY.js +21 -0
- package/dist/satellites/index.js +1 -1
- package/dist/schema-update/index.js +2 -2
- package/dist/sealed-record/index.js +9 -12
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/search/index.js +4 -4
- package/dist/{seed-BVYDPVIW.js → seed-F2OSDZJR.js} +11 -13
- package/dist/{seed-BVYDPVIW.js.map → seed-F2OSDZJR.js.map} +1 -1
- package/dist/sequence/index.js +6 -9
- package/dist/session/index.js +6 -9
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.js +2 -2
- package/dist/signer-5P7IZC2K.js +20 -0
- package/dist/snapshots/index.js +8 -10
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-CROGJBIJ.js → stale-PUCZH5GJ.js} +7 -10
- package/dist/storage-5EGY5OYE.js +18 -0
- package/dist/store/index.js +1 -1
- package/dist/{store-coordination-provider-2YD2PTTP.js → store-coordination-provider-SEQM7SHJ.js} +7 -10
- package/dist/{store-coordination-provider-2YD2PTTP.js.map → store-coordination-provider-SEQM7SHJ.js.map} +1 -1
- package/dist/sync/index.js +13 -15
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.js +14 -16
- package/dist/tiers/index.js +8 -11
- package/dist/to/index.js +2 -2
- package/dist/transactions/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/vault-diff-H7LT5ZBJ.js +8 -0
- package/dist/vault-head/index.js +5 -8
- package/dist/vault-head/index.js.map +1 -1
- package/dist/walk-Z4N7PCZ2.js +17 -0
- package/dist/with-audit/portability/export-accessible.d.ts +3 -1
- package/dist/with-cargo/vault-diff.d.ts +28 -0
- package/dist/with-commit/sequence/index.d.ts +22 -0
- package/dist/with-party/team/delegation.d.ts +16 -12
- package/dist/with-party/team/keyring.d.ts +77 -0
- package/dist/with-party/team/managed-secret.d.ts +40 -3
- package/dist/with-party/team/noydb-facade.d.ts +2 -2
- package/dist/with-party/team/peer-recover.d.ts +2 -2
- package/dist/with-party/team/rotate-recover.d.ts +3 -3
- package/dist/with-shape/manifest/storage.d.ts +2 -2
- package/dist/with-shape/manifest/writer.d.ts +2 -2
- package/dist/with-store/store-middleware.d.ts +18 -5
- package/dist/with-sync/engine.d.ts +0 -2
- package/dist/withdraw-accessible-CRCIQSTL.js +23 -0
- package/package.json +3 -3
- package/dist/api-H4B7ZQXP.js +0 -18
- package/dist/capsule/enclave-aes/classify/reveal.d.ts +0 -10
- package/dist/capsule/enclave-aes/classify/verify.d.ts +0 -36
- package/dist/chunk-27NCEPKM.js.map +0 -1
- package/dist/chunk-2RH5SEY7.js.map +0 -1
- package/dist/chunk-3EXQXOQ2.js.map +0 -1
- package/dist/chunk-4N4OIVK3.js.map +0 -1
- package/dist/chunk-5A3HOTP5.js +0 -591
- package/dist/chunk-5A3HOTP5.js.map +0 -1
- package/dist/chunk-CLOSXHR4.js.map +0 -1
- package/dist/chunk-EPPAEGH5.js +0 -157
- package/dist/chunk-EPPAEGH5.js.map +0 -1
- package/dist/chunk-GLSCL74M.js.map +0 -1
- package/dist/chunk-GQ4MF3CM.js.map +0 -1
- package/dist/chunk-GU6QXHPZ.js.map +0 -1
- package/dist/chunk-HTRLQ4ZZ.js.map +0 -1
- package/dist/chunk-JQMEXCUZ.js.map +0 -1
- package/dist/chunk-LFUID7OW.js.map +0 -1
- package/dist/chunk-N6EWQ5VB.js.map +0 -1
- package/dist/chunk-NH2UOV3B.js +0 -18
- package/dist/chunk-NH2UOV3B.js.map +0 -1
- package/dist/chunk-O6VOR4NH.js +0 -27
- package/dist/chunk-O6VOR4NH.js.map +0 -1
- package/dist/chunk-ODBOHPZU.js +0 -22
- package/dist/chunk-ODBOHPZU.js.map +0 -1
- package/dist/chunk-Q4DBU5RM.js +0 -78
- package/dist/chunk-Q4DBU5RM.js.map +0 -1
- package/dist/chunk-QVUMKG3Z.js.map +0 -1
- package/dist/chunk-RKBCUP5D.js.map +0 -1
- package/dist/chunk-T5EXREMW.js.map +0 -1
- package/dist/chunk-TBVDI3LY.js.map +0 -1
- package/dist/chunk-U277K5GR.js.map +0 -1
- package/dist/chunk-URGHKZPL.js.map +0 -1
- package/dist/chunk-VZFTON37.js +0 -40
- package/dist/chunk-VZFTON37.js.map +0 -1
- package/dist/chunk-WRLWEYHY.js.map +0 -1
- package/dist/chunk-ZVJKHGE5.js.map +0 -1
- package/dist/collection-facade-V63BEBGU.js +0 -41
- package/dist/delegation-7SSGIETH.js +0 -26
- package/dist/derive-IMI3BMDS.js +0 -20
- package/dist/executor-7SY3M6TZ.js +0 -8
- package/dist/executor-SNHW4ELF.js +0 -35
- package/dist/executor-Z3IKK7G3.js +0 -8
- package/dist/export-accessible-O7DIVFUO.js +0 -22
- package/dist/extract-partition-ELZEJKXM.js +0 -35
- package/dist/find-KWB2RYWJ.js +0 -10
- package/dist/issue-5ZHXK4HJ.js +0 -19
- package/dist/liberate-OEOSNNFH.js +0 -25
- package/dist/link-set-KMUBFN2L.js +0 -29
- package/dist/noydb-QDZ4QIKO.js +0 -100
- package/dist/register-PIORIMMR.js +0 -30
- package/dist/registry-BIMICFUH.js +0 -23
- package/dist/registry-JGWLW53D.js +0 -35
- package/dist/registry-SELCBYEQ.js +0 -8
- package/dist/registry-W327UNYH.js +0 -8
- package/dist/request-withdrawal-K3SXXODI.js +0 -28
- package/dist/reveal-UAPBG743.js.map +0 -1
- package/dist/revoke-6AFVXTWF.js +0 -24
- package/dist/signer-TW5MAQJP.js +0 -23
- package/dist/storage-SO2L2Z5J.js +0 -21
- package/dist/vault-diff-C6WUJFNP.js +0 -8
- package/dist/verify-QWO5UKD6.js.map +0 -1
- package/dist/walk-3KEOL7BY.js +0 -20
- package/dist/withdraw-accessible-OZU525ND.js +0 -25
- package/dist/withdraw-accessible-OZU525ND.js.map +0 -1
- /package/dist/{api-H4B7ZQXP.js.map → api-QSEKT4KS.js.map} +0 -0
- /package/dist/{capsule-YQKQZPH7.js.map → capsule-YAITMH77.js.map} +0 -0
- /package/dist/{chunk-PREYKC76.js.map → chunk-24AGG4PP.js.map} +0 -0
- /package/dist/{chunk-ZNVBCKMV.js.map → chunk-2SIREKBR.js.map} +0 -0
- /package/dist/{chunk-UQRKAM2R.js.map → chunk-3M2KK7O7.js.map} +0 -0
- /package/dist/{chunk-P6FATPXQ.js.map → chunk-3ZCVY3T6.js.map} +0 -0
- /package/dist/{chunk-PBEHTFUG.js.map → chunk-4CGWLHPQ.js.map} +0 -0
- /package/dist/{chunk-PFHDQY5L.js.map → chunk-56Z4NOC6.js.map} +0 -0
- /package/dist/{chunk-F7X7MPK4.js.map → chunk-5BGHAVBN.js.map} +0 -0
- /package/dist/{chunk-QHG7GQKM.js.map → chunk-5JNEDW7I.js.map} +0 -0
- /package/dist/{chunk-DYIR6RC3.js.map → chunk-5Y4MO7UQ.js.map} +0 -0
- /package/dist/{chunk-TLIFNRU5.js.map → chunk-63LZLRWG.js.map} +0 -0
- /package/dist/{chunk-GZISWBCJ.js.map → chunk-74W56QPY.js.map} +0 -0
- /package/dist/{chunk-WVQDY3UM.js.map → chunk-AHA7UALU.js.map} +0 -0
- /package/dist/{chunk-S2ORTQGS.js.map → chunk-ANYX2M6P.js.map} +0 -0
- /package/dist/{chunk-6WEPFEMJ.js.map → chunk-ATKYMRBC.js.map} +0 -0
- /package/dist/{chunk-7UHLO4ZN.js.map → chunk-B2HU55QD.js.map} +0 -0
- /package/dist/{chunk-Y22JWHCP.js.map → chunk-BEKMLYQ4.js.map} +0 -0
- /package/dist/{chunk-7C7OF26T.js.map → chunk-C2NXAR3D.js.map} +0 -0
- /package/dist/{chunk-6WIFF46H.js.map → chunk-CQLMRCKX.js.map} +0 -0
- /package/dist/{chunk-LMC5L3MM.js.map → chunk-DS2JXSUA.js.map} +0 -0
- /package/dist/{chunk-X6Z2SIRF.js.map → chunk-E2JIE4S3.js.map} +0 -0
- /package/dist/{chunk-EQ6C2ZPT.js.map → chunk-E7Y4J4GL.js.map} +0 -0
- /package/dist/{chunk-LZN6DTFI.js.map → chunk-ECDM6YRX.js.map} +0 -0
- /package/dist/{chunk-2T2TGRWE.js.map → chunk-EM56MHN5.js.map} +0 -0
- /package/dist/{chunk-NK4LGBGQ.js.map → chunk-EQXOJH6O.js.map} +0 -0
- /package/dist/{chunk-OK44MD3C.js.map → chunk-ET3U2C3A.js.map} +0 -0
- /package/dist/{chunk-RF5WDM25.js.map → chunk-EU4G7PQH.js.map} +0 -0
- /package/dist/{chunk-K5JNK63R.js.map → chunk-EUCUYK5E.js.map} +0 -0
- /package/dist/{chunk-2ODEFG6K.js.map → chunk-EWSIJDWO.js.map} +0 -0
- /package/dist/{chunk-LJ744WXU.js.map → chunk-F2FD4LSB.js.map} +0 -0
- /package/dist/{chunk-L4UL4IAR.js.map → chunk-F7ENMZYJ.js.map} +0 -0
- /package/dist/{chunk-KBIS64X4.js.map → chunk-FIIVYQOW.js.map} +0 -0
- /package/dist/{chunk-BQJ5ORU5.js.map → chunk-FQEUJGBV.js.map} +0 -0
- /package/dist/{chunk-UORWAG7K.js.map → chunk-FY4FFNKK.js.map} +0 -0
- /package/dist/{chunk-MMWX5OT5.js.map → chunk-GDCYZGPB.js.map} +0 -0
- /package/dist/{chunk-7ONMS7QI.js.map → chunk-H6Q7GKLI.js.map} +0 -0
- /package/dist/{chunk-654RE5YC.js.map → chunk-HDAPQF6Q.js.map} +0 -0
- /package/dist/{chunk-5SMCBPJ2.js.map → chunk-HRLMUZLI.js.map} +0 -0
- /package/dist/{chunk-R4GLRJ55.js.map → chunk-HRNQYGLQ.js.map} +0 -0
- /package/dist/{chunk-NHEKQWFI.js.map → chunk-J4L4AS2W.js.map} +0 -0
- /package/dist/{chunk-UMV5GBTJ.js.map → chunk-JPSOFWJR.js.map} +0 -0
- /package/dist/{chunk-A52BK5AY.js.map → chunk-JRCO67NG.js.map} +0 -0
- /package/dist/{chunk-FVKQ5QUC.js.map → chunk-JW3I3NNZ.js.map} +0 -0
- /package/dist/{chunk-BNYDOF2Q.js.map → chunk-JZMPSQBH.js.map} +0 -0
- /package/dist/{chunk-ZK2WT532.js.map → chunk-K5TVSOPQ.js.map} +0 -0
- /package/dist/{chunk-2IASHJPS.js.map → chunk-K75SL74I.js.map} +0 -0
- /package/dist/{chunk-O3NGOHXQ.js.map → chunk-KA4AAUST.js.map} +0 -0
- /package/dist/{chunk-QQLXKDGC.js.map → chunk-KUGUML7H.js.map} +0 -0
- /package/dist/{chunk-AMSSAOOB.js.map → chunk-L4J5NC2Q.js.map} +0 -0
- /package/dist/{chunk-AYOQZJDB.js.map → chunk-LIX4QPMM.js.map} +0 -0
- /package/dist/{chunk-WIUH6EJ7.js.map → chunk-LWQFGR34.js.map} +0 -0
- /package/dist/{chunk-QNOWNCZS.js.map → chunk-MMSSHMHW.js.map} +0 -0
- /package/dist/{chunk-ND6S2DKC.js.map → chunk-N5S2BCW3.js.map} +0 -0
- /package/dist/{chunk-X5RGG3ZW.js.map → chunk-NIZH2TYZ.js.map} +0 -0
- /package/dist/{chunk-SXPLIRQH.js.map → chunk-NLDBQHDV.js.map} +0 -0
- /package/dist/{chunk-AI35LNWQ.js.map → chunk-NQQ4MOPC.js.map} +0 -0
- /package/dist/{chunk-B6EWMGFX.js.map → chunk-NUBI6PYH.js.map} +0 -0
- /package/dist/{chunk-ID4ZBC3X.js.map → chunk-NYEXUZDW.js.map} +0 -0
- /package/dist/{chunk-PWAMX5KU.js.map → chunk-OOLF5FU2.js.map} +0 -0
- /package/dist/{chunk-WQUIJPN4.js.map → chunk-OQA7UF2Q.js.map} +0 -0
- /package/dist/{chunk-7JRLCP2J.js.map → chunk-ORJPICJI.js.map} +0 -0
- /package/dist/{chunk-IF2M43G4.js.map → chunk-PBRD75JF.js.map} +0 -0
- /package/dist/{chunk-BSEPI3HD.js.map → chunk-PR36DD2X.js.map} +0 -0
- /package/dist/{chunk-52ZFNK46.js.map → chunk-PV4HIC4E.js.map} +0 -0
- /package/dist/{chunk-TU6ZJTYT.js.map → chunk-PZNK4HTV.js.map} +0 -0
- /package/dist/{chunk-LUQBG637.js.map → chunk-QBLPLNPE.js.map} +0 -0
- /package/dist/{chunk-UADW5NOU.js.map → chunk-QZXUISRF.js.map} +0 -0
- /package/dist/{chunk-BMAXBTYH.js.map → chunk-RBXYO7MD.js.map} +0 -0
- /package/dist/{chunk-PZN76MMV.js.map → chunk-RIACRFWA.js.map} +0 -0
- /package/dist/{chunk-ICHHNI5E.js.map → chunk-RL6RNDJQ.js.map} +0 -0
- /package/dist/{chunk-4WLI37WK.js.map → chunk-SJ2P7UXD.js.map} +0 -0
- /package/dist/{chunk-2QH3I7QC.js.map → chunk-SWXS4LV3.js.map} +0 -0
- /package/dist/{chunk-4KYKRYRT.js.map → chunk-TOTCZFRF.js.map} +0 -0
- /package/dist/{chunk-CSAN22QG.js.map → chunk-TT4D52EK.js.map} +0 -0
- /package/dist/{chunk-VLRY2UH4.js.map → chunk-U7CMJY5P.js.map} +0 -0
- /package/dist/{chunk-PU5ZEV65.js.map → chunk-UZVHSYIF.js.map} +0 -0
- /package/dist/{chunk-XQGKS4OW.js.map → chunk-VKZ3TDET.js.map} +0 -0
- /package/dist/{chunk-ZOFNZLAA.js.map → chunk-VLZPUG5A.js.map} +0 -0
- /package/dist/{chunk-OR3OHKU6.js.map → chunk-VSN5FLMI.js.map} +0 -0
- /package/dist/{chunk-SVXFCCSX.js.map → chunk-WHK4JVKF.js.map} +0 -0
- /package/dist/{chunk-YVA6UPRN.js.map → chunk-X4LDBALX.js.map} +0 -0
- /package/dist/{chunk-35CNOVQE.js.map → chunk-X67E7NIJ.js.map} +0 -0
- /package/dist/{chunk-IPF5ORDI.js.map → chunk-XMARKBUC.js.map} +0 -0
- /package/dist/{chunk-B3B6HV5S.js.map → chunk-XMBBTETD.js.map} +0 -0
- /package/dist/{chunk-FUHUGKDN.js.map → chunk-XROQP6IQ.js.map} +0 -0
- /package/dist/{chunk-DL4GCSTS.js.map → chunk-Y2RYUWSQ.js.map} +0 -0
- /package/dist/{chunk-7IV7GVOS.js.map → chunk-YCTSQV7K.js.map} +0 -0
- /package/dist/{chunk-IFUYLIEY.js.map → chunk-YF7P2DG7.js.map} +0 -0
- /package/dist/{chunk-PIO6NW7O.js.map → chunk-ZG7DBIVX.js.map} +0 -0
- /package/dist/{chunk-NUZ7ROUZ.js.map → chunk-ZGJ775X7.js.map} +0 -0
- /package/dist/{chunk-6BEBWHNL.js.map → chunk-ZQQLOEWN.js.map} +0 -0
- /package/dist/{classified-marker-7HXDMYHI.js.map → classified-marker-HKMRC7SC.js.map} +0 -0
- /package/dist/{collection-facade-V63BEBGU.js.map → collection-facade-PPKNUR2J.js.map} +0 -0
- /package/dist/{computed-LZLSYOPG.js.map → computed-UCYVPMZA.js.map} +0 -0
- /package/dist/{delegation-7SSGIETH.js.map → delegation-SNALWRMO.js.map} +0 -0
- /package/dist/{derive-IMI3BMDS.js.map → derive-4GNU4E4I.js.map} +0 -0
- /package/dist/{dispatch-KOPDDPEQ.js.map → dispatch-V5WLDTVX.js.map} +0 -0
- /package/dist/{executor-7SY3M6TZ.js.map → executor-7QN22OKI.js.map} +0 -0
- /package/dist/{executor-SNHW4ELF.js.map → executor-BJZJNVBB.js.map} +0 -0
- /package/dist/{executor-Z3IKK7G3.js.map → executor-JEAAEJUM.js.map} +0 -0
- /package/dist/{export-accessible-O7DIVFUO.js.map → export-accessible-TVO2KQPG.js.map} +0 -0
- /package/dist/{extract-partition-ELZEJKXM.js.map → extract-partition-43CLDRN4.js.map} +0 -0
- /package/dist/{find-KWB2RYWJ.js.map → issue-EIHEDAXM.js.map} +0 -0
- /package/dist/{issue-5ZHXK4HJ.js.map → ledger-BMVUFQ3R.js.map} +0 -0
- /package/dist/{ledger-UFJCB6T5.js.map → liberate-7KHXCLNJ.js.map} +0 -0
- /package/dist/{liberate-OEOSNNFH.js.map → link-set-PC2EJRKL.js.map} +0 -0
- /package/dist/{link-set-KMUBFN2L.js.map → managed-secret-RPRVEYZA.js.map} +0 -0
- /package/dist/{migrate-cek-SPESQAAO.js.map → migrate-cek-DTSCWGEF.js.map} +0 -0
- /package/dist/{managed-secret-H5WYSJ46.js.map → noydb-AYDNOXAX.js.map} +0 -0
- /package/dist/{post-register-2AC2STHC.js.map → post-register-RITSNASO.js.map} +0 -0
- /package/dist/{noydb-QDZ4QIKO.js.map → register-BB34SK7E.js.map} +0 -0
- /package/dist/{register-PIORIMMR.js.map → registry-65L6V5TO.js.map} +0 -0
- /package/dist/{registry-BIMICFUH.js.map → registry-HU62GPWA.js.map} +0 -0
- /package/dist/{registry-JGWLW53D.js.map → registry-SMNK6UM4.js.map} +0 -0
- /package/dist/{registry-SELCBYEQ.js.map → registry-X5VPBKCO.js.map} +0 -0
- /package/dist/{registry-W327UNYH.js.map → request-withdrawal-4SKAH46W.js.map} +0 -0
- /package/dist/{request-withdrawal-K3SXXODI.js.map → revoke-IF5PX2JY.js.map} +0 -0
- /package/dist/{revoke-6AFVXTWF.js.map → signer-5P7IZC2K.js.map} +0 -0
- /package/dist/{signer-TW5MAQJP.js.map → stale-PUCZH5GJ.js.map} +0 -0
- /package/dist/{stale-CROGJBIJ.js.map → storage-5EGY5OYE.js.map} +0 -0
- /package/dist/{storage-SO2L2Z5J.js.map → vault-diff-H7LT5ZBJ.js.map} +0 -0
- /package/dist/{vault-diff-C6WUJFNP.js.map → walk-Z4N7PCZ2.js.map} +0 -0
- /package/dist/{walk-3KEOL7BY.js.map → withdraw-accessible-CRCIQSTL.js.map} +0 -0
|
@@ -1,65 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
deriveSecretKey,
|
|
17
|
-
deriveVdigSlotKey,
|
|
18
|
-
encrypt,
|
|
19
|
-
encryptBytes,
|
|
20
|
-
encryptBytesWithAAD,
|
|
21
|
-
encryptDeterministic,
|
|
22
|
-
exportDekSet,
|
|
23
|
-
exportRecipientPrivateKeyPkcs8,
|
|
24
|
-
exportRecipientPublicKeySpki,
|
|
25
|
-
generateDEK,
|
|
26
|
-
generateEphemeralKey,
|
|
27
|
-
generateRecipientKeyPair,
|
|
28
|
-
importCek,
|
|
29
|
-
importDekSet,
|
|
30
|
-
importRecipientKeyPair,
|
|
31
|
-
importRecipientPublicKeySpki,
|
|
32
|
-
importTransferKey,
|
|
33
|
-
importWrappingKey,
|
|
34
|
-
mintCanary,
|
|
35
|
-
recipientUnwrap,
|
|
36
|
-
recipientWrap,
|
|
37
|
-
unwrapCek,
|
|
38
|
-
unwrapKey,
|
|
39
|
-
wrapCek,
|
|
40
|
-
wrapKey
|
|
41
|
-
} from "../../chunk-5A3HOTP5.js";
|
|
42
|
-
import {
|
|
43
|
-
deriveClassifyIndexKey,
|
|
44
|
-
deriveClassifyIndexSalt,
|
|
45
|
-
mintBidxTag,
|
|
46
|
-
pbkdf2VerifyDigest
|
|
47
|
-
} from "../../chunk-Q4DBU5RM.js";
|
|
48
|
-
import {
|
|
2
|
+
IV_BYTES,
|
|
3
|
+
KEY_BITS,
|
|
4
|
+
VDIG_ITERATIONS,
|
|
5
|
+
base64ToBuffer,
|
|
6
|
+
bufferToBase64,
|
|
7
|
+
ctEqualTags,
|
|
8
|
+
deriveBlobAddressKey,
|
|
9
|
+
derivePresenceKey,
|
|
10
|
+
derivePresenceTagKey,
|
|
11
|
+
encodeEchoParts,
|
|
12
|
+
evaluateKofN,
|
|
13
|
+
generateIV,
|
|
14
|
+
generateRecoverySecret,
|
|
15
|
+
generateSalt,
|
|
49
16
|
generateSigningKeyPair,
|
|
17
|
+
hkdfAesGcmKey,
|
|
18
|
+
hmacSha256Hex,
|
|
19
|
+
hmacSignHex,
|
|
20
|
+
makeCapsule,
|
|
21
|
+
normalizeForVerify,
|
|
22
|
+
sha256Bytes,
|
|
23
|
+
sha256Hex,
|
|
50
24
|
signBytes,
|
|
51
25
|
verifyBytes
|
|
52
|
-
} from "../../chunk-
|
|
53
|
-
import {
|
|
54
|
-
evaluateKofN
|
|
55
|
-
} from "../../chunk-NH2UOV3B.js";
|
|
26
|
+
} from "../../chunk-I4S7IZSS.js";
|
|
56
27
|
import {
|
|
57
28
|
buildDeleteMarker,
|
|
58
29
|
buildRecordAad,
|
|
59
30
|
buildRecordEnvelope,
|
|
60
31
|
buildSealedRecordEnvelope,
|
|
61
32
|
buildTombstone,
|
|
62
|
-
ctEqualTags,
|
|
63
33
|
envelopeBodyForHash,
|
|
64
34
|
envelopeBodySize,
|
|
65
35
|
hasPerRecordKey,
|
|
@@ -70,30 +40,614 @@ import {
|
|
|
70
40
|
recordAadFor,
|
|
71
41
|
requireSealedBody,
|
|
72
42
|
sealedBodyArgs
|
|
73
|
-
} from "../../chunk-
|
|
74
|
-
import
|
|
75
|
-
base64ToBuffer,
|
|
76
|
-
bufferToBase64,
|
|
77
|
-
deriveBlobAddressKey,
|
|
78
|
-
derivePresenceKey,
|
|
79
|
-
derivePresenceTagKey,
|
|
80
|
-
encodeEchoParts,
|
|
81
|
-
generateIV,
|
|
82
|
-
generateRecoverySecret,
|
|
83
|
-
generateSalt,
|
|
84
|
-
hkdfAesGcmKey,
|
|
85
|
-
hmacSha256Hex,
|
|
86
|
-
hmacSignHex,
|
|
87
|
-
sha256Bytes,
|
|
88
|
-
sha256Hex
|
|
89
|
-
} from "../../chunk-EPPAEGH5.js";
|
|
90
|
-
import "../../chunk-URGHKZPL.js";
|
|
43
|
+
} from "../../chunk-XWWDZKLS.js";
|
|
44
|
+
import "../../chunk-CR5UPYIJ.js";
|
|
91
45
|
import {
|
|
46
|
+
ClassifiedRotationError,
|
|
47
|
+
DecryptionError,
|
|
48
|
+
InvalidKeyError,
|
|
49
|
+
TamperedError,
|
|
92
50
|
ValidationError
|
|
93
|
-
} from "../../chunk-
|
|
51
|
+
} from "../../chunk-ISIXU45J.js";
|
|
94
52
|
|
|
95
|
-
// src/capsule/enclave-aes/
|
|
53
|
+
// src/capsule/enclave-aes/crypto.ts
|
|
54
|
+
var PBKDF2_ITERATIONS = 6e5;
|
|
96
55
|
var subtle = globalThis.crypto.subtle;
|
|
56
|
+
async function deriveKey(secret, salt) {
|
|
57
|
+
return deriveKekFromMaterial(new TextEncoder().encode(secret), salt);
|
|
58
|
+
}
|
|
59
|
+
async function deriveKekFromMaterial(material, salt) {
|
|
60
|
+
const keyMaterial = await subtle.importKey("raw", material, "PBKDF2", false, ["deriveKey"]);
|
|
61
|
+
return subtle.deriveKey(
|
|
62
|
+
{ name: "PBKDF2", salt, iterations: PBKDF2_ITERATIONS, hash: "SHA-256" },
|
|
63
|
+
keyMaterial,
|
|
64
|
+
{ name: "AES-KW", length: KEY_BITS },
|
|
65
|
+
false,
|
|
66
|
+
["wrapKey", "unwrapKey"]
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
async function deriveEchoKey(parts, salt) {
|
|
70
|
+
return deriveKekFromMaterial(encodeEchoParts(parts), salt);
|
|
71
|
+
}
|
|
72
|
+
async function deriveSecretKey(secret, salt, params) {
|
|
73
|
+
const keyMaterial = await subtle.importKey(
|
|
74
|
+
"raw",
|
|
75
|
+
new TextEncoder().encode(secret),
|
|
76
|
+
"PBKDF2",
|
|
77
|
+
false,
|
|
78
|
+
["deriveKey"]
|
|
79
|
+
);
|
|
80
|
+
return params.keyUsage === "aes-gcm" ? subtle.deriveKey(
|
|
81
|
+
{
|
|
82
|
+
name: "PBKDF2",
|
|
83
|
+
salt,
|
|
84
|
+
iterations: params.iterations,
|
|
85
|
+
hash: "SHA-256"
|
|
86
|
+
},
|
|
87
|
+
keyMaterial,
|
|
88
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
89
|
+
false,
|
|
90
|
+
["encrypt", "decrypt"]
|
|
91
|
+
) : subtle.deriveKey(
|
|
92
|
+
{
|
|
93
|
+
name: "PBKDF2",
|
|
94
|
+
salt,
|
|
95
|
+
iterations: params.iterations,
|
|
96
|
+
hash: "SHA-256"
|
|
97
|
+
},
|
|
98
|
+
keyMaterial,
|
|
99
|
+
{ name: "AES-KW", length: KEY_BITS },
|
|
100
|
+
false,
|
|
101
|
+
["wrapKey", "unwrapKey"]
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
async function generateDEK() {
|
|
105
|
+
return subtle.generateKey(
|
|
106
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
107
|
+
true,
|
|
108
|
+
// extractable — needed for AES-KW wrapping
|
|
109
|
+
["encrypt", "decrypt"]
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
async function generateEphemeralKey() {
|
|
113
|
+
return subtle.generateKey({ name: "AES-GCM", length: KEY_BITS }, false, ["encrypt", "decrypt"]);
|
|
114
|
+
}
|
|
115
|
+
async function exportDekSet(deks) {
|
|
116
|
+
const out = {};
|
|
117
|
+
for (const [coll, dek] of deks) {
|
|
118
|
+
out[coll] = bufferToBase64(await subtle.exportKey("raw", dek));
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
async function importDekSet(exported) {
|
|
123
|
+
const deks = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const [coll, b64] of Object.entries(exported)) {
|
|
125
|
+
const key = await subtle.importKey(
|
|
126
|
+
"raw",
|
|
127
|
+
base64ToBuffer(b64),
|
|
128
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
129
|
+
true,
|
|
130
|
+
["encrypt", "decrypt"]
|
|
131
|
+
);
|
|
132
|
+
deks.set(coll, key);
|
|
133
|
+
}
|
|
134
|
+
return deks;
|
|
135
|
+
}
|
|
136
|
+
async function wrapKey(dek, kek) {
|
|
137
|
+
const wrapped = await subtle.wrapKey("raw", dek, kek, "AES-KW");
|
|
138
|
+
return bufferToBase64(wrapped);
|
|
139
|
+
}
|
|
140
|
+
async function unwrapKey(wrappedBase64, kek) {
|
|
141
|
+
try {
|
|
142
|
+
return await subtle.unwrapKey(
|
|
143
|
+
"raw",
|
|
144
|
+
base64ToBuffer(wrappedBase64),
|
|
145
|
+
kek,
|
|
146
|
+
"AES-KW",
|
|
147
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
148
|
+
true,
|
|
149
|
+
["encrypt", "decrypt"]
|
|
150
|
+
);
|
|
151
|
+
} catch {
|
|
152
|
+
throw new InvalidKeyError();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async function mintCanary(kek, plaintext) {
|
|
156
|
+
const constant = await subtle.importKey(
|
|
157
|
+
"raw",
|
|
158
|
+
plaintext,
|
|
159
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
160
|
+
true,
|
|
161
|
+
["encrypt", "decrypt"]
|
|
162
|
+
);
|
|
163
|
+
return wrapKey(constant, kek);
|
|
164
|
+
}
|
|
165
|
+
async function checkCanary(wrapped, kek) {
|
|
166
|
+
try {
|
|
167
|
+
await unwrapKey(wrapped, kek);
|
|
168
|
+
return true;
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async function asKwKey(dek) {
|
|
174
|
+
const rawDek = await subtle.exportKey("raw", dek);
|
|
175
|
+
const hkdfKey = await subtle.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
176
|
+
const salt = new TextEncoder().encode("noydb-cek-wrap");
|
|
177
|
+
const info = new TextEncoder().encode("v1");
|
|
178
|
+
const bits = await subtle.deriveBits(
|
|
179
|
+
{ name: "HKDF", hash: "SHA-256", salt, info },
|
|
180
|
+
hkdfKey,
|
|
181
|
+
KEY_BITS
|
|
182
|
+
);
|
|
183
|
+
return subtle.importKey("raw", bits, "AES-KW", false, ["wrapKey", "unwrapKey"]);
|
|
184
|
+
}
|
|
185
|
+
async function wrapCek(cek, dek) {
|
|
186
|
+
const kw = await asKwKey(dek);
|
|
187
|
+
const wrapped = await subtle.wrapKey("raw", cek, kw, "AES-KW");
|
|
188
|
+
return bufferToBase64(wrapped);
|
|
189
|
+
}
|
|
190
|
+
async function unwrapCek(wrappedBase64, dek) {
|
|
191
|
+
const kw = await asKwKey(dek);
|
|
192
|
+
try {
|
|
193
|
+
return await subtle.unwrapKey(
|
|
194
|
+
"raw",
|
|
195
|
+
base64ToBuffer(wrappedBase64),
|
|
196
|
+
kw,
|
|
197
|
+
"AES-KW",
|
|
198
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
199
|
+
true,
|
|
200
|
+
["encrypt", "decrypt"]
|
|
201
|
+
);
|
|
202
|
+
} catch {
|
|
203
|
+
throw new InvalidKeyError();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async function importCek(rawKey) {
|
|
207
|
+
return subtle.importKey("raw", rawKey, { name: "AES-GCM", length: KEY_BITS }, false, ["decrypt"]);
|
|
208
|
+
}
|
|
209
|
+
async function importTransferKey(raw) {
|
|
210
|
+
if (raw.byteLength !== 32) {
|
|
211
|
+
throw new ValidationError(`transfer key must be 32 bytes, got ${raw.byteLength}.`);
|
|
212
|
+
}
|
|
213
|
+
return subtle.importKey("raw", raw, { name: "AES-GCM", length: KEY_BITS }, false, ["encrypt", "decrypt"]);
|
|
214
|
+
}
|
|
215
|
+
async function importWrappingKey(raw) {
|
|
216
|
+
if (raw.byteLength !== 32) {
|
|
217
|
+
throw new ValidationError(`wrapping key must be 32 bytes, got ${raw.byteLength}.`);
|
|
218
|
+
}
|
|
219
|
+
return subtle.importKey("raw", raw, { name: "AES-KW", length: KEY_BITS }, false, ["wrapKey", "unwrapKey"]);
|
|
220
|
+
}
|
|
221
|
+
async function encrypt(plaintext, dek, aad) {
|
|
222
|
+
const iv = generateIV();
|
|
223
|
+
const encoded = new TextEncoder().encode(plaintext);
|
|
224
|
+
const ciphertext = await subtle.encrypt(
|
|
225
|
+
{
|
|
226
|
+
name: "AES-GCM",
|
|
227
|
+
iv,
|
|
228
|
+
...aad !== void 0 && { additionalData: aad }
|
|
229
|
+
},
|
|
230
|
+
dek,
|
|
231
|
+
encoded
|
|
232
|
+
);
|
|
233
|
+
return {
|
|
234
|
+
iv: bufferToBase64(iv),
|
|
235
|
+
data: bufferToBase64(ciphertext)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async function decrypt(ivBase64, dataBase64, dek, aad) {
|
|
239
|
+
let iv;
|
|
240
|
+
let ciphertext;
|
|
241
|
+
try {
|
|
242
|
+
iv = base64ToBuffer(ivBase64);
|
|
243
|
+
ciphertext = base64ToBuffer(dataBase64);
|
|
244
|
+
} catch (err) {
|
|
245
|
+
throw new DecryptionError(`envelope body is not valid base64: ${err instanceof Error ? err.message : String(err)}`);
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
const plaintext = await subtle.decrypt(
|
|
249
|
+
{
|
|
250
|
+
name: "AES-GCM",
|
|
251
|
+
iv,
|
|
252
|
+
...aad !== void 0 && { additionalData: aad }
|
|
253
|
+
},
|
|
254
|
+
dek,
|
|
255
|
+
ciphertext
|
|
256
|
+
);
|
|
257
|
+
return new TextDecoder().decode(plaintext);
|
|
258
|
+
} catch (err) {
|
|
259
|
+
if (err instanceof Error && err.name === "OperationError") {
|
|
260
|
+
throw new TamperedError(...await classifyTagFailure(iv, ciphertext, dek, aad));
|
|
261
|
+
}
|
|
262
|
+
throw new DecryptionError(
|
|
263
|
+
err instanceof Error ? err.message : "Decryption failed"
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async function classifyTagFailure(iv, ciphertext, dek, aad) {
|
|
268
|
+
if (aad === void 0) return [];
|
|
269
|
+
try {
|
|
270
|
+
await subtle.decrypt({ name: "AES-GCM", iv }, dek, ciphertext);
|
|
271
|
+
} catch {
|
|
272
|
+
return [];
|
|
273
|
+
}
|
|
274
|
+
return [
|
|
275
|
+
"This record was sealed BEFORE record-identity binding (#1041) and cannot be read by this version. Its body decrypts correctly under the record key, so this is a data-format transition, not tampering \u2014 but it also means the record predates authenticated metadata. There is no migration path; see noy-db #1100.",
|
|
276
|
+
"unbound-legacy-format"
|
|
277
|
+
];
|
|
278
|
+
}
|
|
279
|
+
async function encryptBytes(data, dek) {
|
|
280
|
+
const iv = generateIV();
|
|
281
|
+
const ciphertext = await subtle.encrypt(
|
|
282
|
+
{ name: "AES-GCM", iv },
|
|
283
|
+
dek,
|
|
284
|
+
data
|
|
285
|
+
);
|
|
286
|
+
return {
|
|
287
|
+
iv: bufferToBase64(iv),
|
|
288
|
+
data: bufferToBase64(ciphertext)
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
async function decryptBytes(ivBase64, dataBase64, dek) {
|
|
292
|
+
const iv = base64ToBuffer(ivBase64);
|
|
293
|
+
const ciphertext = base64ToBuffer(dataBase64);
|
|
294
|
+
try {
|
|
295
|
+
const plaintext = await subtle.decrypt(
|
|
296
|
+
{ name: "AES-GCM", iv },
|
|
297
|
+
dek,
|
|
298
|
+
ciphertext
|
|
299
|
+
);
|
|
300
|
+
return new Uint8Array(plaintext);
|
|
301
|
+
} catch (err) {
|
|
302
|
+
if (err instanceof Error && err.name === "OperationError") {
|
|
303
|
+
throw new TamperedError();
|
|
304
|
+
}
|
|
305
|
+
throw new DecryptionError(
|
|
306
|
+
err instanceof Error ? err.message : "Decryption failed"
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
async function encryptBytesWithAAD(data, dek, aad) {
|
|
311
|
+
const iv = generateIV();
|
|
312
|
+
const ciphertext = await subtle.encrypt(
|
|
313
|
+
{
|
|
314
|
+
name: "AES-GCM",
|
|
315
|
+
iv,
|
|
316
|
+
additionalData: aad
|
|
317
|
+
},
|
|
318
|
+
dek,
|
|
319
|
+
data
|
|
320
|
+
);
|
|
321
|
+
return {
|
|
322
|
+
iv: bufferToBase64(iv),
|
|
323
|
+
data: bufferToBase64(ciphertext)
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
async function decryptBytesWithAAD(ivBase64, dataBase64, dek, aad) {
|
|
327
|
+
const iv = base64ToBuffer(ivBase64);
|
|
328
|
+
const ciphertext = base64ToBuffer(dataBase64);
|
|
329
|
+
try {
|
|
330
|
+
const plaintext = await subtle.decrypt(
|
|
331
|
+
{
|
|
332
|
+
name: "AES-GCM",
|
|
333
|
+
iv,
|
|
334
|
+
additionalData: aad
|
|
335
|
+
},
|
|
336
|
+
dek,
|
|
337
|
+
ciphertext
|
|
338
|
+
);
|
|
339
|
+
return new Uint8Array(plaintext);
|
|
340
|
+
} catch (err) {
|
|
341
|
+
if (err instanceof Error && err.name === "OperationError") {
|
|
342
|
+
throw new TamperedError();
|
|
343
|
+
}
|
|
344
|
+
throw new DecryptionError(
|
|
345
|
+
err instanceof Error ? err.message : "Decryption failed"
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function deriveSealedFieldKey(dek, collectionName, field) {
|
|
350
|
+
const rawDek = await subtle.exportKey("raw", dek);
|
|
351
|
+
const hkdfKey = await subtle.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
352
|
+
const salt = new TextEncoder().encode("noydb-sealed");
|
|
353
|
+
const info = new TextEncoder().encode(JSON.stringify(["noydb-sealed", collectionName, field]));
|
|
354
|
+
const bits = await subtle.deriveBits(
|
|
355
|
+
{ name: "HKDF", hash: "SHA-256", salt, info },
|
|
356
|
+
hkdfKey,
|
|
357
|
+
KEY_BITS
|
|
358
|
+
);
|
|
359
|
+
return subtle.importKey(
|
|
360
|
+
"raw",
|
|
361
|
+
bits,
|
|
362
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
363
|
+
false,
|
|
364
|
+
["encrypt", "decrypt"]
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
async function deriveSealedFieldKeyFromCek(cek, collectionName, field) {
|
|
368
|
+
const rawCek = await subtle.exportKey("raw", cek);
|
|
369
|
+
const hkdfKey = await subtle.importKey("raw", rawCek, "HKDF", false, ["deriveBits"]);
|
|
370
|
+
const salt = new TextEncoder().encode("noydb-sealed-cek");
|
|
371
|
+
const info = new TextEncoder().encode(JSON.stringify(["noydb-sealed-cek", collectionName, field]));
|
|
372
|
+
const bits = await subtle.deriveBits(
|
|
373
|
+
{ name: "HKDF", hash: "SHA-256", salt, info },
|
|
374
|
+
hkdfKey,
|
|
375
|
+
KEY_BITS
|
|
376
|
+
);
|
|
377
|
+
return subtle.importKey(
|
|
378
|
+
"raw",
|
|
379
|
+
bits,
|
|
380
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
381
|
+
false,
|
|
382
|
+
["encrypt", "decrypt"]
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
async function deriveDeterministicKey(dek) {
|
|
386
|
+
const rawDek = await subtle.exportKey("raw", dek);
|
|
387
|
+
const hkdfKey = await subtle.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
388
|
+
const salt = new TextEncoder().encode("noydb-det");
|
|
389
|
+
const info = new TextEncoder().encode(JSON.stringify(["noydb-det"]));
|
|
390
|
+
const bits = await subtle.deriveBits(
|
|
391
|
+
{ name: "HKDF", hash: "SHA-256", salt, info },
|
|
392
|
+
hkdfKey,
|
|
393
|
+
KEY_BITS
|
|
394
|
+
);
|
|
395
|
+
return subtle.importKey(
|
|
396
|
+
"raw",
|
|
397
|
+
bits,
|
|
398
|
+
{ name: "AES-GCM", length: KEY_BITS },
|
|
399
|
+
true,
|
|
400
|
+
["encrypt", "decrypt"]
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
async function deriveDeterministicIV(dek, context, plaintext) {
|
|
404
|
+
const rawDek = await subtle.exportKey("raw", dek);
|
|
405
|
+
const hkdfKey = await subtle.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
406
|
+
const salt = new TextEncoder().encode("noydb-deterministic-v1");
|
|
407
|
+
const info = new TextEncoder().encode(`${context}\0${plaintext}`);
|
|
408
|
+
const bits = await subtle.deriveBits(
|
|
409
|
+
{ name: "HKDF", hash: "SHA-256", salt, info },
|
|
410
|
+
hkdfKey,
|
|
411
|
+
IV_BYTES * 8
|
|
412
|
+
);
|
|
413
|
+
return new Uint8Array(bits);
|
|
414
|
+
}
|
|
415
|
+
async function encryptDeterministic(plaintext, dek, context) {
|
|
416
|
+
const iv = await deriveDeterministicIV(dek, context, plaintext);
|
|
417
|
+
const encoded = new TextEncoder().encode(plaintext);
|
|
418
|
+
const ciphertext = await subtle.encrypt(
|
|
419
|
+
{ name: "AES-GCM", iv },
|
|
420
|
+
dek,
|
|
421
|
+
encoded
|
|
422
|
+
);
|
|
423
|
+
return {
|
|
424
|
+
iv: bufferToBase64(iv),
|
|
425
|
+
data: bufferToBase64(ciphertext)
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
async function decryptDeterministic(ivBase64, dataBase64, dek) {
|
|
429
|
+
return decrypt(ivBase64, dataBase64, dek);
|
|
430
|
+
}
|
|
431
|
+
async function generateRecipientKeyPair() {
|
|
432
|
+
return subtle.generateKey(
|
|
433
|
+
{ name: "RSA-OAEP", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256" },
|
|
434
|
+
true,
|
|
435
|
+
["encrypt", "decrypt"]
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
async function exportRecipientPublicKeySpki(pair) {
|
|
439
|
+
return new Uint8Array(await subtle.exportKey("spki", pair.publicKey));
|
|
440
|
+
}
|
|
441
|
+
async function importRecipientPublicKeySpki(spki) {
|
|
442
|
+
return subtle.importKey("spki", spki, { name: "RSA-OAEP", hash: "SHA-256" }, false, ["encrypt"]);
|
|
443
|
+
}
|
|
444
|
+
async function recipientWrap(pub, bytes) {
|
|
445
|
+
return new Uint8Array(await subtle.encrypt({ name: "RSA-OAEP" }, pub, bytes));
|
|
446
|
+
}
|
|
447
|
+
async function recipientUnwrap(pair, wrapped) {
|
|
448
|
+
return new Uint8Array(await subtle.decrypt({ name: "RSA-OAEP" }, pair.privateKey, wrapped));
|
|
449
|
+
}
|
|
450
|
+
async function exportRecipientPrivateKeyPkcs8(pair) {
|
|
451
|
+
return new Uint8Array(await subtle.exportKey("pkcs8", pair.privateKey));
|
|
452
|
+
}
|
|
453
|
+
async function importRecipientKeyPair(pkcs8, spki) {
|
|
454
|
+
const alg = { name: "RSA-OAEP", hash: "SHA-256" };
|
|
455
|
+
const [privateKey, publicKey] = await Promise.all([
|
|
456
|
+
subtle.importKey("pkcs8", pkcs8, alg, false, ["decrypt"]),
|
|
457
|
+
subtle.importKey("spki", spki, alg, false, ["encrypt"])
|
|
458
|
+
]);
|
|
459
|
+
return { privateKey, publicKey };
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// src/capsule/enclave-aes/classify/digest.ts
|
|
463
|
+
var subtle2 = globalThis.crypto.subtle;
|
|
464
|
+
async function pbkdf2VerifyDigest(value, salt, iterations) {
|
|
465
|
+
const keyMaterial = await subtle2.importKey(
|
|
466
|
+
"raw",
|
|
467
|
+
new TextEncoder().encode(value),
|
|
468
|
+
"PBKDF2",
|
|
469
|
+
false,
|
|
470
|
+
["deriveBits"]
|
|
471
|
+
);
|
|
472
|
+
const bits = await subtle2.deriveBits(
|
|
473
|
+
{ name: "PBKDF2", salt, iterations, hash: "SHA-256" },
|
|
474
|
+
keyMaterial,
|
|
475
|
+
256
|
|
476
|
+
);
|
|
477
|
+
return new Uint8Array(bits);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// src/capsule/enclave-aes/classify/compare.ts
|
|
481
|
+
var subtle3 = globalThis.crypto.subtle;
|
|
482
|
+
async function blindedEqual(a, b) {
|
|
483
|
+
const ke = await subtle3.generateKey({ name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
484
|
+
const tagA = new Uint8Array(await subtle3.sign("HMAC", ke, a));
|
|
485
|
+
const tagB = new Uint8Array(await subtle3.sign("HMAC", ke, b));
|
|
486
|
+
return ctEqualTags(tagA, tagB);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// src/capsule/enclave-aes/classify/vdig.ts
|
|
490
|
+
var subtle4 = globalThis.crypto.subtle;
|
|
491
|
+
var VDIG_SALT_DOMAIN = "noydb-classify-vdig";
|
|
492
|
+
function buildVdigAad(collection, recordId, field) {
|
|
493
|
+
return new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, recordId, field]));
|
|
494
|
+
}
|
|
495
|
+
async function deriveVdigSlotKey(cek, collection, field) {
|
|
496
|
+
const raw = await subtle4.exportKey("raw", cek);
|
|
497
|
+
const hkdf = await subtle4.importKey("raw", raw, "HKDF", false, ["deriveBits"]);
|
|
498
|
+
const salt = new TextEncoder().encode(VDIG_SALT_DOMAIN);
|
|
499
|
+
const info = new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, field]));
|
|
500
|
+
const bits = await subtle4.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdf, 256);
|
|
501
|
+
return subtle4.importKey("raw", bits, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
502
|
+
}
|
|
503
|
+
async function sealVdigPayload(payload, cek, collection, recordId, field) {
|
|
504
|
+
const key = await deriveVdigSlotKey(cek, collection, field);
|
|
505
|
+
const { iv, data } = await encryptBytesWithAAD(
|
|
506
|
+
new TextEncoder().encode(JSON.stringify(payload)),
|
|
507
|
+
key,
|
|
508
|
+
buildVdigAad(collection, recordId, field)
|
|
509
|
+
);
|
|
510
|
+
return `${iv}:${data}`;
|
|
511
|
+
}
|
|
512
|
+
async function openVdigPayload(blob, cek, collection, recordId, field) {
|
|
513
|
+
const sep = blob.indexOf(":");
|
|
514
|
+
if (sep === -1) throw new TamperedError();
|
|
515
|
+
const ivPart = blob.slice(0, sep);
|
|
516
|
+
const dataPart = blob.slice(sep + 1);
|
|
517
|
+
try {
|
|
518
|
+
base64ToBuffer(ivPart);
|
|
519
|
+
base64ToBuffer(dataPart);
|
|
520
|
+
} catch {
|
|
521
|
+
throw new TamperedError();
|
|
522
|
+
}
|
|
523
|
+
const key = await deriveVdigSlotKey(cek, collection, field);
|
|
524
|
+
const bytes = await decryptBytesWithAAD(
|
|
525
|
+
ivPart,
|
|
526
|
+
dataPart,
|
|
527
|
+
key,
|
|
528
|
+
buildVdigAad(collection, recordId, field)
|
|
529
|
+
);
|
|
530
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// src/capsule/enclave-aes/classify/write.ts
|
|
534
|
+
async function mintVdigSlot(rawValue, policy, prevBlob, cek, collection, recordId, field) {
|
|
535
|
+
const normalized = normalizeForVerify(policy.normalize, rawValue);
|
|
536
|
+
let prev = null;
|
|
537
|
+
if (prevBlob !== void 0) {
|
|
538
|
+
try {
|
|
539
|
+
prev = await openVdigPayload(prevBlob, cek, collection, recordId, field);
|
|
540
|
+
} catch {
|
|
541
|
+
throw new TamperedError();
|
|
542
|
+
}
|
|
543
|
+
if (!Number.isInteger(prev.iter) || prev.iter < 1) {
|
|
544
|
+
throw new TamperedError();
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (prev !== null && policy.notLastN > 0) {
|
|
548
|
+
const history = [prev.cur, ...prev.ring ?? []];
|
|
549
|
+
for (const entry of history) {
|
|
550
|
+
const digest = await pbkdf2VerifyDigest(normalized, base64ToBuffer(entry.salt), prev.iter);
|
|
551
|
+
if (await blindedEqual(digest, base64ToBuffer(entry.hash))) {
|
|
552
|
+
throw new ClassifiedRotationError(collection, field, "password was used recently");
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const salt = generateSalt();
|
|
557
|
+
const hash = await pbkdf2VerifyDigest(normalized, salt, VDIG_ITERATIONS);
|
|
558
|
+
const ring = prev !== null && policy.notLastN > 0 ? [...prev.ring ?? [], { salt: prev.cur.salt, hash: prev.cur.hash }].slice(-policy.notLastN) : void 0;
|
|
559
|
+
const payload = {
|
|
560
|
+
v: 1,
|
|
561
|
+
alg: "PBKDF2-SHA256",
|
|
562
|
+
iter: VDIG_ITERATIONS,
|
|
563
|
+
cur: { salt: bufferToBase64(salt), hash: bufferToBase64(hash), at: (/* @__PURE__ */ new Date()).toISOString() },
|
|
564
|
+
...ring !== void 0 && ring.length > 0 ? { ring } : {}
|
|
565
|
+
};
|
|
566
|
+
return sealVdigPayload(payload, cek, collection, recordId, field);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// src/capsule/enclave-aes/classify/bidx.ts
|
|
570
|
+
var subtle5 = globalThis.crypto.subtle;
|
|
571
|
+
var CLASSIFY_INDEX_KEY_DOMAIN = "noydb-classify-index-v1";
|
|
572
|
+
var CLASSIFY_INDEX_SALT_DOMAIN = "noydb-classify-index-salt-v1";
|
|
573
|
+
var COST_BYTE_V1 = 1;
|
|
574
|
+
var CURRENT_COST_BYTE = COST_BYTE_V1;
|
|
575
|
+
function iterationsForCostByte(b) {
|
|
576
|
+
if (b === COST_BYTE_V1) return VDIG_ITERATIONS;
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
async function deriveClassifyIndexKey(dek, collection, field) {
|
|
580
|
+
const rawDek = await subtle5.exportKey("raw", dek);
|
|
581
|
+
const hkdfKey = await subtle5.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
582
|
+
const salt = new TextEncoder().encode(CLASSIFY_INDEX_KEY_DOMAIN);
|
|
583
|
+
const info = new TextEncoder().encode(JSON.stringify([CLASSIFY_INDEX_KEY_DOMAIN, collection, field]));
|
|
584
|
+
const bits = await subtle5.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdfKey, 256);
|
|
585
|
+
return subtle5.importKey("raw", bits, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
586
|
+
}
|
|
587
|
+
async function deriveClassifyIndexSalt(dek, collection, field) {
|
|
588
|
+
const rawDek = await subtle5.exportKey("raw", dek);
|
|
589
|
+
const hkdfKey = await subtle5.importKey("raw", rawDek, "HKDF", false, ["deriveBits"]);
|
|
590
|
+
const salt = new TextEncoder().encode(CLASSIFY_INDEX_SALT_DOMAIN);
|
|
591
|
+
const info = new TextEncoder().encode(JSON.stringify([CLASSIFY_INDEX_SALT_DOMAIN, collection, field]));
|
|
592
|
+
const bits = await subtle5.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdfKey, 256);
|
|
593
|
+
return new Uint8Array(bits);
|
|
594
|
+
}
|
|
595
|
+
async function mintAt(normalized, dek, collection, field, costByte) {
|
|
596
|
+
const iterations = iterationsForCostByte(costByte);
|
|
597
|
+
if (iterations == null) {
|
|
598
|
+
throw new Error(`bidx: unknown cost byte 0x${costByte.toString(16)}`);
|
|
599
|
+
}
|
|
600
|
+
const saltCf = await deriveClassifyIndexSalt(dek, collection, field);
|
|
601
|
+
const inner = await pbkdf2VerifyDigest(normalized, saltCf, iterations);
|
|
602
|
+
const kIdx = await deriveClassifyIndexKey(dek, collection, field);
|
|
603
|
+
const mac = await subtle5.sign("HMAC", kIdx, inner);
|
|
604
|
+
const tag = new Uint8Array(1 + 32);
|
|
605
|
+
tag[0] = costByte;
|
|
606
|
+
tag.set(new Uint8Array(mac), 1);
|
|
607
|
+
return bufferToBase64(tag);
|
|
608
|
+
}
|
|
609
|
+
async function mintBidxTag(normalized, dek, collection, field) {
|
|
610
|
+
return mintAt(normalized, dek, collection, field, CURRENT_COST_BYTE);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// src/capsule/enclave-aes/primitives.ts
|
|
614
|
+
var aesPrimitives = {
|
|
615
|
+
encrypt,
|
|
616
|
+
decrypt,
|
|
617
|
+
encryptBytesWithAAD,
|
|
618
|
+
decryptBytesWithAAD,
|
|
619
|
+
encryptDeterministic,
|
|
620
|
+
deriveDeterministicKey,
|
|
621
|
+
deriveSealedFieldKey,
|
|
622
|
+
deriveSealedFieldKeyFromCek,
|
|
623
|
+
generateDEK,
|
|
624
|
+
wrapCek,
|
|
625
|
+
unwrapCek,
|
|
626
|
+
bufferToBase64,
|
|
627
|
+
mintVdigSlot,
|
|
628
|
+
mintBidxTag,
|
|
629
|
+
openVdigPayload,
|
|
630
|
+
sealVdigPayload,
|
|
631
|
+
// family#168 — the two the verify engines need, so the engines can live in
|
|
632
|
+
// the plumbing instead of in here.
|
|
633
|
+
pbkdf2VerifyDigest,
|
|
634
|
+
blindedEqual
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
// src/capsule/enclave-aes/bound.ts
|
|
638
|
+
var aesCapsule = makeCapsule(aesPrimitives);
|
|
639
|
+
|
|
640
|
+
// src/capsule/enclave-aes/classify/find.ts
|
|
641
|
+
async function computeBidxTarget(candidate, normalize, dek, collection, field, costByte) {
|
|
642
|
+
const resolvedCostByte = costByte ?? CURRENT_COST_BYTE;
|
|
643
|
+
const iters = iterationsForCostByte(resolvedCostByte);
|
|
644
|
+
if (iters === null) return null;
|
|
645
|
+
const normalized = normalizeForVerify(normalize, candidate);
|
|
646
|
+
return mintAt(normalized, dek, collection, field, resolvedCostByte);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// src/capsule/enclave-aes/broker/proof.ts
|
|
650
|
+
var subtle6 = globalThis.crypto.subtle;
|
|
97
651
|
var BROKER_PROOF_DOMAIN = "noydb-broker-proof";
|
|
98
652
|
var BROKER_PROOF_VERSION = "noydb-broker-proof-v1";
|
|
99
653
|
var BROKER_PROOF_MEMBER_VERSION = "noydb-broker-proof-v2";
|
|
@@ -125,18 +679,18 @@ function buildCanonical(vaultId, brokerId, parts) {
|
|
|
125
679
|
]);
|
|
126
680
|
}
|
|
127
681
|
async function deriveBrokerProofBits(seed, vaultId, brokerId, memberUserId) {
|
|
128
|
-
const hkdfKey = await
|
|
682
|
+
const hkdfKey = await subtle6.importKey("raw", seed, "HKDF", false, ["deriveBits"]);
|
|
129
683
|
const salt = new TextEncoder().encode(BROKER_PROOF_DOMAIN);
|
|
130
684
|
const info = new TextEncoder().encode(JSON.stringify(
|
|
131
685
|
memberUserId === void 0 ? [BROKER_PROOF_DOMAIN, vaultId, brokerId] : [BROKER_PROOF_DOMAIN, vaultId, brokerId, memberUserId]
|
|
132
686
|
));
|
|
133
|
-
const bits = await
|
|
687
|
+
const bits = await subtle6.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdfKey, 256);
|
|
134
688
|
return new Uint8Array(bits);
|
|
135
689
|
}
|
|
136
690
|
async function deriveBrokerProofKey(seed, vaultId, brokerId, memberUserId) {
|
|
137
691
|
const proofBits = await deriveBrokerProofBits(seed, vaultId, brokerId, memberUserId);
|
|
138
692
|
try {
|
|
139
|
-
return await
|
|
693
|
+
return await subtle6.importKey("raw", proofBits, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
140
694
|
} finally {
|
|
141
695
|
proofBits.fill(0);
|
|
142
696
|
}
|
|
@@ -150,7 +704,7 @@ async function computeBrokerProof(seed, vaultId, brokerId, canonicalParts) {
|
|
|
150
704
|
}
|
|
151
705
|
const canonical = buildCanonical(vaultId, brokerId, canonicalParts);
|
|
152
706
|
const key = await deriveBrokerProofKey(seed, vaultId, brokerId, canonicalParts.member?.userId);
|
|
153
|
-
const mac = await
|
|
707
|
+
const mac = await subtle6.sign("HMAC", key, new TextEncoder().encode(canonical));
|
|
154
708
|
return bufferToBase64(new Uint8Array(mac));
|
|
155
709
|
} finally {
|
|
156
710
|
seed.fill(0);
|
|
@@ -176,14 +730,14 @@ async function verifyBrokerProof(args) {
|
|
|
176
730
|
challenge: args.challenge,
|
|
177
731
|
expiresAt: args.expiresAt
|
|
178
732
|
});
|
|
179
|
-
const key = await
|
|
733
|
+
const key = await subtle6.importKey(
|
|
180
734
|
"raw",
|
|
181
735
|
args.registeredProofKey,
|
|
182
736
|
{ name: "HMAC", hash: "SHA-256" },
|
|
183
737
|
false,
|
|
184
738
|
["verify"]
|
|
185
739
|
);
|
|
186
|
-
const ok = await
|
|
740
|
+
const ok = await subtle6.verify(
|
|
187
741
|
"HMAC",
|
|
188
742
|
key,
|
|
189
743
|
base64ToBuffer(args.proof),
|
|
@@ -262,11 +816,18 @@ var {
|
|
|
262
816
|
findByDet,
|
|
263
817
|
queryByDet
|
|
264
818
|
} = aesCapsule;
|
|
819
|
+
var {
|
|
820
|
+
revealSealedField,
|
|
821
|
+
verifyDigestField,
|
|
822
|
+
verifyTextField,
|
|
823
|
+
matchGroupFields
|
|
824
|
+
} = aesCapsule;
|
|
265
825
|
export {
|
|
266
826
|
RecordCodec,
|
|
267
827
|
SEALED_CEK_NS,
|
|
268
828
|
applyRewrappedBody,
|
|
269
829
|
base64ToBuffer,
|
|
830
|
+
blindedEqual,
|
|
270
831
|
bufferToBase64,
|
|
271
832
|
buildDeleteMarker,
|
|
272
833
|
buildRecordAad,
|
|
@@ -333,6 +894,7 @@ export {
|
|
|
333
894
|
isTombstoneShape,
|
|
334
895
|
issueChallenge,
|
|
335
896
|
makeReservedEnvelopes,
|
|
897
|
+
matchGroupFields,
|
|
336
898
|
mintBidxTag,
|
|
337
899
|
mintCanary,
|
|
338
900
|
openEnvelopeJson,
|
|
@@ -346,6 +908,7 @@ export {
|
|
|
346
908
|
rekeyEnvelopeToDek,
|
|
347
909
|
requireSealedBody,
|
|
348
910
|
resolveStableCek,
|
|
911
|
+
revealSealedField,
|
|
349
912
|
revokeSealedRecord,
|
|
350
913
|
rewrapBodyToDek,
|
|
351
914
|
rewrapEnvelope,
|
|
@@ -359,7 +922,9 @@ export {
|
|
|
359
922
|
unwrapKey,
|
|
360
923
|
verifyBrokerProof,
|
|
361
924
|
verifyBytes,
|
|
925
|
+
verifyDigestField,
|
|
362
926
|
verifyRecordIdentity,
|
|
927
|
+
verifyTextField,
|
|
363
928
|
wrapCek,
|
|
364
929
|
wrapKey,
|
|
365
930
|
writeEnvelopeBody
|