1
0
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:
Timo K
2025-12-19 11:45:25 +01:00
parent 9779ac975d
commit 731828c22e
2 changed files with 9 additions and 9 deletions

View File

@@ -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);
}

View File

@@ -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;
}
}