diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index abf394788..cd046a444 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -23,7 +23,7 @@ const ARCHIVE_AGE = 7 * 24 * 60 * 60 * 1000; function AccountManager(username, password) { - this.server = window.WebAPI.connect({ username, password }); + // this.server = window.WebAPI.connect({ username, password }); this.pending = Promise.resolve(); } @@ -44,10 +44,10 @@ AccountManager.prototype.extend({ constructor: AccountManager, requestVoiceVerification(number) { - return this.server.requestVerificationVoice(number); + // return this.server.requestVerificationVoice(number); }, requestSMSVerification(number) { - return this.server.requestVerificationSMS(number); + // return this.server.requestVerificationSMS(number); }, registerSingleDevice(mnemonic, mnemonicLanguage) { const createAccount = this.createAccount.bind(this); @@ -140,18 +140,18 @@ throw new Error('account_manager: registerSecondDevice has not been implemented!'); }, refreshPreKeys() { - const generateKeys = this.generateKeys.bind(this, 0); - const registerKeys = this.server.registerKeys.bind(this.server); - - return this.queueTask(() => - this.server.getMyKeys().then(preKeyCount => { - window.log.info(`prekey count ${preKeyCount}`); - if (preKeyCount < 10) { - return generateKeys().then(registerKeys); - } - return null; - }) - ); + // const generateKeys = this.generateKeys.bind(this, 0); + // const registerKeys = this.server.registerKeys.bind(this.server); + + // return this.queueTask(() => + // this.server.getMyKeys().then(preKeyCount => { + // window.log.info(`prekey count ${preKeyCount}`); + // if (preKeyCount < 10) { + // return generateKeys().then(registerKeys); + // } + // return null; + // }) + // ); }, rotateSignedPreKey() { return this.queueTask(() => { diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index e70ba299c..bb0c74b41 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -807,6 +807,7 @@ MessageReceiver.prototype.extend({ }, async decryptPreKeyWhisperMessage(ciphertext, sessionCipher, address) { const padded = await sessionCipher.decryptPreKeyWhisperMessage(ciphertext); + return padded; try { return this.unpad(padded); @@ -1032,8 +1033,9 @@ MessageReceiver.prototype.extend({ } else if (content.receiptMessage) { return this.handleReceiptMessage(envelope, content.receiptMessage); } - this.removeFromCache(envelope); - throw new Error('Unsupported content message'); + if (!content.preKeyBundleMessage) { + throw new Error('Unsupported content message'); + } }, handleCallMessage(envelope) { window.log.info('call message from', this.getEnvelopeId(envelope)); diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index c1fb2b615..52b5129c8 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -134,9 +134,9 @@ OutgoingMessage.prototype = { }) ); // TODO: check if still applicable - if (updateDevices === undefined) { - return this.server.getKeysForNumber(number, '*').then(handleResult); - } + // if (updateDevices === undefined) { + // return this.server.getKeysForNumber(number, '*').then(handleResult); + // } let promise = Promise.resolve(true); updateDevices.forEach(device => { promise = promise.then(() =>