@@ -106,6 +106,8 @@ const client = await Client.create(
106106 // client options
107107 {
108108 dbEncryptionKey ,
109+ // Optional: Use a function to dynamically set the database path based on inbox ID
110+ // dbPath: (inboxId) => `./databases/xmtp-${inboxId}.db3`,
109111 },
110112);
111113```
@@ -193,7 +195,7 @@ type ClientOptions = {
193195 /**
194196 * Path to the local DB
195197 *
196- * There are 3 value types that can be used to specify the database path:
198+ * There are 4 value types that can be used to specify the database path:
197199 *
198200 * - `undefined` (or excluded from the client options)
199201 * The database will be created in the current working directory and is based on
@@ -206,8 +208,12 @@ type ClientOptions = {
206208 * - `string`
207209 * The given path will be used to create the database.
208210 * Example: `./my-db.db3`
211+ *
212+ * - `function`
213+ * A callback function that receives the inbox ID and returns a string path.
214+ * Example: `(inboxId) => string`
209215 */
210- dbPath? : string | null ;
216+ dbPath? : string | null | (( inboxId : string ) => string ) ;
211217 /**
212218 * Encryption key for the local DB
213219 */
@@ -278,7 +284,7 @@ type ClientOptions = {
278284 /**
279285 * Path to the local DB
280286 *
281- * There are 3 value types that can be used to specify the database path:
287+ * There are 4 value types that can be used to specify the database path:
282288 *
283289 * - `undefined` (or excluded from the client options)
284290 * The database will be created in the current working directory and is based on
@@ -291,8 +297,12 @@ type ClientOptions = {
291297 * - `string`
292298 * The given path will be used to create the database.
293299 * Example: `./my-db.db3`
300+ *
301+ * - `function`
302+ * A callback function that receives the inbox ID and returns a string path.
303+ * Example: `(inboxId) => string`
294304 */
295- dbPath? : string | null ;
305+ dbPath? : string | null | (( inboxId : string ) => string ) ;
296306 /**
297307 * Encryption key for the local DB
298308 */
0 commit comments