No need to handle authorisations sent in friend requests

pull/534/head
sachaaaaa 6 years ago
parent d5ddc1c536
commit 77bfee8892

@ -1213,25 +1213,8 @@ MessageReceiver.prototype.extend({
}) })
); );
}, },
async handleAuthorisationForContact(envelope, pairingAuthorisation) { async handleAuthorisationForContact(envelope) {
const valid = await this.validateAuthorisation(pairingAuthorisation); window.log.error('Unexpected pairing request/authorisation received, ignoring.');
if (!valid) {
window.log.warn(
'Received invalid pairing authorisation for self. Could not verify signature. Ignoring.'
);
} else {
const {
primaryDevicePubKey,
secondaryDevicePubKey,
} = pairingAuthorisation;
// ensure the primary device is a friend
const c = window.ConversationController.get(primaryDevicePubKey);
if (c && c.isFriend()) {
await libloki.storage.savePairingAuthorisation(pairingAuthorisation);
// send friend accept?
window.libloki.api.sendBackgroundMessage(secondaryDevicePubKey);
}
}
return this.removeFromCache(envelope); return this.removeFromCache(envelope);
}, },
async handlePairingAuthorisationMessage(envelope, content) { async handlePairingAuthorisationMessage(envelope, content) {
@ -1246,7 +1229,7 @@ MessageReceiver.prototype.extend({
content content
); );
} }
return this.handleAuthorisationForContact(envelope, pairingAuthorisation); return this.handleAuthorisationForContact(envelope);
}, },
handleDataMessage(envelope, msg) { handleDataMessage(envelope, msg) {
if (!envelope.isP2p) { if (!envelope.isP2p) {

Loading…
Cancel
Save