Add a developer command to reset Megolm and Olm sessions (#9044)

Useful when debugging crypto setup.
This commit is contained in:
Travis Ralston 2022-07-11 13:18:50 -06:00 committed by GitHub
parent 62f3a9ae05
commit b6a50ee5a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -1070,6 +1070,28 @@ export const Commands = [
category: CommandCategories.advanced,
renderingTypes: [TimelineRenderingType.Room],
}),
new Command({
command: 'remakeolm',
description: _td('Developer command: Discards the current outbound group session and sets up new Olm sessions'),
isEnabled: () => {
return SettingsStore.getValue("developerMode");
},
runFn: (roomId) => {
try {
const room = MatrixClientPeg.get().getRoom(roomId);
MatrixClientPeg.get().forceDiscardSession(roomId);
// noinspection JSIgnoredPromiseFromCall
MatrixClientPeg.get().crypto.ensureOlmSessionsForUsers(room.getMembers().map(m => m.userId), true);
} catch (e) {
return reject(e.message);
}
return success();
},
category: CommandCategories.advanced,
renderingTypes: [TimelineRenderingType.Room],
}),
new Command({
command: "rainbow",
description: _td("Sends the given message coloured as a rainbow"),