mindoodb 0.0.1
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.md +263 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts +5 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts.map +1 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js +17 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js.map +1 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +111 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +237 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -0
- package/dist/appendonlystores/network/HttpTransport.d.ts +78 -0
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -0
- package/dist/appendonlystores/network/HttpTransport.js +356 -0
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +131 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +248 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -0
- package/dist/appendonlystores/network/index.d.ts +8 -0
- package/dist/appendonlystores/network/index.d.ts.map +1 -0
- package/dist/appendonlystores/network/index.js +21 -0
- package/dist/appendonlystores/network/index.js.map +1 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.d.ts +14 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.d.ts.map +1 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.js +30 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.js.map +1 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +26 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/core/BaseMindooDB.d.ts +182 -0
- package/dist/core/BaseMindooDB.d.ts.map +1 -0
- package/dist/core/BaseMindooDB.js +1701 -0
- package/dist/core/BaseMindooDB.js.map +1 -0
- package/dist/core/BaseMindooTenant.d.ts +155 -0
- package/dist/core/BaseMindooTenant.d.ts.map +1 -0
- package/dist/core/BaseMindooTenant.js +673 -0
- package/dist/core/BaseMindooTenant.js.map +1 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts +99 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -0
- package/dist/core/BaseMindooTenantDirectory.js +776 -0
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -0
- package/dist/core/BaseMindooTenantFactory.d.ts +91 -0
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -0
- package/dist/core/BaseMindooTenantFactory.js +297 -0
- package/dist/core/BaseMindooTenantFactory.js.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +111 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +293 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +78 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/AuthenticationService.js +297 -0
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -0
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts +174 -0
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/NetworkTransport.js +3 -0
- package/dist/core/appendonlystores/network/NetworkTransport.js.map +1 -0
- package/dist/core/appendonlystores/network/types.d.ts +135 -0
- package/dist/core/appendonlystores/network/types.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/types.js +35 -0
- package/dist/core/appendonlystores/network/types.js.map +1 -0
- package/dist/core/appendonlystores/types.d.ts +157 -0
- package/dist/core/appendonlystores/types.d.ts.map +1 -0
- package/dist/core/appendonlystores/types.js +3 -0
- package/dist/core/appendonlystores/types.js.map +1 -0
- package/dist/core/crypto/CryptoAdapter.d.ts +19 -0
- package/dist/core/crypto/CryptoAdapter.d.ts.map +1 -0
- package/dist/core/crypto/CryptoAdapter.js +3 -0
- package/dist/core/crypto/CryptoAdapter.js.map +1 -0
- package/dist/core/crypto/MindooDocSigner.d.ts +106 -0
- package/dist/core/crypto/MindooDocSigner.d.ts.map +1 -0
- package/dist/core/crypto/MindooDocSigner.js +192 -0
- package/dist/core/crypto/MindooDocSigner.js.map +1 -0
- package/dist/core/crypto/RSAEncryption.d.ts +62 -0
- package/dist/core/crypto/RSAEncryption.d.ts.map +1 -0
- package/dist/core/crypto/RSAEncryption.js +167 -0
- package/dist/core/crypto/RSAEncryption.js.map +1 -0
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +53 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.d.ts +33 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.js +27 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.js.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts +31 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.js +3 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +52 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +106 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts +44 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js +107 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts +28 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js +133 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualView.d.ts +109 -0
- package/dist/core/indexing/virtualviews/VirtualView.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualView.js +504 -0
- package/dist/core/indexing/virtualviews/VirtualView.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts +59 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js +70 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.d.ts +49 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.js +69 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts +121 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js +365 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts +131 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js +236 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.d.ts +330 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.js +1010 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.js.map +1 -0
- package/dist/core/indexing/virtualviews/index.d.ts +53 -0
- package/dist/core/indexing/virtualviews/index.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/index.js +89 -0
- package/dist/core/indexing/virtualviews/index.js.map +1 -0
- package/dist/core/indexing/virtualviews/types.d.ts +115 -0
- package/dist/core/indexing/virtualviews/types.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/types.js +175 -0
- package/dist/core/indexing/virtualviews/types.js.map +1 -0
- package/dist/core/keys/KeyBag.d.ts +122 -0
- package/dist/core/keys/KeyBag.d.ts.map +1 -0
- package/dist/core/keys/KeyBag.js +401 -0
- package/dist/core/keys/KeyBag.js.map +1 -0
- package/dist/core/types.d.ts +1004 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/userid/index.d.ts +53 -0
- package/dist/core/userid/index.d.ts.map +1 -0
- package/dist/core/userid/index.js +3 -0
- package/dist/core/userid/index.js.map +1 -0
- package/dist/core/utils/idGeneration.d.ts +109 -0
- package/dist/core/utils/idGeneration.d.ts.map +1 -0
- package/dist/core/utils/idGeneration.js +182 -0
- package/dist/core/utils/idGeneration.js.map +1 -0
- package/dist/core/utils/index.d.ts +5 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +19 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/node/crypto/NodeCryptoAdapter.d.ts +16 -0
- package/dist/node/crypto/NodeCryptoAdapter.d.ts.map +1 -0
- package/dist/node/crypto/NodeCryptoAdapter.js +53 -0
- package/dist/node/crypto/NodeCryptoAdapter.js.map +1 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +26 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,1004 @@
|
|
|
1
|
+
import type { KeyBag } from "./keys/KeyBag";
|
|
2
|
+
import type { PublicUserId, PrivateUserId } from "./userid";
|
|
3
|
+
import type { ContentAddressedStore, OpenStoreOptions } from "./appendonlystores/types";
|
|
4
|
+
import type { CryptoAdapter } from "./crypto/CryptoAdapter";
|
|
5
|
+
import { MindooDocSigner } from "./crypto/MindooDocSigner";
|
|
6
|
+
/**
|
|
7
|
+
* Well-known key ID for access control documents (grantaccess, revokeaccess, groups).
|
|
8
|
+
* All servers and clients MUST have this key in their KeyBag to verify user access.
|
|
9
|
+
* This enables servers to validate users without having full tenant data access.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PUBLIC_INFOS_KEY_ID = "$publicinfos";
|
|
12
|
+
/**
|
|
13
|
+
* An EncryptedPrivateKey is a private key that is encrypted with a password.
|
|
14
|
+
* Used for both asymmetric keys (RSA, Ed25519, ECDH) and symmetric keys (AES-256).
|
|
15
|
+
*/
|
|
16
|
+
export interface EncryptedPrivateKey {
|
|
17
|
+
ciphertext: string;
|
|
18
|
+
iv: string;
|
|
19
|
+
tag: string;
|
|
20
|
+
salt: string;
|
|
21
|
+
iterations: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional timestamp for key rotation support (milliseconds since Unix epoch)
|
|
24
|
+
* Newer keys should be tried first when decrypting
|
|
25
|
+
*/
|
|
26
|
+
createdAt?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A signing key pair containing both the public and encrypted private key.
|
|
30
|
+
* The public key is needed for signature verification by other users.
|
|
31
|
+
*/
|
|
32
|
+
export interface SigningKeyPair {
|
|
33
|
+
/**
|
|
34
|
+
* The public signing key (Ed25519, PEM format).
|
|
35
|
+
* This is used by others to verify signatures created with the private key.
|
|
36
|
+
*/
|
|
37
|
+
publicKey: string;
|
|
38
|
+
/**
|
|
39
|
+
* The encrypted private signing key (Ed25519).
|
|
40
|
+
* This is used to create signatures.
|
|
41
|
+
*/
|
|
42
|
+
privateKey: EncryptedPrivateKey;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An encryption key pair containing both the public and encrypted private key.
|
|
46
|
+
* The public key can be shared with others to allow them to encrypt data specifically for the key owner.
|
|
47
|
+
* Only the owner with the private key can decrypt the data.
|
|
48
|
+
*/
|
|
49
|
+
export interface EncryptionKeyPair {
|
|
50
|
+
/**
|
|
51
|
+
* The public encryption key (RSA-OAEP, PEM format).
|
|
52
|
+
* This can be shared with others to allow them to encrypt data for the key owner.
|
|
53
|
+
*/
|
|
54
|
+
publicKey: string;
|
|
55
|
+
/**
|
|
56
|
+
* The encrypted private encryption key (RSA-OAEP).
|
|
57
|
+
* This is used to decrypt data encrypted with the corresponding public key.
|
|
58
|
+
*/
|
|
59
|
+
privateKey: EncryptedPrivateKey;
|
|
60
|
+
}
|
|
61
|
+
export type { PublicUserId, PrivateUserId };
|
|
62
|
+
/**
|
|
63
|
+
* A TenantFactory is a factory for creating and managing tenants.
|
|
64
|
+
*/
|
|
65
|
+
export interface MindooTenantFactory {
|
|
66
|
+
/**
|
|
67
|
+
* Create a new tenant with a new tenant encryption key.
|
|
68
|
+
*
|
|
69
|
+
* The tenant encryption key is used as the default document encryption key
|
|
70
|
+
* (so that all data within the tenant is secure by default).
|
|
71
|
+
*
|
|
72
|
+
* The administration public key must be created beforehand using createSigningKeyPair()
|
|
73
|
+
* and passed to this method. The administration key is used for administrative operations
|
|
74
|
+
* within the tenant, such as adding new users to the tenant.
|
|
75
|
+
*
|
|
76
|
+
* The administration encryption public key must be created using createEncryptionKeyPair()
|
|
77
|
+
* and is used to encrypt sensitive data in the directory that only admins can decrypt
|
|
78
|
+
* (e.g., usernames in access control documents).
|
|
79
|
+
*
|
|
80
|
+
* @param tenantId The ID of the tenant
|
|
81
|
+
* @param administrationPublicKey The administration public key (Ed25519, PEM format) created using createSigningKeyPair()
|
|
82
|
+
* @param administrationEncryptionPublicKey The administration encryption public key (RSA-OAEP, PEM format) created using createEncryptionKeyPair()
|
|
83
|
+
* @param tenantEncryptionKeyPassword The password to be set to decrypt the tenant encryption private key
|
|
84
|
+
* @param currentUser The current user's private user ID (required for tenant operations)
|
|
85
|
+
* @param currentUserPassword The password to decrypt the current user's private keys
|
|
86
|
+
* @param keyBag The KeyBag instance for storing and loading named encrypted keys
|
|
87
|
+
* @return The new tenant
|
|
88
|
+
*/
|
|
89
|
+
createTenant(tenantId: string, administrationPublicKey: string, administrationEncryptionPublicKey: string, tenantEncryptionKeyPassword: string, currentUser: PrivateUserId, currentUserPassword: string, keyBag: KeyBag): Promise<MindooTenant>;
|
|
90
|
+
/**
|
|
91
|
+
* Opens an existing tenant with previously created keys.
|
|
92
|
+
*
|
|
93
|
+
* @param tenantId The ID of the tenant
|
|
94
|
+
* @param tenantEncryptionPrivateKey The tenant encryption key (AES-256, encrypted)
|
|
95
|
+
* @param tenantEncryptionKeyPassword The password to decrypt the tenant encryption key
|
|
96
|
+
* @param administrationPublicKey The administration public key (Ed25519, PEM format)
|
|
97
|
+
* @param administrationEncryptionPublicKey The administration encryption public key (RSA-OAEP, PEM format)
|
|
98
|
+
* @param currentUser The current user's private user ID (required for tenant operations)
|
|
99
|
+
* @param currentUserPassword The password to decrypt the current user's private keys
|
|
100
|
+
* @param keyBag The KeyBag instance for storing and loading named encrypted keys
|
|
101
|
+
* @return The tenant
|
|
102
|
+
*/
|
|
103
|
+
openTenantWithKeys(tenantId: string, tenantEncryptionPrivateKey: EncryptedPrivateKey, tenantEncryptionKeyPassword: string, administrationPublicKey: string, administrationEncryptionPublicKey: string, currentUser: PrivateUserId, currentUserPassword: string, keyBag: KeyBag): Promise<MindooTenant>;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new user with separate signing and encryption key pairs.
|
|
106
|
+
*
|
|
107
|
+
* @param username The username of the user (format: "CN=<username>/O=<tenantId>")
|
|
108
|
+
* @param password The password to encrypt both private keys (via key derivation with different salts)
|
|
109
|
+
* @return The new user ID
|
|
110
|
+
*/
|
|
111
|
+
createUserId(username: string, password: string): Promise<PrivateUserId>;
|
|
112
|
+
/**
|
|
113
|
+
* Removes the private information from a private user ID and returns a public user ID.
|
|
114
|
+
*
|
|
115
|
+
* @param privateUserId The private user ID to convert to a public user ID
|
|
116
|
+
* @return The public user ID
|
|
117
|
+
*/
|
|
118
|
+
toPublicUserId(privateUserId: PrivateUserId): PublicUserId;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a new signing key pair for the tenant.
|
|
121
|
+
* Returns both the public and encrypted private key, as the public key is needed
|
|
122
|
+
* for signature verification by other users.
|
|
123
|
+
*
|
|
124
|
+
* @param password The password to encrypt the signing private key with
|
|
125
|
+
* @return The signing key pair containing both public key (PEM format) and encrypted private key (Ed25519)
|
|
126
|
+
*/
|
|
127
|
+
createSigningKeyPair(password: string): Promise<SigningKeyPair>;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new encrypted symmetric key (AES-256) for document encryption.
|
|
130
|
+
* The key is encrypted with the provided password and can be distributed to authorized users.
|
|
131
|
+
* Use KeyBag.decryptAndImportKey() to store the returned key in the user's KeyBag.
|
|
132
|
+
*
|
|
133
|
+
* Symmetric keys are shared secrets - anyone with the key can both encrypt and decrypt.
|
|
134
|
+
* For user-to-user encryption where only the recipient can decrypt, use createEncryptionKeyPair() instead.
|
|
135
|
+
*
|
|
136
|
+
* @param password The password to encrypt the symmetric key with (mandatory)
|
|
137
|
+
* @return The encrypted symmetric key that can be distributed to authorized users
|
|
138
|
+
*/
|
|
139
|
+
createSymmetricEncryptedPrivateKey(password: string): Promise<EncryptedPrivateKey>;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a new asymmetric encryption key pair (RSA-OAEP) for user-to-user encryption.
|
|
142
|
+
* Returns both the public and encrypted private key.
|
|
143
|
+
*
|
|
144
|
+
* Use case: User A can fetch User B's public key from the directory DB, encrypt data with it,
|
|
145
|
+
* and only User B (with the private key) can decrypt it. This enables secure point-to-point
|
|
146
|
+
* encryption without sharing symmetric keys.
|
|
147
|
+
*
|
|
148
|
+
* @param password The password to encrypt the private key with (mandatory)
|
|
149
|
+
* @return The encryption key pair containing both public key (PEM format) and encrypted private key (RSA-OAEP)
|
|
150
|
+
*/
|
|
151
|
+
createEncryptionKeyPair(password: string): Promise<EncryptionKeyPair>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A MindooTenant contains multiple MindooDB in an organization. One MindooDB is a mandatory part
|
|
155
|
+
* of every tenant and called "directory". It contains all users and their public keys that
|
|
156
|
+
* have access to the tenant and are considered trusted users.
|
|
157
|
+
*
|
|
158
|
+
* Note on access revocation: Due to the append-only nature of the store, revoking a user's access
|
|
159
|
+
* prevents them from decrypting future document changes, but they retain access to previously
|
|
160
|
+
* decrypted changes. This is a fundamental tradeoff of append-only stores.
|
|
161
|
+
*/
|
|
162
|
+
export interface MindooTenant {
|
|
163
|
+
/**
|
|
164
|
+
* Get the factory that was used to create this tenant.
|
|
165
|
+
*
|
|
166
|
+
* @return The factory that was used to create this tenant
|
|
167
|
+
*/
|
|
168
|
+
getFactory(): MindooTenantFactory;
|
|
169
|
+
/**
|
|
170
|
+
* Get the ID of the tenant (UUID7 format)
|
|
171
|
+
*
|
|
172
|
+
* @return The ID of the tenant
|
|
173
|
+
*/
|
|
174
|
+
getId(): string;
|
|
175
|
+
/**
|
|
176
|
+
* Get the administration public key for this tenant.
|
|
177
|
+
* Used for creating document signers for administrative operations and verifying
|
|
178
|
+
* signatures on administrative documents (e.g., user registration, revocation).
|
|
179
|
+
*
|
|
180
|
+
* @return The administration public key (Ed25519, PEM format)
|
|
181
|
+
*/
|
|
182
|
+
getAdministrationPublicKey(): string;
|
|
183
|
+
/**
|
|
184
|
+
* Get the administration encryption public key for this tenant.
|
|
185
|
+
* Used for encrypting sensitive data in the directory that only admins can decrypt
|
|
186
|
+
* (e.g., usernames in access control documents).
|
|
187
|
+
*
|
|
188
|
+
* @return The administration encryption public key (RSA-OAEP, PEM format)
|
|
189
|
+
*/
|
|
190
|
+
getAdministrationEncryptionPublicKey(): string;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the encryption key used to encrypt all communication in this tenant
|
|
193
|
+
* (e.g. the document changesets).
|
|
194
|
+
*
|
|
195
|
+
* Note: This is a symmetric key (AES-256) used ONLY for encryption/decryption, not for signing.
|
|
196
|
+
*
|
|
197
|
+
* @return The tenant encryption key (AES-256, encrypted)
|
|
198
|
+
*/
|
|
199
|
+
getTenantEncryptionKey(): EncryptedPrivateKey;
|
|
200
|
+
/**
|
|
201
|
+
* Encrypt a payload using the symmetric key identified by decryptionKeyId.
|
|
202
|
+
* For "default", uses the tenant encryption key.
|
|
203
|
+
* For named keys, uses the named symmetric key (trying newest versions first for key rotation).
|
|
204
|
+
* This method handles all key management internally.
|
|
205
|
+
*
|
|
206
|
+
* @param payload The payload to encrypt (binary data)
|
|
207
|
+
* @param decryptionKeyId The key ID ("default" or a named key ID)
|
|
208
|
+
* @return The encrypted payload (binary data, AES-256-GCM)
|
|
209
|
+
*/
|
|
210
|
+
encryptPayload(payload: Uint8Array, decryptionKeyId: string): Promise<Uint8Array>;
|
|
211
|
+
/**
|
|
212
|
+
* Decrypt a payload using the symmetric key identified by decryptionKeyId.
|
|
213
|
+
* For "default", uses the tenant encryption key.
|
|
214
|
+
* For named keys, uses the named symmetric key (trying newest versions first for key rotation).
|
|
215
|
+
* This method handles all key management internally.
|
|
216
|
+
*
|
|
217
|
+
* @param encryptedPayload The encrypted payload to decrypt (binary data, AES-256-GCM)
|
|
218
|
+
* @param decryptionKeyId The key ID ("default" or a named key ID)
|
|
219
|
+
* @return The decrypted payload (binary data)
|
|
220
|
+
*/
|
|
221
|
+
decryptPayload(encryptedPayload: Uint8Array, decryptionKeyId: string): Promise<Uint8Array>;
|
|
222
|
+
/**
|
|
223
|
+
* Validates a public signing key by checking if it belongs to a trusted user in the tenant.
|
|
224
|
+
* This is used for signature verification when loading changes from the append-only store.
|
|
225
|
+
*
|
|
226
|
+
* @param publicKey The public signing key to validate (Ed25519, PEM format)
|
|
227
|
+
* @return True if the public key belongs to a trusted (registered and not revoked) user, false otherwise
|
|
228
|
+
*/
|
|
229
|
+
validatePublicSigningKey(publicKey: string): Promise<boolean>;
|
|
230
|
+
/**
|
|
231
|
+
* Get the current user ID for the tenant.
|
|
232
|
+
* This provides user context for operations that need to know which user is performing them.
|
|
233
|
+
* Used for signing document changes.
|
|
234
|
+
*
|
|
235
|
+
* @return The current user's public user ID (always set, never null)
|
|
236
|
+
*/
|
|
237
|
+
getCurrentUserId(): Promise<PublicUserId>;
|
|
238
|
+
/**
|
|
239
|
+
* Sign a payload with the current user's signing private key.
|
|
240
|
+
* This is used by MindooDB operations (like changeDoc) to sign document changes.
|
|
241
|
+
* The signature proves authenticity and integrity of the payload.
|
|
242
|
+
*
|
|
243
|
+
* @param payload The payload to sign (binary data)
|
|
244
|
+
* @return The signature (Ed25519 signature as Uint8Array)
|
|
245
|
+
*/
|
|
246
|
+
signPayload(payload: Uint8Array): Promise<Uint8Array>;
|
|
247
|
+
/**
|
|
248
|
+
* Sign a payload with a specific signing key pair.
|
|
249
|
+
* This is used for operations that need to sign with a different key than the current user's,
|
|
250
|
+
* such as directory operations that must be signed with the administration key.
|
|
251
|
+
*
|
|
252
|
+
* @param payload The payload to sign (binary data)
|
|
253
|
+
* @param signingKeyPair The signing key pair to use (Ed25519)
|
|
254
|
+
* @param password The password to decrypt the signing private key
|
|
255
|
+
* @return The signature (Ed25519 signature as Uint8Array)
|
|
256
|
+
*/
|
|
257
|
+
signPayloadWithKey(payload: Uint8Array, signingKeyPair: SigningKeyPair, password: string): Promise<Uint8Array>;
|
|
258
|
+
/**
|
|
259
|
+
* Verify a signature for a payload with a public key.
|
|
260
|
+
*
|
|
261
|
+
* @param payload The payload to verify the signature for (binary data)
|
|
262
|
+
* @param signature The signature to verify (Ed25519 signature as Uint8Array)
|
|
263
|
+
* @param publicKey The public key to verify the signature with (Ed25519, PEM format)
|
|
264
|
+
* @return True if the signature is valid, false otherwise
|
|
265
|
+
*/
|
|
266
|
+
verifySignature(payload: Uint8Array, signature: Uint8Array, publicKey: string): Promise<boolean>;
|
|
267
|
+
/**
|
|
268
|
+
* Method to open the directory for this tenant
|
|
269
|
+
*
|
|
270
|
+
* @return The directory
|
|
271
|
+
*/
|
|
272
|
+
openDirectory(): Promise<MindooTenantDirectory>;
|
|
273
|
+
/**
|
|
274
|
+
* Opens a database for this tenant.
|
|
275
|
+
* Creates the database if it doesn't exist.
|
|
276
|
+
*
|
|
277
|
+
* @param id The ID of the database
|
|
278
|
+
* @param options Optional configuration including store options and adminOnlyDb flag
|
|
279
|
+
* @return The database instance
|
|
280
|
+
*/
|
|
281
|
+
openDB(id: string, options?: OpenDBOptions): Promise<MindooDB>;
|
|
282
|
+
/**
|
|
283
|
+
* Creates a MindooDocSigner instance for signing and verifying document items.
|
|
284
|
+
* The signer uses the tenant's cryptographic infrastructure for key management.
|
|
285
|
+
*
|
|
286
|
+
* @param signKey The signing key pair to use for document item signatures
|
|
287
|
+
* @return A MindooDocSigner instance configured with this tenant and the provided signing key
|
|
288
|
+
*/
|
|
289
|
+
createDocSignerFor(signKey: SigningKeyPair): MindooDocSigner;
|
|
290
|
+
/**
|
|
291
|
+
* Get the crypto adapter for this tenant.
|
|
292
|
+
* The crypto adapter provides access to the Web Crypto API (SubtleCrypto).
|
|
293
|
+
*
|
|
294
|
+
* @return The crypto adapter
|
|
295
|
+
*/
|
|
296
|
+
getCryptoAdapter(): CryptoAdapter;
|
|
297
|
+
}
|
|
298
|
+
export type { ContentAddressedStore, ContentAddressedStoreFactory, CreateStoreResult, OpenStoreOptions } from "./appendonlystores/types";
|
|
299
|
+
/**
|
|
300
|
+
* The type of entry stored in the ContentAddressedStore.
|
|
301
|
+
* Entry types are prefixed to indicate their domain:
|
|
302
|
+
* - doc_* entries are for Automerge document operations
|
|
303
|
+
* - attachment_* entries are for file attachment storage
|
|
304
|
+
*/
|
|
305
|
+
export type StoreEntryType = "doc_create" | "doc_change" | "doc_snapshot" | "doc_delete" | "attachment_chunk";
|
|
306
|
+
/**
|
|
307
|
+
* Metadata for entries stored in the ContentAddressedStore.
|
|
308
|
+
* This contains all information except the actual encrypted payload,
|
|
309
|
+
* making it efficient for synchronization negotiations.
|
|
310
|
+
*/
|
|
311
|
+
export interface StoreEntryMetadata {
|
|
312
|
+
/**
|
|
313
|
+
* The type of this entry, indicating what kind of data it contains.
|
|
314
|
+
*/
|
|
315
|
+
entryType: StoreEntryType;
|
|
316
|
+
/**
|
|
317
|
+
* Unique identifier for this entry (primary key in the store).
|
|
318
|
+
* - For doc_* entries: "<docId>_d_<depsFingerprint>_<automergeHash>"
|
|
319
|
+
* - For attachment_chunk: "<docId>_a_<fileUuid7>_<base62ChunkUuid7>"
|
|
320
|
+
*
|
|
321
|
+
* The structured ID format enables:
|
|
322
|
+
* - Guaranteed uniqueness across documents
|
|
323
|
+
* - Efficient prefix-based queries
|
|
324
|
+
* - Debugging visibility into entry relationships
|
|
325
|
+
*/
|
|
326
|
+
id: string;
|
|
327
|
+
/**
|
|
328
|
+
* SHA-256 hash of the encryptedData.
|
|
329
|
+
* Used for integrity verification and storage-level deduplication.
|
|
330
|
+
* Multiple entries can share the same contentHash (same bytes on disk).
|
|
331
|
+
*/
|
|
332
|
+
contentHash: string;
|
|
333
|
+
/**
|
|
334
|
+
* The ID of the document this entry is associated with (UUID7 format).
|
|
335
|
+
* For attachment chunks, this links the chunk to its parent document.
|
|
336
|
+
*/
|
|
337
|
+
docId: string;
|
|
338
|
+
/**
|
|
339
|
+
* IDs of entries this entry depends on.
|
|
340
|
+
* - For doc_* entries: Entry IDs of Automerge dependencies
|
|
341
|
+
* - For attachment_chunk: Previous chunk's entry ID (enables append-only file growth)
|
|
342
|
+
*/
|
|
343
|
+
dependencyIds: string[];
|
|
344
|
+
/**
|
|
345
|
+
* The timestamp when this entry was created (milliseconds since Unix epoch).
|
|
346
|
+
*/
|
|
347
|
+
createdAt: number;
|
|
348
|
+
/**
|
|
349
|
+
* The public signing key of the user who created this entry (Ed25519, PEM format).
|
|
350
|
+
* Used for signature verification and audit trails.
|
|
351
|
+
*/
|
|
352
|
+
createdByPublicKey: string;
|
|
353
|
+
/**
|
|
354
|
+
* The ID of the symmetric key used to encrypt this entry.
|
|
355
|
+
* "default" means tenant encryption key (all tenant members can decrypt).
|
|
356
|
+
* Other IDs refer to named symmetric keys (only users with that key can decrypt).
|
|
357
|
+
*/
|
|
358
|
+
decryptionKeyId: string;
|
|
359
|
+
/**
|
|
360
|
+
* The signature of the entry (signed with the user's signing key over the encrypted data).
|
|
361
|
+
* This allows signature verification without decryption.
|
|
362
|
+
*/
|
|
363
|
+
signature: Uint8Array;
|
|
364
|
+
/**
|
|
365
|
+
* Original size of the plaintext data before encryption (in bytes).
|
|
366
|
+
* For doc_* entries: size of the Automerge binary change/snapshot
|
|
367
|
+
* For attachment_chunk: size of the unencrypted chunk data
|
|
368
|
+
*/
|
|
369
|
+
originalSize: number;
|
|
370
|
+
/**
|
|
371
|
+
* Size of the encrypted data (in bytes).
|
|
372
|
+
* This is the size that will be transferred over the network or stored on disk.
|
|
373
|
+
* Useful for download time estimation, storage space checks, and progress indicators.
|
|
374
|
+
*/
|
|
375
|
+
encryptedSize: number;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A complete entry stored in the ContentAddressedStore.
|
|
379
|
+
* Extends StoreEntryMetadata with the actual encrypted payload.
|
|
380
|
+
*/
|
|
381
|
+
export interface StoreEntry extends StoreEntryMetadata {
|
|
382
|
+
/**
|
|
383
|
+
* The encrypted binary payload data.
|
|
384
|
+
* - For doc_create/doc_change: Encrypted Automerge change bytes
|
|
385
|
+
* - For doc_snapshot: Encrypted Automerge snapshot bytes
|
|
386
|
+
* - For doc_delete: Encrypted Automerge change bytes (may be empty change)
|
|
387
|
+
* - For attachment_chunk: Encrypted file chunk data
|
|
388
|
+
*
|
|
389
|
+
* The IV and authentication tag are embedded within this data.
|
|
390
|
+
*/
|
|
391
|
+
encryptedData: Uint8Array;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Reference to an attachment stored in the attachment store.
|
|
395
|
+
* This metadata is stored in the document's _attachments array.
|
|
396
|
+
*/
|
|
397
|
+
export interface AttachmentReference {
|
|
398
|
+
/**
|
|
399
|
+
* Unique identifier for this attachment instance (UUID7 format)
|
|
400
|
+
*/
|
|
401
|
+
attachmentId: string;
|
|
402
|
+
/**
|
|
403
|
+
* Original filename of the attachment
|
|
404
|
+
*/
|
|
405
|
+
fileName: string;
|
|
406
|
+
/**
|
|
407
|
+
* MIME type of the attachment (e.g., "application/pdf", "image/png")
|
|
408
|
+
*/
|
|
409
|
+
mimeType: string;
|
|
410
|
+
/**
|
|
411
|
+
* Total size of the attachment in bytes
|
|
412
|
+
*/
|
|
413
|
+
size: number;
|
|
414
|
+
/**
|
|
415
|
+
* Entry ID of the last chunk in the attachment store.
|
|
416
|
+
* Used for dependency resolution to traverse all chunks.
|
|
417
|
+
*/
|
|
418
|
+
lastChunkId: string;
|
|
419
|
+
/**
|
|
420
|
+
* The key ID used to encrypt attachment chunks.
|
|
421
|
+
* Same as the document's decryptionKeyId ("default" or named key).
|
|
422
|
+
*/
|
|
423
|
+
decryptionKeyId: string;
|
|
424
|
+
/**
|
|
425
|
+
* Timestamp when the attachment was added (milliseconds since Unix epoch)
|
|
426
|
+
*/
|
|
427
|
+
createdAt: number;
|
|
428
|
+
/**
|
|
429
|
+
* Public signing key of the user who created this attachment (Ed25519, PEM format)
|
|
430
|
+
*/
|
|
431
|
+
createdBy: string;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Configuration for attachment handling in MindooDB.
|
|
435
|
+
*/
|
|
436
|
+
export interface AttachmentConfig {
|
|
437
|
+
/**
|
|
438
|
+
* Size of each attachment chunk in bytes.
|
|
439
|
+
* Larger chunks mean fewer entries but higher memory usage.
|
|
440
|
+
* Default: 256 * 1024 (256KB)
|
|
441
|
+
*/
|
|
442
|
+
chunkSizeBytes?: number;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* A MindooDoc is a document that is stored in the MindooDB.
|
|
446
|
+
* It's a wrapper around the Automerge document.
|
|
447
|
+
*/
|
|
448
|
+
export interface MindooDoc {
|
|
449
|
+
/**
|
|
450
|
+
* Get the database that this document belongs to
|
|
451
|
+
*
|
|
452
|
+
* @return The database that this document belongs to
|
|
453
|
+
*/
|
|
454
|
+
getDatabase(): MindooDB;
|
|
455
|
+
getId(): string;
|
|
456
|
+
/**
|
|
457
|
+
* Get the timestamp of the creation of the document
|
|
458
|
+
* in milliseconds since the Unix epoch.
|
|
459
|
+
*
|
|
460
|
+
* @return The timestamp of the creation of the document
|
|
461
|
+
*/
|
|
462
|
+
getCreatedAt(): number;
|
|
463
|
+
/**
|
|
464
|
+
* Get the timestamp of the last modification of the document
|
|
465
|
+
* in milliseconds since the Unix epoch.
|
|
466
|
+
*
|
|
467
|
+
* @return The timestamp of the last modification of the document
|
|
468
|
+
*/
|
|
469
|
+
getLastModified(): number;
|
|
470
|
+
/**
|
|
471
|
+
* Check if the document has been deleted.
|
|
472
|
+
* Deletion is tracked via "delete" type entries in the append-only store.
|
|
473
|
+
*
|
|
474
|
+
* @return True if the document has been deleted, false otherwise
|
|
475
|
+
*/
|
|
476
|
+
isDeleted(): boolean;
|
|
477
|
+
getData(): MindooDocPayload;
|
|
478
|
+
/**
|
|
479
|
+
* Add an attachment to this document.
|
|
480
|
+
* This method only works within the changeDoc() callback.
|
|
481
|
+
*
|
|
482
|
+
* @param fileData The binary data of the attachment
|
|
483
|
+
* @param fileName The original filename
|
|
484
|
+
* @param mimeType The MIME type (e.g., "application/pdf")
|
|
485
|
+
* @param decryptionKeyId Optional key ID for encryption. If not provided, uses the document's key.
|
|
486
|
+
* @return The attachment reference with metadata
|
|
487
|
+
* @throws Error if called outside of changeDoc() callback
|
|
488
|
+
*/
|
|
489
|
+
addAttachment(fileData: Uint8Array, fileName: string, mimeType: string, decryptionKeyId?: string): Promise<AttachmentReference>;
|
|
490
|
+
/**
|
|
491
|
+
* Add an attachment from a streaming data source.
|
|
492
|
+
* This method only works within the changeDoc() callback.
|
|
493
|
+
* Memory efficient for large files - processes data chunk by chunk.
|
|
494
|
+
*
|
|
495
|
+
* Accepts any AsyncIterable, including:
|
|
496
|
+
* - ReadableStream (from fetch, File.stream(), Blob.stream())
|
|
497
|
+
* - Node.js streams (via async iteration)
|
|
498
|
+
* - Custom async generators
|
|
499
|
+
*
|
|
500
|
+
* @param dataStream An async iterable yielding Uint8Array chunks
|
|
501
|
+
* @param fileName The original filename
|
|
502
|
+
* @param mimeType The MIME type (e.g., "application/pdf")
|
|
503
|
+
* @param decryptionKeyId Optional key ID for encryption. If not provided, uses the document's key.
|
|
504
|
+
* @return The attachment reference with metadata
|
|
505
|
+
* @throws Error if called outside of changeDoc() callback
|
|
506
|
+
*/
|
|
507
|
+
addAttachmentStream(dataStream: AsyncIterable<Uint8Array>, fileName: string, mimeType: string, decryptionKeyId?: string): Promise<AttachmentReference>;
|
|
508
|
+
/**
|
|
509
|
+
* Remove an attachment from this document.
|
|
510
|
+
* This method only works within the changeDoc() callback.
|
|
511
|
+
* Note: This removes the reference from the document but does not delete the chunks
|
|
512
|
+
* from the attachment store (append-only semantics).
|
|
513
|
+
*
|
|
514
|
+
* @param attachmentId The ID of the attachment to remove
|
|
515
|
+
* @throws Error if called outside of changeDoc() callback or if attachment not found
|
|
516
|
+
*/
|
|
517
|
+
removeAttachment(attachmentId: string): Promise<void>;
|
|
518
|
+
/**
|
|
519
|
+
* Append data to an existing attachment.
|
|
520
|
+
* This method only works within the changeDoc() callback.
|
|
521
|
+
* Useful for log files and other append-only data.
|
|
522
|
+
*
|
|
523
|
+
* @param attachmentId The ID of the attachment to append to
|
|
524
|
+
* @param data The binary data to append
|
|
525
|
+
* @throws Error if called outside of changeDoc() callback or if attachment not found
|
|
526
|
+
*/
|
|
527
|
+
appendToAttachment(attachmentId: string, data: Uint8Array): Promise<void>;
|
|
528
|
+
/**
|
|
529
|
+
* Get all attachment references for this document.
|
|
530
|
+
*
|
|
531
|
+
* @return Array of attachment references
|
|
532
|
+
*/
|
|
533
|
+
getAttachments(): AttachmentReference[];
|
|
534
|
+
/**
|
|
535
|
+
* Get the full content of an attachment.
|
|
536
|
+
* Fetches all chunks, verifies signatures, decrypts, and concatenates them.
|
|
537
|
+
*
|
|
538
|
+
* @param attachmentId The ID of the attachment to retrieve
|
|
539
|
+
* @return The complete binary data of the attachment
|
|
540
|
+
* @throws Error if attachment not found or decryption fails
|
|
541
|
+
*/
|
|
542
|
+
getAttachment(attachmentId: string): Promise<Uint8Array>;
|
|
543
|
+
/**
|
|
544
|
+
* Get a byte range from an attachment.
|
|
545
|
+
* Only fetches and decrypts the chunks needed for the requested range.
|
|
546
|
+
* Useful for random access to large files.
|
|
547
|
+
*
|
|
548
|
+
* @param attachmentId The ID of the attachment
|
|
549
|
+
* @param startByte The starting byte offset (inclusive, 0-based)
|
|
550
|
+
* @param endByte The ending byte offset (exclusive)
|
|
551
|
+
* @return The binary data for the requested range
|
|
552
|
+
* @throws Error if attachment not found, range invalid, or decryption fails
|
|
553
|
+
*/
|
|
554
|
+
getAttachmentRange(attachmentId: string, startByte: number, endByte: number): Promise<Uint8Array>;
|
|
555
|
+
/**
|
|
556
|
+
* Stream attachment data starting from a given offset.
|
|
557
|
+
* Returns an AsyncGenerator that yields decrypted chunks one at a time.
|
|
558
|
+
* Memory-efficient for large files - only one chunk in memory at a time.
|
|
559
|
+
*
|
|
560
|
+
* @param attachmentId The ID of the attachment to stream
|
|
561
|
+
* @param startOffset Optional byte offset to start streaming from (default: 0)
|
|
562
|
+
* @return AsyncGenerator yielding Uint8Array chunks
|
|
563
|
+
* @throws Error if attachment not found
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* // Stream from the beginning
|
|
567
|
+
* for await (const chunk of doc.streamAttachment(attachmentId)) {
|
|
568
|
+
* await processChunk(chunk);
|
|
569
|
+
* if (shouldStop) break; // Early termination supported
|
|
570
|
+
* }
|
|
571
|
+
*
|
|
572
|
+
* // Seek to 1MB offset and stream
|
|
573
|
+
* for await (const chunk of doc.streamAttachment(attachmentId, 1024 * 1024)) {
|
|
574
|
+
* await writeToOutput(chunk);
|
|
575
|
+
* }
|
|
576
|
+
*/
|
|
577
|
+
streamAttachment(attachmentId: string, startOffset?: number): AsyncGenerator<Uint8Array, void, unknown>;
|
|
578
|
+
}
|
|
579
|
+
export interface MindooDocPayload {
|
|
580
|
+
[key: string]: unknown;
|
|
581
|
+
}
|
|
582
|
+
export interface MindooTenantDirectory {
|
|
583
|
+
/**
|
|
584
|
+
* Adds a new user to the tenant. The user is identified by its user ID.
|
|
585
|
+
* The registration operation is signed with the administration key (signing only, not encryption).
|
|
586
|
+
*
|
|
587
|
+
* @param userId The user ID to register
|
|
588
|
+
* @param administrationPrivateKey The administration private key to sign the registration operation with (signing only)
|
|
589
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
590
|
+
* @return A promise that resolves when the user is registered
|
|
591
|
+
*/
|
|
592
|
+
registerUser(userId: PublicUserId, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
593
|
+
/**
|
|
594
|
+
* Revokes a user's access to the tenant by adding a revocation record to the directory.
|
|
595
|
+
* This prevents the user from decrypting future changes, but they retain access to previously
|
|
596
|
+
* decrypted changes (append-only limitation).
|
|
597
|
+
*
|
|
598
|
+
* @param username The username of the user to revoke (format: "CN=<username>/O=<tenantId>")
|
|
599
|
+
* @param requestDataWipe If true, the next time the user syncs the directory, the locally cached data on the user's machine will be wiped.
|
|
600
|
+
* @param administrationPrivateKey The administration private key to sign the revocation (signing only)
|
|
601
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
602
|
+
* @return A promise that resolves when the user is revoked
|
|
603
|
+
*/
|
|
604
|
+
revokeUser(username: string, requestDataWipe: boolean, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
605
|
+
/**
|
|
606
|
+
* Validates a public signing key by checking if it belongs to a trusted user in the tenant.
|
|
607
|
+
* This is used for signature verification when loading changes from the append-only store.
|
|
608
|
+
*
|
|
609
|
+
* @param publicKey The public signing key to validate (Ed25519, PEM format)
|
|
610
|
+
* @return True if the public key belongs to a trusted (registered and not revoked) user, false otherwise
|
|
611
|
+
*/
|
|
612
|
+
validatePublicSigningKey(publicKey: string): Promise<boolean>;
|
|
613
|
+
/**
|
|
614
|
+
* Get a user's public keys from the directory.
|
|
615
|
+
* Used for authentication (signature verification) and encryption (transport encryption).
|
|
616
|
+
*
|
|
617
|
+
* @param username The username to look up (format: "CN=<username>/O=<tenantId>")
|
|
618
|
+
* @return The user's public keys, or null if user not found or has been revoked
|
|
619
|
+
*/
|
|
620
|
+
getUserPublicKeys(username: string): Promise<{
|
|
621
|
+
signingPublicKey: string;
|
|
622
|
+
encryptionPublicKey: string;
|
|
623
|
+
} | null>;
|
|
624
|
+
/**
|
|
625
|
+
* Check if a user has been revoked.
|
|
626
|
+
*
|
|
627
|
+
* @param username The username to check (format: "CN=<username>/O=<tenantId>")
|
|
628
|
+
* @return True if the user has been revoked (all grant access documents have been revoked), false otherwise
|
|
629
|
+
*/
|
|
630
|
+
isUserRevoked(username: string): Promise<boolean>;
|
|
631
|
+
/**
|
|
632
|
+
* Requests that a document's change history be purged from all client stores.
|
|
633
|
+
* Creates a purge request record in the directory that clients will process when they
|
|
634
|
+
* sync directory changes. Clients receiving this directory update will purge all
|
|
635
|
+
* changes for the specified document from their local stores.
|
|
636
|
+
*
|
|
637
|
+
* This is useful for GDPR compliance (right to be forgotten) and other scenarios
|
|
638
|
+
* where document data must be removed from all systems.
|
|
639
|
+
*
|
|
640
|
+
* @param dbId The database ID containing the document
|
|
641
|
+
* @param docId The document ID whose change history should be purged
|
|
642
|
+
* @param reason Optional reason for the purge request (e.g., "GDPR right to be forgotten")
|
|
643
|
+
* @param administrationPrivateKey The administration private key to sign the request
|
|
644
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
645
|
+
* @return A promise that resolves when the purge request record is created
|
|
646
|
+
*/
|
|
647
|
+
requestDocHistoryPurge(dbId: string, docId: string, reason: string | undefined, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Get all pending document history purge requests that clients should process.
|
|
650
|
+
* Returns purge requests with verified admin signatures that clients have not yet processed.
|
|
651
|
+
*
|
|
652
|
+
* Clients should call this method periodically (e.g., after directory sync) and
|
|
653
|
+
* purge the requested documents from their local stores.
|
|
654
|
+
*
|
|
655
|
+
* @return Array of purge request records with verified admin signatures
|
|
656
|
+
*/
|
|
657
|
+
getRequestedDocHistoryPurges(): Promise<Array<{
|
|
658
|
+
dbId: string;
|
|
659
|
+
docId: string;
|
|
660
|
+
reason?: string;
|
|
661
|
+
requestedAt: number;
|
|
662
|
+
purgeRequestDocId: string;
|
|
663
|
+
}>>;
|
|
664
|
+
/**
|
|
665
|
+
* Get the latest tenant-wide settings document from the directory.
|
|
666
|
+
* Returns null if no settings document exists.
|
|
667
|
+
*
|
|
668
|
+
* Settings are synced to all clients via the directory database.
|
|
669
|
+
*
|
|
670
|
+
* @return The latest tenant settings document, or null if none exists
|
|
671
|
+
*/
|
|
672
|
+
getTenantSettings(): Promise<MindooDoc | null>;
|
|
673
|
+
/**
|
|
674
|
+
* Create or update tenant-wide settings.
|
|
675
|
+
* Automatically uses the cached settings document if it exists, or creates a new one.
|
|
676
|
+
*
|
|
677
|
+
* Settings are signed with the administration key and synced to all clients.
|
|
678
|
+
* The `form` field is automatically set to "tenantsettings" after the callback.
|
|
679
|
+
*
|
|
680
|
+
* @param changeFunc Function to modify the settings document
|
|
681
|
+
* @param administrationPrivateKey The administration private key to sign the settings
|
|
682
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
683
|
+
* @return A promise that resolves when the settings are updated
|
|
684
|
+
*/
|
|
685
|
+
changeTenantSettings(changeFunc: (doc: MindooDoc) => void | Promise<void>, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
686
|
+
/**
|
|
687
|
+
* Get the latest database-specific settings document from the directory.
|
|
688
|
+
* Returns null if no settings document exists for the given database.
|
|
689
|
+
*
|
|
690
|
+
* @param dbId The database ID to get settings for
|
|
691
|
+
* @return The latest DB settings document, or null if none exists
|
|
692
|
+
*/
|
|
693
|
+
getDBSettings(dbId: string): Promise<MindooDoc | null>;
|
|
694
|
+
/**
|
|
695
|
+
* Create or update database-specific settings.
|
|
696
|
+
* Automatically uses the cached settings document for the given dbId if it exists, or creates a new one.
|
|
697
|
+
*
|
|
698
|
+
* The `form` field is automatically set to "dbsettings" and `dbid` is set to the provided dbId
|
|
699
|
+
* after the callback to ensure they are always correct.
|
|
700
|
+
*
|
|
701
|
+
* @param dbId The database ID these settings apply to
|
|
702
|
+
* @param changeFunc Function to modify the settings document
|
|
703
|
+
* @param administrationPrivateKey The administration private key to sign the settings
|
|
704
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
705
|
+
* @return A promise that resolves when the settings are updated
|
|
706
|
+
*/
|
|
707
|
+
changeDBSettings(dbId: string, changeFunc: (doc: MindooDoc) => void | Promise<void>, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
708
|
+
/**
|
|
709
|
+
* Get the names of all groups from the directory.
|
|
710
|
+
*
|
|
711
|
+
* @return names
|
|
712
|
+
*/
|
|
713
|
+
getGroups(): Promise<string[]>;
|
|
714
|
+
/**
|
|
715
|
+
* Looks up the members of a group by name.
|
|
716
|
+
*
|
|
717
|
+
* @param groupName The name of the group to look up (case-insensitive, converted to lowercase)
|
|
718
|
+
* @return The members of the group
|
|
719
|
+
*/
|
|
720
|
+
getGroupMembers(groupName: string): Promise<string[]>;
|
|
721
|
+
/**
|
|
722
|
+
* Deletes a group. Does nothing if the group does not exist.
|
|
723
|
+
*
|
|
724
|
+
* @param groupName The name of the group to delete (case-insensitive, converted to lowercase)
|
|
725
|
+
* @param administrationPrivateKey The administration private key to sign the group
|
|
726
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
727
|
+
* @return A promise that resolves when the group is deleted
|
|
728
|
+
*/
|
|
729
|
+
deleteGroup(groupName: string, administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
730
|
+
/**
|
|
731
|
+
* For a given username, get the username, name variants (e.g. wildcards)
|
|
732
|
+
* and all groups the user is currently a member of (resolved recursively).
|
|
733
|
+
* For example: if the user is cn=john.doe/ou=team1/o=example.com, the result will be:
|
|
734
|
+
*
|
|
735
|
+
* cn=john.doe/ou=team1/o=example.com , *\/ou=team1/o=example.com ,
|
|
736
|
+
* *\/o=example.com, group1, group2
|
|
737
|
+
*
|
|
738
|
+
* @param username The username to get the names list for (case-insensitive comparison)
|
|
739
|
+
* @return A promise that resolves with the usernameslist
|
|
740
|
+
*/
|
|
741
|
+
getUserNamesList(username: string): Promise<string[]>;
|
|
742
|
+
/**
|
|
743
|
+
* Adds users to a group. Does nothing if the users are already in the group.
|
|
744
|
+
*
|
|
745
|
+
* @param groupName The name of the group to add users to (case-insensitive, converted to lowercase)
|
|
746
|
+
* @param username The usernames to add to the group
|
|
747
|
+
* @param administrationPrivateKey The administration private key to sign the group
|
|
748
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
749
|
+
* @return A promise that resolves when the users are added to the group
|
|
750
|
+
*/
|
|
751
|
+
addUsersToGroup(groupName: string, username: string[], administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
752
|
+
/**
|
|
753
|
+
* Removes users from a group. Does nothing if the users are not in the group.
|
|
754
|
+
*
|
|
755
|
+
* @param groupName The name of the group to remove users from (case-insensitive, converted to lowercase)
|
|
756
|
+
* @param username The usernames to remove from the group
|
|
757
|
+
* @param administrationPrivateKey The administration private key to sign the group
|
|
758
|
+
* @param administrationPrivateKeyPassword The password to decrypt the administration private key
|
|
759
|
+
* @return A promise that resolves when the users are removed from the group
|
|
760
|
+
*/
|
|
761
|
+
removeUsersFromGroup(groupName: string, username: string[], administrationPrivateKey: EncryptedPrivateKey, administrationPrivateKeyPassword: string): Promise<void>;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Cursor for incremental processing of document changes.
|
|
765
|
+
* Contains both timestamp and document ID to ensure uniqueness
|
|
766
|
+
* and prevent duplicate processing when multiple documents have the same timestamp.
|
|
767
|
+
*/
|
|
768
|
+
export interface ProcessChangesCursor {
|
|
769
|
+
/**
|
|
770
|
+
* The timestamp of the last processed change (milliseconds since Unix epoch)
|
|
771
|
+
*/
|
|
772
|
+
lastModified: number;
|
|
773
|
+
/**
|
|
774
|
+
* The document ID of the last processed change.
|
|
775
|
+
* Used to break ties when multiple documents have the same timestamp.
|
|
776
|
+
*/
|
|
777
|
+
docId: string;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Result yielded by the iterateChangesSince generator.
|
|
781
|
+
* Contains both the document and its cursor position for tracking progress.
|
|
782
|
+
*/
|
|
783
|
+
export interface ProcessChangesResult {
|
|
784
|
+
/**
|
|
785
|
+
* The document that was processed
|
|
786
|
+
*/
|
|
787
|
+
doc: MindooDoc;
|
|
788
|
+
/**
|
|
789
|
+
* The cursor position of this document
|
|
790
|
+
*/
|
|
791
|
+
cursor: ProcessChangesCursor;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Options for opening a database
|
|
795
|
+
*/
|
|
796
|
+
export interface OpenDBOptions extends OpenStoreOptions {
|
|
797
|
+
/**
|
|
798
|
+
* If true, only entries signed by the administration key will be loaded.
|
|
799
|
+
* All other entries will be silently ignored.
|
|
800
|
+
* This is used for the directory database to prevent recursion and ensure security.
|
|
801
|
+
*/
|
|
802
|
+
adminOnlyDb?: boolean;
|
|
803
|
+
/**
|
|
804
|
+
* Configuration for attachment handling (chunk size, etc.)
|
|
805
|
+
* If not provided, defaults are used.
|
|
806
|
+
*/
|
|
807
|
+
attachmentConfig?: AttachmentConfig;
|
|
808
|
+
}
|
|
809
|
+
export interface MindooDB {
|
|
810
|
+
/**
|
|
811
|
+
* Get the tenant that this database belongs to
|
|
812
|
+
*
|
|
813
|
+
* @return The tenant
|
|
814
|
+
*/
|
|
815
|
+
getTenant(): MindooTenant;
|
|
816
|
+
/**
|
|
817
|
+
* Check if this database is in admin-only mode.
|
|
818
|
+
* In admin-only mode, only entries signed by the administration key are loaded.
|
|
819
|
+
*
|
|
820
|
+
* @return True if admin-only mode is enabled
|
|
821
|
+
*/
|
|
822
|
+
isAdminOnlyDb(): boolean;
|
|
823
|
+
/**
|
|
824
|
+
* Get the content-addressed store that is used to store document changes for this database.
|
|
825
|
+
*
|
|
826
|
+
* @return The content-addressed store for documents
|
|
827
|
+
*/
|
|
828
|
+
getStore(): ContentAddressedStore;
|
|
829
|
+
/**
|
|
830
|
+
* Get the content-addressed store that is used to store attachment chunks for this database.
|
|
831
|
+
* Returns undefined if no attachment store was configured.
|
|
832
|
+
*
|
|
833
|
+
* @return The content-addressed store for attachments, or undefined if not configured
|
|
834
|
+
*/
|
|
835
|
+
getAttachmentStore(): ContentAddressedStore | undefined;
|
|
836
|
+
/**
|
|
837
|
+
* Create a new document (unencrypted, uses tenant default encryption)
|
|
838
|
+
*
|
|
839
|
+
* @return The new document
|
|
840
|
+
*/
|
|
841
|
+
createDocument(): Promise<MindooDoc>;
|
|
842
|
+
/**
|
|
843
|
+
* Create a new document with optional encryption using a named symmetric key.
|
|
844
|
+
*
|
|
845
|
+
* @param decryptionKeyId Optional key ID for encryption. If not provided, uses "default" (tenant key).
|
|
846
|
+
* If provided, document will be encrypted with the named symmetric key.
|
|
847
|
+
* All changes to this document will use the same key ID.
|
|
848
|
+
* @return The new document
|
|
849
|
+
*/
|
|
850
|
+
createEncryptedDocument(decryptionKeyId?: string): Promise<MindooDoc>;
|
|
851
|
+
/**
|
|
852
|
+
* Create a new document using a specific signing key.
|
|
853
|
+
* This is like createDocument but allows signing with a different key than the current user's.
|
|
854
|
+
* Used for directory operations that must be signed with the administration key.
|
|
855
|
+
*
|
|
856
|
+
* @param signingKeyPair The signing key pair to use for signing the initial entry
|
|
857
|
+
* @param signingKeyPassword The password to decrypt the signing private key
|
|
858
|
+
* @param decryptionKeyId Optional key ID for encryption. If not provided, uses "default" (tenant key).
|
|
859
|
+
* @return The new document
|
|
860
|
+
*/
|
|
861
|
+
createDocumentWithSigningKey(signingKeyPair: SigningKeyPair, signingKeyPassword: string, decryptionKeyId?: string): Promise<MindooDoc>;
|
|
862
|
+
/**
|
|
863
|
+
* Get a document by its ID
|
|
864
|
+
*
|
|
865
|
+
* @param docId The ID of the document
|
|
866
|
+
* @return The document
|
|
867
|
+
*/
|
|
868
|
+
getDocument(docId: string): Promise<MindooDoc>;
|
|
869
|
+
/**
|
|
870
|
+
* Get a document at a specific point in time by applying changes up to the given timestamp.
|
|
871
|
+
* This enables historical analysis and time travel functionality.
|
|
872
|
+
*
|
|
873
|
+
* @param docId The ID of the document
|
|
874
|
+
* @param timestamp The timestamp to reconstruct the document at (milliseconds since Unix epoch)
|
|
875
|
+
* @return The document at the specified timestamp, or null if the document didn't exist at that time
|
|
876
|
+
*/
|
|
877
|
+
getDocumentAtTimestamp(docId: string, timestamp: number): Promise<MindooDoc | null>;
|
|
878
|
+
/**
|
|
879
|
+
* Get all document IDs in this database.
|
|
880
|
+
*
|
|
881
|
+
* @return A list of document IDs
|
|
882
|
+
*/
|
|
883
|
+
getAllDocumentIds(): Promise<string[]>;
|
|
884
|
+
/**
|
|
885
|
+
* Delete a document by its ID
|
|
886
|
+
*
|
|
887
|
+
* @param docId The ID of the document
|
|
888
|
+
* @return A promise that resolves when the document is deleted
|
|
889
|
+
*/
|
|
890
|
+
deleteDocument(docId: string): Promise<void>;
|
|
891
|
+
/**
|
|
892
|
+
* Delete a document using a specific signing key.
|
|
893
|
+
* This is like deleteDocument but allows signing with a different key than the current user's.
|
|
894
|
+
* Used for directory operations that must be signed with the administration key.
|
|
895
|
+
*
|
|
896
|
+
* @param docId The ID of the document
|
|
897
|
+
* @param signingKeyPair The signing key pair to use for signing the deletion
|
|
898
|
+
* @param signingKeyPassword The password to decrypt the signing private key
|
|
899
|
+
* @return A promise that resolves when the document is deleted
|
|
900
|
+
*/
|
|
901
|
+
deleteDocumentWithSigningKey(docId: string, signingKeyPair: SigningKeyPair, signingKeyPassword: string): Promise<void>;
|
|
902
|
+
/**
|
|
903
|
+
* Change a document. This internally produces a binary Automerge change
|
|
904
|
+
* to the underlying Automerge document, signs it with the current user's signing key,
|
|
905
|
+
* optionally encrypts it with the appropriate encryption key, and appends it to the attached AppendOnlyStore.
|
|
906
|
+
*
|
|
907
|
+
* Note: Signing and encryption use different keys:
|
|
908
|
+
* - Signing uses the current user's signing key (Ed25519) - proves authorship and integrity
|
|
909
|
+
* The signature is created via tenant.signPayload()
|
|
910
|
+
* - Encryption uses the tenant encryption key or a named symmetric key (AES-256) - protects content
|
|
911
|
+
* Encryption/decryption is handled via tenant.encryptPayload() and tenant.decryptPayload()
|
|
912
|
+
*
|
|
913
|
+
* The encryption key ID is determined from the first entry's decryptionKeyId (stored in StoreEntryMetadata).
|
|
914
|
+
* If the document was created with a named key, all subsequent changes use that same key.
|
|
915
|
+
*
|
|
916
|
+
* @param doc The document to change
|
|
917
|
+
* @param changeFunc The function to change the document (can be async to perform operations like signing)
|
|
918
|
+
* @return A promise that resolves when the document is changed
|
|
919
|
+
*/
|
|
920
|
+
changeDoc(doc: MindooDoc, changeFunc: (doc: MindooDoc) => void | Promise<void>): Promise<void>;
|
|
921
|
+
/**
|
|
922
|
+
* Change a document using a specific signing key.
|
|
923
|
+
* This is like changeDoc but allows signing with a different key than the current user's.
|
|
924
|
+
* Used for directory operations that must be signed with the administration key.
|
|
925
|
+
*
|
|
926
|
+
* @param doc The document to change
|
|
927
|
+
* @param changeFunc The function to change the document (can be async)
|
|
928
|
+
* @param signingKeyPair The signing key pair to use for signing the change
|
|
929
|
+
* @param signingKeyPassword The password to decrypt the signing private key
|
|
930
|
+
* @return A promise that resolves when the document is changed
|
|
931
|
+
*/
|
|
932
|
+
changeDocWithSigningKey(doc: MindooDoc, changeFunc: (doc: MindooDoc) => void | Promise<void>, signingKeyPair: SigningKeyPair, signingKeyPassword: string): Promise<void>;
|
|
933
|
+
/**
|
|
934
|
+
* Each MindooDB maintains an internal index that tracks documents and their latest state,
|
|
935
|
+
* sorted by their last modified timestamp (then by document ID for uniqueness).
|
|
936
|
+
* The index is updated when documents actually change (after applying changes),
|
|
937
|
+
* enabling incremental operations on the database.
|
|
938
|
+
*
|
|
939
|
+
* This method uses the internal index to efficiently find and process documents that changed
|
|
940
|
+
* since a given cursor, useful for incremental processing of changes.
|
|
941
|
+
* Documents are returned in modification order (oldest first).
|
|
942
|
+
* The callback will receive new documents, changes and deletions.
|
|
943
|
+
*
|
|
944
|
+
* The callback can return `false` to stop processing early. If the callback throws an error
|
|
945
|
+
* or if there's an error processing a document, the loop will stop and the error will be propagated.
|
|
946
|
+
*
|
|
947
|
+
* @param cursor The cursor to start processing changes from. Use `null` or `{ lastModified: 0, docId: "" }` to start from the beginning.
|
|
948
|
+
* @param limit The maximum number of changes to process (for pagination)
|
|
949
|
+
* @param callback The function to call for each change. Receives the document and its cursor position. Return `false` to stop processing, or `true`/`undefined` to continue.
|
|
950
|
+
* @return The cursor of the last change processed, can be used to continue processing from this position
|
|
951
|
+
*/
|
|
952
|
+
processChangesSince(cursor: ProcessChangesCursor | null, limit: number, callback: (change: MindooDoc, currentCursor: ProcessChangesCursor) => boolean | void): Promise<ProcessChangesCursor>;
|
|
953
|
+
/**
|
|
954
|
+
* Iterate over documents that changed since a given cursor using an async generator.
|
|
955
|
+
* This provides a cleaner iteration pattern compared to the callback-based processChangesSince.
|
|
956
|
+
*
|
|
957
|
+
* Documents are returned in modification order (oldest first).
|
|
958
|
+
* The generator automatically handles pagination internally.
|
|
959
|
+
*
|
|
960
|
+
* Example usage:
|
|
961
|
+
* ```typescript
|
|
962
|
+
* for await (const { doc, cursor } of db.iterateChangesSince(null, 100)) {
|
|
963
|
+
* const data = doc.getData();
|
|
964
|
+
* if (data.type === "target") {
|
|
965
|
+
* // Process document
|
|
966
|
+
* break; // Stop iteration early if needed
|
|
967
|
+
* }
|
|
968
|
+
* }
|
|
969
|
+
* ```
|
|
970
|
+
*
|
|
971
|
+
* @param cursor The cursor to start processing changes from. Use `null` to start from the beginning.
|
|
972
|
+
* @param pageSize The number of documents to process per page (for internal pagination). Defaults to 100.
|
|
973
|
+
* @return An async generator that yields ProcessChangesResult objects containing the document and its cursor
|
|
974
|
+
*/
|
|
975
|
+
iterateChangesSince(cursor: ProcessChangesCursor | null, pageSize?: number): AsyncGenerator<ProcessChangesResult, void, unknown>;
|
|
976
|
+
/**
|
|
977
|
+
* Sync changes from the append-only store by finding new changes and processing them.
|
|
978
|
+
* This method can be called multiple times to incrementally sync new changes.
|
|
979
|
+
* On first call (when processedChangeHashes is empty), it will process all changes.
|
|
980
|
+
*
|
|
981
|
+
* The method uses a stored list of processed change hashes to determine which changes
|
|
982
|
+
* are new. It calls AppendOnlyStore.findNewChanges() to find unprocessed changes,
|
|
983
|
+
* then processes them to update the cached database documents and index.
|
|
984
|
+
* After processing, the new change hashes are appended to the stored list.
|
|
985
|
+
*
|
|
986
|
+
* @return A promise that resolves when the sync is complete
|
|
987
|
+
*/
|
|
988
|
+
syncStoreChanges(): Promise<void>;
|
|
989
|
+
/**
|
|
990
|
+
* Pull changes from a remote content-addressed store.
|
|
991
|
+
*
|
|
992
|
+
* @param remoteStore The remote store to pull changes from
|
|
993
|
+
* @return A promise that resolves when the pull is complete
|
|
994
|
+
*/
|
|
995
|
+
pullChangesFrom(remoteStore: ContentAddressedStore): Promise<void>;
|
|
996
|
+
/**
|
|
997
|
+
* Push changes to a remote content-addressed store.
|
|
998
|
+
*
|
|
999
|
+
* @param remoteStore The remote store to push changes to
|
|
1000
|
+
* @return A promise that resolves when the push is complete
|
|
1001
|
+
*/
|
|
1002
|
+
pushChangesTo(remoteStore: ContentAddressedStore): Promise<void>;
|
|
1003
|
+
}
|
|
1004
|
+
//# sourceMappingURL=types.d.ts.map
|