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
} if (Whisper.events.isListenedTo('devicePairingRequestReceived')) {
await window.libloki.storage.savePairingAuthorisation(pairingRequest); await window.libloki.storage.savePairingAuthorisation(pairingRequest);
if (Whisper.events.isListenedTo('devicePairingRequestReceived')) { Whisper.events.trigger(
Whisper.events.trigger( 'devicePairingRequestReceived',
'devicePairingRequestReceived', pairingRequest.secondaryDevicePubKey
pairingRequest.secondaryDevicePubKey );
); }
} else { // Ignore requests if the dialog is closed
Whisper.events.trigger(
'devicePairingRequestRejected',
pairingRequest.secondaryDevicePubKey
);
} }
return this.removeFromCache(envelope); return this.removeFromCache(envelope);
}, },

Loading…
Cancel
Save