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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkTransport.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/NetworkTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,EAC3B,0BAA0B,EAC1B,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE1F;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,CAAC,IAAI,MAAM,CAAC;IAEvB
|
|
1
|
+
{"version":3,"file":"NetworkTransport.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/NetworkTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,EAC3B,0BAA0B,EAC1B,SAAS,EACV,MAAM,UAAU,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AAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D;;;;;;;;;;OAUG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5C;;;;;;;;;;;;;;;OAeG;IACH,mBAAmB,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
|
|
@@ -44,7 +44,12 @@ export interface UserPublicKeys {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface NetworkAuthTokenPayload {
|
|
46
46
|
/**
|
|
47
|
-
* Subject
|
|
47
|
+
* Subject of the authenticated session. Historically the cleartext username
|
|
48
|
+
* the client posted to `/auth/challenge`. With key-based challenges the
|
|
49
|
+
* username is optional, so `sub` may instead carry the authenticated device
|
|
50
|
+
* signing key (Ed25519, PEM) when no username was supplied. Treat it as an
|
|
51
|
+
* opaque principal id; identity for the read gate is resolved from
|
|
52
|
+
* {@link deviceSigningKey} where present.
|
|
48
53
|
*/
|
|
49
54
|
sub: string;
|
|
50
55
|
/**
|
|
@@ -63,6 +68,21 @@ export interface NetworkAuthTokenPayload {
|
|
|
63
68
|
* Optional: database ID if token is scoped to a specific database
|
|
64
69
|
*/
|
|
65
70
|
dbId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Optional: the signing public key (Ed25519, PEM) the device actually
|
|
73
|
+
* authenticated with (docs/accesscontrol.md §6.5). Determined by the server
|
|
74
|
+
* from which of the user's granted/wipe-targeted keys verified the challenge.
|
|
75
|
+
* Used to target a specific device for remote wipe.
|
|
76
|
+
*/
|
|
77
|
+
deviceSigningKey?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Optional: set when the authenticating device's signing key is the target of
|
|
80
|
+
* an admin-requested remote wipe (`wipeRequestedForSigningKeys`, §6.5). A
|
|
81
|
+
* wipe-scoped token may only fetch the admin-signed grant document carrying
|
|
82
|
+
* the directive, and bypasses the normal revocation check so a revoked device
|
|
83
|
+
* can still learn it must wipe.
|
|
84
|
+
*/
|
|
85
|
+
wipe?: boolean;
|
|
66
86
|
}
|
|
67
87
|
/**
|
|
68
88
|
* Challenge stored server-side for authentication.
|
|
@@ -73,9 +93,18 @@ export interface AuthChallenge {
|
|
|
73
93
|
*/
|
|
74
94
|
challenge: string;
|
|
75
95
|
/**
|
|
76
|
-
* The username this challenge was issued for
|
|
96
|
+
* The username this challenge was issued for. Optional: with key-based
|
|
97
|
+
* challenges the client may identify itself by its signing public key
|
|
98
|
+
* instead (see {@link signingPublicKey}), so the server no longer requires
|
|
99
|
+
* the cleartext username.
|
|
100
|
+
*/
|
|
101
|
+
username?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The device signing public key (Ed25519, PEM) this challenge was issued for,
|
|
104
|
+
* when the client identified itself by key rather than username. Used by
|
|
105
|
+
* {@link AuthenticationService.authenticate} to scope candidate keys.
|
|
77
106
|
*/
|
|
78
|
-
|
|
107
|
+
signingPublicKey?: string;
|
|
79
108
|
/**
|
|
80
109
|
* Timestamp when the challenge was created (Unix epoch milliseconds)
|
|
81
110
|
*/
|
|
@@ -148,6 +177,27 @@ export interface NetworkSyncCapabilities {
|
|
|
148
177
|
* walking attachment chunk metadata over the network.
|
|
149
178
|
*/
|
|
150
179
|
supportsAttachmentReadPlanning: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Server's current wall-clock time (ms since Unix epoch) at the moment it
|
|
182
|
+
* answered the capabilities request. Clients use this for the clock-skew
|
|
183
|
+
* guard before syncing against an access-controlled tenant
|
|
184
|
+
* (docs/accesscontrol.md §4 "Clock-skew guard"), so a client with a wrong
|
|
185
|
+
* local clock cannot mis-stamp `createdAt`/trusted-time decisions.
|
|
186
|
+
*/
|
|
187
|
+
serverTime?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the server implements the v1 access-control protocol (witness
|
|
190
|
+
* receipts + Tier 1 enforcement, docs/accesscontrol.md §5–§7). Clients use
|
|
191
|
+
* this to negotiate whether to enforce the clock-skew guard and to expect
|
|
192
|
+
* witness receipts on accepted entries.
|
|
193
|
+
*/
|
|
194
|
+
supportsAccessControlV1?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether the server enforces remote-wipe serving (docs/accesscontrol.md
|
|
197
|
+
* §6.5): a device whose signing key is wipe-targeted is served only the
|
|
198
|
+
* admin-signed grant document carrying the directive and no other data.
|
|
199
|
+
*/
|
|
200
|
+
supportsRemoteWipeV1?: boolean;
|
|
151
201
|
}
|
|
152
202
|
/**
|
|
153
203
|
* Network transport error types for error handling.
|
|
@@ -170,7 +220,11 @@ export declare enum NetworkErrorType {
|
|
|
170
220
|
/** Server-side error */
|
|
171
221
|
SERVER_ERROR = "SERVER_ERROR",
|
|
172
222
|
/** User not found in directory */
|
|
173
|
-
USER_NOT_FOUND = "USER_NOT_FOUND"
|
|
223
|
+
USER_NOT_FOUND = "USER_NOT_FOUND",
|
|
224
|
+
/** Entry was denied by a Tier 1 access-control rule (docs/accesscontrol.md §7) */
|
|
225
|
+
ACCESS_DENIED = "ACCESS_DENIED",
|
|
226
|
+
/** Local/server clock skew exceeded tolerance during sync (§4 clock-skew guard) */
|
|
227
|
+
CLOCK_SKEW = "CLOCK_SKEW"
|
|
174
228
|
}
|
|
175
229
|
/**
|
|
176
230
|
* Network transport error with type for structured error handling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;;;;;;;;;OAUG;IACH,mBAAmB,EAAE,UAAU,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;;;;;;;;;OAUG;IACH,mBAAmB,EAAE,UAAU,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;OAOG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,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B;IACvC,wCAAwC;IACxC,iBAAiB,sBAAsB;IACvC,kCAAkC;IAClC,aAAa,kBAAkB;IAC/B,uDAAuD;IACvD,iBAAiB,sBAAsB;IACvC,oDAAoD;IACpD,YAAY,iBAAiB;IAC7B,wBAAwB;IACxB,YAAY,iBAAiB;IAC7B,kCAAkC;IAClC,cAAc,mBAAmB;IACjC,kFAAkF;IAClF,aAAa,kBAAkB;IAC/B,mFAAmF;IACnF,UAAU,eAAe;CAC1B;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;aAEnB,IAAI,EAAE,gBAAgB;aAEtB,YAAY,CAAC,EAAE,MAAM;gBAFrB,IAAI,EAAE,gBAAgB,EACtC,OAAO,EAAE,MAAM,EACC,YAAY,CAAC,EAAE,MAAM,YAAA;CAKxC"}
|
|
@@ -24,6 +24,10 @@ var NetworkErrorType;
|
|
|
24
24
|
NetworkErrorType["SERVER_ERROR"] = "SERVER_ERROR";
|
|
25
25
|
/** User not found in directory */
|
|
26
26
|
NetworkErrorType["USER_NOT_FOUND"] = "USER_NOT_FOUND";
|
|
27
|
+
/** Entry was denied by a Tier 1 access-control rule (docs/accesscontrol.md §7) */
|
|
28
|
+
NetworkErrorType["ACCESS_DENIED"] = "ACCESS_DENIED";
|
|
29
|
+
/** Local/server clock skew exceeded tolerance during sync (§4 clock-skew guard) */
|
|
30
|
+
NetworkErrorType["CLOCK_SKEW"] = "CLOCK_SKEW";
|
|
27
31
|
})(NetworkErrorType || (exports.NetworkErrorType = NetworkErrorType = {}));
|
|
28
32
|
/**
|
|
29
33
|
* Network transport error with type for structured error handling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":";;;AA8NA;;GAEG;AACH,IAAY,gBAuBX;AAvBD,WAAY,gBAAgB;IAC1B,kCAAkC;IAClC,mDAA+B,CAAA;IAC/B,4BAA4B;IAC5B,iDAA6B,CAAA;IAC7B,oCAAoC;IACpC,2DAAuC,CAAA;IACvC,wCAAwC;IACxC,2DAAuC,CAAA;IACvC,kCAAkC;IAClC,mDAA+B,CAAA;IAC/B,uDAAuD;IACvD,2DAAuC,CAAA;IACvC,oDAAoD;IACpD,iDAA6B,CAAA;IAC7B,wBAAwB;IACxB,iDAA6B,CAAA;IAC7B,kCAAkC;IAClC,qDAAiC,CAAA;IACjC,kFAAkF;IAClF,mDAA+B,CAAA;IAC/B,mFAAmF;IACnF,6CAAyB,CAAA;AAC3B,CAAC,EAvBW,gBAAgB,gCAAhB,gBAAgB,QAuB3B;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YACkB,IAAsB,EACtC,OAAe,EACC,YAAqB;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAkB;QAEtB,iBAAY,GAAZ,YAAY,CAAS;QAGrC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AATD,oCASC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StoreEntryMetadata } from "../types";
|
|
2
|
+
import type { StoreScanCursor, StoreScanFilters, StoreScanResult } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Shared helpers for cursor-based metadata scans over content-addressed
|
|
5
|
+
* stores. All stores order scans by `(receiptOrder ASC, id ASC)`; these
|
|
6
|
+
* utilities implement the doc-scoped fast path so a `docId`-filtered scan
|
|
7
|
+
* costs O(entries of that document) instead of O(entries in the store).
|
|
8
|
+
*/
|
|
9
|
+
/** Canonical scan ordering: `(receiptOrder ?? 0) ASC, id ASC`. */
|
|
10
|
+
export declare function compareByReceiptOrderAndId(a: StoreEntryMetadata, b: StoreEntryMetadata): number;
|
|
11
|
+
/** Whether `meta` sorts strictly after the (exclusive) scan cursor. */
|
|
12
|
+
export declare function isAfterScanCursor(meta: StoreEntryMetadata, cursor: StoreScanCursor): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Test whether a metadata entry passes the given scan filters
|
|
15
|
+
* (docId, entryTypes whitelist, creation-date range).
|
|
16
|
+
*/
|
|
17
|
+
export declare function metadataMatchesScanFilters(meta: StoreEntryMetadata, filters?: StoreScanFilters): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Doc-scoped implementation of `scanEntriesSince`: takes the (unsorted)
|
|
20
|
+
* metadata of a single document — resolved through a store's docId index —
|
|
21
|
+
* and applies the canonical scan ordering, cursor, remaining filters and
|
|
22
|
+
* limit. The result contract matches the full-store scan exactly
|
|
23
|
+
* (`entries` in `(receiptOrder, id)` order, `nextCursor` pointing at the
|
|
24
|
+
* last returned entry, `hasMore` when further matching entries exist).
|
|
25
|
+
*/
|
|
26
|
+
export declare function scanDocScopedEntries(docEntries: StoreEntryMetadata[], cursor: StoreScanCursor | null, limit: number, filters?: StoreScanFilters): StoreScanResult;
|
|
27
|
+
//# sourceMappingURL=scanUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanUtils.d.ts","sourceRoot":"","sources":["../../../src/core/appendonlystores/scanUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;GAKG;AAEH,kEAAkE;AAClE,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,kBAAkB,EACrB,CAAC,EAAE,kBAAkB,GACpB,MAAM,CAOR;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,eAAe,GACtB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CA0BT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,kBAAkB,EAAE,EAChC,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,gBAAgB,GACzB,eAAe,CA0BjB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compareByReceiptOrderAndId = compareByReceiptOrderAndId;
|
|
4
|
+
exports.isAfterScanCursor = isAfterScanCursor;
|
|
5
|
+
exports.metadataMatchesScanFilters = metadataMatchesScanFilters;
|
|
6
|
+
exports.scanDocScopedEntries = scanDocScopedEntries;
|
|
7
|
+
/**
|
|
8
|
+
* Shared helpers for cursor-based metadata scans over content-addressed
|
|
9
|
+
* stores. All stores order scans by `(receiptOrder ASC, id ASC)`; these
|
|
10
|
+
* utilities implement the doc-scoped fast path so a `docId`-filtered scan
|
|
11
|
+
* costs O(entries of that document) instead of O(entries in the store).
|
|
12
|
+
*/
|
|
13
|
+
/** Canonical scan ordering: `(receiptOrder ?? 0) ASC, id ASC`. */
|
|
14
|
+
function compareByReceiptOrderAndId(a, b) {
|
|
15
|
+
const orderA = a.receiptOrder ?? 0;
|
|
16
|
+
const orderB = b.receiptOrder ?? 0;
|
|
17
|
+
if (orderA !== orderB) {
|
|
18
|
+
return orderA - orderB;
|
|
19
|
+
}
|
|
20
|
+
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
21
|
+
}
|
|
22
|
+
/** Whether `meta` sorts strictly after the (exclusive) scan cursor. */
|
|
23
|
+
function isAfterScanCursor(meta, cursor) {
|
|
24
|
+
const order = meta.receiptOrder ?? 0;
|
|
25
|
+
return (order > cursor.receiptOrder ||
|
|
26
|
+
(order === cursor.receiptOrder && meta.id > cursor.id));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Test whether a metadata entry passes the given scan filters
|
|
30
|
+
* (docId, entryTypes whitelist, creation-date range).
|
|
31
|
+
*/
|
|
32
|
+
function metadataMatchesScanFilters(meta, filters) {
|
|
33
|
+
if (filters?.docId && meta.docId !== filters.docId) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (filters?.entryTypes &&
|
|
37
|
+
filters.entryTypes.length > 0 &&
|
|
38
|
+
!filters.entryTypes.includes(meta.entryType)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (filters?.creationDateFrom !== undefined &&
|
|
42
|
+
filters.creationDateFrom !== null &&
|
|
43
|
+
meta.createdAt < filters.creationDateFrom) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (filters?.creationDateUntil !== undefined &&
|
|
47
|
+
filters.creationDateUntil !== null &&
|
|
48
|
+
meta.createdAt >= filters.creationDateUntil) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Doc-scoped implementation of `scanEntriesSince`: takes the (unsorted)
|
|
55
|
+
* metadata of a single document — resolved through a store's docId index —
|
|
56
|
+
* and applies the canonical scan ordering, cursor, remaining filters and
|
|
57
|
+
* limit. The result contract matches the full-store scan exactly
|
|
58
|
+
* (`entries` in `(receiptOrder, id)` order, `nextCursor` pointing at the
|
|
59
|
+
* last returned entry, `hasMore` when further matching entries exist).
|
|
60
|
+
*/
|
|
61
|
+
function scanDocScopedEntries(docEntries, cursor, limit, filters) {
|
|
62
|
+
const sorted = [...docEntries].sort(compareByReceiptOrderAndId);
|
|
63
|
+
const page = [];
|
|
64
|
+
let hasMore = false;
|
|
65
|
+
for (const meta of sorted) {
|
|
66
|
+
if (cursor !== null && !isAfterScanCursor(meta, cursor)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (!metadataMatchesScanFilters(meta, filters)) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (page.length < limit) {
|
|
73
|
+
page.push(meta);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
hasMore = true;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const last = page.length > 0 ? page[page.length - 1] : null;
|
|
81
|
+
return {
|
|
82
|
+
entries: page,
|
|
83
|
+
nextCursor: last ? { receiptOrder: last.receiptOrder ?? 0, id: last.id } : cursor,
|
|
84
|
+
hasMore,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=scanUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanUtils.js","sourceRoot":"","sources":["../../../src/core/appendonlystores/scanUtils.ts"],"names":[],"mappings":";;AAWA,gEAUC;AAGD,8CASC;AAMD,gEA6BC;AAUD,oDA+BC;AA1GD;;;;;GAKG;AAEH,kEAAkE;AAClE,SAAgB,0BAA0B,CACxC,CAAqB,EACrB,CAAqB;IAErB,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;IACnC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,uEAAuE;AACvE,SAAgB,iBAAiB,CAC/B,IAAwB,EACxB,MAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;IACrC,OAAO,CACL,KAAK,GAAG,MAAM,CAAC,YAAY;QAC3B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iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;YACxD,SAAS;QACX,CAAC;QACD,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;YAC/C,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAI,CAAC;YACf,MAAM;QACR,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM;QACjF,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -296,10 +296,31 @@ export interface ContentAddressedStore {
|
|
|
296
296
|
* - Metadata is stored by entry id (always unique)
|
|
297
297
|
* - Encrypted bytes are deduplicated by contentHash (same bytes stored once)
|
|
298
298
|
*
|
|
299
|
+
* A remote (network) store may return witness receipts (stamped metadata with
|
|
300
|
+
* `receivedAt`/`receivedByPublicKey`/`receivedDateSignature`) for the accepted
|
|
301
|
+
* entries so the pushing client can persist the attestation on its local copy
|
|
302
|
+
* via {@link applyWitnessReceipts} (docs/accesscontrol.md §5.3). Local stores
|
|
303
|
+
* return `void`; callers that do not need receipts can ignore the result.
|
|
304
|
+
*
|
|
299
305
|
* @param entries The entries to store
|
|
300
|
-
* @return A promise that resolves when all entries are stored
|
|
306
|
+
* @return A promise that resolves when all entries are stored, optionally
|
|
307
|
+
* carrying witness receipts for the accepted entries.
|
|
308
|
+
*/
|
|
309
|
+
putEntries(entries: StoreEntry[]): Promise<void | StoreEntryMetadata[]>;
|
|
310
|
+
/**
|
|
311
|
+
* Apply witness receipts to entries already present in this (local) store.
|
|
312
|
+
*
|
|
313
|
+
* Each receipt is the server-stamped metadata for an entry this store
|
|
314
|
+
* authored and pushed; applying it copies the witness fields (`receivedAt`,
|
|
315
|
+
* `receivedByPublicKey`, `receivedDateSignature`, `receiptScheme`) onto the
|
|
316
|
+
* stored entry and assigns it a fresh `receiptOrder` so the revision feed's
|
|
317
|
+
* `scanEntriesSince` cursor re-discovers it and re-anchors it from the
|
|
318
|
+
* provisional head to its committed `receivedAt` position (docs/accesscontrol.md
|
|
319
|
+
* §5.3, §8). Receipts for entries not present locally are ignored.
|
|
320
|
+
*
|
|
321
|
+
* Optional: stores without a receipt-order backbone may omit this.
|
|
301
322
|
*/
|
|
302
|
-
|
|
323
|
+
applyWitnessReceipts?(receipts: StoreEntryMetadata[]): Promise<void>;
|
|
303
324
|
/**
|
|
304
325
|
* Get entries by their IDs.
|
|
305
326
|
* Returns only entries that exist in this store.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/appendonlystores/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/E;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C,CAAC,GAAG,EAAE,MAAM,GAAG,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,CAAC;IAClB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,EAAE,qBAAqB,CAAC;IAEhC;;OAEG;IACH,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;OAOG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;CAC1E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;OAGG;IACH,YAAY,IAAI,SAAS,CAAC;IAE1B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/appendonlystores/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/E;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACp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,CAAC;IAErB;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;OAGG;IACH,0BAA0B,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElF;;OAEG;IACH,iBAAiB,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD;;;OAGG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;OAGG;IACH,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEnF;;OAEG;IACH,mBAAmB,CAAC,IAAI,qBAAqB,CAAC;IAE9C;;OAEG;IACH,mBAAmB,CAAC,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEvD;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,IAAI,MAAM,CAAC;CAC7B"}
|
|
@@ -15,10 +15,15 @@ export interface ICacheable {
|
|
|
15
15
|
* Export the current dirty state to the cache store.
|
|
16
16
|
* Called by CacheManager during flush.
|
|
17
17
|
*
|
|
18
|
-
* @param store
|
|
18
|
+
* @param store The cache store to write to
|
|
19
|
+
* @param options `force: true` on shutdown/deregister paths — implementations
|
|
20
|
+
* must persist immediately and may not defer (e.g. a
|
|
21
|
+
* VirtualView's minimum flush interval is bypassed)
|
|
19
22
|
* @returns The number of entries written
|
|
20
23
|
*/
|
|
21
|
-
flushToCache(store: LocalCacheStore
|
|
24
|
+
flushToCache(store: LocalCacheStore, options?: {
|
|
25
|
+
force?: boolean;
|
|
26
|
+
}): Promise<number>;
|
|
22
27
|
/**
|
|
23
28
|
* Clear the dirty tracking state after a successful flush.
|
|
24
29
|
*/
|
|
@@ -65,8 +70,13 @@ export declare class CacheManager {
|
|
|
65
70
|
private scheduleFlush;
|
|
66
71
|
/**
|
|
67
72
|
* Immediately flush all dirty cacheables.
|
|
73
|
+
*
|
|
74
|
+
* @param options `force: true` bypasses per-cacheable flush deferral
|
|
75
|
+
* (used on dispose so shutdown never skips pending state)
|
|
68
76
|
*/
|
|
69
|
-
flush(
|
|
77
|
+
flush(options?: {
|
|
78
|
+
force?: boolean;
|
|
79
|
+
}): Promise<void>;
|
|
70
80
|
/**
|
|
71
81
|
* Flush all pending state and stop the periodic timer.
|
|
72
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheManager.d.ts","sourceRoot":"","sources":["../../../src/core/cache/CacheManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAoC,MAAM,YAAY,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB
|
|
1
|
+
{"version":3,"file":"CacheManager.d.ts","sourceRoot":"","sources":["../../../src/core/cache/CacheManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAoC,MAAM,YAAY,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;;;;;;;;OASG;IACH,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAErF;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,KAAK,CAA8C;IAC3D,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAS;gBAEX,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM;IAMlF,QAAQ,IAAI,eAAe;IAI3B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;IAIrC;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAYtD;;;OAGG;IACH,SAAS,IAAI,IAAI;IAKjB,OAAO,CAAC,aAAa;IAQrB;;;;;OAKG;IACG,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBzD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ/B"}
|
|
@@ -34,7 +34,7 @@ class CacheManager {
|
|
|
34
34
|
async deregister(cacheable) {
|
|
35
35
|
if (cacheable.hasDirtyState()) {
|
|
36
36
|
try {
|
|
37
|
-
await cacheable.flushToCache(this.store);
|
|
37
|
+
await cacheable.flushToCache(this.store, { force: true });
|
|
38
38
|
cacheable.clearDirty();
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
@@ -62,8 +62,11 @@ class CacheManager {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Immediately flush all dirty cacheables.
|
|
65
|
+
*
|
|
66
|
+
* @param options `force: true` bypasses per-cacheable flush deferral
|
|
67
|
+
* (used on dispose so shutdown never skips pending state)
|
|
65
68
|
*/
|
|
66
|
-
async flush() {
|
|
69
|
+
async flush(options) {
|
|
67
70
|
if (this.flushInProgress)
|
|
68
71
|
return;
|
|
69
72
|
this.flushInProgress = true;
|
|
@@ -72,7 +75,7 @@ class CacheManager {
|
|
|
72
75
|
if (!cacheable.hasDirtyState())
|
|
73
76
|
continue;
|
|
74
77
|
try {
|
|
75
|
-
const count = await cacheable.flushToCache(this.store);
|
|
78
|
+
const count = await cacheable.flushToCache(this.store, options);
|
|
76
79
|
cacheable.clearDirty();
|
|
77
80
|
this.logger.debug(`Flushed ${count} entries for ${cacheable.getCachePrefix()}`);
|
|
78
81
|
}
|
|
@@ -94,7 +97,7 @@ class CacheManager {
|
|
|
94
97
|
clearTimeout(this.timer);
|
|
95
98
|
this.timer = null;
|
|
96
99
|
}
|
|
97
|
-
await this.flush();
|
|
100
|
+
await this.flush({ force: true });
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
exports.CacheManager = CacheManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheManager.js","sourceRoot":"","sources":["../../../src/core/cache/CacheManager.ts"],"names":[],"mappings":";;;AACA,wCAAsE;
|
|
1
|
+
{"version":3,"file":"CacheManager.js","sourceRoot":"","sources":["../../../src/core/cache/CacheManager.ts"],"names":[],"mappings":";;;AACA,wCAAsE;AA0CtE;;;;;GAKG;AACH,MAAa,YAAY;IASvB,YAAY,KAAsB,EAAE,OAA6B,EAAE,MAAe;QAP1E,eAAU,GAAoB,IAAI,GAAG,EAAE,CAAC;QAExC,UAAK,GAAyC,IAAI,CAAC;QACnD,oBAAe,GAAY,KAAK,CAAC;QACjC,aAAQ,GAAY,KAAK,CAAC;QAIhC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,sBAAY,CAAC,IAAA,4BAAkB,GAAE,EAAE,cAA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QAE5B,IAAI,CAAC;YACH,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACxC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;oBAAE,SAAS;gBAEzC,IAAI,CAAC;oBACH,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBAChE,SAAS,CAAC,UAAU,EAAE,CAAC;oBACvB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,gBAAgB,SAAS,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;gBAClF,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,SAAS,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC/B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAjGD,oCAiGC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { StoreEntryAttachmentRef, StoreEntryMetadata } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Author entry signatures (security hardening, audit finding #5).
|
|
4
|
+
*
|
|
5
|
+
* Historically (early betas) a store entry's author signature (`StoreEntryMetadata.signature`)
|
|
6
|
+
* covered ONLY the encrypted payload bytes. That leaves every cleartext metadata
|
|
7
|
+
* field (`entryType`, `docId`, `decryptionKeyId`, `createdAt`, `dependencyIds`,
|
|
8
|
+
* `contentHash`, ...) unauthenticated: a relay holding any trusted key could
|
|
9
|
+
* tweak metadata on an un-witnessed/legacy entry and the legacy signature would
|
|
10
|
+
* still verify.
|
|
11
|
+
*
|
|
12
|
+
* This module adds a second, stronger author signature
|
|
13
|
+
* (`StoreEntryMetadata.metadataSignature`) computed over a **fixed, versioned,
|
|
14
|
+
* length-prefixed byte layout** that binds the security-relevant metadata
|
|
15
|
+
* alongside the `contentHash` (which itself is `SHA-256(encryptedData)`, so the
|
|
16
|
+
* ciphertext is transitively bound). It mirrors {@link WitnessReceipt} in style
|
|
17
|
+
* and is intentionally free of tenant/IO dependencies so it can be reused on
|
|
18
|
+
* both client and server and unit-tested in isolation.
|
|
19
|
+
*
|
|
20
|
+
* Backward compatibility: writers populate BOTH `signature` (legacy, over
|
|
21
|
+
* ciphertext) and `metadataSignature`. Verifiers prefer `metadataSignature`
|
|
22
|
+
* when present and fall back to the legacy `signature` for v1/legacy entries
|
|
23
|
+
* that predate this field, so old entries remain readable.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Version byte of the canonical entry-signature layout. Any change to the field
|
|
27
|
+
* set or ordering MUST bump this value (and verifiers MUST reject unknown
|
|
28
|
+
* versions).
|
|
29
|
+
*
|
|
30
|
+
* Exception — backward-compatible trailing extensions: a strictly trailing,
|
|
31
|
+
* optional block whose absence produces ZERO bytes (so the layout is
|
|
32
|
+
* byte-identical to the prior version for entries that do not carry the new
|
|
33
|
+
* data) does NOT bump this value. The `attachmentRefs` block (see
|
|
34
|
+
* {@link buildEntrySigningBytes}) is such an extension: attachment-free entries —
|
|
35
|
+
* including every entry signed before the field existed — are unaffected and
|
|
36
|
+
* keep verifying.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ENTRY_SIGNATURE_LAYOUT_VERSION = 1;
|
|
39
|
+
/**
|
|
40
|
+
* The exact set of metadata fields bound by an author's `metadataSignature`, in
|
|
41
|
+
* the order they appear in the byte layout.
|
|
42
|
+
*/
|
|
43
|
+
export interface EntrySignatureFields {
|
|
44
|
+
entryType: string;
|
|
45
|
+
id: string;
|
|
46
|
+
docId: string;
|
|
47
|
+
decryptionKeyId: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
dependencyIds: string[];
|
|
50
|
+
/** SHA-256 of the encrypted payload (transitively binds the ciphertext). */
|
|
51
|
+
contentHash: string;
|
|
52
|
+
/** Ed25519 public key (PEM) of the author. */
|
|
53
|
+
createdByPublicKey: string;
|
|
54
|
+
/**
|
|
55
|
+
* Optional snapshot of the document's attachment references as of this entry
|
|
56
|
+
* (see {@link StoreEntryMetadata.attachmentRefs}). Encoded as a backward-compatible
|
|
57
|
+
* TRAILING block (see {@link buildEntrySigningBytes}): when absent or empty it
|
|
58
|
+
* contributes ZERO bytes, so attachment-free entries (every legacy entry) keep
|
|
59
|
+
* the original v1 signing input and verify unchanged. Treat empty as absent.
|
|
60
|
+
*/
|
|
61
|
+
attachmentRefs?: StoreEntryAttachmentRef[];
|
|
62
|
+
}
|
|
63
|
+
/** Options for the version-aware entry-signature verifiers. */
|
|
64
|
+
export interface VerifyEntrySignatureOptions {
|
|
65
|
+
/**
|
|
66
|
+
* When true, an entry that lacks a `metadataSignature` (legacy/v1) is
|
|
67
|
+
* rejected instead of falling back to the ciphertext-only signature. Callers
|
|
68
|
+
* set this per entry based on the tenant's `requireMetadataSignatureSince`
|
|
69
|
+
* cutoff vs. the entry's trusted time.
|
|
70
|
+
*/
|
|
71
|
+
requireMetadataSignature?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the canonical, versioned, length-prefixed byte layout the author signs
|
|
75
|
+
* over.
|
|
76
|
+
*
|
|
77
|
+
* Layout:
|
|
78
|
+
* ```
|
|
79
|
+
* version(1 byte)
|
|
80
|
+
* || len(entryType) || entryType
|
|
81
|
+
* || len(id) || id
|
|
82
|
+
* || len(docId) || docId
|
|
83
|
+
* || len(decryptionKeyId) || decryptionKeyId
|
|
84
|
+
* || int64BE(createdAt)
|
|
85
|
+
* || uint32BE(dependencyIds.length)
|
|
86
|
+
* || ( len(dep) || dep ) * (in array order)
|
|
87
|
+
* || len(contentHash) || contentHash
|
|
88
|
+
* || len(createdByPublicKey) || createdByPublicKey
|
|
89
|
+
* -- trailing attachmentRefs block, PRESENT ONLY IF attachmentRefs.length > 0 --
|
|
90
|
+
* || uint32BE(attachmentRefs.length)
|
|
91
|
+
* || ( len(attachmentId) || attachmentId
|
|
92
|
+
* || len(lastChunkId) || lastChunkId
|
|
93
|
+
* || int64BE(size) ) * (one triple per ref, in array order)
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* The attachmentRefs block is a deliberately backward-compatible TRAILING
|
|
97
|
+
* extension: it is appended ONLY when there is at least one ref, so an
|
|
98
|
+
* attachment-free entry (every entry written before this field existed, and
|
|
99
|
+
* every future text-only revision) produces byte-for-byte the same input as the
|
|
100
|
+
* original layout and its existing signature still verifies. This is why the
|
|
101
|
+
* version byte intentionally stays `0x01` and is NOT bumped despite the new
|
|
102
|
+
* field: absence is byte-identical to the prior layout. Callers MUST treat an
|
|
103
|
+
* empty array as absent (the canonicalization in {@link entrySignatureFieldsFromEntry}
|
|
104
|
+
* guarantees this) and emit refs in a stable order (the writer sorts by
|
|
105
|
+
* `attachmentId`) so signing and verification produce identical bytes.
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildEntrySigningBytes(fields: EntrySignatureFields, version?: number): Uint8Array;
|
|
108
|
+
/** Project the signed fields out of an entry's metadata. */
|
|
109
|
+
export declare function entrySignatureFieldsFromEntry(entry: Pick<StoreEntryMetadata, "entryType" | "id" | "docId" | "decryptionKeyId" | "createdAt" | "dependencyIds" | "contentHash" | "createdByPublicKey" | "attachmentRefs">): EntrySignatureFields;
|
|
110
|
+
/**
|
|
111
|
+
* Sign the canonical entry layout with an already-imported Ed25519 private key.
|
|
112
|
+
* Returns the raw signature bytes to store as `metadataSignature`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function signEntryMetadata(fields: EntrySignatureFields, signingPrivateKey: CryptoKey, subtle: SubtleCrypto, version?: number): Promise<Uint8Array>;
|
|
115
|
+
/**
|
|
116
|
+
* Pure cryptographic verification of an entry's author signature, version-aware.
|
|
117
|
+
*
|
|
118
|
+
* - If `metadataSignature` is present, verifies it over {@link buildEntrySigningBytes}
|
|
119
|
+
* (strong, metadata-binding scheme; v2+).
|
|
120
|
+
* - Otherwise falls back to the legacy `signature` over `encryptedData`
|
|
121
|
+
* (v1/legacy entries that predate the metadata-binding scheme).
|
|
122
|
+
*
|
|
123
|
+
* This does NOT decide whether the author key is *trusted* — callers must
|
|
124
|
+
* separately confirm the key via the tenant directory.
|
|
125
|
+
*/
|
|
126
|
+
export declare function verifyEntrySignatureWithImportedKey(entry: Pick<StoreEntryMetadata, "entryType" | "id" | "docId" | "decryptionKeyId" | "createdAt" | "dependencyIds" | "contentHash" | "createdByPublicKey" | "attachmentRefs" | "signature"> & {
|
|
127
|
+
metadataSignature?: Uint8Array;
|
|
128
|
+
}, encryptedData: Uint8Array, cryptoKey: CryptoKey, subtle: SubtleCrypto, opts?: VerifyEntrySignatureOptions): Promise<boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* Same as {@link verifyEntrySignatureWithImportedKey} but imports the author's
|
|
131
|
+
* PEM-encoded public key first. Convenient for one-off verifications (e.g. on
|
|
132
|
+
* the server's push path) where no key cache is available.
|
|
133
|
+
*/
|
|
134
|
+
export declare function verifyEntrySignatureCrypto(entry: Pick<StoreEntryMetadata, "entryType" | "id" | "docId" | "decryptionKeyId" | "createdAt" | "dependencyIds" | "contentHash" | "createdByPublicKey" | "attachmentRefs" | "signature"> & {
|
|
135
|
+
metadataSignature?: Uint8Array;
|
|
136
|
+
}, encryptedData: Uint8Array, authorPublicKeyPem: string, subtle: SubtleCrypto, opts?: VerifyEntrySignatureOptions): Promise<boolean>;
|
|
137
|
+
//# sourceMappingURL=EntrySignature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntrySignature.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/EntrySignature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,8BAA8B,IAAO,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC5C;AAED,+DAA+D;AAC/D,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AA6BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE,MAAuC,GAC/C,UAAU,CAmCZ;AAED,4DAA4D;AAC5D,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,IAAI,CACT,kBAAkB,EAChB,WAAW,GACX,IAAI,GACJ,OAAO,GACP,iBAAiB,GACjB,WAAW,GACX,eAAe,GACf,aAAa,GACb,oBAAoB,GACpB,gBAAgB,CACnB,GACA,oBAAoB,CAiBtB;AAgBD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC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