compress new e2ee stores into one new idb version

This commit is contained in:
Bruno Windels 2020-09-11 08:40:43 +02:00
parent 2f835238c8
commit 0b26e6f53a

View file

@ -9,12 +9,7 @@ export const schema = [
createInitialStores, createInitialStores,
createMemberStore, createMemberStore,
migrateSession, migrateSession,
createIdentityStores, createE2EEStores
createOlmSessionStore,
createInboundGroupSessionsStore,
createOutboundGroupSessionsStore,
createGroupSessionDecryptions,
addSenderKeyIndexToDeviceStore
]; ];
// TODO: how to deal with git merge conflicts of this array? // TODO: how to deal with git merge conflicts of this array?
@ -71,33 +66,12 @@ async function migrateSession(db, txn) {
} }
} }
//v4 //v4
function createIdentityStores(db) { function createE2EEStores(db) {
db.createObjectStore("userIdentities", {keyPath: "userId"}); db.createObjectStore("userIdentities", {keyPath: "userId"});
db.createObjectStore("deviceIdentities", {keyPath: "key"}); const deviceIdentities = db.createObjectStore("deviceIdentities", {keyPath: "key"});
} deviceIdentities.createIndex("byCurve25519Key", "curve25519Key", {unique: true});
//v5
function createOlmSessionStore(db) {
db.createObjectStore("olmSessions", {keyPath: "key"}); db.createObjectStore("olmSessions", {keyPath: "key"});
}
//v6
function createInboundGroupSessionsStore(db) {
db.createObjectStore("inboundGroupSessions", {keyPath: "key"}); db.createObjectStore("inboundGroupSessions", {keyPath: "key"});
}
//v7
function createOutboundGroupSessionsStore(db) {
db.createObjectStore("outboundGroupSessions", {keyPath: "roomId"}); db.createObjectStore("outboundGroupSessions", {keyPath: "roomId"});
}
//v8
function createGroupSessionDecryptions(db) {
db.createObjectStore("groupSessionDecryptions", {keyPath: "key"}); db.createObjectStore("groupSessionDecryptions", {keyPath: "key"});
} }
//v9
function addSenderKeyIndexToDeviceStore(db, txn) {
const deviceIdentities = txn.objectStore("deviceIdentities");
deviceIdentities.createIndex("byCurve25519Key", "curve25519Key", {unique: true});
}