Support for web socket communication with no signaling key

This commit is contained in:
Scott Nonnenberg
2019-01-11 08:53:35 -08:00
parent 00755072ee
commit 43e5d16020
7 changed files with 66 additions and 25 deletions

View File

@@ -274,8 +274,18 @@ MessageReceiver.prototype.extend({
return;
}
const promise = textsecure.crypto
.decryptWebsocketMessage(request.body, this.signalingKey)
let promise;
const headers = request.headers || [];
if (headers.includes('X-Signal-Key: true')) {
promise = textsecure.crypto.decryptWebsocketMessage(
request.body,
this.signalingKey
);
} else {
promise = Promise.resolve(request.body.toArrayBuffer());
}
promise = promise
.then(plaintext => {
const envelope = textsecure.protobuf.Envelope.decode(plaintext);
// After this point, decoding errors are not the server's