This commit is contained in:
Ashley Graves 2024-10-13 15:29:19 +02:00
parent 6780ef1eb5
commit 8f7549fabe

View file

@ -110,8 +110,11 @@ function doCommand(client, event, cmd, args) {
async function verifyCallback(request) {
request.on(VerificationRequestEvent.Change, async function () {
switch (request.phase) {
case 2:
console.log("### VERIFICATION ### Requested by " + request.otherUserId);
await request.accept();
break;
case 3:
console.log("### VERIFICATION ### Starting for " + request.otherUserId);
var verifier = await request.startVerification(VerificationMethod.Sas);
verifier.on(VerifierEvent.ShowSas, async function () {
console.log("### VERIFICATION ### Confirming");
@ -124,6 +127,9 @@ async function verifyCallback(request) {
case 6:
console.log("### VERIFICATION ### Done!");
break;
default:
console.log("### VERIFICATION ### " + request.phase);
break;
}
});
}
@ -141,7 +147,7 @@ client.once("sync", async function (state, prevState, data) {
verifyCallback(request);
});
client.on(sdk.CryptoEvent.VerificationRequest, verifyCallback);
client.on("m.key.verification.request", verifyCallback);
client.on(sdk.RoomEvent.Timeline, async function (event, room, toStartOfTimeline) {
await client.decryptEventIfNeeded(event);