mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-02-02 15:41:41 +01:00
mark all existing user identities outdated as cross-signing keys missing
This commit is contained in:
parent
1dc3acad03
commit
7d806b03b3
@ -13,6 +13,7 @@ import {encodeScopeTypeKey} from "./stores/OperationStore";
|
|||||||
import {MAX_UNICODE} from "./stores/common";
|
import {MAX_UNICODE} from "./stores/common";
|
||||||
import {ILogItem} from "../../../logging/types";
|
import {ILogItem} from "../../../logging/types";
|
||||||
|
|
||||||
|
import type {UserIdentity} from "../../e2ee/DeviceTracker";
|
||||||
|
|
||||||
export type MigrationFunc = (db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem) => Promise<void> | void;
|
export type MigrationFunc = (db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem) => Promise<void> | void;
|
||||||
// FUNCTIONS SHOULD ONLY BE APPENDED!!
|
// FUNCTIONS SHOULD ONLY BE APPENDED!!
|
||||||
@ -35,7 +36,7 @@ export const schema: MigrationFunc[] = [
|
|||||||
addInboundSessionBackupIndex,
|
addInboundSessionBackupIndex,
|
||||||
migrateBackupStatus,
|
migrateBackupStatus,
|
||||||
createCallStore,
|
createCallStore,
|
||||||
createCrossSigningKeyStoreAndRenameDeviceIdentities
|
applyCrossSigningChanges
|
||||||
];
|
];
|
||||||
// TODO: how to deal with git merge conflicts of this array?
|
// TODO: how to deal with git merge conflicts of this array?
|
||||||
|
|
||||||
@ -277,10 +278,16 @@ function createCallStore(db: IDBDatabase) : void {
|
|||||||
db.createObjectStore("calls", {keyPath: "key"});
|
db.createObjectStore("calls", {keyPath: "key"});
|
||||||
}
|
}
|
||||||
|
|
||||||
//v18 create calls store and rename deviceIdentities to deviceKeys
|
//v18 add crossSigningKeys store, rename deviceIdentities to deviceKeys and empties userIdentities
|
||||||
function createCrossSigningKeyStoreAndRenameDeviceIdentities(db: IDBDatabase) : void {
|
async function applyCrossSigningChanges(db: IDBDatabase, txn: IDBTransaction) : Promise<void> {
|
||||||
db.createObjectStore("crossSigningKeys", {keyPath: "key"});
|
db.createObjectStore("crossSigningKeys", {keyPath: "key"});
|
||||||
db.deleteObjectStore("deviceIdentities");
|
db.deleteObjectStore("deviceIdentities");
|
||||||
const deviceKeys = db.createObjectStore("deviceKeys", {keyPath: "key"});
|
const deviceKeys = db.createObjectStore("deviceKeys", {keyPath: "key"});
|
||||||
deviceKeys.createIndex("byCurve25519Key", "curve25519Key", {unique: true});
|
deviceKeys.createIndex("byCurve25519Key", "curve25519Key", {unique: true});
|
||||||
|
// mark all userIdentities as outdated as cross-signing keys won't be stored
|
||||||
|
const userIdentities = txn.objectStore("userIdentities");
|
||||||
|
await iterateCursor<UserIdentity>(userIdentities.openCursor(), (value, key, cursor) => {
|
||||||
|
value.deviceTrackingStatus = 0 // outdated;
|
||||||
|
return NOT_DONE;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user