Skip to content

Commit

Permalink
Fix bug with pendingEventOrdering: "chronological" (#3382)
Browse files Browse the repository at this point in the history
If we don't do this, then we end up trying to match the MAC on our own
`m.key.verification.mac`, which of course fails.
  • Loading branch information
richvdh committed May 18, 2023
1 parent 0fa9528 commit b7b1129
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/crypto/verification/request/InRoomChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,17 @@ export class InRoomChannel implements IVerificationChannel {
this.requestEventId = InRoomChannel.getTransactionId(event);
}

// With pendingEventOrdering: "chronological", we will see events that have been sent but not yet reflected
// back via /sync. These are "local echoes" and are identifiable by their txnId
const isLocalEcho = !!event.getTxnId();

// Alternatively, we may see an event that we sent that is reflected back via /sync. These are "remote echoes"
// and have a transaction ID in the "unsigned" data
const isRemoteEcho = !!event.getUnsigned().transaction_id;

const isSentByUs = event.getSender() === this.client.getUserId();

return request.handleEvent(type, event, isLiveEvent, isRemoteEcho, isSentByUs);
return request.handleEvent(type, event, isLiveEvent, isLocalEcho || isRemoteEcho, isSentByUs);
}

/**
Expand Down

0 comments on commit b7b1129

Please sign in to comment.