From 9095d3b4793c7a5b0c148f1708e640115fab0511 Mon Sep 17 00:00:00 2001 From: Gigiaj Date: Fri, 20 Jun 2025 16:13:44 -0500 Subject: [PATCH] update to use the modern crypto store and session store implementation --- src/client/initMatrix.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/client/initMatrix.ts b/src/client/initMatrix.ts index b80a080f..5bcdce83 100644 --- a/src/client/initMatrix.ts +++ b/src/client/initMatrix.ts @@ -1,30 +1,25 @@ import { createClient, MatrixClient, IndexedDBStore, IndexedDBCryptoStore } from 'matrix-js-sdk'; - import { cryptoCallbacks } from './state/secretStorageKeys'; import { clearNavToActivePathStore } from '../app/state/navToActivePath'; - -type Session = { - baseUrl: string; - accessToken: string; - userId: string; - deviceId: string; -}; +import { Session, getSessionStoreName } from '../app/state/sessions'; export const initClient = async (session: Session): Promise => { + const storeName = getSessionStoreName(session); + const indexedDBStore = new IndexedDBStore({ indexedDB: global.indexedDB, localStorage: global.localStorage, - dbName: 'web-sync-store', + dbName: storeName.sync, }); - const legacyCryptoStore = new IndexedDBCryptoStore(global.indexedDB, 'crypto-store'); + const cryptoStore = new IndexedDBCryptoStore(global.indexedDB, storeName.crypto); // 4. USE THE DYNAMIC NAME const mx = createClient({ baseUrl: session.baseUrl, accessToken: session.accessToken, userId: session.userId, store: indexedDBStore, - cryptoStore: legacyCryptoStore, + cryptoStore, deviceId: session.deviceId, timelineSupport: true, cryptoCallbacks: cryptoCallbacks as any,