log amount of marked user identities in migration

This commit is contained in:
Bruno Windels 2023-03-03 11:57:15 +01:00
parent 2563aa23e1
commit 08984ad1bc

View File

@ -279,8 +279,8 @@ function createCallStore(db: IDBDatabase) : void {
db.createObjectStore("calls", {keyPath: "key"});
}
//v18 add crossSigningKeys store, rename deviceIdentities to deviceKeys and empties userIdentities
async function applyCrossSigningChanges(db: IDBDatabase, txn: IDBTransaction) : Promise<void> {
//v18 add crossSigningKeys store, rename deviceIdentities to deviceKeys and empties userIdentities
async function applyCrossSigningChanges(db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem) : Promise<void> {
db.createObjectStore("crossSigningKeys", {keyPath: "key"});
db.deleteObjectStore("deviceIdentities");
const deviceKeys = db.createObjectStore("deviceKeys", {keyPath: "key"});
@ -288,10 +288,13 @@ async function applyCrossSigningChanges(db: IDBDatabase, txn: IDBTransaction) :
// mark all userIdentities as outdated as cross-signing keys won't be stored
// also rename the deviceTrackingStatus field to keysTrackingStatus
const userIdentities = txn.objectStore("userIdentities");
let counter = 0;
await iterateCursor<UserIdentity>(userIdentities.openCursor(), (value, key, cursor) => {
delete value["deviceTrackingStatus"];
value.keysTrackingStatus = KeysTrackingStatus.Outdated;
cursor.update(value);
counter += 1;
return NOT_DONE;
});
log.set("marked_outdated", counter);
}