From 875c128d2a5b30995c7839bb5986b623360f14d2 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 20 Apr 2020 16:26:04 +1000 Subject: [PATCH] remove useSealedSender feature as this is default now --- libtextsecure/outgoing_message.js | 49 ++++++++++--------------------- preload.js | 2 -- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index bcbc7c8fb..64a44819e 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -5,7 +5,6 @@ ConversationController, libloki, StringView, - dcodeIO, lokiMessageAPI, i18n, */ @@ -429,42 +428,24 @@ OutgoingMessage.prototype = { ); } - let type; - let content; - if (window.lokiFeatureFlags.useSealedSender) { - const secretSessionCipher = new window.Signal.Metadata.SecretSessionCipher( - textsecure.storage.protocol - ); - // ciphers[address.getDeviceId()] = secretSessionCipher; + const secretSessionCipher = new window.Signal.Metadata.SecretSessionCipher( + textsecure.storage.protocol + ); + // ciphers[address.getDeviceId()] = secretSessionCipher; - const senderCert = new textsecure.protobuf.SenderCertificate(); + const senderCert = new textsecure.protobuf.SenderCertificate(); - senderCert.sender = ourKey; - senderCert.senderDevice = deviceId; + senderCert.sender = ourKey; + senderCert.senderDevice = deviceId; - const ciphertext = await secretSessionCipher.encrypt( - address, - senderCert, - plaintext, - sessionCipher - ); - type = textsecure.protobuf.Envelope.Type.UNIDENTIFIED_SENDER; - content = window.Signal.Crypto.arrayBufferToBase64(ciphertext); - } else { - // TODO: probably remove this branch once - // mobile clients implement sealed sender - // ciphers[address.getDeviceId()] = sessionCipher; - const ciphertext = await sessionCipher.encrypt(plaintext); - if (!enableFallBackEncryption) { - // eslint-disable-next-line no-param-reassign - ciphertext.body = new Uint8Array( - dcodeIO.ByteBuffer.wrap(ciphertext.body, 'binary').toArrayBuffer() - ); - } - // eslint-disable-next-line prefer-destructuring - type = ciphertext.type; - content = ciphertext.body; - } + const ciphertext = await secretSessionCipher.encrypt( + address, + senderCert, + plaintext, + sessionCipher + ); + const type = textsecure.protobuf.Envelope.Type.UNIDENTIFIED_SENDER; + const content = window.Signal.Crypto.arrayBufferToBase64(ciphertext); return { type, // FallBackSessionCipher sets this to FRIEND_REQUEST diff --git a/preload.js b/preload.js index 7178e1f69..634dcb860 100644 --- a/preload.js +++ b/preload.js @@ -413,7 +413,6 @@ window.lokiFeatureFlags = { multiDeviceUnpairing: true, privateGroupChats: true, useSnodeProxy: !process.env.USE_STUBBED_NETWORK, - useSealedSender: true, useOnionRequests: true, onionRequestHops: 1, }; @@ -448,6 +447,5 @@ if (config.environment.includes('test-integration')) { multiDeviceUnpairing: true, privateGroupChats: true, useSnodeProxy: !process.env.USE_STUBBED_NETWORK, - useSealedSender: true, }; }