@@ -1527,9 +1527,14 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1527
1527
/**
1528
1528
* Clear any data out of the persistent stores used by the client.
1529
1529
*
1530
+ * @param args.cryptoDatabasePrefix - The database name to use for indexeddb, defaults to 'matrix-js-sdk'.
1530
1531
* @returns Promise which resolves when the stores have been cleared.
1531
1532
*/
1532
- public clearStores ( ) : Promise < void > {
1533
+ public clearStores (
1534
+ args : {
1535
+ cryptoDatabasePrefix ?: string ;
1536
+ } = { } ,
1537
+ ) : Promise < void > {
1533
1538
if ( this . clientRunning ) {
1534
1539
throw new Error ( "Cannot clear stores while client is running" ) ;
1535
1540
}
@@ -1552,8 +1557,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1552
1557
return ;
1553
1558
}
1554
1559
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` ,
1557
1562
] ) {
1558
1563
const prom = new Promise ( ( resolve , reject ) => {
1559
1564
this . logger . info ( `Removing IndexedDB instance ${ dbname } ` ) ;
@@ -1901,6 +1906,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1901
1906
* ensuring that only one `MatrixClient` issue is instantiated at a time.
1902
1907
*
1903
1908
* @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'.
1904
1911
* @param args.storageKey - A key with which to encrypt the indexeddb store. If provided, it must be exactly
1905
1912
* 32 bytes of data, and must be the same each time the client is initialised for a given device.
1906
1913
* If both this and `storagePassword` are unspecified, the store will be unencrypted.
@@ -1914,6 +1921,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1914
1921
public async initRustCrypto (
1915
1922
args : {
1916
1923
useIndexedDB ?: boolean ;
1924
+ cryptoDatabasePrefix ?: string ;
1917
1925
storageKey ?: Uint8Array ;
1918
1926
storagePassword ?: string ;
1919
1927
} = { } ,
@@ -1950,7 +1958,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1950
1958
deviceId : deviceId ,
1951
1959
secretStorage : this . secretStorage ,
1952
1960
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 ) ,
1954
1962
storeKey : args . storageKey ,
1955
1963
storePassphrase : args . storagePassword ,
1956
1964
0 commit comments