1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-21 07:42:09 +03:00

Explicitly create cryptoStore in React SDK

The React SDK has a client creation path that starts 2 out of 3 stores, but then
leaves the other one for the JS SDK's default value handling.

We'll soon be adding additional code to check the health of stores, so it would
be simpler to follow and think about if we create them all in one place.
This commit is contained in:
J. Ryan Stinnett
2019-03-21 15:02:26 +00:00
parent ed72352636
commit 2ac7dd4ca3

View File

@ -48,10 +48,6 @@ export default function createMatrixClient(opts, useIndexedDb) {
useAuthorizationHeader: true,
};
if (localStorage) {
storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage);
}
if (indexedDB && localStorage && useIndexedDb) {
storeOpts.store = new Matrix.IndexedDBStore({
indexedDB: indexedDB,
@ -61,6 +57,16 @@ export default function createMatrixClient(opts, useIndexedDb) {
});
}
if (localStorage) {
storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage);
}
if (indexedDB && useIndexedDb) {
storeOpts.cryptoStore = new Matrix.IndexedDBCryptoStore(
indexedDB, "matrix-js-sdk:crypto",
);
}
opts = Object.assign(storeOpts, opts);
return Matrix.createClient(opts);