Skip to content

Commit

Permalink
Filter signaling data by seq
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-nadymov committed Apr 23, 2021
1 parent 13a2a0a commit ce576f1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Calls/P2P/P2PEncryptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default class P2PEncryptor {
this.isOutgoing = isOutgoing;
this.type = 'Signaling';
this.counter = 0;
this.seqMap = new Map();

const p2pKeyWA = CryptoJS.enc.Base64.parse(keyBase64);
this.p2pKey = wordArrayToUint8Array(p2pKeyWA);
Expand Down Expand Up @@ -250,16 +251,12 @@ export default class P2PEncryptor {
return null;
}

// let msgKeyEquals = true;
// for (let i = 0; i < 16; i++) {
// if (msgKey[i] !== msgKeyLarge[i + 8]) {
// msgKeyEquals = false;
// }
// }
//
// if (!msgKeyEquals) {
// return null;
// }
const dataView = new DataView(decryptionBuffer.buffer);
const seq = dataView.getUint32(0);
if (this.seqMap.has(seq)) {
return null;
}
this.seqMap.set(seq, seq);

return decryptionBuffer.slice(4);
}
Expand Down

0 comments on commit ce576f1

Please sign in to comment.