mindoodb 0.0.85 → 0.0.88
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 +6 -2
- package/README.md +6 -4
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +2 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +151 -12
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +340 -24
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
- package/dist/browser/index.mjs +14 -0
- package/dist/cloudflare/DurableObjectSql.d.ts +56 -0
- package/dist/cloudflare/DurableObjectSql.d.ts.map +1 -0
- package/dist/cloudflare/DurableObjectSql.js +180 -0
- package/dist/cloudflare/DurableObjectSql.js.map +1 -0
- package/dist/cloudflare/MindooDatabaseObject.d.ts +86 -0
- package/dist/cloudflare/MindooDatabaseObject.d.ts.map +1 -0
- package/dist/cloudflare/MindooDatabaseObject.js +614 -0
- package/dist/cloudflare/MindooDatabaseObject.js.map +1 -0
- package/dist/cloudflare/MindooServerObject.d.ts +63 -0
- package/dist/cloudflare/MindooServerObject.d.ts.map +1 -0
- package/dist/cloudflare/MindooServerObject.js +521 -0
- package/dist/cloudflare/MindooServerObject.js.map +1 -0
- package/dist/cloudflare/WorkersCryptoAdapter.d.ts +7 -0
- package/dist/cloudflare/WorkersCryptoAdapter.d.ts.map +1 -0
- package/dist/cloudflare/WorkersCryptoAdapter.js +14 -0
- package/dist/cloudflare/WorkersCryptoAdapter.js.map +1 -0
- package/dist/cloudflare/host.d.ts +49 -0
- package/dist/cloudflare/host.d.ts.map +1 -0
- package/dist/cloudflare/host.js +104 -0
- package/dist/cloudflare/host.js.map +1 -0
- package/dist/cloudflare/http.d.ts +91 -0
- package/dist/cloudflare/http.d.ts.map +1 -0
- package/dist/cloudflare/http.js +266 -0
- package/dist/cloudflare/http.js.map +1 -0
- package/dist/cloudflare/index.d.ts +12 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +20 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/cloudflare/storeRpc.d.ts +22 -0
- package/dist/cloudflare/storeRpc.d.ts.map +1 -0
- package/dist/cloudflare/storeRpc.js +85 -0
- package/dist/cloudflare/storeRpc.js.map +1 -0
- package/dist/cloudflare/types.d.ts +101 -0
- package/dist/cloudflare/types.d.ts.map +1 -0
- package/dist/cloudflare/types.js +10 -0
- package/dist/cloudflare/types.js.map +1 -0
- package/dist/cloudflare/worker.d.ts +25 -0
- package/dist/cloudflare/worker.d.ts.map +1 -0
- package/dist/cloudflare/worker.js +170 -0
- package/dist/cloudflare/worker.js.map +1 -0
- package/dist/core/BaseMindooDB.d.ts +95 -10
- package/dist/core/BaseMindooDB.d.ts.map +1 -1
- package/dist/core/BaseMindooDB.js +441 -98
- package/dist/core/BaseMindooDB.js.map +1 -1
- package/dist/core/BaseMindooTenant.d.ts +43 -0
- package/dist/core/BaseMindooTenant.d.ts.map +1 -1
- package/dist/core/BaseMindooTenant.js +157 -6
- package/dist/core/BaseMindooTenant.js.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts +103 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.js +371 -8
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantFactory.js +2 -1
- package/dist/core/BaseMindooTenantFactory.js.map +1 -1
- package/dist/core/ChangeDocDraft.d.ts +133 -0
- package/dist/core/ChangeDocDraft.d.ts.map +1 -0
- package/dist/core/ChangeDocDraft.js +492 -0
- package/dist/core/ChangeDocDraft.js.map +1 -0
- package/dist/core/MindooDBServerAdmin.d.ts.map +1 -1
- package/dist/core/MindooDBServerAdmin.js +2 -1
- package/dist/core/MindooDBServerAdmin.js.map +1 -1
- package/dist/core/accesscontrol/directoryProjection.d.ts.map +1 -1
- package/dist/core/accesscontrol/directoryProjection.js +19 -0
- package/dist/core/accesscontrol/directoryProjection.js.map +1 -1
- package/dist/core/accesscontrol/evaluate.d.ts +14 -0
- package/dist/core/accesscontrol/evaluate.d.ts.map +1 -1
- package/dist/core/accesscontrol/evaluate.js +42 -1
- package/dist/core/accesscontrol/evaluate.js.map +1 -1
- package/dist/core/accesscontrol/types.d.ts +88 -4
- package/dist/core/accesscontrol/types.d.ts.map +1 -1
- package/dist/core/accesscontrol/types.js +114 -1
- package/dist/core/accesscontrol/types.js.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +14 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.js +27 -7
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -1
- package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/IrohNetworkTransport.js +12 -0
- package/dist/core/appendonlystores/network/IrohNetworkTransport.js.map +1 -1
- package/dist/core/appendonlystores/network/IrohStreamIO.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/IrohStreamIO.js +3 -23
- package/dist/core/appendonlystores/network/IrohStreamIO.js.map +1 -1
- package/dist/core/appendonlystores/rpc/RpcContentAddressedStore.d.ts +6 -0
- package/dist/core/appendonlystores/rpc/RpcContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/rpc/RpcContentAddressedStore.js +20 -1
- package/dist/core/appendonlystores/rpc/RpcContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/rpc/storeRpcCodec.d.ts.map +1 -1
- package/dist/core/appendonlystores/rpc/storeRpcCodec.js +3 -23
- package/dist/core/appendonlystores/rpc/storeRpcCodec.js.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.d.ts +7 -0
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js +39 -30
- package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteDriver.d.ts +37 -1
- package/dist/core/appendonlystores/sqlite/SqliteDriver.d.ts.map +1 -1
- package/dist/core/appendonlystores/sqlite/SqliteDriver.js +99 -40
- package/dist/core/appendonlystores/sqlite/SqliteDriver.js.map +1 -1
- package/dist/core/appendonlystores/syncStores.d.ts.map +1 -1
- package/dist/core/appendonlystores/syncStores.js +25 -5
- package/dist/core/appendonlystores/syncStores.js.map +1 -1
- package/dist/core/appendonlystores/types.d.ts +7 -1
- package/dist/core/appendonlystores/types.d.ts.map +1 -1
- package/dist/core/appendonlystores/types.js +1 -0
- package/dist/core/appendonlystores/types.js.map +1 -1
- package/dist/core/builtinDbInvariants.d.ts +49 -0
- package/dist/core/builtinDbInvariants.d.ts.map +1 -1
- package/dist/core/builtinDbInvariants.js +86 -1
- package/dist/core/builtinDbInvariants.js.map +1 -1
- package/dist/core/crypto/AuthChallenge.d.ts +68 -0
- package/dist/core/crypto/AuthChallenge.d.ts.map +1 -0
- package/dist/core/crypto/AuthChallenge.js +118 -0
- package/dist/core/crypto/AuthChallenge.js.map +1 -0
- package/dist/core/crypto/DomainStatement.d.ts +5 -3
- package/dist/core/crypto/DomainStatement.d.ts.map +1 -1
- package/dist/core/crypto/DomainStatement.js +5 -3
- package/dist/core/crypto/DomainStatement.js.map +1 -1
- package/dist/core/crypto/encryptedFields.d.ts +11 -0
- package/dist/core/crypto/encryptedFields.d.ts.map +1 -1
- package/dist/core/crypto/encryptedFields.js +18 -0
- package/dist/core/crypto/encryptedFields.js.map +1 -1
- package/dist/core/expressions/evaluateExpression.d.ts +8 -0
- package/dist/core/expressions/evaluateExpression.d.ts.map +1 -1
- package/dist/core/expressions/evaluateExpression.js +29 -4
- package/dist/core/expressions/evaluateExpression.js.map +1 -1
- package/dist/core/expressions/metadata.js +4 -4
- package/dist/core/expressions/metadata.js.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +17 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/query/executeQuery.d.ts.map +1 -1
- package/dist/core/query/executeQuery.js +5 -1
- package/dist/core/query/executeQuery.js.map +1 -1
- package/dist/core/query/executeQueryInclude.d.ts.map +1 -1
- package/dist/core/query/executeQueryInclude.js +2 -0
- package/dist/core/query/executeQueryInclude.js.map +1 -1
- package/dist/core/query/queryView.d.ts.map +1 -1
- package/dist/core/query/queryView.js +5 -1
- package/dist/core/query/queryView.js.map +1 -1
- package/dist/core/types.d.ts +204 -10
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/uri/MindooURI.d.ts.map +1 -1
- package/dist/core/uri/MindooURI.js +3 -24
- package/dist/core/uri/MindooURI.js.map +1 -1
- package/dist/core/userkeys/index.d.ts +1 -0
- package/dist/core/userkeys/index.d.ts.map +1 -1
- package/dist/core/userkeys/index.js +5 -1
- package/dist/core/userkeys/index.js.map +1 -1
- package/dist/core/userkeys/sealedValues.d.ts +54 -0
- package/dist/core/userkeys/sealedValues.d.ts.map +1 -0
- package/dist/core/userkeys/sealedValues.js +67 -0
- package/dist/core/userkeys/sealedValues.js.map +1 -0
- package/dist/core/utils/base64.d.ts +17 -0
- package/dist/core/utils/base64.d.ts.map +1 -0
- package/dist/core/utils/base64.js +54 -0
- package/dist/core/utils/base64.js.map +1 -0
- package/dist/core/utils/dynamicImportInterop.d.ts +10 -0
- package/dist/core/utils/dynamicImportInterop.d.ts.map +1 -0
- package/dist/core/utils/dynamicImportInterop.js +22 -0
- package/dist/core/utils/dynamicImportInterop.js.map +1 -0
- package/dist/core/utils/idGeneration.d.ts.map +1 -1
- package/dist/core/utils/idGeneration.js +14 -3
- package/dist/core/utils/idGeneration.js.map +1 -1
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -1
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js +7 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -1
- package/dist/node/server/FsServerDataStore.d.ts +23 -0
- package/dist/node/server/FsServerDataStore.d.ts.map +1 -0
- package/dist/node/server/FsServerDataStore.js +59 -0
- package/dist/node/server/FsServerDataStore.js.map +1 -0
- package/dist/node/server/IrohServerEndpoint.d.ts +1 -1
- package/dist/node/server/IrohServerEndpoint.d.ts.map +1 -1
- package/dist/node/server/IrohServerRpc.d.ts +5 -5
- package/dist/node/server/IrohServerRpc.d.ts.map +1 -1
- package/dist/node/server/IrohServerRpc.js +1 -1
- package/dist/node/server/IrohServerRpc.js.map +1 -1
- package/dist/node/server/MindooDBServer.d.ts +29 -150
- package/dist/node/server/MindooDBServer.d.ts.map +1 -1
- package/dist/node/server/MindooDBServer.js +160 -1573
- package/dist/node/server/MindooDBServer.js.map +1 -1
- package/dist/node/server/PurgedDocRegistry.d.ts +4 -27
- package/dist/node/server/PurgedDocRegistry.d.ts.map +1 -1
- package/dist/node/server/PurgedDocRegistry.js +6 -83
- package/dist/node/server/PurgedDocRegistry.js.map +1 -1
- package/dist/node/server/StoreFactory.d.ts +1 -1
- package/dist/node/server/StoreFactory.d.ts.map +1 -1
- package/dist/node/server/TenantManager.d.ts +16 -284
- package/dist/node/server/TenantManager.d.ts.map +1 -1
- package/dist/node/server/TenantManager.js +35 -1168
- package/dist/node/server/TenantManager.js.map +1 -1
- package/dist/node/server/add-to-network.js +1 -1
- package/dist/node/server/add-to-network.js.map +1 -1
- package/dist/node/server/config.d.ts +11 -15
- package/dist/node/server/config.d.ts.map +1 -1
- package/dist/node/server/config.js +30 -245
- package/dist/node/server/config.js.map +1 -1
- package/dist/node/server/expressAdapter.d.ts +23 -0
- package/dist/node/server/expressAdapter.d.ts.map +1 -0
- package/dist/node/server/expressAdapter.js +108 -0
- package/dist/node/server/expressAdapter.js.map +1 -0
- package/dist/node/server/nativeIrohStreamIO.d.ts +1 -1
- package/dist/node/server/nativeIrohStreamIO.d.ts.map +1 -1
- package/dist/node/server/peer/FileClusterAuditStorage.d.ts +16 -0
- package/dist/node/server/peer/FileClusterAuditStorage.d.ts.map +1 -0
- package/dist/node/server/peer/FileClusterAuditStorage.js +39 -0
- package/dist/node/server/peer/FileClusterAuditStorage.js.map +1 -0
- package/dist/node/server/peer/IrohPeerLink.d.ts +1 -1
- package/dist/node/server/peer/IrohPeerLink.d.ts.map +1 -1
- package/dist/node/server/peer/routes.d.ts +10 -44
- package/dist/node/server/peer/routes.d.ts.map +1 -1
- package/dist/node/server/peer/routes.js +33 -275
- package/dist/node/server/peer/routes.js.map +1 -1
- package/dist/node/server/resolveServerPassword.js +1 -1
- package/dist/node/server/resolveServerPassword.js.map +1 -1
- package/dist/node/server/server.js +1 -1
- package/dist/node/server/server.js.map +1 -1
- package/dist/node/server/serverinit.js +1 -1
- package/dist/node/server/serverinit.js.map +1 -1
- package/dist/server/CapabilityMatcher.d.ts +60 -0
- package/dist/server/CapabilityMatcher.d.ts.map +1 -0
- package/dist/server/CapabilityMatcher.js +138 -0
- package/dist/server/CapabilityMatcher.js.map +1 -0
- package/dist/server/DeviceDiscoveryService.d.ts +36 -0
- package/dist/server/DeviceDiscoveryService.d.ts.map +1 -0
- package/dist/server/DeviceDiscoveryService.js +164 -0
- package/dist/server/DeviceDiscoveryService.js.map +1 -0
- package/dist/server/PurgedDocRegistry.d.ts +35 -0
- package/dist/server/PurgedDocRegistry.d.ts.map +1 -0
- package/dist/server/PurgedDocRegistry.js +90 -0
- package/dist/server/PurgedDocRegistry.js.map +1 -0
- package/dist/server/ServerDataStore.d.ts +67 -0
- package/dist/server/ServerDataStore.d.ts.map +1 -0
- package/dist/server/ServerDataStore.js +88 -0
- package/dist/server/ServerDataStore.js.map +1 -0
- package/dist/server/SyncEventBus.d.ts +39 -0
- package/dist/server/SyncEventBus.d.ts.map +1 -0
- package/dist/server/SyncEventBus.js +41 -0
- package/dist/server/SyncEventBus.js.map +1 -0
- package/dist/server/SystemAdminAuth.d.ts +82 -0
- package/dist/server/SystemAdminAuth.d.ts.map +1 -0
- package/dist/server/SystemAdminAuth.js +227 -0
- package/dist/server/SystemAdminAuth.js.map +1 -0
- package/dist/server/TenantManager.d.ts +366 -0
- package/dist/server/TenantManager.d.ts.map +1 -0
- package/dist/server/TenantManager.js +1416 -0
- package/dist/server/TenantManager.js.map +1 -0
- package/dist/server/http/MindooDBServerCore.d.ts +313 -0
- package/dist/server/http/MindooDBServerCore.d.ts.map +1 -0
- package/dist/server/http/MindooDBServerCore.js +1410 -0
- package/dist/server/http/MindooDBServerCore.js.map +1 -0
- package/dist/server/http/types.d.ts +89 -0
- package/dist/server/http/types.d.ts.map +1 -0
- package/dist/server/http/types.js +29 -0
- package/dist/server/http/types.js.map +1 -0
- package/dist/server/index.d.ts +32 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +76 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/peer/ClusterAuditLog.d.ts +71 -0
- package/dist/server/peer/ClusterAuditLog.d.ts.map +1 -0
- package/dist/server/peer/ClusterAuditLog.js +81 -0
- package/dist/server/peer/ClusterAuditLog.js.map +1 -0
- package/dist/server/peer/ClusterJobRunner.d.ts +43 -0
- package/dist/server/peer/ClusterJobRunner.d.ts.map +1 -0
- package/dist/server/peer/ClusterJobRunner.js +119 -0
- package/dist/server/peer/ClusterJobRunner.js.map +1 -0
- package/dist/server/peer/ClusterManager.d.ts +149 -0
- package/dist/server/peer/ClusterManager.d.ts.map +1 -0
- package/dist/server/peer/ClusterManager.js +292 -0
- package/dist/server/peer/ClusterManager.js.map +1 -0
- package/dist/server/peer/PeerAuthService.d.ts +69 -0
- package/dist/server/peer/PeerAuthService.d.ts.map +1 -0
- package/dist/server/peer/PeerAuthService.js +207 -0
- package/dist/server/peer/PeerAuthService.js.map +1 -0
- package/dist/server/peer/PeerReplicator.d.ts +303 -0
- package/dist/server/peer/PeerReplicator.d.ts.map +1 -0
- package/dist/server/peer/PeerReplicator.js +1072 -0
- package/dist/server/peer/PeerReplicator.js.map +1 -0
- package/dist/server/peer/clusterHttp.d.ts +113 -0
- package/dist/server/peer/clusterHttp.d.ts.map +1 -0
- package/dist/server/peer/clusterHttp.js +290 -0
- package/dist/server/peer/clusterHttp.js.map +1 -0
- package/dist/server/peer/types.d.ts +244 -0
- package/dist/server/peer/types.d.ts.map +1 -0
- package/dist/server/peer/types.js +189 -0
- package/dist/server/peer/types.js.map +1 -0
- package/dist/server/rateLimits.d.ts +119 -0
- package/dist/server/rateLimits.d.ts.map +1 -0
- package/dist/server/rateLimits.js +159 -0
- package/dist/server/rateLimits.js.map +1 -0
- package/dist/server/serverConfig.d.ts +37 -0
- package/dist/server/serverConfig.d.ts.map +1 -0
- package/dist/server/serverConfig.js +251 -0
- package/dist/server/serverConfig.js.map +1 -0
- package/dist/server/timestampProxy.d.ts +129 -0
- package/dist/server/timestampProxy.d.ts.map +1 -0
- package/dist/server/timestampProxy.js +361 -0
- package/dist/server/timestampProxy.js.map +1 -0
- package/dist/server/types.d.ts +267 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +56 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/validation.d.ts +43 -0
- package/dist/server/validation.d.ts.map +1 -0
- package/dist/server/validation.js +104 -0
- package/dist/server/validation.js.map +1 -0
- package/package.json +9 -1
|
@@ -5,6 +5,8 @@ import { KeyBag } from "./keys/KeyBag";
|
|
|
5
5
|
import { UserKeyManager } from "./userkeys/UserKeyManager";
|
|
6
6
|
import type { PendingUserKeyDevice, UserKeyEnrollmentStatus } from "./userkeys/types";
|
|
7
7
|
import type { EntryRecipients } from "./userkeys/sealedTypes";
|
|
8
|
+
import type { RecipientOptions, RecipientSpec } from "./userkeys/sealedTypes";
|
|
9
|
+
import { type SealedValue } from "./userkeys/sealedValues";
|
|
8
10
|
import { MindooDocSigner } from "./crypto/MindooDocSigner";
|
|
9
11
|
import { Logger } from "./logging";
|
|
10
12
|
import { type LocalCacheStore } from "./cache/LocalCacheStore";
|
|
@@ -29,6 +31,9 @@ export declare class BaseMindooTenant implements MindooTenant {
|
|
|
29
31
|
private administrationPublicKey;
|
|
30
32
|
private administrationEncryptionPublicKey;
|
|
31
33
|
private currentUser;
|
|
34
|
+
/** Open withDecryptedKeyReuse scopes and their shared decryptions. */
|
|
35
|
+
private decryptedKeyReuseScopes;
|
|
36
|
+
private decryptedKeyReuse;
|
|
32
37
|
private currentUserPassword;
|
|
33
38
|
protected cryptoAdapter: CryptoAdapter;
|
|
34
39
|
private keyBag;
|
|
@@ -167,6 +172,19 @@ export declare class BaseMindooTenant implements MindooTenant {
|
|
|
167
172
|
rememberSealedGenerations(keyId: string, generations: Uint8Array[]): void;
|
|
168
173
|
getSealedGenerations(keyId: string): Uint8Array[];
|
|
169
174
|
ingestSealedRecipients(keyId: string, recipients: EntryRecipients): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Seals `value` to people (their published User-Keys) or devices, for a
|
|
177
|
+
* field of a document encrypted with another key (see {@link SealedValue}).
|
|
178
|
+
* `options` as for sealed documents: the current user is included unless
|
|
179
|
+
* `includeSelf` is false; `strict` fails on a recipient without a published
|
|
180
|
+
* User-Key instead of leaving them out.
|
|
181
|
+
*/
|
|
182
|
+
sealValue(value: Uint8Array, recipients: RecipientSpec[], options?: RecipientOptions): Promise<SealedValue>;
|
|
183
|
+
/**
|
|
184
|
+
* Opens a {@link SealedValue} with this identity's User-Key (any generation)
|
|
185
|
+
* or device key. Returns null when it is not sealed to them.
|
|
186
|
+
*/
|
|
187
|
+
openSealedValue(sealed: SealedValue): Promise<Uint8Array | null>;
|
|
170
188
|
ingestSealedFromEntries(keyId: string, entries: Array<{
|
|
171
189
|
recipients?: EntryRecipients;
|
|
172
190
|
createdAt: number;
|
|
@@ -408,6 +426,20 @@ export declare class BaseMindooTenant implements MindooTenant {
|
|
|
408
426
|
* and the full ticket so the same handshake runs over Iroh RPC.
|
|
409
427
|
*/
|
|
410
428
|
publishToServer(serverUrl: string, options?: PublishToServerOptions): Promise<void>;
|
|
429
|
+
/**
|
|
430
|
+
* Adds the server the tenant was just published to as a trusted witness
|
|
431
|
+
* (docs/accesscontrol.md §6.4). The server stamps every entry it accepts;
|
|
432
|
+
* without this directory document those receipts come from an untrusted key,
|
|
433
|
+
* and once access control is switched on every stamped entry is quarantined.
|
|
434
|
+
* Trust is evaluated at the receipt's `receivedAt`, so it has to be in place
|
|
435
|
+
* before the first entry is pushed: that is why the publish flow writes it.
|
|
436
|
+
*
|
|
437
|
+
* Needs the administration private key: {@link PublishToServerOptions.adminSigningKey}
|
|
438
|
+
* and `adminPassword`, or a `systemAdminUser` that is the tenant admin (demo
|
|
439
|
+
* servers with open tenant creation). Without it a warning is logged and the
|
|
440
|
+
* admin has to call `MindooTenantDirectory.addTrustedWitness()` before pushing.
|
|
441
|
+
*/
|
|
442
|
+
private trustServerAsWitness;
|
|
411
443
|
private resolveIrohDial;
|
|
412
444
|
private publishToIrohServer;
|
|
413
445
|
private authenticateAsSystemAdminOverIroh;
|
|
@@ -456,6 +488,17 @@ export declare class BaseMindooTenant implements MindooTenant {
|
|
|
456
488
|
* @returns The decrypted private key as ArrayBuffer
|
|
457
489
|
*/
|
|
458
490
|
decryptPrivateKey(encryptedKey: EncryptedPrivateKey, password: string, saltString: string): Promise<ArrayBuffer>;
|
|
491
|
+
/**
|
|
492
|
+
* Shares private key decryption (PBKDF2, the dominant cost of an admin
|
|
493
|
+
* operation) between all calls made while `fn` runs, e.g. a batch of
|
|
494
|
+
* user registrations signed with the same administration key. Checks are
|
|
495
|
+
* unchanged: every caller still passes key and password, a different
|
|
496
|
+
* password is decrypted on its own, and signatures are still verified
|
|
497
|
+
* against the claimed public key. The decrypted keys are dropped when the
|
|
498
|
+
* last open scope ends.
|
|
499
|
+
*/
|
|
500
|
+
withDecryptedKeyReuse<T>(fn: () => Promise<T>): Promise<T>;
|
|
501
|
+
private decryptPrivateKeyUncached;
|
|
459
502
|
/**
|
|
460
503
|
* Helper method to convert base64 string to Uint8Array
|
|
461
504
|
* Protected so that BaseMindooTenantDirectory can access it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMindooTenant.d.ts","sourceRoot":"","sources":["../../src/core/BaseMindooTenant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACrB,4BAA4B,EAE5B,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,YAAY,EAGZ,yBAAyB,EACzB,sBAAsB,EAEtB,sBAAsB,EAIvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseMindooTenant.d.ts","sourceRoot":"","sources":["../../src/core/BaseMindooTenant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACrB,4BAA4B,EAE5B,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,YAAY,EAGZ,yBAAyB,EACzB,sBAAsB,EAEtB,sBAAsB,EAIvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAA2B,MAAM,eAAe,CAAC;AAIhE,OAAO,EAAE,cAAc,EAAE,MA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KAAK,CAAC;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAchF;;;;;;;;OAQG;IACG,wCAAwC,CAC5C,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,MAAM,CAAC;IAiClB,oEAAoE;IACpE,OAAO,CAAC,4BAA4B;IAIpC;;;;;;OAMG;cACa,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA8B7E;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,qCAAqC,IAAI,OAAO;IAI1D;;;;;;;;;;OAUG;IACG,wBAAwB,CAC5B,OAAO,EAAE,UAAU,EACnB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,UAAU,CAAC;IAgEtB;;;;;;;OAOG;IACG,wBAAwB,CAC5B,gBAAgB,EAAE,UAAU,EAC5B,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,UAAU,CAAC;CA2DvB"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseMindooTenant = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
const userid_1 = require("./userid");
|
|
6
|
+
const AuthChallenge_1 = require("./crypto/AuthChallenge");
|
|
6
7
|
const BaseMindooDB_1 = require("./BaseMindooDB");
|
|
7
8
|
const BaseMindooTenantDirectory_1 = require("./BaseMindooTenantDirectory");
|
|
8
9
|
const grantKeys_1 = require("./accesscontrol/grantKeys");
|
|
@@ -11,6 +12,7 @@ const types_2 = require("./userkeys/types");
|
|
|
11
12
|
const validateUserKeyDocument_1 = require("./userkeys/validateUserKeyDocument");
|
|
12
13
|
const sealedTypes_1 = require("./userkeys/sealedTypes");
|
|
13
14
|
const recipients_1 = require("./userkeys/recipients");
|
|
15
|
+
const sealedValues_1 = require("./userkeys/sealedValues");
|
|
14
16
|
const sealedCrypto_1 = require("./userkeys/sealedCrypto");
|
|
15
17
|
const MindooDocSigner_1 = require("./crypto/MindooDocSigner");
|
|
16
18
|
const RSAEncryption_1 = require("./crypto/RSAEncryption");
|
|
@@ -33,6 +35,7 @@ const CacheManager_1 = require("./cache/CacheManager");
|
|
|
33
35
|
const databaseIdValidation_1 = require("./databaseIdValidation");
|
|
34
36
|
const BackgroundTaskTracker_1 = require("./BackgroundTaskTracker");
|
|
35
37
|
const singleFlight_1 = require("./utils/singleFlight");
|
|
38
|
+
const dynamicImportInterop_1 = require("./utils/dynamicImportInterop");
|
|
36
39
|
/**
|
|
37
40
|
* BaseMindooTenant is a platform-agnostic implementation of MindooTenant
|
|
38
41
|
* that works in both browser and server environments.
|
|
@@ -59,6 +62,9 @@ class BaseMindooTenant {
|
|
|
59
62
|
* cache).
|
|
60
63
|
*/
|
|
61
64
|
preDecryptedMaterial) {
|
|
65
|
+
/** Open withDecryptedKeyReuse scopes and their shared decryptions. */
|
|
66
|
+
this.decryptedKeyReuseScopes = 0;
|
|
67
|
+
this.decryptedKeyReuse = null;
|
|
62
68
|
this.databaseCache = new Map();
|
|
63
69
|
this.databaseOpenInFlight = new Map();
|
|
64
70
|
this.directoryCache = null;
|
|
@@ -399,6 +405,41 @@ class BaseMindooTenant {
|
|
|
399
405
|
});
|
|
400
406
|
this.sealedGenerations.delete(keyId);
|
|
401
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Seals `value` to people (their published User-Keys) or devices, for a
|
|
410
|
+
* field of a document encrypted with another key (see {@link SealedValue}).
|
|
411
|
+
* `options` as for sealed documents: the current user is included unless
|
|
412
|
+
* `includeSelf` is false; `strict` fails on a recipient without a published
|
|
413
|
+
* User-Key instead of leaving them out.
|
|
414
|
+
*/
|
|
415
|
+
async sealValue(value, recipients, options) {
|
|
416
|
+
const resolved = await (0, recipients_1.resolveRecipientSpecs)({
|
|
417
|
+
tenant: this,
|
|
418
|
+
specs: recipients,
|
|
419
|
+
options,
|
|
420
|
+
addedBy: this.currentUser.userSigningKeyPair.publicKey,
|
|
421
|
+
now: (0, timeSource_1.semanticNow)(),
|
|
422
|
+
});
|
|
423
|
+
const { contentKey, ciphertext } = await (0, sealedValues_1.encryptSealedValueContent)(this.cryptoAdapter, value);
|
|
424
|
+
const sealed = await (0, recipients_1.sealToTargets)({ tenant: this, generations: [contentKey], targets: resolved.targets, epoch: 1 });
|
|
425
|
+
return {
|
|
426
|
+
v: sealedValues_1.SEALED_VALUE_VERSION,
|
|
427
|
+
ciphertext,
|
|
428
|
+
recipients: sealed,
|
|
429
|
+
to: resolved.targets.map((target) => ({ kind: target.kind, keyFingerprint: target.keyFingerprint })),
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Opens a {@link SealedValue} with this identity's User-Key (any generation)
|
|
434
|
+
* or device key. Returns null when it is not sealed to them.
|
|
435
|
+
*/
|
|
436
|
+
async openSealedValue(sealed) {
|
|
437
|
+
const privateKeys = [
|
|
438
|
+
...(await this.userKeys.getUserKeyCryptoKeysForReconcile()),
|
|
439
|
+
await this.getEncryptionPrivateKeyForReconcile(),
|
|
440
|
+
].filter((key) => !!key);
|
|
441
|
+
return (0, sealedValues_1.openSealedValueWithKeys)({ crypto: this.cryptoAdapter, sealed, privateKeys });
|
|
442
|
+
}
|
|
402
443
|
async ingestSealedFromEntries(keyId, entries) {
|
|
403
444
|
if (!(0, sealedTypes_1.isSealedKeyId)(keyId))
|
|
404
445
|
return;
|
|
@@ -988,6 +1029,12 @@ class BaseMindooTenant {
|
|
|
988
1029
|
// canReadDatabase).
|
|
989
1030
|
if (typeof directory.canReadDatabase === "function") {
|
|
990
1031
|
const canRead = await directory.canReadDatabase(id);
|
|
1032
|
+
// Deposit right (doc_deposit, §6.10): the database opens so the user can
|
|
1033
|
+
// create sealed documents and push them; the server refuses every read.
|
|
1034
|
+
if (!canRead && typeof directory.canDepositDatabase === "function" && (await directory.canDepositDatabase(id))) {
|
|
1035
|
+
this.logger.info(`Opening database "${id}" for deposit only (no read access)`);
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
991
1038
|
if (!canRead) {
|
|
992
1039
|
this.logger.warn(`Denied database open for ${currentUser.username}: no read access to database "${id}"`);
|
|
993
1040
|
throw new Error(`User "${currentUser.username}" does not have read access to database "${id}".`);
|
|
@@ -1416,6 +1463,15 @@ class BaseMindooTenant {
|
|
|
1416
1463
|
await directory.registerUser(publicUserId, options.adminSigningKey, options.adminPassword, undefined, deviceLabel, {
|
|
1417
1464
|
distributeKeyIds: [],
|
|
1418
1465
|
});
|
|
1466
|
+
if ((options.depositPrefixes?.length ?? 0) > 0 || (options.accessPrefixes?.length ?? 0) > 0) {
|
|
1467
|
+
if (typeof directory.setGrantPersonalDatabaseRights !== "function") {
|
|
1468
|
+
throw new Error("This directory cannot record personal-database rights (depositPrefixes, accessPrefixes)");
|
|
1469
|
+
}
|
|
1470
|
+
await directory.setGrantPersonalDatabaseRights(publicUserId.username, {
|
|
1471
|
+
...(options.depositPrefixes?.length ? { depositPrefixes: options.depositPrefixes } : {}),
|
|
1472
|
+
...(options.accessPrefixes?.length ? { accessPrefixes: options.accessPrefixes } : {}),
|
|
1473
|
+
}, options.adminSigningKey, options.adminPassword);
|
|
1474
|
+
}
|
|
1419
1475
|
const userPublicKey = typeof request.userPublicKey === "string" ? request.userPublicKey.trim() : "";
|
|
1420
1476
|
if (userPublicKey) {
|
|
1421
1477
|
const userKeyDoc = await this.userKeys.createPendingFromJoin({
|
|
@@ -1587,6 +1643,7 @@ class BaseMindooTenant {
|
|
|
1587
1643
|
adminSigningPublicKey: this.administrationPublicKey,
|
|
1588
1644
|
adminEncryptionPublicKey: this.administrationEncryptionPublicKey,
|
|
1589
1645
|
};
|
|
1646
|
+
let serverSigningPublicKey;
|
|
1590
1647
|
try {
|
|
1591
1648
|
const serverInfoResponse = await fetch(`${baseUrl}/.well-known/mindoodb-server-info`, {
|
|
1592
1649
|
headers: {
|
|
@@ -1611,6 +1668,7 @@ class BaseMindooTenant {
|
|
|
1611
1668
|
|| typeof serverInfoBody.encryptionPublicKey !== "string") {
|
|
1612
1669
|
throw new Error("The server returned an invalid .well-known payload.");
|
|
1613
1670
|
}
|
|
1671
|
+
serverSigningPublicKey = readServerSigningPublicKey(serverInfoBody);
|
|
1614
1672
|
const rsaEncryption = new RSAEncryption_1.RSAEncryption(this.cryptoAdapter);
|
|
1615
1673
|
requestBody.encryptedPublicInfosKey = this.uint8ArrayToBase64(await rsaEncryption.encrypt(publicInfosKeyBytes, serverInfoBody.encryptionPublicKey));
|
|
1616
1674
|
}
|
|
@@ -1650,6 +1708,48 @@ class BaseMindooTenant {
|
|
|
1650
1708
|
}
|
|
1651
1709
|
console.log(`[publishToServer] ✓ Tenant "${this.tenantId}" published to server successfully`);
|
|
1652
1710
|
this.logger.info(`Tenant "${this.tenantId}" published to server successfully`);
|
|
1711
|
+
await this.trustServerAsWitness(serverSigningPublicKey, baseUrl, options);
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Adds the server the tenant was just published to as a trusted witness
|
|
1715
|
+
* (docs/accesscontrol.md §6.4). The server stamps every entry it accepts;
|
|
1716
|
+
* without this directory document those receipts come from an untrusted key,
|
|
1717
|
+
* and once access control is switched on every stamped entry is quarantined.
|
|
1718
|
+
* Trust is evaluated at the receipt's `receivedAt`, so it has to be in place
|
|
1719
|
+
* before the first entry is pushed: that is why the publish flow writes it.
|
|
1720
|
+
*
|
|
1721
|
+
* Needs the administration private key: {@link PublishToServerOptions.adminSigningKey}
|
|
1722
|
+
* and `adminPassword`, or a `systemAdminUser` that is the tenant admin (demo
|
|
1723
|
+
* servers with open tenant creation). Without it a warning is logged and the
|
|
1724
|
+
* admin has to call `MindooTenantDirectory.addTrustedWitness()` before pushing.
|
|
1725
|
+
*/
|
|
1726
|
+
async trustServerAsWitness(serverSigningPublicKey, serverUrl, options) {
|
|
1727
|
+
if (options?.skipTrustedWitness)
|
|
1728
|
+
return;
|
|
1729
|
+
if (!serverSigningPublicKey) {
|
|
1730
|
+
this.logger.warn(`[publishToServer] ${serverUrl} did not report a signing key; it was not added as a trusted witness`);
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
let adminKey = options?.adminSigningKey;
|
|
1734
|
+
let adminPassword = options?.adminPassword;
|
|
1735
|
+
if ((!adminKey || adminPassword === undefined) &&
|
|
1736
|
+
options?.systemAdminUser &&
|
|
1737
|
+
options.systemAdminPassword !== undefined &&
|
|
1738
|
+
options.systemAdminUser.userSigningKeyPair.publicKey === this.administrationPublicKey) {
|
|
1739
|
+
adminKey = options.systemAdminUser.userSigningKeyPair.privateKey;
|
|
1740
|
+
adminPassword = options.systemAdminPassword;
|
|
1741
|
+
}
|
|
1742
|
+
const directory = await this.openDirectory();
|
|
1743
|
+
const trustedNow = await directory.getTrustedWitnessKeysAt?.(Date.now());
|
|
1744
|
+
if (trustedNow?.has(serverSigningPublicKey))
|
|
1745
|
+
return;
|
|
1746
|
+
if (!adminKey || adminPassword === undefined || !directory.addTrustedWitness) {
|
|
1747
|
+
console.warn(`[publishToServer] ${serverUrl} was not added as a trusted witness (no administration key given). ` +
|
|
1748
|
+
`Call directory.addTrustedWitness() before pushing data, or entries it stamps are quarantined once access control is enabled.`);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
await directory.addTrustedWitness({ witnessPublicKey: serverSigningPublicKey, serverUrl }, adminKey, adminPassword);
|
|
1752
|
+
this.logger.info(`Added ${serverUrl} as a trusted witness of tenant "${this.tenantId}"`);
|
|
1653
1753
|
}
|
|
1654
1754
|
resolveIrohDial(serverUrl, options) {
|
|
1655
1755
|
if (!(0, irohLocator_1.isIrohLocator)(serverUrl) && !options?.irohTicket) {
|
|
@@ -1665,7 +1765,7 @@ class BaseMindooTenant {
|
|
|
1665
1765
|
return { ticket, io: options.irohStreamIO };
|
|
1666
1766
|
}
|
|
1667
1767
|
async publishToIrohServer(target, options) {
|
|
1668
|
-
const
|
|
1768
|
+
const IrohNetworkTransport = (0, dynamicImportInterop_1.namedExport)(await import("./appendonlystores/network/IrohNetworkTransport.js"), "IrohNetworkTransport");
|
|
1669
1769
|
const transport = new IrohNetworkTransport(target.io, target.ticket, {
|
|
1670
1770
|
tenantId: this.tenantId,
|
|
1671
1771
|
});
|
|
@@ -1678,6 +1778,7 @@ class BaseMindooTenant {
|
|
|
1678
1778
|
adminEncryptionPublicKey: this.administrationEncryptionPublicKey,
|
|
1679
1779
|
};
|
|
1680
1780
|
let supportsSystemAdmin = false;
|
|
1781
|
+
let serverSigningPublicKey;
|
|
1681
1782
|
try {
|
|
1682
1783
|
const serverInfo = await transport.getServerInfo();
|
|
1683
1784
|
if (!serverInfo
|
|
@@ -1687,6 +1788,7 @@ class BaseMindooTenant {
|
|
|
1687
1788
|
throw new Error("The server returned an invalid Iroh server-info payload.");
|
|
1688
1789
|
}
|
|
1689
1790
|
supportsSystemAdmin = serverInfo.supportsSystemAdmin === true;
|
|
1791
|
+
serverSigningPublicKey = readServerSigningPublicKey(serverInfo);
|
|
1690
1792
|
const rsaEncryption = new RSAEncryption_1.RSAEncryption(this.cryptoAdapter);
|
|
1691
1793
|
requestBody.encryptedPublicInfosKey = this.uint8ArrayToBase64(await rsaEncryption.encrypt(publicInfosKeyBytes, serverInfo.encryptionPublicKey));
|
|
1692
1794
|
}
|
|
@@ -1714,13 +1816,14 @@ class BaseMindooTenant {
|
|
|
1714
1816
|
await transport.registerTenant(token, this.tenantId, requestBody);
|
|
1715
1817
|
console.log(`[publishToServer] ✓ Tenant "${this.tenantId}" published to server successfully`);
|
|
1716
1818
|
this.logger.info(`Tenant "${this.tenantId}" published to server successfully`);
|
|
1819
|
+
await this.trustServerAsWitness(serverSigningPublicKey, `iroh:${target.ticket}`, options);
|
|
1717
1820
|
}
|
|
1718
1821
|
async authenticateAsSystemAdminOverIroh(transport, adminUser, adminPassword) {
|
|
1719
1822
|
const subtle = this.cryptoAdapter.getSubtle();
|
|
1720
1823
|
const signingKeyBuffer = await this.decryptPrivateKey(adminUser.userSigningKeyPair.privateKey, adminPassword, "signing");
|
|
1721
1824
|
const signingKey = await subtle.importKey("pkcs8", signingKeyBuffer, { name: "Ed25519" }, false, ["sign"]);
|
|
1722
1825
|
const { challenge } = await transport.requestSystemChallenge(adminUser.username, adminUser.userSigningKeyPair.publicKey);
|
|
1723
|
-
const messageBytes =
|
|
1826
|
+
const messageBytes = (0, AuthChallenge_1.authChallengeSigningBytes)(challenge);
|
|
1724
1827
|
const signatureBuffer = await subtle.sign({ name: "Ed25519" }, signingKey, messageBytes);
|
|
1725
1828
|
const result = await transport.authenticateSystem(challenge, new Uint8Array(signatureBuffer));
|
|
1726
1829
|
if (!result.success || !result.token) {
|
|
@@ -1751,7 +1854,7 @@ class BaseMindooTenant {
|
|
|
1751
1854
|
}
|
|
1752
1855
|
const { challenge } = (await challengeRes.json());
|
|
1753
1856
|
// Step 2: Sign the challenge
|
|
1754
|
-
const messageBytes =
|
|
1857
|
+
const messageBytes = (0, AuthChallenge_1.authChallengeSigningBytes)(challenge);
|
|
1755
1858
|
const signatureBuffer = await subtle.sign({ name: "Ed25519" }, signingKey, messageBytes);
|
|
1756
1859
|
const signatureBase64 = this.uint8ArrayToBase64(new Uint8Array(signatureBuffer));
|
|
1757
1860
|
// Step 3: Authenticate
|
|
@@ -1787,14 +1890,14 @@ class BaseMindooTenant {
|
|
|
1787
1890
|
}
|
|
1788
1891
|
const remoteStorePromise = (async () => {
|
|
1789
1892
|
// Lazy-import network modules to avoid circular dependencies and keep core lightweight
|
|
1790
|
-
const
|
|
1893
|
+
const ClientNetworkContentAddressedStore = (0, dynamicImportInterop_1.namedExport)(await import("../appendonlystores/network/ClientNetworkContentAddressedStore.js"), "ClientNetworkContentAddressedStore");
|
|
1791
1894
|
const transport = irohTarget
|
|
1792
|
-
? new (await import("./appendonlystores/network/IrohNetworkTransport.js"))
|
|
1895
|
+
? new ((0, dynamicImportInterop_1.namedExport)(await import("./appendonlystores/network/IrohNetworkTransport.js"), "IrohNetworkTransport"))(irohTarget.io, irohTarget.ticket, {
|
|
1793
1896
|
tenantId: this.tenantId,
|
|
1794
1897
|
dbId: validDbId,
|
|
1795
1898
|
storeKind,
|
|
1796
1899
|
})
|
|
1797
|
-
: new (await import("../appendonlystores/network/HttpTransport.js"))
|
|
1900
|
+
: new ((0, dynamicImportInterop_1.namedExport)(await import("../appendonlystores/network/HttpTransport.js"), "HttpTransport"))({
|
|
1798
1901
|
baseUrl: `${normalizedServerUrl}/${this.tenantId}`,
|
|
1799
1902
|
tenantId: this.tenantId,
|
|
1800
1903
|
dbId: validDbId,
|
|
@@ -1897,6 +2000,49 @@ class BaseMindooTenant {
|
|
|
1897
2000
|
* @returns The decrypted private key as ArrayBuffer
|
|
1898
2001
|
*/
|
|
1899
2002
|
async decryptPrivateKey(encryptedKey, password, saltString) {
|
|
2003
|
+
if (this.decryptedKeyReuse) {
|
|
2004
|
+
// Inside withDecryptedKeyReuse: the same key object, password and salt
|
|
2005
|
+
// decrypt to the same bytes, so the PBKDF2 run is shared. A wrong
|
|
2006
|
+
// password is its own cache entry and fails like before.
|
|
2007
|
+
let byKey = this.decryptedKeyReuse.get(encryptedKey);
|
|
2008
|
+
if (!byKey) {
|
|
2009
|
+
byKey = new Map();
|
|
2010
|
+
this.decryptedKeyReuse.set(encryptedKey, byKey);
|
|
2011
|
+
}
|
|
2012
|
+
const cacheKey = `${saltString}\u0000${password}`;
|
|
2013
|
+
let pending = byKey.get(cacheKey);
|
|
2014
|
+
if (!pending) {
|
|
2015
|
+
pending = this.decryptPrivateKeyUncached(encryptedKey, password, saltString);
|
|
2016
|
+
byKey.set(cacheKey, pending);
|
|
2017
|
+
pending.catch(() => byKey.delete(cacheKey));
|
|
2018
|
+
}
|
|
2019
|
+
return (await pending).slice(0);
|
|
2020
|
+
}
|
|
2021
|
+
return this.decryptPrivateKeyUncached(encryptedKey, password, saltString);
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* Shares private key decryption (PBKDF2, the dominant cost of an admin
|
|
2025
|
+
* operation) between all calls made while `fn` runs, e.g. a batch of
|
|
2026
|
+
* user registrations signed with the same administration key. Checks are
|
|
2027
|
+
* unchanged: every caller still passes key and password, a different
|
|
2028
|
+
* password is decrypted on its own, and signatures are still verified
|
|
2029
|
+
* against the claimed public key. The decrypted keys are dropped when the
|
|
2030
|
+
* last open scope ends.
|
|
2031
|
+
*/
|
|
2032
|
+
async withDecryptedKeyReuse(fn) {
|
|
2033
|
+
if (this.decryptedKeyReuseScopes++ === 0) {
|
|
2034
|
+
this.decryptedKeyReuse = new WeakMap();
|
|
2035
|
+
}
|
|
2036
|
+
try {
|
|
2037
|
+
return await fn();
|
|
2038
|
+
}
|
|
2039
|
+
finally {
|
|
2040
|
+
if (--this.decryptedKeyReuseScopes === 0) {
|
|
2041
|
+
this.decryptedKeyReuse = null;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
async decryptPrivateKeyUncached(encryptedKey, password, saltString) {
|
|
1900
2046
|
// Do NOT log the password length or KDF iteration count (audit, Medium:
|
|
1901
2047
|
// sensitive debug logging) — both narrow an offline cracking search space.
|
|
1902
2048
|
this.logger.debug(`decryptPrivateKey: Starting decryption (keyCategory: ${saltString})`);
|
|
@@ -2439,4 +2585,9 @@ BaseMindooTenant.DB_CACHE_RECORD_TYPES = [
|
|
|
2439
2585
|
*/
|
|
2440
2586
|
BaseMindooTenant.ENCRYPTION_MODE_RANDOM = 0x00;
|
|
2441
2587
|
BaseMindooTenant.ENCRYPTION_MODE_DETERMINISTIC = 0x01;
|
|
2588
|
+
/** The server's Ed25519 signing key (its witness key) from its server-info payload. */
|
|
2589
|
+
function readServerSigningPublicKey(serverInfo) {
|
|
2590
|
+
const key = serverInfo?.signingPublicKey;
|
|
2591
|
+
return typeof key === "string" && key.length > 0 ? key : undefined;
|
|
2592
|
+
}
|
|
2442
2593
|
//# sourceMappingURL=BaseMindooTenant.js.map
|