@@ -1527,9 +1527,14 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
15271527 /**
15281528 * Clear any data out of the persistent stores used by the client.
15291529 *
1530+ * @param args.cryptoDatabasePrefix - The database name to use for indexeddb, defaults to 'matrix-js-sdk'.
15301531 * @returns Promise which resolves when the stores have been cleared.
15311532 */
1532- public clearStores ( ) : Promise < void > {
1533+ public clearStores (
1534+ args : {
1535+ cryptoDatabasePrefix ?: string ;
1536+ } = { } ,
1537+ ) : Promise < void > {
15331538 if ( this . clientRunning ) {
15341539 throw new Error ( "Cannot clear stores while client is running" ) ;
15351540 }
@@ -1552,8 +1557,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
15521557 return ;
15531558 }
15541559 for ( const dbname of [
1555- `${ RUST_SDK_STORE_PREFIX } ::matrix-sdk-crypto` ,
1556- `${ RUST_SDK_STORE_PREFIX } ::matrix-sdk-crypto-meta` ,
1560+ `${ args . cryptoDatabasePrefix ?? RUST_SDK_STORE_PREFIX } ::matrix-sdk-crypto` ,
1561+ `${ args . cryptoDatabasePrefix ?? RUST_SDK_STORE_PREFIX } ::matrix-sdk-crypto-meta` ,
15571562 ] ) {
15581563 const prom = new Promise ( ( resolve , reject ) => {
15591564 this . logger . info ( `Removing IndexedDB instance ${ dbname } ` ) ;
@@ -1901,6 +1906,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
19011906 * ensuring that only one `MatrixClient` issue is instantiated at a time.
19021907 *
19031908 * @param args.useIndexedDB - True to use an indexeddb store, false to use an in-memory store. Defaults to 'true'.
1909+ * @param args.cryptoDatabasePrefix - The database name to use for indexeddb, defaults to 'matrix-js-sdk'.
1910+ * Unused if useIndexedDB is 'false'.
19041911 * @param args.storageKey - A key with which to encrypt the indexeddb store. If provided, it must be exactly
19051912 * 32 bytes of data, and must be the same each time the client is initialised for a given device.
19061913 * If both this and `storagePassword` are unspecified, the store will be unencrypted.
@@ -1914,6 +1921,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
19141921 public async initRustCrypto (
19151922 args : {
19161923 useIndexedDB ?: boolean ;
1924+ cryptoDatabasePrefix ?: string ;
19171925 storageKey ?: Uint8Array ;
19181926 storagePassword ?: string ;
19191927 } = { } ,
@@ -1950,7 +1958,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
19501958 deviceId : deviceId ,
19511959 secretStorage : this . secretStorage ,
19521960 cryptoCallbacks : this . cryptoCallbacks ,
1953- storePrefix : args . useIndexedDB === false ? null : RUST_SDK_STORE_PREFIX ,
1961+ storePrefix : args . useIndexedDB === false ? null : ( args . cryptoDatabasePrefix ?? RUST_SDK_STORE_PREFIX ) ,
19541962 storeKey : args . storageKey ,
19551963 storePassphrase : args . storagePassword ,
19561964
0 commit comments