pull/495/head
sachaaaaa 6 years ago
parent bd16bc5b9b
commit 712afef8e2

@ -1095,20 +1095,16 @@ MessageReceiver.prototype.extend({
}, },
async handlePairingRequest(envelope, pairingRequest) { async handlePairingRequest(envelope, pairingRequest) {
const valid = await this.validateAuthorisation(pairingRequest); const valid = await this.validateAuthorisation(pairingRequest);
if (!valid) { if (valid) {
return this.removeFromCache(envelope); // Pairing dialog is open and is listening
}
await window.libloki.storage.savePairingAuthorisation(pairingRequest);
if (Whisper.events.isListenedTo('devicePairingRequestReceived')) { if (Whisper.events.isListenedTo('devicePairingRequestReceived')) {
await window.libloki.storage.savePairingAuthorisation(pairingRequest);
Whisper.events.trigger( Whisper.events.trigger(
'devicePairingRequestReceived', 'devicePairingRequestReceived',
pairingRequest.secondaryDevicePubKey pairingRequest.secondaryDevicePubKey
); );
} else { }
Whisper.events.trigger( // Ignore requests if the dialog is closed
'devicePairingRequestRejected',
pairingRequest.secondaryDevicePubKey
);
} }
return this.removeFromCache(envelope); return this.removeFromCache(envelope);
}, },

Loading…
Cancel
Save