mindoodb 0.0.23 → 0.0.32
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/README-server.md +9 -1
- package/README.md +5 -3
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +24 -5
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.d.ts +14 -2
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.js +124 -27
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +159 -4
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +334 -25
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts +9 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts.map +1 -1
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js +77 -5
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js.map +1 -1
- package/dist/browser/index.mjs +103 -0
- package/dist/core/BaseMindooDB.d.ts +697 -4
- package/dist/core/BaseMindooDB.d.ts.map +1 -1
- package/dist/core/BaseMindooDB.js +3273 -180
- package/dist/core/BaseMindooDB.js.map +1 -1
- package/dist/core/BaseMindooTenant.d.ts +192 -1
- package/dist/core/BaseMindooTenant.d.ts.map +1 -1
- package/dist/core/BaseMindooTenant.js +633 -88
- package/dist/core/BaseMindooTenant.js.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts +770 -10
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.js +2715 -292
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
- package/dist/core/BaseMindooTenantFactory.d.ts +2 -0
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantFactory.js +20 -0
- package/dist/core/BaseMindooTenantFactory.js.map +1 -1
- package/dist/core/accesscontrol/AccessDeniedError.d.ts +22 -0
- package/dist/core/accesscontrol/AccessDeniedError.d.ts.map +1 -0
- package/dist/core/accesscontrol/AccessDeniedError.js +28 -0
- package/dist/core/accesscontrol/AccessDeniedError.js.map +1 -0
- package/dist/core/accesscontrol/DirectoryStateNode.d.ts +220 -0
- package/dist/core/accesscontrol/DirectoryStateNode.d.ts.map +1 -0
- package/dist/core/accesscontrol/DirectoryStateNode.js +297 -0
- package/dist/core/accesscontrol/DirectoryStateNode.js.map +1 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.d.ts +118 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.d.ts.map +1 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.js +173 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.js.map +1 -0
- package/dist/core/accesscontrol/directoryProjection.d.ts +26 -0
- package/dist/core/accesscontrol/directoryProjection.d.ts.map +1 -0
- package/dist/core/accesscontrol/directoryProjection.js +174 -0
- package/dist/core/accesscontrol/directoryProjection.js.map +1 -0
- package/dist/core/accesscontrol/evaluate.d.ts +77 -0
- package/dist/core/accesscontrol/evaluate.d.ts.map +1 -0
- package/dist/core/accesscontrol/evaluate.js +206 -0
- package/dist/core/accesscontrol/evaluate.js.map +1 -0
- package/dist/core/accesscontrol/grantKeys.d.ts +113 -0
- package/dist/core/accesscontrol/grantKeys.d.ts.map +1 -0
- package/dist/core/accesscontrol/grantKeys.js +302 -0
- package/dist/core/accesscontrol/grantKeys.js.map +1 -0
- package/dist/core/accesscontrol/keyBagReconciler.d.ts +22 -0
- package/dist/core/accesscontrol/keyBagReconciler.d.ts.map +1 -0
- package/dist/core/accesscontrol/keyBagReconciler.js +3 -0
- package/dist/core/accesscontrol/keyBagReconciler.js.map +1 -0
- package/dist/core/accesscontrol/materializationGuard.d.ts +89 -0
- package/dist/core/accesscontrol/materializationGuard.d.ts.map +1 -0
- package/dist/core/accesscontrol/materializationGuard.js +69 -0
- package/dist/core/accesscontrol/materializationGuard.js.map +1 -0
- package/dist/core/accesscontrol/quarantine.d.ts +65 -0
- package/dist/core/accesscontrol/quarantine.d.ts.map +1 -0
- package/dist/core/accesscontrol/quarantine.js +79 -0
- package/dist/core/accesscontrol/quarantine.js.map +1 -0
- package/dist/core/accesscontrol/receiptValidation.d.ts +113 -0
- package/dist/core/accesscontrol/receiptValidation.d.ts.map +1 -0
- package/dist/core/accesscontrol/receiptValidation.js +142 -0
- package/dist/core/accesscontrol/receiptValidation.js.map +1 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.d.ts +31 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.d.ts.map +1 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.js +66 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.js.map +1 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.d.ts +79 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.d.ts.map +1 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.js +22 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.js.map +1 -0
- package/dist/core/accesscontrol/types.d.ts +825 -0
- package/dist/core/accesscontrol/types.d.ts.map +1 -0
- package/dist/core/accesscontrol/types.js +534 -0
- package/dist/core/accesscontrol/types.js.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +9 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +54 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +38 -2
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.js +199 -26
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -1
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts +17 -3
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.d.ts +58 -4
- package/dist/core/appendonlystores/network/types.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.js +4 -0
- package/dist/core/appendonlystores/network/types.js.map +1 -1
- package/dist/core/appendonlystores/scanUtils.d.ts +27 -0
- package/dist/core/appendonlystores/scanUtils.d.ts.map +1 -0
- package/dist/core/appendonlystores/scanUtils.js +87 -0
- package/dist/core/appendonlystores/scanUtils.js.map +1 -0
- package/dist/core/appendonlystores/types.d.ts +23 -2
- package/dist/core/appendonlystores/types.d.ts.map +1 -1
- package/dist/core/cache/CacheManager.d.ts +13 -3
- package/dist/core/cache/CacheManager.d.ts.map +1 -1
- package/dist/core/cache/CacheManager.js +7 -4
- package/dist/core/cache/CacheManager.js.map +1 -1
- package/dist/core/crypto/EntrySignature.d.ts +137 -0
- package/dist/core/crypto/EntrySignature.d.ts.map +1 -0
- package/dist/core/crypto/EntrySignature.js +210 -0
- package/dist/core/crypto/EntrySignature.js.map +1 -0
- package/dist/core/crypto/MindooDocSigner.d.ts.map +1 -1
- package/dist/core/crypto/MindooDocSigner.js +6 -2
- package/dist/core/crypto/MindooDocSigner.js.map +1 -1
- package/dist/core/crypto/WitnessReceipt.d.ts +137 -0
- package/dist/core/crypto/WitnessReceipt.d.ts.map +1 -0
- package/dist/core/crypto/WitnessReceipt.js +182 -0
- package/dist/core/crypto/WitnessReceipt.js.map +1 -0
- package/dist/core/crypto/encryptedFields.d.ts +27 -0
- package/dist/core/crypto/encryptedFields.d.ts.map +1 -0
- package/dist/core/crypto/encryptedFields.js +58 -0
- package/dist/core/crypto/encryptedFields.js.map +1 -0
- package/dist/core/crypto/pbkdf2Iterations.d.ts +12 -0
- package/dist/core/crypto/pbkdf2Iterations.d.ts.map +1 -1
- package/dist/core/crypto/pbkdf2Iterations.js +23 -0
- package/dist/core/crypto/pbkdf2Iterations.js.map +1 -1
- package/dist/core/crypto/privateKeyEncryption.d.ts.map +1 -1
- package/dist/core/crypto/privateKeyEncryption.js +3 -1
- package/dist/core/crypto/privateKeyEncryption.js.map +1 -1
- package/dist/core/databaseIdValidation.d.ts +1 -1
- package/dist/core/databaseIdValidation.d.ts.map +1 -1
- package/dist/core/databaseIdValidation.js +4 -4
- package/dist/core/databaseIdValidation.js.map +1 -1
- package/dist/core/errors.d.ts +26 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +42 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/expressions/builder.d.ts +102 -0
- package/dist/core/expressions/builder.d.ts.map +1 -0
- package/dist/core/expressions/builder.js +249 -0
- package/dist/core/expressions/builder.js.map +1 -0
- package/dist/core/expressions/evaluateExpression.d.ts +78 -0
- package/dist/core/expressions/evaluateExpression.d.ts.map +1 -0
- package/dist/core/expressions/evaluateExpression.js +386 -0
- package/dist/core/expressions/evaluateExpression.js.map +1 -0
- package/dist/core/expressions/formulaSource.d.ts +24 -0
- package/dist/core/expressions/formulaSource.d.ts.map +1 -0
- package/dist/core/expressions/formulaSource.js +765 -0
- package/dist/core/expressions/formulaSource.js.map +1 -0
- package/dist/core/expressions/index.d.ts +8 -0
- package/dist/core/expressions/index.d.ts.map +1 -0
- package/dist/core/expressions/index.js +46 -0
- package/dist/core/expressions/index.js.map +1 -0
- package/dist/core/expressions/metadata.d.ts +23 -0
- package/dist/core/expressions/metadata.d.ts.map +1 -0
- package/dist/core/expressions/metadata.js +191 -0
- package/dist/core/expressions/metadata.js.map +1 -0
- package/dist/core/expressions/types.d.ts +164 -0
- package/dist/core/expressions/types.d.ts.map +1 -0
- package/dist/core/expressions/types.js +3 -0
- package/dist/core/expressions/types.js.map +1 -0
- package/dist/core/extraction/types.d.ts +47 -0
- package/dist/core/extraction/types.d.ts.map +1 -0
- package/dist/core/extraction/types.js +42 -0
- package/dist/core/extraction/types.js.map +1 -0
- package/dist/core/index.d.ts +13 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +113 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/indexing/createViewDataProvider.d.ts +84 -0
- package/dist/core/indexing/createViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/createViewDataProvider.js +139 -0
- package/dist/core/indexing/createViewDataProvider.js.map +1 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.d.ts +180 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.js +548 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.js.map +1 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.d.ts +69 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.js +183 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.js.map +1 -0
- package/dist/core/indexing/fulltext/extractFulltextText.d.ts +34 -0
- package/dist/core/indexing/fulltext/extractFulltextText.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/extractFulltextText.js +129 -0
- package/dist/core/indexing/fulltext/extractFulltextText.js.map +1 -0
- package/dist/core/indexing/fulltext/index.d.ts +5 -0
- package/dist/core/indexing/fulltext/index.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/index.js +20 -0
- package/dist/core/indexing/fulltext/index.js.map +1 -0
- package/dist/core/indexing/fulltext/types.d.ts +168 -0
- package/dist/core/indexing/fulltext/types.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/types.js +89 -0
- package/dist/core/indexing/fulltext/types.js.map +1 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.d.ts +137 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.d.ts.map +1 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.js +438 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.js.map +1 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.d.ts +72 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.js +221 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/summary/extractSummaryFields.d.ts +75 -0
- package/dist/core/indexing/summary/extractSummaryFields.d.ts.map +1 -0
- package/dist/core/indexing/summary/extractSummaryFields.js +266 -0
- package/dist/core/indexing/summary/extractSummaryFields.js.map +1 -0
- package/dist/core/indexing/summary/index.d.ts +5 -0
- package/dist/core/indexing/summary/index.d.ts.map +1 -0
- package/dist/core/indexing/summary/index.js +23 -0
- package/dist/core/indexing/summary/index.js.map +1 -0
- package/dist/core/indexing/summary/types.d.ts +119 -0
- package/dist/core/indexing/summary/types.d.ts.map +1 -0
- package/dist/core/indexing/summary/types.js +81 -0
- package/dist/core/indexing/summary/types.js.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts +47 -1
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +24 -8
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +96 -41
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -1
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts +2 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js +8 -3
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualView.d.ts +111 -5
- package/dist/core/indexing/virtualviews/VirtualView.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualView.js +266 -75
- package/dist/core/indexing/virtualviews/VirtualView.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts +12 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts +12 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js +66 -5
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts +50 -6
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js +54 -12
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js.map +1 -1
- package/dist/core/indexing/virtualviews/index.d.ts +3 -3
- package/dist/core/indexing/virtualviews/index.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/index.js.map +1 -1
- package/dist/core/indexing/virtualviews/types.d.ts +6 -0
- package/dist/core/indexing/virtualviews/types.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/types.js +11 -3
- package/dist/core/indexing/virtualviews/types.js.map +1 -1
- package/dist/core/keys/KeyBag.d.ts +25 -0
- package/dist/core/keys/KeyBag.d.ts.map +1 -1
- package/dist/core/keys/KeyBag.js +37 -1
- package/dist/core/keys/KeyBag.js.map +1 -1
- package/dist/core/query/executeQuery.d.ts +18 -0
- package/dist/core/query/executeQuery.d.ts.map +1 -0
- package/dist/core/query/executeQuery.js +313 -0
- package/dist/core/query/executeQuery.js.map +1 -0
- package/dist/core/query/index.d.ts +5 -0
- package/dist/core/query/index.d.ts.map +1 -0
- package/dist/core/query/index.js +14 -0
- package/dist/core/query/index.js.map +1 -0
- package/dist/core/query/queryLive.d.ts +27 -0
- package/dist/core/query/queryLive.d.ts.map +1 -0
- package/dist/core/query/queryLive.js +104 -0
- package/dist/core/query/queryLive.js.map +1 -0
- package/dist/core/query/queryView.d.ts +156 -0
- package/dist/core/query/queryView.d.ts.map +1 -0
- package/dist/core/query/queryView.js +266 -0
- package/dist/core/query/queryView.js.map +1 -0
- package/dist/core/query/types.d.ts +121 -0
- package/dist/core/query/types.d.ts.map +1 -0
- package/dist/core/query/types.js +18 -0
- package/dist/core/query/types.js.map +1 -0
- package/dist/core/storeEntryTime.d.ts +57 -0
- package/dist/core/storeEntryTime.d.ts.map +1 -0
- package/dist/core/storeEntryTime.js +72 -0
- package/dist/core/storeEntryTime.js.map +1 -0
- package/dist/core/types.d.ts +1509 -39
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +13 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/uri/MindooURI.d.ts +53 -1
- package/dist/core/uri/MindooURI.d.ts.map +1 -1
- package/dist/core/uri/MindooURI.js +135 -0
- package/dist/core/uri/MindooURI.js.map +1 -1
- package/dist/core/utils/urlSafety.d.ts +46 -0
- package/dist/core/utils/urlSafety.d.ts.map +1 -0
- package/dist/core/utils/urlSafety.js +144 -0
- package/dist/core/utils/urlSafety.js.map +1 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +14 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -1
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js +95 -4
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -1
- package/dist/node/server/CapabilityMatcher.d.ts +10 -0
- package/dist/node/server/CapabilityMatcher.d.ts.map +1 -1
- package/dist/node/server/CapabilityMatcher.js +14 -2
- package/dist/node/server/CapabilityMatcher.js.map +1 -1
- package/dist/node/server/MindooDBServer.d.ts.map +1 -1
- package/dist/node/server/MindooDBServer.js +117 -8
- package/dist/node/server/MindooDBServer.js.map +1 -1
- package/dist/node/server/PurgedDocRegistry.d.ts +32 -0
- package/dist/node/server/PurgedDocRegistry.d.ts.map +1 -0
- package/dist/node/server/PurgedDocRegistry.js +94 -0
- package/dist/node/server/PurgedDocRegistry.js.map +1 -0
- package/dist/node/server/ServerSync.d.ts.map +1 -1
- package/dist/node/server/ServerSync.js +5 -2
- package/dist/node/server/ServerSync.js.map +1 -1
- package/dist/node/server/SystemAdminAuth.d.ts +10 -0
- package/dist/node/server/SystemAdminAuth.d.ts.map +1 -1
- package/dist/node/server/SystemAdminAuth.js +25 -0
- package/dist/node/server/SystemAdminAuth.js.map +1 -1
- package/dist/node/server/TenantManager.d.ts +95 -1
- package/dist/node/server/TenantManager.d.ts.map +1 -1
- package/dist/node/server/TenantManager.js +382 -15
- package/dist/node/server/TenantManager.js.map +1 -1
- package/dist/node/server/config.d.ts.map +1 -1
- package/dist/node/server/config.js +5 -1
- package/dist/node/server/config.js.map +1 -1
- package/dist/node/server/types.d.ts +29 -3
- package/dist/node/server/types.d.ts.map +1 -1
- package/dist/node/server/types.js +12 -0
- package/dist/node/server/types.js.map +1 -1
- package/dist/node/server/validation.d.ts +6 -0
- package/dist/node/server/validation.d.ts.map +1 -1
- package/dist/node/server/validation.js +7 -1
- package/dist/node/server/validation.js.map +1 -1
- package/package.json +4 -3
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts +0 -8
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts.map +0 -1
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js +0 -16
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js.map +0 -1
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +0 -68
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +0 -1
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js +0 -659
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js.map +0 -1
- package/dist/node/attachments/writeAttachmentToFile.d.ts +0 -15
- package/dist/node/attachments/writeAttachmentToFile.d.ts.map +0 -1
- package/dist/node/attachments/writeAttachmentToFile.js +0 -73
- package/dist/node/attachments/writeAttachmentToFile.js.map +0 -1
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access-control directory schema (docs/accesscontrol.md §6) plus the
|
|
3
|
+
* evaluation result type (§7).
|
|
4
|
+
*
|
|
5
|
+
* All access-control state lives in the admin-only `directory` database and
|
|
6
|
+
* syncs to every participant. Several documents use **fixed document IDs** so
|
|
7
|
+
* they can be read by direct lookup without an index/view. Every field the
|
|
8
|
+
* SERVER must evaluate for Tier 1 is encrypted with the `$publicinfos` key (so
|
|
9
|
+
* the server can read it without the tenant key); `withfields` (Tier 2) is
|
|
10
|
+
* never readable by the server.
|
|
11
|
+
*/
|
|
12
|
+
/** The `form` value shared by every access-control directory document (§6). */
|
|
13
|
+
export declare const ACCESS_CONTROL_FORM: "accesscontrol";
|
|
14
|
+
/**
|
|
15
|
+
* Operation types a rule can govern. The `doc_*` mutation types mirror the
|
|
16
|
+
* relevant `StoreEntryType`s. `doc_read` is special: it is NOT a store entry
|
|
17
|
+
* type but a **database-level read/sync gate** (§6.6) — it decides whether a
|
|
18
|
+
* user/group may open and sync a database at all. Because it is the coarse
|
|
19
|
+
* gate in front of every sync operation for a database, it also gates writes
|
|
20
|
+
* (a user who cannot read a database cannot create data in it either); `dbid`
|
|
21
|
+
* is therefore the only scope that matters for a `doc_read` rule, and content
|
|
22
|
+
* (`withfields`) clauses are not allowed on it.
|
|
23
|
+
*/
|
|
24
|
+
export type RuleType = "doc_create" | "doc_change" | "doc_delete" | "doc_undelete" | "doc_snapshot" | "doc_read";
|
|
25
|
+
/** All valid {@link RuleType} values, for validation and iteration. */
|
|
26
|
+
export declare const RULE_TYPES: readonly RuleType[];
|
|
27
|
+
/** Comparison operators usable in a {@link WithFieldClause}. Closed set. */
|
|
28
|
+
export type Operator = "equals" | "notEquals" | "contains" | "containsAny" | "containsAll" | "exists" | "notExists" | "gt" | "gte" | "lt" | "lte";
|
|
29
|
+
/** All valid {@link Operator} values. */
|
|
30
|
+
export declare const OPERATORS: readonly Operator[];
|
|
31
|
+
/**
|
|
32
|
+
* Placeholders resolved at evaluation time against the acting user.
|
|
33
|
+
*
|
|
34
|
+
* There is deliberately NO `${now}` / wall-clock placeholder: ACL evaluation
|
|
35
|
+
* must be a pure, deterministic function of the entry plus directory state
|
|
36
|
+
* (§7, §10), and a wall-clock value would make replicas disagree.
|
|
37
|
+
*/
|
|
38
|
+
export type Placeholder = "${user.username}" | "${user.usernames}" | "${user.groups}";
|
|
39
|
+
/** All valid {@link Placeholder} values. */
|
|
40
|
+
export declare const PLACEHOLDERS: readonly Placeholder[];
|
|
41
|
+
/** Returns true if `value` is a recognized {@link Placeholder}. */
|
|
42
|
+
export declare function isPlaceholder(value: unknown): value is Placeholder;
|
|
43
|
+
/**
|
|
44
|
+
* Reserved pseudo-tokens stored literally in `users_hashes`. They are NOT
|
|
45
|
+
* secret (§6.3):
|
|
46
|
+
* - `$everyone` — all registered users;
|
|
47
|
+
* - `$admin` — the tenant admin only;
|
|
48
|
+
* - `$author` — the original creator of the document being modified
|
|
49
|
+
* (meaningful only on `doc_change`/`doc_delete`/`doc_undelete`).
|
|
50
|
+
*/
|
|
51
|
+
export declare const PSEUDO_TOKEN_EVERYONE: "$everyone";
|
|
52
|
+
export declare const PSEUDO_TOKEN_ADMIN: "$admin";
|
|
53
|
+
export declare const PSEUDO_TOKEN_AUTHOR: "$author";
|
|
54
|
+
export declare const RESERVED_PSEUDO_TOKENS: readonly string[];
|
|
55
|
+
/** Which document state a {@link WithFieldClause} is evaluated against (§6.3). */
|
|
56
|
+
export type WithFieldWhen = "before" | "after";
|
|
57
|
+
/**
|
|
58
|
+
* A single content condition inside a Tier 2 rule (§6.3). The presence of any
|
|
59
|
+
* `withfields` clause on a rule makes the rule Tier 2 (client-only), because it
|
|
60
|
+
* depends on encrypted document content the server cannot read.
|
|
61
|
+
*/
|
|
62
|
+
export interface WithFieldClause {
|
|
63
|
+
/** Dot-path inside the document, e.g. `myeditors` or `meta.owner`. */
|
|
64
|
+
key: string;
|
|
65
|
+
op: Operator;
|
|
66
|
+
/** Literal value or a {@link Placeholder} resolved against the acting user. */
|
|
67
|
+
value: string | number | boolean | string[] | Placeholder;
|
|
68
|
+
/**
|
|
69
|
+
* Which document state to evaluate against. Op-appropriate defaults when
|
|
70
|
+
* omitted: `doc_create` => "after" (no before state exists); all other ops
|
|
71
|
+
* => "before" (authorization must look at the existing document, otherwise a
|
|
72
|
+
* user could self-authorize within the same change).
|
|
73
|
+
*/
|
|
74
|
+
when?: WithFieldWhen;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The default tenant policy, or a per-database policy (same shape), §6.1/§6.2.
|
|
78
|
+
*
|
|
79
|
+
* The mere existence of `acl_defaultpolicy` is what activates access control;
|
|
80
|
+
* a brand-new tenant has no such document and therefore runs with no checks.
|
|
81
|
+
* Once the document exists, omitted fields take the stated defaults — see
|
|
82
|
+
* {@link DEFAULT_POLICY_DEFAULTS} and {@link effectivePolicy}.
|
|
83
|
+
*/
|
|
84
|
+
export interface DefaultAccessPolicyDoc {
|
|
85
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
86
|
+
type: "defaultpolicy";
|
|
87
|
+
/**
|
|
88
|
+
* Master off switch (§7 step 0). When true, ALL checks and rules (including
|
|
89
|
+
* standalone deny rules) are bypassed. Defaults to false when the document
|
|
90
|
+
* exists.
|
|
91
|
+
*/
|
|
92
|
+
disableAllAccessChecksAndPolicies?: boolean;
|
|
93
|
+
denyDocCreate?: boolean;
|
|
94
|
+
denyDocChange?: boolean;
|
|
95
|
+
denyDocDelete?: boolean;
|
|
96
|
+
denyDocUndelete?: boolean;
|
|
97
|
+
denyDocSnapshot?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Database read/sync gate (§6.6). When true, members may NOT open or sync the
|
|
100
|
+
* governed database(s) unless an explicit `doc_read` allow rule grants them
|
|
101
|
+
* access; when false (the default), reading is open and key possession is the
|
|
102
|
+
* only thing that decides what a user can actually decrypt.
|
|
103
|
+
*
|
|
104
|
+
* This is the coarse per-database gate that sits in front of EVERY sync
|
|
105
|
+
* operation: a user denied read access can neither pull nor push (so they
|
|
106
|
+
* cannot create data in the database either — read is required to create).
|
|
107
|
+
* Like the other `deny<Op>` flags it layers per-db over the tenant default in
|
|
108
|
+
* {@link effectivePolicy}. The tenant admin is always exempt and the
|
|
109
|
+
* `"directory"` database is never gated (it must always sync so the policy
|
|
110
|
+
* itself can be read). Defaults to false.
|
|
111
|
+
*/
|
|
112
|
+
denyDocRead?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Optional default `decryptionKeyId` for a `doc_create` that does not specify
|
|
115
|
+
* one in the governed scope (tenant default, or a single database when set on
|
|
116
|
+
* a per-db policy). This is NOT a security control: the sync server never
|
|
117
|
+
* selects keys, so this is a client-side create-time convenience that fills in
|
|
118
|
+
* the key when the caller omits it (replacing the hardcoded `"default"`
|
|
119
|
+
* fallback). Which keys a user may create or read under is governed by **key
|
|
120
|
+
* possession** (the key distribution model, docs/accesscontrol.md §13), not by
|
|
121
|
+
* a policy gate. Like every policy field it layers per-db over the tenant
|
|
122
|
+
* default in {@link effectivePolicy}.
|
|
123
|
+
*/
|
|
124
|
+
defaultCreateKeyId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Governs whether tenant members may open/sync arbitrary database ids.
|
|
127
|
+
*
|
|
128
|
+
* This is a **tenant-level** control and is only read from the tenant default
|
|
129
|
+
* policy (`acl_defaultpolicy`); it is intentionally NOT layered through a
|
|
130
|
+
* per-db `acl_dbpolicy_*` document. Defaults to `"open"` when omitted.
|
|
131
|
+
*
|
|
132
|
+
* - `"open"` (default): any syntactically valid database id may be opened and
|
|
133
|
+
* synced — today's behavior, convenient for quick experimentation.
|
|
134
|
+
* - `"directory-restricted"`: only the `"directory"` database (always
|
|
135
|
+
* implicitly allowed) and the ids listed in {@link allowedDbIds} may be
|
|
136
|
+
* opened or synced. The tenant admin is exempt and may use any id.
|
|
137
|
+
*/
|
|
138
|
+
databaseCreationPolicy?: "open" | "directory-restricted";
|
|
139
|
+
/**
|
|
140
|
+
* The set of database ids that may be opened/synced when
|
|
141
|
+
* {@link databaseCreationPolicy} is `"directory-restricted"`. `"directory"` is
|
|
142
|
+
* always implicitly allowed and need not be listed; every other id (including
|
|
143
|
+
* `"main"`) must be listed explicitly. Ignored when the policy is `"open"`.
|
|
144
|
+
* Tenant-level only (not layered per-db).
|
|
145
|
+
*/
|
|
146
|
+
allowedDbIds?: string[];
|
|
147
|
+
/**
|
|
148
|
+
* Storage-format floor: a trusted-time cutoff (ms since epoch) at and after
|
|
149
|
+
* which a store entry MUST carry the v2 metadata-binding author signature
|
|
150
|
+
* (`metadataSignature`, `entryVersion >= 2`). Entries whose trusted time is
|
|
151
|
+
* strictly BEFORE this cutoff may still verify via the legacy ciphertext-only
|
|
152
|
+
* signature, so genuine older history (and old tenants migrating in) keeps
|
|
153
|
+
* loading.
|
|
154
|
+
*
|
|
155
|
+
* This is a **tenant-level** control read only from the tenant default policy
|
|
156
|
+
* (`acl_defaultpolicy`); it is NOT layered per-db. Absent = no requirement
|
|
157
|
+
* (fully backward compatible — the legacy fallback always applies).
|
|
158
|
+
*
|
|
159
|
+
* Security model (zero-trust server): the authoritative enforcement is the
|
|
160
|
+
* sync server's push gate, which compares the cutoff against ITS OWN clock at
|
|
161
|
+
* ingest (`receivedAt = now`). After the cutoff, no new v1 entry can be
|
|
162
|
+
* accepted, so a forged v1 entry cannot bypass the floor by backdating its
|
|
163
|
+
* self-asserted `createdAt`. Honest clients additionally re-check on read
|
|
164
|
+
* using each entry's {@link entryTrustedTime} as defense in depth. Because the
|
|
165
|
+
* cutoff lives in the admin-signed policy document, a hostile relay cannot
|
|
166
|
+
* move it. New tenants are created with this set to their creation time so the
|
|
167
|
+
* whole tenant is v2-only from entry #1.
|
|
168
|
+
*/
|
|
169
|
+
requireMetadataSignatureSince?: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The effective baseline defaults when a policy document exists but omits a
|
|
173
|
+
* field (§6.1). Snapshot and purge default to denied (admin-only).
|
|
174
|
+
*/
|
|
175
|
+
export declare const DEFAULT_POLICY_DEFAULTS: Required<Omit<DefaultAccessPolicyDoc, "form" | "type" | "disableAllAccessChecksAndPolicies" | "defaultCreateKeyId" | "databaseCreationPolicy" | "allowedDbIds" | "requireMetadataSignatureSince">>;
|
|
176
|
+
/** Map a {@link RuleType} to the policy `deny<Op>` field that gates it. */
|
|
177
|
+
export declare const RULE_TYPE_TO_DENY_FIELD: Record<RuleType, keyof typeof DEFAULT_POLICY_DEFAULTS>;
|
|
178
|
+
/** A single access-control rule (§6.3). */
|
|
179
|
+
export interface AclRuleDoc {
|
|
180
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
181
|
+
type: RuleType;
|
|
182
|
+
/** Stable id, surfaced in {@link AccessDecision.matchedRuleId}. */
|
|
183
|
+
ruleId: string;
|
|
184
|
+
description?: string;
|
|
185
|
+
/** Target database, or `"*"` for all databases in the tenant. */
|
|
186
|
+
dbid: string | "*";
|
|
187
|
+
/** Presence makes the rule Tier 2 (client-only). */
|
|
188
|
+
withfields?: WithFieldClause[];
|
|
189
|
+
/** User + group hashes, plus reserved pseudo-tokens. */
|
|
190
|
+
users_hashes: string[];
|
|
191
|
+
/**
|
|
192
|
+
* Targeted usernames/groups (JSON {@link RuleTargets}) encrypted with the
|
|
193
|
+
* tenant default key, base64-encoded — a display aid for admin UIs so they can
|
|
194
|
+
* show who a rule targets without reversing the salted hashes. Encrypted with
|
|
195
|
+
* the tenant default key (not `$publicinfos`), so it stays opaque to the sync
|
|
196
|
+
* server while remaining readable by tenant clients. Empty when the rule was
|
|
197
|
+
* authored from raw hashes / pseudo-tokens only (nothing cleartext to show).
|
|
198
|
+
*/
|
|
199
|
+
users_encrypted: string;
|
|
200
|
+
action: "allow" | "deny";
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Decrypted targets of a rule, for admin-UI display only (never serialized to
|
|
204
|
+
* the directory). Populated by {@link AclRuleDoc.users_encrypted} on the
|
|
205
|
+
* listing APIs.
|
|
206
|
+
*/
|
|
207
|
+
export interface RuleTargets {
|
|
208
|
+
usernames: string[];
|
|
209
|
+
groups: string[];
|
|
210
|
+
}
|
|
211
|
+
/** A trusted timestamping witness (sync server), §6.4. */
|
|
212
|
+
export interface TrustedWitnessDoc {
|
|
213
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
214
|
+
type: "trustedwitness";
|
|
215
|
+
/** Ed25519 public key, PEM. */
|
|
216
|
+
witnessPublicKey: string;
|
|
217
|
+
serverUrl?: string;
|
|
218
|
+
}
|
|
219
|
+
/** Tier an {@link AccessDecision} was reached at. */
|
|
220
|
+
export type AccessTier = "tier1" | "tier2";
|
|
221
|
+
/** Result of an access-control evaluation (§7). */
|
|
222
|
+
export interface AccessDecision {
|
|
223
|
+
allowed: boolean;
|
|
224
|
+
/** Human-readable explanation, for audit logs and the Haven UI. */
|
|
225
|
+
reason: string;
|
|
226
|
+
/** Set to the `ruleId` of the rule that decided, when a rule decided. */
|
|
227
|
+
matchedRuleId?: string;
|
|
228
|
+
tier: AccessTier;
|
|
229
|
+
}
|
|
230
|
+
/** Singleton id of the tenant default policy document. */
|
|
231
|
+
export declare const ACL_DEFAULT_POLICY_DOC_ID = "acl_defaultpolicy";
|
|
232
|
+
/**
|
|
233
|
+
* Encode an arbitrary string into a component made only of `[A-Za-z0-9_]`, so
|
|
234
|
+
* it can be embedded in a fixed document ID that satisfies
|
|
235
|
+
* {@link CUSTOM_DOC_ID_REGEX} (§6).
|
|
236
|
+
*
|
|
237
|
+
* The encoding is injective and reversible: ASCII letters and digits pass
|
|
238
|
+
* through unchanged; every other byte (including a literal `_`) is escaped as
|
|
239
|
+
* `_` followed by two lowercase hex digits. Because every literal underscore is
|
|
240
|
+
* escaped, decoding is unambiguous. Examples:
|
|
241
|
+
* - `directory` -> `directory`
|
|
242
|
+
* - `test-db` -> `test_2ddb`
|
|
243
|
+
* - `a_b` -> `a_5fb`
|
|
244
|
+
*/
|
|
245
|
+
export declare function encodeAclIdComponent(raw: string): string;
|
|
246
|
+
/** Inverse of {@link encodeAclIdComponent}. */
|
|
247
|
+
export declare function decodeAclIdComponent(encoded: string): string;
|
|
248
|
+
/** Document id for a per-database policy (§6.2). */
|
|
249
|
+
export declare function aclDbPolicyDocId(dbid: string): string;
|
|
250
|
+
/** Document id for a trusted-witness entry, keyed by witness fingerprint (§6.4). */
|
|
251
|
+
export declare function aclTrustedWitnessDocId(fingerprint: string): string;
|
|
252
|
+
/** Document id for a single rule, keyed by its stable `ruleId` (§6.3). */
|
|
253
|
+
export declare function aclRuleDocId(ruleId: string): string;
|
|
254
|
+
/**
|
|
255
|
+
* Validate a {@link WithFieldClause} against the closed operator/placeholder
|
|
256
|
+
* set and the op-specific `when` constraints. Throws a descriptive error on
|
|
257
|
+
* the first violation. `ruleType` is needed to reject `when: "before"` on
|
|
258
|
+
* `doc_create` (no before state exists).
|
|
259
|
+
*/
|
|
260
|
+
export declare function validateWithFieldClause(clause: WithFieldClause, ruleType: RuleType): void;
|
|
261
|
+
/**
|
|
262
|
+
* Validate an {@link AclRuleDoc} (minus the assigned `form`/`ruleId`, which the
|
|
263
|
+
* directory sets). Enforces the closed type/operator/placeholder sets and the
|
|
264
|
+
* `withfields` constraints (§6.3). Throws on the first violation.
|
|
265
|
+
*/
|
|
266
|
+
export declare function validateAclRule(rule: {
|
|
267
|
+
type: RuleType;
|
|
268
|
+
dbid: string;
|
|
269
|
+
action: "allow" | "deny";
|
|
270
|
+
users_hashes: string[];
|
|
271
|
+
withfields?: WithFieldClause[];
|
|
272
|
+
}): void;
|
|
273
|
+
/**
|
|
274
|
+
* Validate a {@link DefaultAccessPolicyDoc} (tenant default or per-db) before
|
|
275
|
+
* it is written. Throws on violation.
|
|
276
|
+
*/
|
|
277
|
+
export declare function validateAccessPolicy(policy: Partial<Omit<DefaultAccessPolicyDoc, "form" | "type">>): void;
|
|
278
|
+
/**
|
|
279
|
+
* Compute the effective policy by layering DB policy over the tenant default
|
|
280
|
+
* and filling omitted fields with {@link DEFAULT_POLICY_DEFAULTS} (§6.2, §7).
|
|
281
|
+
*
|
|
282
|
+
* Returns a fully-populated set of `deny<Op>` flags plus the master switch.
|
|
283
|
+
* A `null`/absent default policy means access control was never enabled, which
|
|
284
|
+
* callers should treat as "all allowed" before calling this.
|
|
285
|
+
*/
|
|
286
|
+
export declare function effectivePolicy(tenantDefault: DefaultAccessPolicyDoc | null | undefined, dbPolicy: DefaultAccessPolicyDoc | null | undefined): Required<Omit<DefaultAccessPolicyDoc, "form" | "type" | "defaultCreateKeyId" | "databaseCreationPolicy" | "allowedDbIds" | "requireMetadataSignatureSince">> & {
|
|
287
|
+
defaultCreateKeyId?: string;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Key distribution type tag (the `type` field of a {@link KeyDistributionDoc}).
|
|
291
|
+
*/
|
|
292
|
+
export declare const KEY_DISTRIBUTION_TYPE: "keydistribution";
|
|
293
|
+
/** Key ids that may never be governed by a distribution document. */
|
|
294
|
+
export declare const PROTECTED_DISTRIBUTION_KEY_IDS: readonly string[];
|
|
295
|
+
/**
|
|
296
|
+
* One distributed version of a key in the {@link KeyDistributionDoc.keyVersions}
|
|
297
|
+
* manifest. `fingerprint` is the SHA-256 hex of the raw symmetric key bytes and
|
|
298
|
+
* is the stable identity used to (a) verify unwrapped bytes on import and (b)
|
|
299
|
+
* scope `pullfrom` deletion to exactly the listed versions. `createdAt` is the
|
|
300
|
+
* KeyBag version timestamp, used for display and to set the imported version's
|
|
301
|
+
* stamp.
|
|
302
|
+
*/
|
|
303
|
+
export interface KeyVersionRef {
|
|
304
|
+
createdAt: number;
|
|
305
|
+
/** SHA-256 hex of the raw key bytes of this version. */
|
|
306
|
+
fingerprint: string;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Wrapped key material for a single recipient device: a map from version
|
|
310
|
+
* fingerprint to the base64 RSA-OAEP-wrapped raw key bytes of that version.
|
|
311
|
+
* Every entry must cover ALL of the manifest's version fingerprints (full
|
|
312
|
+
* coverage), so a recipient can decrypt documents encrypted under any version.
|
|
313
|
+
*/
|
|
314
|
+
export type DeviceWrappedVersions = Record<string, string>;
|
|
315
|
+
/**
|
|
316
|
+
* The single authoritative document governing the distribution of one symmetric
|
|
317
|
+
* key (`keyId`). Stored at the fixed id `acl_keydistribution_<keyId>` (singleton
|
|
318
|
+
* per key); publish is always an upsert of the full desired state.
|
|
319
|
+
*
|
|
320
|
+
* The wrapped bytes (`pushto_users_keys`) are produced by a key-*holder* using
|
|
321
|
+
* each recipient device's RSA encryption public key; the admin merely signs and
|
|
322
|
+
* writes the document, so an admin outside the recipient set never sees the
|
|
323
|
+
* plaintext key. Syncing clients reconcile their KeyBags against the head state:
|
|
324
|
+
* `pushto` users unwrap+verify+merge the manifest's versions; `pullfrom` users
|
|
325
|
+
* delete exactly the manifest's versions (and purge the scope when nothing
|
|
326
|
+
* remains). Title/comment/usernames are stored under the `<field>_encrypted`
|
|
327
|
+
* convention with the tenant `default` key, so the sync server cannot read them;
|
|
328
|
+
* only the hashes + wrapped material stay `$publicinfos`-readable.
|
|
329
|
+
*/
|
|
330
|
+
export interface KeyDistributionDoc {
|
|
331
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
332
|
+
type: typeof KEY_DISTRIBUTION_TYPE;
|
|
333
|
+
keyId: string;
|
|
334
|
+
/** Manifest of distributed versions. fingerprint = SHA-256 hex of raw key bytes. */
|
|
335
|
+
keyVersions: KeyVersionRef[];
|
|
336
|
+
title_encrypted: string;
|
|
337
|
+
title_encrypted_key: string;
|
|
338
|
+
comment_encrypted?: string;
|
|
339
|
+
comment_encrypted_key?: string;
|
|
340
|
+
/** The key-holder's signing public key that wrapped the material (audit trail). */
|
|
341
|
+
preparedByPublicKey: string;
|
|
342
|
+
/** Users whose KeyBags receive the key. */
|
|
343
|
+
pushto_users_hashes: string[];
|
|
344
|
+
/**
|
|
345
|
+
* Display aid: ONE encrypted JSON array of usernames, index-aligned with
|
|
346
|
+
* `pushto_users_hashes`. Single blob so views can read it via
|
|
347
|
+
* `v.decryptJson("pushto_users_encrypted")` with no view-language extension;
|
|
348
|
+
* hashes stay authoritative for enforcement, alignment drift is cosmetic.
|
|
349
|
+
*/
|
|
350
|
+
pushto_users_encrypted?: string;
|
|
351
|
+
pushto_users_encrypted_key?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Wrapped material: `"<userhash>|<deviceEncKeyFingerprint>"` -> { versionFingerprint -> wrappedKey (b64 RSA-OAEP) }.
|
|
354
|
+
* One entry per active device of each pushto user; every entry covers ALL manifest versions.
|
|
355
|
+
*/
|
|
356
|
+
pushto_users_keys: Record<string, DeviceWrappedVersions>;
|
|
357
|
+
/** Users whose KeyBags must NOT hold the manifest's versions (no device keys needed). */
|
|
358
|
+
pullfrom_users_hashes: string[];
|
|
359
|
+
pullfrom_users_encrypted?: string;
|
|
360
|
+
pullfrom_users_encrypted_key?: string;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* One `pushto` recipient inside a {@link KeyDistributionRequest}: the plaintext
|
|
364
|
+
* username (display only, the URI travels out-of-band) plus the wrapped material
|
|
365
|
+
* for each of the recipient's active devices.
|
|
366
|
+
*/
|
|
367
|
+
export interface KeyDistributionPushRecipient {
|
|
368
|
+
username: string;
|
|
369
|
+
username_hash: string;
|
|
370
|
+
/** deviceEncKeyFingerprint -> { versionFingerprint -> wrappedKey (b64) }. */
|
|
371
|
+
devices: Record<string, DeviceWrappedVersions>;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The full unsigned content of one key's distribution, carried by an
|
|
375
|
+
* `mdb://key-distribution/...` request URI so a key-holder without admin rights
|
|
376
|
+
* can hand a ready-to-sign request to an admin. The admin maps it to a
|
|
377
|
+
* {@link KeyDistributionDoc} on save (encrypting title/comment/usernames and
|
|
378
|
+
* folding `devices` into `pushto_users_keys`).
|
|
379
|
+
*/
|
|
380
|
+
export interface KeyDistributionRequest {
|
|
381
|
+
v: 1;
|
|
382
|
+
tenantId?: string;
|
|
383
|
+
keyId: string;
|
|
384
|
+
keyVersions: KeyVersionRef[];
|
|
385
|
+
/** Plaintext in the URI (sent out-of-band); the admin encrypts it on save. */
|
|
386
|
+
title: string;
|
|
387
|
+
comment?: string;
|
|
388
|
+
preparedByPublicKey: string;
|
|
389
|
+
pushto: KeyDistributionPushRecipient[];
|
|
390
|
+
pullfrom: Array<{
|
|
391
|
+
username: string;
|
|
392
|
+
username_hash: string;
|
|
393
|
+
}>;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Read-side projection of a {@link KeyDistributionDoc} for list/edit UIs. Raw
|
|
397
|
+
* hashes + wrapped material are surfaced so an editor can preserve devices it
|
|
398
|
+
* cannot re-wrap; `*Usernames` are the decrypted display arrays (null when the
|
|
399
|
+
* tenant default key is not held, i.e. the blob is unreadable).
|
|
400
|
+
*/
|
|
401
|
+
export interface KeyDistributionView {
|
|
402
|
+
keyId: string;
|
|
403
|
+
title: string | null;
|
|
404
|
+
comment: string | null;
|
|
405
|
+
keyVersions: KeyVersionRef[];
|
|
406
|
+
preparedByPublicKey: string;
|
|
407
|
+
pushto_users_hashes: string[];
|
|
408
|
+
pushto_users_keys: Record<string, DeviceWrappedVersions>;
|
|
409
|
+
pullfrom_users_hashes: string[];
|
|
410
|
+
pushtoUsernames: string[] | null;
|
|
411
|
+
pullfromUsernames: string[] | null;
|
|
412
|
+
}
|
|
413
|
+
/** Document id prefix for the per-key distribution documents. */
|
|
414
|
+
export declare const ACL_KEY_DISTRIBUTION_PREFIX = "acl_keydistribution_";
|
|
415
|
+
/**
|
|
416
|
+
* Document id for a key distribution — a SINGLETON per key id, so there is one
|
|
417
|
+
* authoritative document governing each key's distribution and publish is always
|
|
418
|
+
* an upsert. The key id is encoded so arbitrary key ids stay valid doc-id
|
|
419
|
+
* components.
|
|
420
|
+
*/
|
|
421
|
+
export declare function aclKeyDistributionDocId(keyId: string): string;
|
|
422
|
+
/** True when `docId` is a key-distribution document id. */
|
|
423
|
+
export declare function isKeyDistributionDocId(docId: string): boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Validate the structural invariants of a key distribution before publish
|
|
426
|
+
* (docs/accesscontrol.md §13). Throws on the first violation:
|
|
427
|
+
*
|
|
428
|
+
* - `keyId` is non-empty and not a protected id (`default` / `$publicinfos`);
|
|
429
|
+
* - `pushto` and `pullfrom` user-hash sets are disjoint;
|
|
430
|
+
* - every `pushto` device entry covers EXACTLY the manifest's version
|
|
431
|
+
* fingerprints (full coverage, no extras), so every recipient can decrypt
|
|
432
|
+
* documents encrypted under any distributed version.
|
|
433
|
+
*
|
|
434
|
+
* Grant existence / active-device coverage are enforced by the directory at
|
|
435
|
+
* publish time (they need directory state), not here.
|
|
436
|
+
*/
|
|
437
|
+
export declare function validateKeyDistribution(input: {
|
|
438
|
+
keyId: string;
|
|
439
|
+
keyVersions: KeyVersionRef[];
|
|
440
|
+
pushto_users_hashes: string[];
|
|
441
|
+
pullfrom_users_hashes: string[];
|
|
442
|
+
pushto_users_keys: Record<string, DeviceWrappedVersions>;
|
|
443
|
+
}): void;
|
|
444
|
+
/**
|
|
445
|
+
* App distribution type tag (the `type` field of an {@link AppDistributionDoc}).
|
|
446
|
+
*/
|
|
447
|
+
export declare const APP_DISTRIBUTION_TYPE: "appdistribution";
|
|
448
|
+
/**
|
|
449
|
+
* The single authoritative document governing the distribution of one Haven
|
|
450
|
+
* application (`appId`). Stored at the fixed id `acl_appdistribution_<appId>`
|
|
451
|
+
* (singleton per app); publish is always an upsert of the full desired state.
|
|
452
|
+
*
|
|
453
|
+
* Unlike key distribution there is no cryptographic key material: the payload
|
|
454
|
+
* is the application registration JSON (`appdata_encrypted`). Recipient
|
|
455
|
+
* membership (`pushto` / `pullfrom`) is a UX-level governance gesture resolved
|
|
456
|
+
* client-side at reconcile time against the directory head, with `pullfrom`
|
|
457
|
+
* winning on any list overlap. Title/comment/appid/version/appdata are stored
|
|
458
|
+
* under the `<field>_encrypted` convention with the tenant `default` key, so
|
|
459
|
+
* the sync server cannot read them.
|
|
460
|
+
*/
|
|
461
|
+
export interface AppDistributionDoc {
|
|
462
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
463
|
+
type: typeof APP_DISTRIBUTION_TYPE;
|
|
464
|
+
/** Bare app id; the document identity (one doc per app). */
|
|
465
|
+
appId: string;
|
|
466
|
+
/** Display aid: the app id re-stated under the tenant default key. */
|
|
467
|
+
appid_encrypted: string;
|
|
468
|
+
appid_encrypted_key: string;
|
|
469
|
+
/** The distributed version string (encrypted); drives the reconcile diff. */
|
|
470
|
+
version_encrypted: string;
|
|
471
|
+
version_encrypted_key: string;
|
|
472
|
+
title_encrypted: string;
|
|
473
|
+
title_encrypted_key: string;
|
|
474
|
+
comment_encrypted?: string;
|
|
475
|
+
comment_encrypted_key?: string;
|
|
476
|
+
/** The application registration JSON payload, encrypted with the default key. */
|
|
477
|
+
appdata_encrypted: string;
|
|
478
|
+
appdata_encrypted_key: string;
|
|
479
|
+
/** The author's signing public key that prepared the distribution (audit). */
|
|
480
|
+
preparedByPublicKey: string;
|
|
481
|
+
/** Users whose Haven client should install the app. */
|
|
482
|
+
pushto_users_hashes: string[];
|
|
483
|
+
pushto_users_encrypted?: string;
|
|
484
|
+
pushto_users_encrypted_key?: string;
|
|
485
|
+
/** Groups whose members should install the app (resolved at reconcile time). */
|
|
486
|
+
pushto_groups_hashes: string[];
|
|
487
|
+
pushto_groups_encrypted?: string;
|
|
488
|
+
pushto_groups_encrypted_key?: string;
|
|
489
|
+
/** Users whose Haven client must NOT have the app. */
|
|
490
|
+
pullfrom_users_hashes: string[];
|
|
491
|
+
pullfrom_users_encrypted?: string;
|
|
492
|
+
pullfrom_users_encrypted_key?: string;
|
|
493
|
+
/** Groups whose members must NOT have the app. */
|
|
494
|
+
pullfrom_groups_hashes: string[];
|
|
495
|
+
pullfrom_groups_encrypted?: string;
|
|
496
|
+
pullfrom_groups_encrypted_key?: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* The full unsigned content of one app's distribution, built in the authoring
|
|
500
|
+
* dialog (or carried by an `mdb://app-distribution/...` request URI). The admin
|
|
501
|
+
* maps it to an {@link AppDistributionDoc} on save (encrypting the display +
|
|
502
|
+
* payload fields and hashing the user/group names).
|
|
503
|
+
*/
|
|
504
|
+
export interface AppDistributionRequest {
|
|
505
|
+
v: 1;
|
|
506
|
+
tenantId?: string;
|
|
507
|
+
appId: string;
|
|
508
|
+
version: string;
|
|
509
|
+
/** Plaintext (encrypted on save). */
|
|
510
|
+
title: string;
|
|
511
|
+
comment?: string;
|
|
512
|
+
/** The application registration JSON payload (serialized + encrypted on save). */
|
|
513
|
+
appData: unknown;
|
|
514
|
+
preparedByPublicKey: string;
|
|
515
|
+
pushtoUsernames: string[];
|
|
516
|
+
pushtoGroups: string[];
|
|
517
|
+
pullfromUsernames: string[];
|
|
518
|
+
pullfromGroups: string[];
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Read-side projection of an {@link AppDistributionDoc} for list/edit UIs. The
|
|
522
|
+
* `*Usernames` / `*Groups` are the decrypted display arrays (null when the
|
|
523
|
+
* tenant default key is not held); `appData` is the parsed payload (null when
|
|
524
|
+
* unreadable).
|
|
525
|
+
*/
|
|
526
|
+
export interface AppDistributionView {
|
|
527
|
+
appId: string;
|
|
528
|
+
title: string | null;
|
|
529
|
+
comment: string | null;
|
|
530
|
+
version: string | null;
|
|
531
|
+
appData: unknown | null;
|
|
532
|
+
preparedByPublicKey: string;
|
|
533
|
+
pushto_users_hashes: string[];
|
|
534
|
+
pushto_groups_hashes: string[];
|
|
535
|
+
pullfrom_users_hashes: string[];
|
|
536
|
+
pullfrom_groups_hashes: string[];
|
|
537
|
+
pushtoUsernames: string[] | null;
|
|
538
|
+
pushtoGroups: string[] | null;
|
|
539
|
+
pullfromUsernames: string[] | null;
|
|
540
|
+
pullfromGroups: string[] | null;
|
|
541
|
+
}
|
|
542
|
+
/** One app the active user is entitled to (the install/update side of reconcile). */
|
|
543
|
+
export interface AppDistributionInstall {
|
|
544
|
+
appId: string;
|
|
545
|
+
/** The policy's display title — authoritative for the installed app's label. */
|
|
546
|
+
title: string;
|
|
547
|
+
version: string;
|
|
548
|
+
appData: unknown;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* The per-user reconcile plan computed from the directory head: `have` is the
|
|
552
|
+
* set of apps the user is entitled to (install or update on version change),
|
|
553
|
+
* `notHave` is the set of distributed app ids the user is NOT entitled to
|
|
554
|
+
* (remove if locally present).
|
|
555
|
+
*/
|
|
556
|
+
export interface AppDistributionReconcilePlan {
|
|
557
|
+
have: AppDistributionInstall[];
|
|
558
|
+
notHave: string[];
|
|
559
|
+
}
|
|
560
|
+
/** Document id prefix for the per-app distribution documents. */
|
|
561
|
+
export declare const ACL_APP_DISTRIBUTION_PREFIX = "acl_appdistribution_";
|
|
562
|
+
/**
|
|
563
|
+
* Document id for an app distribution — a SINGLETON per app id, so there is one
|
|
564
|
+
* authoritative document governing each app's distribution and publish is
|
|
565
|
+
* always an upsert. The app id is encoded so arbitrary ids stay valid doc-id
|
|
566
|
+
* components.
|
|
567
|
+
*/
|
|
568
|
+
export declare function aclAppDistributionDocId(appId: string): string;
|
|
569
|
+
/** True when `docId` is an app-distribution document id. */
|
|
570
|
+
export declare function isAppDistributionDocId(docId: string): boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Validate the structural invariants of an app distribution before publish
|
|
573
|
+
* (docs/accesscontrol.md §13). Throws on the first violation:
|
|
574
|
+
*
|
|
575
|
+
* - `appId` is non-empty;
|
|
576
|
+
* - `pushto` and `pullfrom` user-hash sets are disjoint;
|
|
577
|
+
* - `pushto` and `pullfrom` group-hash sets are disjoint.
|
|
578
|
+
*/
|
|
579
|
+
export declare function validateAppDistribution(input: {
|
|
580
|
+
appId: string;
|
|
581
|
+
pushto_users_hashes: string[];
|
|
582
|
+
pullfrom_users_hashes: string[];
|
|
583
|
+
pushto_groups_hashes: string[];
|
|
584
|
+
pullfrom_groups_hashes: string[];
|
|
585
|
+
}): void;
|
|
586
|
+
/**
|
|
587
|
+
* Sync setup policy type tag (the `type` field of a {@link SyncSetupPolicyDoc}).
|
|
588
|
+
*/
|
|
589
|
+
export declare const SYNC_SETUP_POLICY_TYPE: "syncsetuppolicy";
|
|
590
|
+
/**
|
|
591
|
+
* Enforcement mode of a sync setup policy:
|
|
592
|
+
* - `"initial"`: the listed databases are seeded onto the targeted user's Sync
|
|
593
|
+
* page once; the user remains free to change the sync direction or disable
|
|
594
|
+
* them (onboarding aid only).
|
|
595
|
+
* - `"permanent"`: the listed databases stay on the Sync page and their sync
|
|
596
|
+
* direction is forced to bidirectional; the user cannot change the direction
|
|
597
|
+
* or disable them (unless released via `pullfrom`).
|
|
598
|
+
*/
|
|
599
|
+
export type SyncSetupPolicyMode = "initial" | "permanent";
|
|
600
|
+
/** All valid {@link SyncSetupPolicyMode} values, for validation. */
|
|
601
|
+
export declare const SYNC_SETUP_POLICY_MODES: readonly SyncSetupPolicyMode[];
|
|
602
|
+
/**
|
|
603
|
+
* The authoritative document governing one sync setup policy (`policyId`).
|
|
604
|
+
* Stored at the fixed id `acl_syncsetuppolicy_<policyId>` (one doc per policy;
|
|
605
|
+
* a tenant may have several). Publish is always an upsert of the full desired
|
|
606
|
+
* state.
|
|
607
|
+
*
|
|
608
|
+
* Like app distribution there is no key material: the payload is the list of
|
|
609
|
+
* database ids the targeted clients should have on their Sync page. Recipient
|
|
610
|
+
* membership (`pushto` / `pullfrom`) is resolved client-side at reconcile time
|
|
611
|
+
* against the directory head. `pushto` means "targeted" (seed the databases);
|
|
612
|
+
* `pullfrom` releases any `permanent` lock for that user/group while keeping the
|
|
613
|
+
* databases seeded (it does NOT remove them). Display fields are stored under
|
|
614
|
+
* the `<field>_encrypted` convention with the tenant `default` key, so the sync
|
|
615
|
+
* server cannot read them.
|
|
616
|
+
*/
|
|
617
|
+
export interface SyncSetupPolicyDoc {
|
|
618
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
619
|
+
type: typeof SYNC_SETUP_POLICY_TYPE;
|
|
620
|
+
/** Bare policy id; the document identity (one doc per policy). */
|
|
621
|
+
policyId: string;
|
|
622
|
+
/** Display aid: the policy id re-stated under the tenant default key. */
|
|
623
|
+
policyid_encrypted: string;
|
|
624
|
+
policyid_encrypted_key: string;
|
|
625
|
+
/** Enforcement mode; cleartext is fine (not a secret), but kept simple. */
|
|
626
|
+
mode: SyncSetupPolicyMode;
|
|
627
|
+
title_encrypted: string;
|
|
628
|
+
title_encrypted_key: string;
|
|
629
|
+
comment_encrypted?: string;
|
|
630
|
+
comment_encrypted_key?: string;
|
|
631
|
+
/** JSON array of database ids the targeted clients should sync, encrypted. */
|
|
632
|
+
databaseids_encrypted: string;
|
|
633
|
+
databaseids_encrypted_key: string;
|
|
634
|
+
/** The author's signing public key that prepared the policy (audit). */
|
|
635
|
+
preparedByPublicKey: string;
|
|
636
|
+
/** Users whose Haven client should seed the databases. */
|
|
637
|
+
pushto_users_hashes: string[];
|
|
638
|
+
pushto_users_encrypted?: string;
|
|
639
|
+
pushto_users_encrypted_key?: string;
|
|
640
|
+
/** Groups whose members should seed the databases (resolved at reconcile). */
|
|
641
|
+
pushto_groups_hashes: string[];
|
|
642
|
+
pushto_groups_encrypted?: string;
|
|
643
|
+
pushto_groups_encrypted_key?: string;
|
|
644
|
+
/** Users for whom any `permanent` lock is released (databases stay seeded). */
|
|
645
|
+
pullfrom_users_hashes: string[];
|
|
646
|
+
pullfrom_users_encrypted?: string;
|
|
647
|
+
pullfrom_users_encrypted_key?: string;
|
|
648
|
+
/** Groups for whom any `permanent` lock is released. */
|
|
649
|
+
pullfrom_groups_hashes: string[];
|
|
650
|
+
pullfrom_groups_encrypted?: string;
|
|
651
|
+
pullfrom_groups_encrypted_key?: string;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* The full unsigned content of one sync setup policy, built in the authoring
|
|
655
|
+
* dialog (or carried by an `mdb://sync-setup-policy/...` request URI). The admin
|
|
656
|
+
* maps it to a {@link SyncSetupPolicyDoc} on save (encrypting the display +
|
|
657
|
+
* database fields and hashing the user/group names).
|
|
658
|
+
*/
|
|
659
|
+
export interface SyncSetupPolicyRequest {
|
|
660
|
+
v: 1;
|
|
661
|
+
tenantId?: string;
|
|
662
|
+
policyId: string;
|
|
663
|
+
mode: SyncSetupPolicyMode;
|
|
664
|
+
/** Plaintext (encrypted on save). */
|
|
665
|
+
title: string;
|
|
666
|
+
comment?: string;
|
|
667
|
+
/** The database ids the targeted clients should sync (encrypted on save). */
|
|
668
|
+
databaseIds: string[];
|
|
669
|
+
preparedByPublicKey: string;
|
|
670
|
+
pushtoUsernames: string[];
|
|
671
|
+
pushtoGroups: string[];
|
|
672
|
+
pullfromUsernames: string[];
|
|
673
|
+
pullfromGroups: string[];
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Read-side projection of a {@link SyncSetupPolicyDoc} for list/edit UIs. The
|
|
677
|
+
* `*Usernames` / `*Groups` are the decrypted display arrays (null when the
|
|
678
|
+
* tenant default key is not held); `databaseIds` is the parsed list (null when
|
|
679
|
+
* unreadable).
|
|
680
|
+
*/
|
|
681
|
+
export interface SyncSetupPolicyView {
|
|
682
|
+
policyId: string;
|
|
683
|
+
mode: SyncSetupPolicyMode;
|
|
684
|
+
title: string | null;
|
|
685
|
+
comment: string | null;
|
|
686
|
+
databaseIds: string[] | null;
|
|
687
|
+
preparedByPublicKey: string;
|
|
688
|
+
pushto_users_hashes: string[];
|
|
689
|
+
pushto_groups_hashes: string[];
|
|
690
|
+
pullfrom_users_hashes: string[];
|
|
691
|
+
pullfrom_groups_hashes: string[];
|
|
692
|
+
pushtoUsernames: string[] | null;
|
|
693
|
+
pushtoGroups: string[] | null;
|
|
694
|
+
pullfromUsernames: string[] | null;
|
|
695
|
+
pullfromGroups: string[] | null;
|
|
696
|
+
}
|
|
697
|
+
/** One database the active user should have on the Sync page, with its lock state. */
|
|
698
|
+
export interface SyncSetupPolicyDatabase {
|
|
699
|
+
databaseId: string;
|
|
700
|
+
/** True when a `permanent` policy targets this database for the user (and is not released). */
|
|
701
|
+
locked: boolean;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* The per-user reconcile plan computed from the directory head: the union of
|
|
705
|
+
* databases the user is targeted for across all policies, each carrying the
|
|
706
|
+
* effective lock state (locked wins on overlap).
|
|
707
|
+
*/
|
|
708
|
+
export interface SyncSetupPolicyReconcilePlan {
|
|
709
|
+
databases: SyncSetupPolicyDatabase[];
|
|
710
|
+
}
|
|
711
|
+
/** Document id prefix for the per-policy sync setup policy documents. */
|
|
712
|
+
export declare const ACL_SYNC_SETUP_POLICY_PREFIX = "acl_syncsetuppolicy_";
|
|
713
|
+
/**
|
|
714
|
+
* Document id for a sync setup policy — one doc per `policyId`, so publish is
|
|
715
|
+
* always an upsert of that policy's full desired state. The policy id is
|
|
716
|
+
* encoded so arbitrary ids stay valid doc-id components.
|
|
717
|
+
*/
|
|
718
|
+
export declare function aclSyncSetupPolicyDocId(policyId: string): string;
|
|
719
|
+
/** True when `docId` is a sync-setup-policy document id. */
|
|
720
|
+
export declare function isSyncSetupPolicyDocId(docId: string): boolean;
|
|
721
|
+
/**
|
|
722
|
+
* Validate the structural invariants of a sync setup policy before publish.
|
|
723
|
+
* Throws on the first violation:
|
|
724
|
+
*
|
|
725
|
+
* - `policyId` is non-empty;
|
|
726
|
+
* - `mode` is a valid {@link SyncSetupPolicyMode};
|
|
727
|
+
* - `databaseIds` is non-empty;
|
|
728
|
+
* - `pushto` and `pullfrom` user-hash sets are disjoint;
|
|
729
|
+
* - `pushto` and `pullfrom` group-hash sets are disjoint.
|
|
730
|
+
*/
|
|
731
|
+
export declare function validateSyncSetupPolicy(input: {
|
|
732
|
+
policyId: string;
|
|
733
|
+
mode: SyncSetupPolicyMode;
|
|
734
|
+
databaseIds: string[];
|
|
735
|
+
pushto_users_hashes: string[];
|
|
736
|
+
pullfrom_users_hashes: string[];
|
|
737
|
+
pushto_groups_hashes: string[];
|
|
738
|
+
pullfrom_groups_hashes: string[];
|
|
739
|
+
}): void;
|
|
740
|
+
/**
|
|
741
|
+
* Document history purge request type tag (the `type` field of a
|
|
742
|
+
* {@link DocHistoryPurgeDoc}).
|
|
743
|
+
*/
|
|
744
|
+
export declare const DOC_HISTORY_PURGE_TYPE: "dochistorypurge";
|
|
745
|
+
/**
|
|
746
|
+
* The admin-signed document requesting the physical purge of one or more
|
|
747
|
+
* documents' history from a database. Stored at the fixed id
|
|
748
|
+
* `acl_dochistorypurge_<requestId>` (one doc per request; append-only audit
|
|
749
|
+
* record). The doc shell is `$publicinfos`-readable so the server can read the
|
|
750
|
+
* cleartext `dbId` + `docIds` routing fields and execute the purge; `reason` is
|
|
751
|
+
* stored under the `<field>_encrypted` convention with the tenant `default` key,
|
|
752
|
+
* so the server cannot read it.
|
|
753
|
+
*/
|
|
754
|
+
export interface DocHistoryPurgeDoc {
|
|
755
|
+
form: typeof ACCESS_CONTROL_FORM;
|
|
756
|
+
type: typeof DOC_HISTORY_PURGE_TYPE;
|
|
757
|
+
/** Stable request id; the document identity (one doc per request). */
|
|
758
|
+
requestId: string;
|
|
759
|
+
/** Cleartext (server-readable) id of the database whose docs are purged. */
|
|
760
|
+
dbId: string;
|
|
761
|
+
/** Cleartext (server-readable) ids of the documents to purge. */
|
|
762
|
+
docIds: string[];
|
|
763
|
+
/** Optional human-readable reason, encrypted with the tenant default key. */
|
|
764
|
+
reason_encrypted?: string;
|
|
765
|
+
reason_encrypted_key?: string;
|
|
766
|
+
/** The requesting user's signing public key that prepared the request (audit). */
|
|
767
|
+
preparedByPublicKey: string;
|
|
768
|
+
/** Epoch millis the request was prepared/signed. */
|
|
769
|
+
requestedAt: number;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* The full unsigned content of one purge request, built in the authoring dialog
|
|
773
|
+
* (or carried by an `mdb://doc-history-purge/...` request URI). The admin maps
|
|
774
|
+
* it to a {@link DocHistoryPurgeDoc} on save (encrypting `reason`). A
|
|
775
|
+
* `requestId` is generated at prepare time and carried through so admin import +
|
|
776
|
+
* sign is idempotent (the doc id is derived from it).
|
|
777
|
+
*/
|
|
778
|
+
export interface DocHistoryPurgeRequest {
|
|
779
|
+
v: 1;
|
|
780
|
+
tenantId?: string;
|
|
781
|
+
requestId: string;
|
|
782
|
+
dbId: string;
|
|
783
|
+
docIds: string[];
|
|
784
|
+
/** Plaintext in the URI (sent out-of-band); the admin encrypts it on save. */
|
|
785
|
+
reason?: string;
|
|
786
|
+
preparedByPublicKey: string;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Read-side projection of a {@link DocHistoryPurgeDoc} for list UIs. `reason` is
|
|
790
|
+
* the decrypted value (null when the tenant default key is not held).
|
|
791
|
+
*/
|
|
792
|
+
export interface DocHistoryPurgeView {
|
|
793
|
+
requestId: string;
|
|
794
|
+
dbId: string;
|
|
795
|
+
docIds: string[];
|
|
796
|
+
reason: string | null;
|
|
797
|
+
preparedByPublicKey: string;
|
|
798
|
+
requestedAt: number;
|
|
799
|
+
/** The directory document id that carries this request. */
|
|
800
|
+
purgeRequestDocId: string;
|
|
801
|
+
}
|
|
802
|
+
/** Document id prefix for the per-request purge documents. */
|
|
803
|
+
export declare const ACL_DOC_HISTORY_PURGE_PREFIX = "acl_dochistorypurge_";
|
|
804
|
+
/**
|
|
805
|
+
* Document id for a purge request — one doc per request, keyed by `requestId`
|
|
806
|
+
* (append-only audit record). The request id is encoded so arbitrary ids stay
|
|
807
|
+
* valid doc-id components.
|
|
808
|
+
*/
|
|
809
|
+
export declare function aclDocHistoryPurgeDocId(requestId: string): string;
|
|
810
|
+
/** True when `docId` is a purge-request document id. */
|
|
811
|
+
export declare function isDocHistoryPurgeDocId(docId: string): boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Validate the structural invariants of a purge request before publish. Throws
|
|
814
|
+
* on the first violation:
|
|
815
|
+
*
|
|
816
|
+
* - `requestId` is non-empty;
|
|
817
|
+
* - `dbId` is non-empty;
|
|
818
|
+
* - `docIds` is a non-empty array of non-empty strings.
|
|
819
|
+
*/
|
|
820
|
+
export declare function validateDocHistoryPurge(input: {
|
|
821
|
+
requestId: string;
|
|
822
|
+
dbId: string;
|
|
823
|
+
docIds: string[];
|
|
824
|
+
}): void;
|
|
825
|
+
//# sourceMappingURL=types.d.ts.map
|