gg
This commit is contained in:
parent
6780ef1eb5
commit
8f7549fabe
1 changed files with 8 additions and 2 deletions
10
index.js
10
index.js
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue