pull/541/head
sachaaaaa 6 years ago
parent 8df692901a
commit c38e145be7

@ -34,7 +34,9 @@ class LokiFileServerAPI {
); );
} else { } else {
authorisations = [ authorisations = [
await libloki.storage.getGrantAuthorisationForSecondaryPubKey(this.ourKey), await libloki.storage.getGrantAuthorisationForSecondaryPubKey(
this.ourKey
),
]; ];
} }
return this._setOurDeviceMapping(authorisations, isPrimary); return this._setOurDeviceMapping(authorisations, isPrimary);

@ -1068,7 +1068,9 @@ MessageReceiver.prototype.extend({
pairingAuthorisation, pairingAuthorisation,
{ dataMessage, syncMessage } { dataMessage, syncMessage }
) { ) {
const valid = await libloki.crypto.validateAuthorisation(pairingAuthorisation); const valid = await libloki.crypto.validateAuthorisation(
pairingAuthorisation
);
const alreadySecondaryDevice = !!window.storage.get('isSecondaryDevice'); const alreadySecondaryDevice = !!window.storage.get('isSecondaryDevice');
let removedFromCache = false; let removedFromCache = false;
if (alreadySecondaryDevice) { if (alreadySecondaryDevice) {
@ -1145,7 +1147,9 @@ MessageReceiver.prototype.extend({
); );
}, },
async handleAuthorisationForContact(envelope) { async handleAuthorisationForContact(envelope) {
window.log.error('Unexpected pairing request/authorisation received, ignoring.'); window.log.error(
'Unexpected pairing request/authorisation received, ignoring.'
);
return this.removeFromCache(envelope); return this.removeFromCache(envelope);
}, },
async handlePairingAuthorisationMessage(envelope, content) { async handlePairingAuthorisationMessage(envelope, content) {
@ -1250,9 +1254,14 @@ MessageReceiver.prototype.extend({
} else { } else {
const senderPubKey = envelope.source; const senderPubKey = envelope.source;
// fetch the device mapping from the server // fetch the device mapping from the server
const deviceMapping = await lokiFileServerAPI.getUserDeviceMapping(senderPubKey); const deviceMapping = await lokiFileServerAPI.getUserDeviceMapping(
senderPubKey
);
// auto-accept friend request if the device is paired to one of our friend // auto-accept friend request if the device is paired to one of our friend
const autoAccepted = await this.handleSecondaryDeviceFriendRequest(senderPubKey, deviceMapping); const autoAccepted = await this.handleSecondaryDeviceFriendRequest(
senderPubKey,
deviceMapping
);
if (autoAccepted) { if (autoAccepted) {
return this.removeFromCache(envelope); return this.removeFromCache(envelope);
} }

Loading…
Cancel
Save