From bf8bb236833e7fe52f7be8988bef430cb372c843 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Wed, 7 Aug 2019 16:45:07 +1000 Subject: [PATCH] remove stale comment and simplify conversation creation --- libloki/api.js | 1 - libtextsecure/account_manager.js | 16 ++++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libloki/api.js b/libloki/api.js index ccc15ef12..9c1314285 100644 --- a/libloki/api.js +++ b/libloki/api.js @@ -77,7 +77,6 @@ pairingAuthorisation, }); const options = {}; - // Send a empty message with information about how to contact us directly const outgoingMessage = new textsecure.OutgoingMessage( null, // server Date.now(), // timestamp, diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index 39806415d..7ad16c766 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -563,23 +563,15 @@ } // Validate pubKey - const c = new Whisper.Conversation({ - id: secondaryDevicePubKey, - type: 'private', - }); + const c = await ConversationController.getOrCreateAndWait( + secondaryDevicePubKey, + 'private' + ); const validationError = c.validateNumber(); if (validationError) { throw new Error('Invalid secondary device pubkey provided'); } // Ensure there is a conversation existing - try { - await ConversationController.getOrCreateAndWait( - secondaryDevicePubKey, - 'private' - ); - } catch (e) { - window.log.error(e); - } const signature = await libloki.crypto.generateSignatureForPairing( secondaryDevicePubKey, textsecure.protobuf.PairingAuthorisationMessage.Type.PAIRING_REQUEST