You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2026-01-03 23:22:30 +03:00
rename if to mapKey
This commit is contained in:
@@ -127,11 +127,11 @@ export class RTCEncryptionManager implements IEncryptionManager {
|
||||
}
|
||||
|
||||
private addKeyToParticipant(key: Uint8Array, keyIndex: number, membership: CallMembershipIdentityParts): void {
|
||||
const id = getEncryptionKeyMapKey(membership);
|
||||
if (!this.participantKeyRings.has(id)) {
|
||||
this.participantKeyRings.set(id, []);
|
||||
const mapKey = getEncryptionKeyMapKey(membership);
|
||||
if (!this.participantKeyRings.has(mapKey)) {
|
||||
this.participantKeyRings.set(mapKey, []);
|
||||
}
|
||||
this.participantKeyRings.get(id)!.push({ key, keyIndex, membership });
|
||||
this.participantKeyRings.get(mapKey)!.push({ key, keyIndex, membership });
|
||||
this.onEncryptionKeysChanged(key, keyIndex, membership);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,17 +33,17 @@ export class OutdatedKeyFilter {
|
||||
* @param item
|
||||
*/
|
||||
public isOutdated(membership: CallMembershipIdentityParts, item: InboundEncryptionSession): boolean {
|
||||
const id = getEncryptionKeyMapKey(membership);
|
||||
if (!this.tsBuffer.has(id)) {
|
||||
this.tsBuffer.set(id, new Map<number, number>());
|
||||
const mapKey = getEncryptionKeyMapKey(membership);
|
||||
if (!this.tsBuffer.has(mapKey)) {
|
||||
this.tsBuffer.set(mapKey, new Map<number, number>());
|
||||
}
|
||||
|
||||
const latestTimestamp = this.tsBuffer.get(id)?.get(item.keyIndex);
|
||||
const latestTimestamp = this.tsBuffer.get(mapKey)?.get(item.keyIndex);
|
||||
if (latestTimestamp && latestTimestamp > item.creationTS) {
|
||||
// The existing key is more recent, ignore this one
|
||||
return true;
|
||||
}
|
||||
this.tsBuffer.get(id)!.set(item.keyIndex, item.creationTS);
|
||||
this.tsBuffer.get(mapKey)!.set(item.keyIndex, item.creationTS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user