@noy-db/hub 0.1.0-pre.9 → 0.2.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/dist/aggregate/index.cjs +91 -36
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +16 -9
- package/dist/aggregate/index.js.map +1 -1
- package/dist/attestation/index.cjs +305 -0
- package/dist/attestation/index.cjs.map +1 -0
- package/dist/attestation/index.d.cts +52 -0
- package/dist/attestation/index.d.ts +52 -0
- package/dist/attestation/index.js +36 -0
- package/dist/attestation/index.js.map +1 -0
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +7 -6
- package/dist/blobs/index.d.ts +7 -6
- package/dist/blobs/index.js +10 -8
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.cjs +16923 -60
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +175 -6
- package/dist/bundle/index.d.ts +175 -6
- package/dist/bundle/index.js +543 -4
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-PTVMYYON.js → chunk-243PNUA6.js} +3 -3
- package/dist/{chunk-MR4424N3.js → chunk-2PAQNPE3.js} +2 -2
- package/dist/chunk-3QAKZ37R.js +83 -0
- package/dist/chunk-3QAKZ37R.js.map +1 -0
- package/dist/chunk-3S4BJX25.js +36 -0
- package/dist/chunk-3S4BJX25.js.map +1 -0
- package/dist/chunk-3XHOCQK4.js +118 -0
- package/dist/chunk-3XHOCQK4.js.map +1 -0
- package/dist/{chunk-AVVPZ4BC.js → chunk-3Y53S2SA.js} +4 -4
- package/dist/chunk-3Z2TPHC4.js +291 -0
- package/dist/chunk-3Z2TPHC4.js.map +1 -0
- package/dist/chunk-4HIL6AHQ.js +57 -0
- package/dist/chunk-4HIL6AHQ.js.map +1 -0
- package/dist/chunk-5ZGZ6HIZ.js +100 -0
- package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
- package/dist/{chunk-ZFKD4QMV.js → chunk-7BRE6EUA.js} +3 -3
- package/dist/chunk-7BUTTVMR.js +34 -0
- package/dist/chunk-7BUTTVMR.js.map +1 -0
- package/dist/{chunk-VQBTTTUN.js → chunk-7Q5PLD5C.js} +4 -4
- package/dist/{chunk-VQBTTTUN.js.map → chunk-7Q5PLD5C.js.map} +1 -1
- package/dist/{chunk-QAVUREFT.js → chunk-7Z23ZFLV.js} +12 -6
- package/dist/chunk-7Z23ZFLV.js.map +1 -0
- package/dist/chunk-AHPFONIL.js +59 -0
- package/dist/chunk-AHPFONIL.js.map +1 -0
- package/dist/chunk-CXSCDO5T.js +51 -0
- package/dist/chunk-CXSCDO5T.js.map +1 -0
- package/dist/chunk-E535SAN4.js +8834 -0
- package/dist/chunk-E535SAN4.js.map +1 -0
- package/dist/chunk-EUYOGYGV.js +830 -0
- package/dist/chunk-EUYOGYGV.js.map +1 -0
- package/dist/chunk-FAQVNJD4.js +61 -0
- package/dist/chunk-FAQVNJD4.js.map +1 -0
- package/dist/{chunk-SCZXXXU4.js → chunk-G6FRSBKK.js} +7 -32
- package/dist/chunk-G6FRSBKK.js.map +1 -0
- package/dist/chunk-GIV6DWBG.js +79 -0
- package/dist/chunk-GIV6DWBG.js.map +1 -0
- package/dist/chunk-HXJXPZRE.js +73 -0
- package/dist/chunk-HXJXPZRE.js.map +1 -0
- package/dist/{chunk-GOUT6DND.js → chunk-J4KLMEUL.js} +173 -91
- package/dist/chunk-J4KLMEUL.js.map +1 -0
- package/dist/{chunk-2CSJGFCB.js → chunk-JYQTXEIO.js} +6 -229
- package/dist/chunk-JYQTXEIO.js.map +1 -0
- package/dist/{chunk-MDDTIZUO.js → chunk-LRAZDV5X.js} +7 -119
- package/dist/chunk-LRAZDV5X.js.map +1 -0
- package/dist/{chunk-M5INGEFC.js → chunk-MRIBLZL3.js} +3 -1
- package/dist/chunk-MRIBLZL3.js.map +1 -0
- package/dist/{chunk-USKYUS74.js → chunk-MUWOSVEP.js} +2 -2
- package/dist/{chunk-4PWAI7Q4.js → chunk-NWZ3I6R6.js} +5 -5
- package/dist/chunk-OVZDFEOR.js +124 -0
- package/dist/chunk-OVZDFEOR.js.map +1 -0
- package/dist/chunk-PEULZC6M.js +118 -0
- package/dist/chunk-PEULZC6M.js.map +1 -0
- package/dist/chunk-PFSNOPBQ.js +233 -0
- package/dist/chunk-PFSNOPBQ.js.map +1 -0
- package/dist/chunk-PLI5TV7N.js +53 -0
- package/dist/chunk-PLI5TV7N.js.map +1 -0
- package/dist/{chunk-WDM5XGGS.js → chunk-Q6W2CMEJ.js} +181 -11
- package/dist/chunk-Q6W2CMEJ.js.map +1 -0
- package/dist/{chunk-QGZRWRSL.js → chunk-QPEXPHJR.js} +4 -4
- package/dist/{chunk-R36SIKES.js → chunk-QXQRKXCU.js} +2 -2
- package/dist/chunk-RTZVQAJ7.js +82 -0
- package/dist/chunk-RTZVQAJ7.js.map +1 -0
- package/dist/chunk-TBKOGSYR.js +296 -0
- package/dist/chunk-TBKOGSYR.js.map +1 -0
- package/dist/chunk-UMLVJTYV.js +20 -0
- package/dist/chunk-UMLVJTYV.js.map +1 -0
- package/dist/chunk-UND4XIB6.js +251 -0
- package/dist/chunk-UND4XIB6.js.map +1 -0
- package/dist/chunk-VCGTOS2A.js +795 -0
- package/dist/chunk-VCGTOS2A.js.map +1 -0
- package/dist/chunk-VE6YVP32.js +19 -0
- package/dist/chunk-VE6YVP32.js.map +1 -0
- package/dist/{chunk-M62XNWRA.js → chunk-VK5EER6C.js} +2 -2
- package/dist/{chunk-NXFEYLVG.js → chunk-VPSUZLOJ.js} +4 -3
- package/dist/{chunk-NXFEYLVG.js.map → chunk-VPSUZLOJ.js.map} +1 -1
- package/dist/{chunk-TDR6T5CJ.js → chunk-VRBCTEKQ.js} +91 -132
- package/dist/chunk-VRBCTEKQ.js.map +1 -0
- package/dist/{chunk-ACLDOTNQ.js → chunk-W3XXT26A.js} +303 -3
- package/dist/chunk-W3XXT26A.js.map +1 -0
- package/dist/{chunk-CIMZBAZB.js → chunk-XG3PTSCD.js} +1 -1
- package/dist/chunk-XG3PTSCD.js.map +1 -0
- package/dist/chunk-Y2RKOPNC.js +145 -0
- package/dist/chunk-Y2RKOPNC.js.map +1 -0
- package/dist/{chunk-NPC4LFV5.js → chunk-YMYK7US4.js} +2 -2
- package/dist/{chunk-RKJ6OL7K.js → chunk-YS3POABP.js} +1 -1
- package/dist/chunk-YS3POABP.js.map +1 -0
- package/dist/chunk-YTXSFG3C.js +179 -0
- package/dist/chunk-YTXSFG3C.js.map +1 -0
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +7 -6
- package/dist/consent/index.d.ts +7 -6
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-IVKU7YTT.js → crypto-5ZDIY3NG.js} +3 -3
- package/dist/{delegation-2DBS2EOH.js → delegation-QYXZW25W.js} +5 -4
- package/dist/derivations/index.cjs +351 -0
- package/dist/derivations/index.cjs.map +1 -0
- package/dist/derivations/index.d.cts +72 -0
- package/dist/derivations/index.d.ts +72 -0
- package/dist/derivations/index.js +27 -0
- package/dist/{dev-unlock-Da1B0TIK.d.cts → dev-unlock-DQCNDfFp.d.cts} +1 -1
- package/dist/{dev-unlock-BdPp68qn.d.ts → dev-unlock-utkybTKb.d.ts} +1 -1
- package/dist/executor-AS2IDHKZ.js +11 -0
- package/dist/executor-HLXFXNFM.js +8 -0
- package/dist/executor-HLXFXNFM.js.map +1 -0
- package/dist/executor-HN6YBHZ5.js +8 -0
- package/dist/executor-HN6YBHZ5.js.map +1 -0
- package/dist/fanout-sidecar-VJ52RIEY.js +51 -0
- package/dist/fanout-sidecar-VJ52RIEY.js.map +1 -0
- package/dist/guards/index.cjs +315 -0
- package/dist/guards/index.cjs.map +1 -0
- package/dist/guards/index.d.cts +31 -0
- package/dist/guards/index.d.ts +31 -0
- package/dist/guards/index.js +29 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/{hash-lsoL3eEW.d.ts → hash-DcoYWfJ_.d.ts} +1 -1
- package/dist/{hash-BEfzPKwo.d.cts → hash-jDowCrK2.d.cts} +1 -1
- package/dist/history/index.cjs +8 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +8 -7
- package/dist/history/index.d.ts +8 -7
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.cjs +81 -0
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +7 -6
- package/dist/i18n/index.d.ts +7 -6
- package/dist/i18n/index.js +27 -12
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-6xNpPsxR.d.cts → index-BCKdioeh.d.ts} +331 -5
- package/dist/{index-DJTf9yxn.d.ts → index-BMjrzNZr.d.cts} +331 -5
- package/dist/index.cjs +6065 -959
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +208 -16
- package/dist/index.d.ts +208 -16
- package/dist/index.js +242 -7392
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +2 -0
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/issue-ORP37MVW.js +12 -0
- package/dist/issue-ORP37MVW.js.map +1 -0
- package/dist/{lazy-builder-CZVLKh0Z.d.cts → lazy-builder-C-rPfWG0.d.cts} +1 -1
- package/dist/{lazy-builder-BwEoBQZ9.d.ts → lazy-builder-Rpd-V3jP.d.ts} +1 -1
- package/dist/{ledger-QZTTHQAQ.js → ledger-3IU5GMXA.js} +6 -6
- package/dist/ledger-3IU5GMXA.js.map +1 -0
- package/dist/materialized-views/index.cjs +837 -0
- package/dist/materialized-views/index.cjs.map +1 -0
- package/dist/materialized-views/index.d.cts +184 -0
- package/dist/materialized-views/index.d.ts +184 -0
- package/dist/materialized-views/index.js +45 -0
- package/dist/materialized-views/index.js.map +1 -0
- package/dist/noydb-5H3C24GG.js +34 -0
- package/dist/noydb-5H3C24GG.js.map +1 -0
- package/dist/overlay-views/index.cjs +359 -0
- package/dist/overlay-views/index.cjs.map +1 -0
- package/dist/overlay-views/index.d.cts +82 -0
- package/dist/overlay-views/index.d.ts +82 -0
- package/dist/overlay-views/index.js +25 -0
- package/dist/overlay-views/index.js.map +1 -0
- package/dist/periods/index.cjs +7 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +7 -6
- package/dist/periods/index.d.ts +7 -6
- package/dist/periods/index.js +6 -6
- package/dist/{predicate-SBHmi6D0.d.cts → predicate-Dnu81tsS.d.cts} +25 -1
- package/dist/{predicate-SBHmi6D0.d.ts → predicate-Dnu81tsS.d.ts} +25 -1
- package/dist/{public-envelope-6JTACYJV.js → public-envelope-U3CMEOMV.js} +4 -4
- package/dist/public-envelope-U3CMEOMV.js.map +1 -0
- package/dist/query/index.cjs +302 -124
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +26 -11
- package/dist/read-only-facade-ITU6L7BL.js +7 -0
- package/dist/read-only-facade-ITU6L7BL.js.map +1 -0
- package/dist/registry-3ALP62P6.js +10 -0
- package/dist/registry-3ALP62P6.js.map +1 -0
- package/dist/registry-7HE6VJGC.js +8 -0
- package/dist/registry-7HE6VJGC.js.map +1 -0
- package/dist/registry-PSIPG2QR.js +8 -0
- package/dist/registry-PSIPG2QR.js.map +1 -0
- package/dist/registry-RFGGMVNJ.js +7 -0
- package/dist/registry-RFGGMVNJ.js.map +1 -0
- package/dist/revoke-KY2GB4KP.js +17 -0
- package/dist/revoke-KY2GB4KP.js.map +1 -0
- package/dist/session/index.cjs +7 -1
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +8 -7
- package/dist/session/index.d.ts +8 -7
- package/dist/session/index.js +10 -3
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +7 -6
- package/dist/shadow/index.d.ts +7 -6
- package/dist/shadow/index.js +2 -2
- package/dist/signer-GRI5TZKH.js +18 -0
- package/dist/signer-GRI5TZKH.js.map +1 -0
- package/dist/stale-OTOF3FH7.js +13 -0
- package/dist/stale-OTOF3FH7.js.map +1 -0
- package/dist/store/index.cjs +14 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +7 -6
- package/dist/store/index.d.ts +7 -6
- package/dist/store/index.js +5 -2
- package/dist/{strategy-D-SrOLCl.d.cts → strategy-DSTrsZ8t.d.cts} +72 -19
- package/dist/{strategy-D-SrOLCl.d.ts → strategy-DSTrsZ8t.d.ts} +72 -19
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +6 -5
- package/dist/sync/index.d.ts +6 -5
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs +1554 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +7 -6
- package/dist/team/index.d.ts +7 -6
- package/dist/team/index.js +77 -8
- package/dist/tx/index.cjs +296 -44
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +7 -6
- package/dist/tx/index.d.ts +7 -6
- package/dist/tx/index.js +2 -2
- package/dist/{types-Bo7NSXJr.d.ts → types-BoFFiskX.d.ts} +2714 -321
- package/dist/{types-Bnb82f5R.d.cts → types-DJG8HG6F.d.cts} +2714 -321
- package/dist/{index-CywCC1qZ.d.cts → ulid-BmBgooGm.d.ts} +215 -26
- package/dist/{index-8QDuznDr.d.ts → ulid-C7ms9oli.d.cts} +215 -26
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/with-derivation-BKXXa8Vt.d.ts +13 -0
- package/dist/with-derivation-BjQ7q4NE.d.cts +13 -0
- package/dist/with-guard-C25yNjzd.d.ts +18 -0
- package/dist/with-guard-DQme5DKE.d.cts +18 -0
- package/dist/with-materialized-view-BbEPFIIJ.d.cts +27 -0
- package/dist/with-materialized-view-CqnRwI2S.d.ts +27 -0
- package/dist/with-overlayed-view-Ct1fSJt-.d.ts +13 -0
- package/dist/with-overlayed-view-bwlmmFjx.d.cts +13 -0
- package/package.json +65 -2
- package/dist/chunk-2CSJGFCB.js.map +0 -1
- package/dist/chunk-ACLDOTNQ.js.map +0 -1
- package/dist/chunk-BTDCBVJW.js +0 -160
- package/dist/chunk-BTDCBVJW.js.map +0 -1
- package/dist/chunk-CIMZBAZB.js.map +0 -1
- package/dist/chunk-EXHNQEV4.js +0 -392
- package/dist/chunk-EXHNQEV4.js.map +0 -1
- package/dist/chunk-GOUT6DND.js.map +0 -1
- package/dist/chunk-M5INGEFC.js.map +0 -1
- package/dist/chunk-MDDTIZUO.js.map +0 -1
- package/dist/chunk-QAVUREFT.js.map +0 -1
- package/dist/chunk-RKJ6OL7K.js.map +0 -1
- package/dist/chunk-SCZXXXU4.js.map +0 -1
- package/dist/chunk-TDR6T5CJ.js.map +0 -1
- package/dist/chunk-WDM5XGGS.js.map +0 -1
- /package/dist/{chunk-PTVMYYON.js.map → chunk-243PNUA6.js.map} +0 -0
- /package/dist/{chunk-MR4424N3.js.map → chunk-2PAQNPE3.js.map} +0 -0
- /package/dist/{chunk-AVVPZ4BC.js.map → chunk-3Y53S2SA.js.map} +0 -0
- /package/dist/{chunk-ZFKD4QMV.js.map → chunk-7BRE6EUA.js.map} +0 -0
- /package/dist/{chunk-USKYUS74.js.map → chunk-MUWOSVEP.js.map} +0 -0
- /package/dist/{chunk-4PWAI7Q4.js.map → chunk-NWZ3I6R6.js.map} +0 -0
- /package/dist/{chunk-QGZRWRSL.js.map → chunk-QPEXPHJR.js.map} +0 -0
- /package/dist/{chunk-R36SIKES.js.map → chunk-QXQRKXCU.js.map} +0 -0
- /package/dist/{chunk-M62XNWRA.js.map → chunk-VK5EER6C.js.map} +0 -0
- /package/dist/{chunk-NPC4LFV5.js.map → chunk-YMYK7US4.js.map} +0 -0
- /package/dist/{crypto-IVKU7YTT.js.map → crypto-5ZDIY3NG.js.map} +0 -0
- /package/dist/{delegation-2DBS2EOH.js.map → delegation-QYXZW25W.js.map} +0 -0
- /package/dist/{ledger-QZTTHQAQ.js.map → derivations/index.js.map} +0 -0
- /package/dist/{public-envelope-6JTACYJV.js.map → executor-AS2IDHKZ.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ba as PublicEnvelope, bb as SealingKeyProvider, bc as BundleRecipient, bd as RecipientSealer, be as RecipientHint, bf as Vault } from './types-BoFFiskX.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `.noydb` container format — byte layout, header schema, validators.
|
|
@@ -123,6 +123,38 @@ interface NoydbBundleHeader {
|
|
|
123
123
|
* other unknown header key still rejects at parse time.
|
|
124
124
|
*/
|
|
125
125
|
readonly publicEnvelope?: PublicEnvelope;
|
|
126
|
+
/**
|
|
127
|
+
* Auto-unlock material indicator (#197). When present, the bundle
|
|
128
|
+
* body wraps the dump JSON in a structure carrying per-user
|
|
129
|
+
* passphrases — either plaintext (`'unsealed'`, public-by-design)
|
|
130
|
+
* or sealed under a `SealingKeyProvider` (`'sealed'`, requires
|
|
131
|
+
* matching provider on the recipient side).
|
|
132
|
+
*
|
|
133
|
+
* Visible pre-decompression so cloud listing UIs can warn before
|
|
134
|
+
* download: "this bundle opens itself for anyone holding the file"
|
|
135
|
+
* (unsealed) or "this bundle is sealed for a specific provider"
|
|
136
|
+
* (sealed).
|
|
137
|
+
*
|
|
138
|
+
* Absent → the body is a raw `vault.dump()` JSON string (the
|
|
139
|
+
* pre-#197 shape; back-compatible).
|
|
140
|
+
*/
|
|
141
|
+
readonly autoUnlock?: 'unsealed' | 'sealed';
|
|
142
|
+
/**
|
|
143
|
+
* Bundle's role in the source → destination lifecycle (#203).
|
|
144
|
+
* - omitted / 'snapshot' (default): backup/copy of an existing vault.
|
|
145
|
+
* - 'extracted-partition': re-keyed projection awaiting adoption.
|
|
146
|
+
*/
|
|
147
|
+
readonly bundleKind?: 'snapshot' | 'extracted-partition';
|
|
148
|
+
/**
|
|
149
|
+
* Transfer-seal INDICATOR (#206) — metadata only, no payload (the
|
|
150
|
+
* sealed DEKs live in the body). Present iff
|
|
151
|
+
* bundleKind === 'extracted-partition'.
|
|
152
|
+
*/
|
|
153
|
+
readonly transferSeal?: {
|
|
154
|
+
readonly v: 1;
|
|
155
|
+
readonly alg: 'aes-256-gcm-pre-shared';
|
|
156
|
+
readonly sealId: string;
|
|
157
|
+
};
|
|
126
158
|
}
|
|
127
159
|
/**
|
|
128
160
|
* Validate a parsed bundle header. Throws on any deviation from
|
|
@@ -188,6 +220,26 @@ declare function hasNoydbBundleMagic(bytes: Uint8Array): boolean;
|
|
|
188
220
|
* archive utilities that don't care about decryption.
|
|
189
221
|
*/
|
|
190
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The credential kinds that can be bundled for auto-unlock.
|
|
225
|
+
* WebAuthn is intentionally excluded — it is hardware-bound and
|
|
226
|
+
* cannot be embedded as a portable credential.
|
|
227
|
+
*/
|
|
228
|
+
type AutoCredentialKind = 'passphrase' | 'password' | 'pin';
|
|
229
|
+
/**
|
|
230
|
+
* A typed credential for auto-unlock. Carries the credential `kind`
|
|
231
|
+
* alongside the plaintext `value`, so consumers can dispatch the
|
|
232
|
+
* correct login/prefill path rather than treating all credentials
|
|
233
|
+
* as passphrases.
|
|
234
|
+
*
|
|
235
|
+
* `bundle.ts` is a pure format layer — it carries the credential
|
|
236
|
+
* without interpreting it. The consumer is responsible for
|
|
237
|
+
* dispatching on `kind`.
|
|
238
|
+
*/
|
|
239
|
+
interface AutoCredential {
|
|
240
|
+
readonly kind: AutoCredentialKind;
|
|
241
|
+
readonly value: string;
|
|
242
|
+
}
|
|
191
243
|
/**
|
|
192
244
|
* Options accepted by `writeNoydbBundle`.
|
|
193
245
|
*
|
|
@@ -258,6 +310,109 @@ interface WriteNoydbBundleOptions {
|
|
|
258
310
|
* suited to personal backup-and-restore).
|
|
259
311
|
*/
|
|
260
312
|
readonly recipients?: readonly BundleRecipient[];
|
|
313
|
+
/**
|
|
314
|
+
* Auto-unlock — unsealed per-user credentials (#215).
|
|
315
|
+
*
|
|
316
|
+
* Generalises `autoPassphrases` to support any bundleable credential
|
|
317
|
+
* kind (`passphrase` | `password` | `pin`).
|
|
318
|
+
*
|
|
319
|
+
* Public-by-design: anyone holding the bundle bytes can read these
|
|
320
|
+
* plaintext credentials. Use for demo data, sample vaults,
|
|
321
|
+
* prospect onboarding.
|
|
322
|
+
*
|
|
323
|
+
* The `policy: 'public-by-design'` discriminant is mandatory. A
|
|
324
|
+
* bare `{ perUser }` without it is rejected at write time — the
|
|
325
|
+
* safety net against a careless call against a production vault.
|
|
326
|
+
*
|
|
327
|
+
* Mutually exclusive with `sealedCredentials`, `autoPassphrases`,
|
|
328
|
+
* and `sealedPassphrases`.
|
|
329
|
+
*/
|
|
330
|
+
readonly autoCredentials?: {
|
|
331
|
+
readonly policy: 'public-by-design';
|
|
332
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Auto-unlock — per-user credentials sealed under a
|
|
336
|
+
* {@link SealingKeyProvider} (#215).
|
|
337
|
+
*
|
|
338
|
+
* Generalises `sealedPassphrases` to support any bundleable
|
|
339
|
+
* credential kind (`passphrase` | `password` | `pin`).
|
|
340
|
+
*
|
|
341
|
+
* The hub seals each user's plaintext credential under `provider`
|
|
342
|
+
* and embeds the resulting sealed envelopes in the bundle. The
|
|
343
|
+
* recipient must hold a provider with a matching `pid` (i.e.,
|
|
344
|
+
* `provider.id`) to auto-unseal on import.
|
|
345
|
+
*
|
|
346
|
+
* `mode: 'self-target'` — sender and recipient share the same
|
|
347
|
+
* provider identity (same iCloud Keychain entry, same
|
|
348
|
+
* MDM-provisioned bundle id, same KMS account, etc.).
|
|
349
|
+
*
|
|
350
|
+
* `mode: 'recipient-target'` — asymmetric sealing via a
|
|
351
|
+
* {@link RecipientSealer}. Each user entry carries a
|
|
352
|
+
* `credential` and a `hint` (the recipient's public material).
|
|
353
|
+
* The bundle can only be unsealed by the holder of the matching
|
|
354
|
+
* private key.
|
|
355
|
+
*
|
|
356
|
+
* Mutually exclusive with `autoCredentials`, `autoPassphrases`,
|
|
357
|
+
* and `sealedPassphrases`.
|
|
358
|
+
*/
|
|
359
|
+
readonly sealedCredentials?: {
|
|
360
|
+
readonly mode: 'self-target';
|
|
361
|
+
readonly provider: SealingKeyProvider;
|
|
362
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
363
|
+
} | {
|
|
364
|
+
readonly mode: 'recipient-target';
|
|
365
|
+
readonly provider: RecipientSealer;
|
|
366
|
+
readonly perUser: Record<string, {
|
|
367
|
+
readonly credential: AutoCredential;
|
|
368
|
+
readonly hint: RecipientHint;
|
|
369
|
+
}>;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* @deprecated Use `autoCredentials` instead (#215).
|
|
373
|
+
*
|
|
374
|
+
* Auto-unlock — unsealed per-user passphrases (#197 slice 1).
|
|
375
|
+
*
|
|
376
|
+
* Public-by-design: anyone holding the bundle bytes can read these
|
|
377
|
+
* plaintext credentials. Use for demo data, sample vaults,
|
|
378
|
+
* prospect onboarding.
|
|
379
|
+
*
|
|
380
|
+
* The `policy: 'public-by-design'` discriminant is mandatory. A
|
|
381
|
+
* bare `{ perUser }` without it is rejected at write time — the
|
|
382
|
+
* safety net against a careless call against a production vault.
|
|
383
|
+
*
|
|
384
|
+
* Mutually exclusive with `autoCredentials`, `sealedCredentials`,
|
|
385
|
+
* and `sealedPassphrases`.
|
|
386
|
+
*/
|
|
387
|
+
readonly autoPassphrases?: {
|
|
388
|
+
readonly policy: 'public-by-design';
|
|
389
|
+
readonly perUser: Record<string, string>;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* @deprecated Use `sealedCredentials` instead (#215).
|
|
393
|
+
*
|
|
394
|
+
* Auto-unlock — per-user passphrases sealed under a
|
|
395
|
+
* {@link SealingKeyProvider} (#197 slice 1, self-target only).
|
|
396
|
+
*
|
|
397
|
+
* The hub seals each user's plaintext passphrase under `provider`
|
|
398
|
+
* and embeds the resulting sealed envelopes in the bundle. The
|
|
399
|
+
* recipient must hold a provider with a matching `pid` (i.e.,
|
|
400
|
+
* `provider.id`) to auto-unseal on import.
|
|
401
|
+
*
|
|
402
|
+
* `mode: 'self-target'` is the only mode for `sealedPassphrases` — sender
|
|
403
|
+
* and recipient share the same provider identity (same iCloud Keychain
|
|
404
|
+
* entry, same MDM-provisioned bundle id, same KMS account, etc.).
|
|
405
|
+
* For recipient-target sealing via the `RecipientSealer` interface,
|
|
406
|
+
* use `sealedCredentials` with `mode: 'recipient-target'` (§11.4).
|
|
407
|
+
*
|
|
408
|
+
* Mutually exclusive with `autoCredentials`, `sealedCredentials`,
|
|
409
|
+
* and `autoPassphrases`.
|
|
410
|
+
*/
|
|
411
|
+
readonly sealedPassphrases?: {
|
|
412
|
+
readonly mode: 'self-target';
|
|
413
|
+
readonly provider: SealingKeyProvider;
|
|
414
|
+
readonly perUser: Record<string, string>;
|
|
415
|
+
};
|
|
261
416
|
}
|
|
262
417
|
/**
|
|
263
418
|
* Result returned by `readNoydbBundle`. The caller is expected to
|
|
@@ -268,32 +423,66 @@ interface WriteNoydbBundleOptions {
|
|
|
268
423
|
interface NoydbBundleReadResult {
|
|
269
424
|
readonly header: NoydbBundleHeader;
|
|
270
425
|
readonly dumpJson: string;
|
|
426
|
+
/**
|
|
427
|
+
* Auto-unlock material (#197, widened in #215). Present only when
|
|
428
|
+
* the header's `autoUnlock` flag is set AND the body's wrapped
|
|
429
|
+
* structure survived parsing. Values are typed credentials — either
|
|
430
|
+
* delivered plain (`kind: 'unsealed'`) or unsealed at read time
|
|
431
|
+
* using one of the supplied `sealingProviders` (`kind: 'sealed'`).
|
|
432
|
+
*
|
|
433
|
+
* Consumers dispatch on `cred.kind` to choose the correct login /
|
|
434
|
+
* prefill path. Pre-0.2 bundles (bare string entries) are coerced
|
|
435
|
+
* to `{ kind: 'passphrase', value }` on read for back-compat.
|
|
436
|
+
*
|
|
437
|
+
* For `kind: 'sealed'` bundles read without `sealingProviders`, the
|
|
438
|
+
* `value` field is the raw base64 sealed bytes — opaque to the
|
|
439
|
+
* consumer until unsealed elsewhere.
|
|
440
|
+
*/
|
|
441
|
+
readonly autoUnlock?: {
|
|
442
|
+
readonly kind: 'unsealed' | 'sealed';
|
|
443
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
444
|
+
};
|
|
271
445
|
}
|
|
272
|
-
/** Test-only: reset the brotli detection cache between tests. */
|
|
273
|
-
declare function resetBrotliSupportCache(): void;
|
|
274
446
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* 1. Resolve or create the compartment's stable bundle handle
|
|
279
|
-
* via `vault.getBundleHandle()` — same handle on
|
|
280
|
-
* every export from the same vault instance, so cloud
|
|
281
|
-
* adapters can use it as a primary key.
|
|
282
|
-
* 2. `vault.dump()` → JSON string with encrypted records
|
|
283
|
-
* inside.
|
|
284
|
-
* 3. UTF-8 encode the dump string.
|
|
285
|
-
* 4. Compress (brotli if available, gzip fallback by default).
|
|
286
|
-
* 5. Compute SHA-256 of the compressed body for integrity.
|
|
287
|
-
* 6. Build the minimum-disclosure header from format version,
|
|
288
|
-
* handle, body length, body sha.
|
|
289
|
-
* 7. Serialize: magic (4) + flags (1) + algo (1) + headerLen (4)
|
|
290
|
-
* + header JSON (N) + compressed body (M).
|
|
291
|
-
*
|
|
292
|
-
* The output is a single `Uint8Array`. Consumers writing to disk
|
|
293
|
-
* pass it to `fs.writeFile`; consumers uploading to cloud storage
|
|
294
|
-
* pass it as the request body. The `@noy-db/file` adapter wraps
|
|
295
|
-
* this with a `saveBundle(path, vault)` helper.
|
|
447
|
+
* Options accepted by {@link readNoydbBundle} for the #197
|
|
448
|
+
* auto-unlock paths. Without these the reader behaves exactly as
|
|
449
|
+
* pre-#197 (header parsed; body returned as `dumpJson`).
|
|
296
450
|
*/
|
|
451
|
+
interface ReadNoydbBundleOptions {
|
|
452
|
+
/**
|
|
453
|
+
* Recipient-side sealing providers used to unseal entries from
|
|
454
|
+
* `sealedPassphrases`. The reader picks the one whose `.id`
|
|
455
|
+
* matches each entry's `pid`. Multiple providers may be supplied
|
|
456
|
+
* (different users may seal under different identities).
|
|
457
|
+
*
|
|
458
|
+
* When unset and the bundle carries sealed envelopes, the
|
|
459
|
+
* `autoUnlock.perUser` map remains the SEALED entries unmodified
|
|
460
|
+
* — callers can inspect them or unseal elsewhere.
|
|
461
|
+
*/
|
|
462
|
+
readonly sealingProviders?: readonly SealingKeyProvider[];
|
|
463
|
+
/**
|
|
464
|
+
* Opt-in trial mode for unsealing — when an entry's `pid` doesn't
|
|
465
|
+
* match a registered provider, try each provider whose alg
|
|
466
|
+
* matches. Default `false` (strict-pid dispatch per foundation
|
|
467
|
+
* §11.9.2). Surfaces extra credential prompts; use deliberately.
|
|
468
|
+
*/
|
|
469
|
+
readonly attemptUnsealAcrossProviders?: boolean;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Transfer-seal payload (#206). The destination DEKs, exported to raw
|
|
473
|
+
* bytes and AES-256-GCM-sealed *as a set* under the one-time transfer
|
|
474
|
+
* key. `adoptPartition` (#207) unseals this; `createOwnerOnAdoptedPartition`
|
|
475
|
+
* (#208) re-wraps the raw DEKs under the recipient's KEK.
|
|
476
|
+
*/
|
|
477
|
+
interface TransferSealPayload {
|
|
478
|
+
readonly v: 1;
|
|
479
|
+
readonly alg: 'aes-256-gcm-pre-shared';
|
|
480
|
+
readonly sealId: string;
|
|
481
|
+
/** base64(AES-256-GCM(transferKey, JSON of { collection: base64(rawDEK) })) — iv ‖ ct ‖ tag. */
|
|
482
|
+
readonly payload: string;
|
|
483
|
+
}
|
|
484
|
+
/** Test-only: reset the brotli detection cache between tests. */
|
|
485
|
+
declare function resetBrotliSupportCache(): void;
|
|
297
486
|
declare function writeNoydbBundle(vault: Vault, opts?: WriteNoydbBundleOptions): Promise<Uint8Array>;
|
|
298
487
|
/**
|
|
299
488
|
* Read just the bundle header — no body decompression, no
|
|
@@ -344,7 +533,7 @@ declare function readNoydbBundlePublicEnvelope(bytes: Uint8Array, opts?: {
|
|
|
344
533
|
* free of crypto concerns and lets the same code feed format
|
|
345
534
|
* inspectors that never decrypt anything.
|
|
346
535
|
*/
|
|
347
|
-
declare function readNoydbBundle(bytes: Uint8Array): Promise<NoydbBundleReadResult>;
|
|
536
|
+
declare function readNoydbBundle(bytes: Uint8Array, opts?: ReadNoydbBundleOptions): Promise<NoydbBundleReadResult>;
|
|
348
537
|
|
|
349
538
|
/**
|
|
350
539
|
* Minimal ULID generator — zero dependencies, Web Crypto API only.
|
|
@@ -411,4 +600,4 @@ declare function generateULID(): string;
|
|
|
411
600
|
*/
|
|
412
601
|
declare function isULID(value: string): boolean;
|
|
413
602
|
|
|
414
|
-
export { type
|
|
603
|
+
export { type AutoCredential as A, COMPRESSION_BROTLI as C, FLAG_COMPRESSED as F, NOYDB_BUNDLE_FORMAT_VERSION as N, type ReadNoydbBundleOptions as R, type TransferSealPayload as T, type WriteNoydbBundleOptions as W, COMPRESSION_GZIP as a, COMPRESSION_NONE as b, type CompressionAlgo as c, FLAG_HAS_INTEGRITY_HASH as d, NOYDB_BUNDLE_MAGIC as e, NOYDB_BUNDLE_PREFIX_BYTES as f, type NoydbBundleHeader as g, type NoydbBundleReadResult as h, encodeBundleHeader as i, generateULID as j, isULID as k, readNoydbBundleHeader as l, resetBrotliSupportCache as m, type AutoCredentialKind as n, hasNoydbBundleMagic as o, readNoydbBundlePublicEnvelope as p, readNoydbBundle as r, validateBundleHeader as v, writeNoydbBundle as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ba as PublicEnvelope, bb as SealingKeyProvider, bc as BundleRecipient, bd as RecipientSealer, be as RecipientHint, bf as Vault } from './types-DJG8HG6F.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `.noydb` container format — byte layout, header schema, validators.
|
|
@@ -123,6 +123,38 @@ interface NoydbBundleHeader {
|
|
|
123
123
|
* other unknown header key still rejects at parse time.
|
|
124
124
|
*/
|
|
125
125
|
readonly publicEnvelope?: PublicEnvelope;
|
|
126
|
+
/**
|
|
127
|
+
* Auto-unlock material indicator (#197). When present, the bundle
|
|
128
|
+
* body wraps the dump JSON in a structure carrying per-user
|
|
129
|
+
* passphrases — either plaintext (`'unsealed'`, public-by-design)
|
|
130
|
+
* or sealed under a `SealingKeyProvider` (`'sealed'`, requires
|
|
131
|
+
* matching provider on the recipient side).
|
|
132
|
+
*
|
|
133
|
+
* Visible pre-decompression so cloud listing UIs can warn before
|
|
134
|
+
* download: "this bundle opens itself for anyone holding the file"
|
|
135
|
+
* (unsealed) or "this bundle is sealed for a specific provider"
|
|
136
|
+
* (sealed).
|
|
137
|
+
*
|
|
138
|
+
* Absent → the body is a raw `vault.dump()` JSON string (the
|
|
139
|
+
* pre-#197 shape; back-compatible).
|
|
140
|
+
*/
|
|
141
|
+
readonly autoUnlock?: 'unsealed' | 'sealed';
|
|
142
|
+
/**
|
|
143
|
+
* Bundle's role in the source → destination lifecycle (#203).
|
|
144
|
+
* - omitted / 'snapshot' (default): backup/copy of an existing vault.
|
|
145
|
+
* - 'extracted-partition': re-keyed projection awaiting adoption.
|
|
146
|
+
*/
|
|
147
|
+
readonly bundleKind?: 'snapshot' | 'extracted-partition';
|
|
148
|
+
/**
|
|
149
|
+
* Transfer-seal INDICATOR (#206) — metadata only, no payload (the
|
|
150
|
+
* sealed DEKs live in the body). Present iff
|
|
151
|
+
* bundleKind === 'extracted-partition'.
|
|
152
|
+
*/
|
|
153
|
+
readonly transferSeal?: {
|
|
154
|
+
readonly v: 1;
|
|
155
|
+
readonly alg: 'aes-256-gcm-pre-shared';
|
|
156
|
+
readonly sealId: string;
|
|
157
|
+
};
|
|
126
158
|
}
|
|
127
159
|
/**
|
|
128
160
|
* Validate a parsed bundle header. Throws on any deviation from
|
|
@@ -188,6 +220,26 @@ declare function hasNoydbBundleMagic(bytes: Uint8Array): boolean;
|
|
|
188
220
|
* archive utilities that don't care about decryption.
|
|
189
221
|
*/
|
|
190
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The credential kinds that can be bundled for auto-unlock.
|
|
225
|
+
* WebAuthn is intentionally excluded — it is hardware-bound and
|
|
226
|
+
* cannot be embedded as a portable credential.
|
|
227
|
+
*/
|
|
228
|
+
type AutoCredentialKind = 'passphrase' | 'password' | 'pin';
|
|
229
|
+
/**
|
|
230
|
+
* A typed credential for auto-unlock. Carries the credential `kind`
|
|
231
|
+
* alongside the plaintext `value`, so consumers can dispatch the
|
|
232
|
+
* correct login/prefill path rather than treating all credentials
|
|
233
|
+
* as passphrases.
|
|
234
|
+
*
|
|
235
|
+
* `bundle.ts` is a pure format layer — it carries the credential
|
|
236
|
+
* without interpreting it. The consumer is responsible for
|
|
237
|
+
* dispatching on `kind`.
|
|
238
|
+
*/
|
|
239
|
+
interface AutoCredential {
|
|
240
|
+
readonly kind: AutoCredentialKind;
|
|
241
|
+
readonly value: string;
|
|
242
|
+
}
|
|
191
243
|
/**
|
|
192
244
|
* Options accepted by `writeNoydbBundle`.
|
|
193
245
|
*
|
|
@@ -258,6 +310,109 @@ interface WriteNoydbBundleOptions {
|
|
|
258
310
|
* suited to personal backup-and-restore).
|
|
259
311
|
*/
|
|
260
312
|
readonly recipients?: readonly BundleRecipient[];
|
|
313
|
+
/**
|
|
314
|
+
* Auto-unlock — unsealed per-user credentials (#215).
|
|
315
|
+
*
|
|
316
|
+
* Generalises `autoPassphrases` to support any bundleable credential
|
|
317
|
+
* kind (`passphrase` | `password` | `pin`).
|
|
318
|
+
*
|
|
319
|
+
* Public-by-design: anyone holding the bundle bytes can read these
|
|
320
|
+
* plaintext credentials. Use for demo data, sample vaults,
|
|
321
|
+
* prospect onboarding.
|
|
322
|
+
*
|
|
323
|
+
* The `policy: 'public-by-design'` discriminant is mandatory. A
|
|
324
|
+
* bare `{ perUser }` without it is rejected at write time — the
|
|
325
|
+
* safety net against a careless call against a production vault.
|
|
326
|
+
*
|
|
327
|
+
* Mutually exclusive with `sealedCredentials`, `autoPassphrases`,
|
|
328
|
+
* and `sealedPassphrases`.
|
|
329
|
+
*/
|
|
330
|
+
readonly autoCredentials?: {
|
|
331
|
+
readonly policy: 'public-by-design';
|
|
332
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Auto-unlock — per-user credentials sealed under a
|
|
336
|
+
* {@link SealingKeyProvider} (#215).
|
|
337
|
+
*
|
|
338
|
+
* Generalises `sealedPassphrases` to support any bundleable
|
|
339
|
+
* credential kind (`passphrase` | `password` | `pin`).
|
|
340
|
+
*
|
|
341
|
+
* The hub seals each user's plaintext credential under `provider`
|
|
342
|
+
* and embeds the resulting sealed envelopes in the bundle. The
|
|
343
|
+
* recipient must hold a provider with a matching `pid` (i.e.,
|
|
344
|
+
* `provider.id`) to auto-unseal on import.
|
|
345
|
+
*
|
|
346
|
+
* `mode: 'self-target'` — sender and recipient share the same
|
|
347
|
+
* provider identity (same iCloud Keychain entry, same
|
|
348
|
+
* MDM-provisioned bundle id, same KMS account, etc.).
|
|
349
|
+
*
|
|
350
|
+
* `mode: 'recipient-target'` — asymmetric sealing via a
|
|
351
|
+
* {@link RecipientSealer}. Each user entry carries a
|
|
352
|
+
* `credential` and a `hint` (the recipient's public material).
|
|
353
|
+
* The bundle can only be unsealed by the holder of the matching
|
|
354
|
+
* private key.
|
|
355
|
+
*
|
|
356
|
+
* Mutually exclusive with `autoCredentials`, `autoPassphrases`,
|
|
357
|
+
* and `sealedPassphrases`.
|
|
358
|
+
*/
|
|
359
|
+
readonly sealedCredentials?: {
|
|
360
|
+
readonly mode: 'self-target';
|
|
361
|
+
readonly provider: SealingKeyProvider;
|
|
362
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
363
|
+
} | {
|
|
364
|
+
readonly mode: 'recipient-target';
|
|
365
|
+
readonly provider: RecipientSealer;
|
|
366
|
+
readonly perUser: Record<string, {
|
|
367
|
+
readonly credential: AutoCredential;
|
|
368
|
+
readonly hint: RecipientHint;
|
|
369
|
+
}>;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* @deprecated Use `autoCredentials` instead (#215).
|
|
373
|
+
*
|
|
374
|
+
* Auto-unlock — unsealed per-user passphrases (#197 slice 1).
|
|
375
|
+
*
|
|
376
|
+
* Public-by-design: anyone holding the bundle bytes can read these
|
|
377
|
+
* plaintext credentials. Use for demo data, sample vaults,
|
|
378
|
+
* prospect onboarding.
|
|
379
|
+
*
|
|
380
|
+
* The `policy: 'public-by-design'` discriminant is mandatory. A
|
|
381
|
+
* bare `{ perUser }` without it is rejected at write time — the
|
|
382
|
+
* safety net against a careless call against a production vault.
|
|
383
|
+
*
|
|
384
|
+
* Mutually exclusive with `autoCredentials`, `sealedCredentials`,
|
|
385
|
+
* and `sealedPassphrases`.
|
|
386
|
+
*/
|
|
387
|
+
readonly autoPassphrases?: {
|
|
388
|
+
readonly policy: 'public-by-design';
|
|
389
|
+
readonly perUser: Record<string, string>;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* @deprecated Use `sealedCredentials` instead (#215).
|
|
393
|
+
*
|
|
394
|
+
* Auto-unlock — per-user passphrases sealed under a
|
|
395
|
+
* {@link SealingKeyProvider} (#197 slice 1, self-target only).
|
|
396
|
+
*
|
|
397
|
+
* The hub seals each user's plaintext passphrase under `provider`
|
|
398
|
+
* and embeds the resulting sealed envelopes in the bundle. The
|
|
399
|
+
* recipient must hold a provider with a matching `pid` (i.e.,
|
|
400
|
+
* `provider.id`) to auto-unseal on import.
|
|
401
|
+
*
|
|
402
|
+
* `mode: 'self-target'` is the only mode for `sealedPassphrases` — sender
|
|
403
|
+
* and recipient share the same provider identity (same iCloud Keychain
|
|
404
|
+
* entry, same MDM-provisioned bundle id, same KMS account, etc.).
|
|
405
|
+
* For recipient-target sealing via the `RecipientSealer` interface,
|
|
406
|
+
* use `sealedCredentials` with `mode: 'recipient-target'` (§11.4).
|
|
407
|
+
*
|
|
408
|
+
* Mutually exclusive with `autoCredentials`, `sealedCredentials`,
|
|
409
|
+
* and `autoPassphrases`.
|
|
410
|
+
*/
|
|
411
|
+
readonly sealedPassphrases?: {
|
|
412
|
+
readonly mode: 'self-target';
|
|
413
|
+
readonly provider: SealingKeyProvider;
|
|
414
|
+
readonly perUser: Record<string, string>;
|
|
415
|
+
};
|
|
261
416
|
}
|
|
262
417
|
/**
|
|
263
418
|
* Result returned by `readNoydbBundle`. The caller is expected to
|
|
@@ -268,32 +423,66 @@ interface WriteNoydbBundleOptions {
|
|
|
268
423
|
interface NoydbBundleReadResult {
|
|
269
424
|
readonly header: NoydbBundleHeader;
|
|
270
425
|
readonly dumpJson: string;
|
|
426
|
+
/**
|
|
427
|
+
* Auto-unlock material (#197, widened in #215). Present only when
|
|
428
|
+
* the header's `autoUnlock` flag is set AND the body's wrapped
|
|
429
|
+
* structure survived parsing. Values are typed credentials — either
|
|
430
|
+
* delivered plain (`kind: 'unsealed'`) or unsealed at read time
|
|
431
|
+
* using one of the supplied `sealingProviders` (`kind: 'sealed'`).
|
|
432
|
+
*
|
|
433
|
+
* Consumers dispatch on `cred.kind` to choose the correct login /
|
|
434
|
+
* prefill path. Pre-0.2 bundles (bare string entries) are coerced
|
|
435
|
+
* to `{ kind: 'passphrase', value }` on read for back-compat.
|
|
436
|
+
*
|
|
437
|
+
* For `kind: 'sealed'` bundles read without `sealingProviders`, the
|
|
438
|
+
* `value` field is the raw base64 sealed bytes — opaque to the
|
|
439
|
+
* consumer until unsealed elsewhere.
|
|
440
|
+
*/
|
|
441
|
+
readonly autoUnlock?: {
|
|
442
|
+
readonly kind: 'unsealed' | 'sealed';
|
|
443
|
+
readonly perUser: Record<string, AutoCredential>;
|
|
444
|
+
};
|
|
271
445
|
}
|
|
272
|
-
/** Test-only: reset the brotli detection cache between tests. */
|
|
273
|
-
declare function resetBrotliSupportCache(): void;
|
|
274
446
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* 1. Resolve or create the compartment's stable bundle handle
|
|
279
|
-
* via `vault.getBundleHandle()` — same handle on
|
|
280
|
-
* every export from the same vault instance, so cloud
|
|
281
|
-
* adapters can use it as a primary key.
|
|
282
|
-
* 2. `vault.dump()` → JSON string with encrypted records
|
|
283
|
-
* inside.
|
|
284
|
-
* 3. UTF-8 encode the dump string.
|
|
285
|
-
* 4. Compress (brotli if available, gzip fallback by default).
|
|
286
|
-
* 5. Compute SHA-256 of the compressed body for integrity.
|
|
287
|
-
* 6. Build the minimum-disclosure header from format version,
|
|
288
|
-
* handle, body length, body sha.
|
|
289
|
-
* 7. Serialize: magic (4) + flags (1) + algo (1) + headerLen (4)
|
|
290
|
-
* + header JSON (N) + compressed body (M).
|
|
291
|
-
*
|
|
292
|
-
* The output is a single `Uint8Array`. Consumers writing to disk
|
|
293
|
-
* pass it to `fs.writeFile`; consumers uploading to cloud storage
|
|
294
|
-
* pass it as the request body. The `@noy-db/file` adapter wraps
|
|
295
|
-
* this with a `saveBundle(path, vault)` helper.
|
|
447
|
+
* Options accepted by {@link readNoydbBundle} for the #197
|
|
448
|
+
* auto-unlock paths. Without these the reader behaves exactly as
|
|
449
|
+
* pre-#197 (header parsed; body returned as `dumpJson`).
|
|
296
450
|
*/
|
|
451
|
+
interface ReadNoydbBundleOptions {
|
|
452
|
+
/**
|
|
453
|
+
* Recipient-side sealing providers used to unseal entries from
|
|
454
|
+
* `sealedPassphrases`. The reader picks the one whose `.id`
|
|
455
|
+
* matches each entry's `pid`. Multiple providers may be supplied
|
|
456
|
+
* (different users may seal under different identities).
|
|
457
|
+
*
|
|
458
|
+
* When unset and the bundle carries sealed envelopes, the
|
|
459
|
+
* `autoUnlock.perUser` map remains the SEALED entries unmodified
|
|
460
|
+
* — callers can inspect them or unseal elsewhere.
|
|
461
|
+
*/
|
|
462
|
+
readonly sealingProviders?: readonly SealingKeyProvider[];
|
|
463
|
+
/**
|
|
464
|
+
* Opt-in trial mode for unsealing — when an entry's `pid` doesn't
|
|
465
|
+
* match a registered provider, try each provider whose alg
|
|
466
|
+
* matches. Default `false` (strict-pid dispatch per foundation
|
|
467
|
+
* §11.9.2). Surfaces extra credential prompts; use deliberately.
|
|
468
|
+
*/
|
|
469
|
+
readonly attemptUnsealAcrossProviders?: boolean;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Transfer-seal payload (#206). The destination DEKs, exported to raw
|
|
473
|
+
* bytes and AES-256-GCM-sealed *as a set* under the one-time transfer
|
|
474
|
+
* key. `adoptPartition` (#207) unseals this; `createOwnerOnAdoptedPartition`
|
|
475
|
+
* (#208) re-wraps the raw DEKs under the recipient's KEK.
|
|
476
|
+
*/
|
|
477
|
+
interface TransferSealPayload {
|
|
478
|
+
readonly v: 1;
|
|
479
|
+
readonly alg: 'aes-256-gcm-pre-shared';
|
|
480
|
+
readonly sealId: string;
|
|
481
|
+
/** base64(AES-256-GCM(transferKey, JSON of { collection: base64(rawDEK) })) — iv ‖ ct ‖ tag. */
|
|
482
|
+
readonly payload: string;
|
|
483
|
+
}
|
|
484
|
+
/** Test-only: reset the brotli detection cache between tests. */
|
|
485
|
+
declare function resetBrotliSupportCache(): void;
|
|
297
486
|
declare function writeNoydbBundle(vault: Vault, opts?: WriteNoydbBundleOptions): Promise<Uint8Array>;
|
|
298
487
|
/**
|
|
299
488
|
* Read just the bundle header — no body decompression, no
|
|
@@ -344,7 +533,7 @@ declare function readNoydbBundlePublicEnvelope(bytes: Uint8Array, opts?: {
|
|
|
344
533
|
* free of crypto concerns and lets the same code feed format
|
|
345
534
|
* inspectors that never decrypt anything.
|
|
346
535
|
*/
|
|
347
|
-
declare function readNoydbBundle(bytes: Uint8Array): Promise<NoydbBundleReadResult>;
|
|
536
|
+
declare function readNoydbBundle(bytes: Uint8Array, opts?: ReadNoydbBundleOptions): Promise<NoydbBundleReadResult>;
|
|
348
537
|
|
|
349
538
|
/**
|
|
350
539
|
* Minimal ULID generator — zero dependencies, Web Crypto API only.
|
|
@@ -411,4 +600,4 @@ declare function generateULID(): string;
|
|
|
411
600
|
*/
|
|
412
601
|
declare function isULID(value: string): boolean;
|
|
413
602
|
|
|
414
|
-
export { type
|
|
603
|
+
export { type AutoCredential as A, COMPRESSION_BROTLI as C, FLAG_COMPRESSED as F, NOYDB_BUNDLE_FORMAT_VERSION as N, type ReadNoydbBundleOptions as R, type TransferSealPayload as T, type WriteNoydbBundleOptions as W, COMPRESSION_GZIP as a, COMPRESSION_NONE as b, type CompressionAlgo as c, FLAG_HAS_INTEGRITY_HASH as d, NOYDB_BUNDLE_MAGIC as e, NOYDB_BUNDLE_PREFIX_BYTES as f, type NoydbBundleHeader as g, type NoydbBundleReadResult as h, encodeBundleHeader as i, generateULID as j, isULID as k, readNoydbBundleHeader as l, resetBrotliSupportCache as m, type AutoCredentialKind as n, hasNoydbBundleMagic as o, readNoydbBundlePublicEnvelope as p, readNoydbBundle as r, validateBundleHeader as v, writeNoydbBundle as w };
|