diff --git a/ts/background.ts b/ts/background.ts index 64a1f182eb7d..cce6c97131d5 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -2050,10 +2050,6 @@ export async function startApp(): Promise { const OLD_USERNAME = window.storage.get('number_id', ''); const USERNAME = window.storage.get('uuid_id', ''); const PASSWORD = window.storage.get('password', ''); - const mySignalingKey = window.storage.get( - 'signaling_key', - new ArrayBuffer(0) - ); window.textsecure.messaging = new window.textsecure.MessageSender( USERNAME || OLD_USERNAME, @@ -2113,7 +2109,6 @@ export async function startApp(): Promise { OLD_USERNAME, USERNAME, PASSWORD, - mySignalingKey, messageReceiverOptions ); window.textsecure.messageReceiver = messageReceiver; @@ -2257,7 +2252,7 @@ export async function startApp(): Promise { const manager = window.getAccountManager()!; await Promise.all([ manager.maybeUpdateDeviceName(), - manager.maybeDeleteSignalingKey(), + window.textsecure.storage.user.removeSignalingKey(), ]); } catch (e) { window.log.error( diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index d9281f292f7b..12545be60eb3 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -720,7 +720,6 @@ const ITEM_KEYS: Partial>> = { identityKey: ['value.pubKey', 'value.privKey'], senderCertificate: ['value.serialized'], senderCertificateNoE164: ['value.serialized'], - signaling_key: ['value'], profileKey: ['value'], }; async function createOrUpdateItem(data: ItemType) { diff --git a/ts/test-electron/MessageReceiver_test.ts b/ts/test-electron/MessageReceiver_test.ts index 5ce83664a2d5..79c7eedd1ed5 100644 --- a/ts/test-electron/MessageReceiver_test.ts +++ b/ts/test-electron/MessageReceiver_test.ts @@ -27,7 +27,6 @@ describe('MessageReceiver', () => { const number = '+19999999999'; const uuid = 'aaaaaaaa-bbbb-4ccc-9ddd-eeeeeeeeeeee'; const deviceId = 1; - const signalingKey = Crypto.getRandomBytes(32 + 20); describe('connecting', () => { it('generates decryption-error event when it cannot decrypt', done => { @@ -37,7 +36,6 @@ describe('MessageReceiver', () => { 'oldUsername.2', 'username.2', 'password', - signalingKey, { serverTrustRoot: 'AAAAAAAA', socket: socket as WebSocket, diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index 21583d640f64..cc18fea03c45 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -158,13 +158,6 @@ export default class AccountManager extends EventTarget { await window.textsecure.storage.user.setDeviceNameEncrypted(); } - async maybeDeleteSignalingKey() { - const key = window.textsecure.storage.user.getSignalingKey(); - if (key) { - await this.server.removeSignalingKey(); - } - } - async registerSingleDevice(number: string, verificationCode: string) { return this.queueTask(async () => { const identityKeyPair = generateKeyPair(); diff --git a/ts/textsecure/Crypto.ts b/ts/textsecure/Crypto.ts index fd3e0a01ef98..55e80b3e87c5 100644 --- a/ts/textsecure/Crypto.ts +++ b/ts/textsecure/Crypto.ts @@ -151,45 +151,6 @@ async function verifyDigest( } const Crypto = { - // Decrypts message into a raw string - async decryptWebsocketMessage( - decodedMessage: ArrayBuffer, - signalingKey: ArrayBuffer - ): Promise { - if (signalingKey.byteLength !== 52) { - throw new Error('Got invalid length signalingKey'); - } - if (decodedMessage.byteLength < 1 + 16 + 10) { - throw new Error('Got invalid length message'); - } - if (new Uint8Array(decodedMessage)[0] !== 1) { - throw new Error( - `Got bad version number: ${new Uint8Array(decodedMessage)[0]}` - ); - } - - const aesKey = signalingKey.slice(0, 32); - const macKey = signalingKey.slice(32, 32 + 20); - - const iv = decodedMessage.slice(1, 1 + 16); - const ciphertext = decodedMessage.slice( - 1 + 16, - decodedMessage.byteLength - 10 - ); - const ivAndCiphertext = decodedMessage.slice( - 0, - decodedMessage.byteLength - 10 - ); - const mac = decodedMessage.slice( - decodedMessage.byteLength - 10, - decodedMessage.byteLength - ); - - await verifyHmacSha256(ivAndCiphertext, macKey, mac, 10); - - return decryptAes256CbcPkcsPadding(aesKey, ciphertext, iv); - }, - async decryptAttachment( encryptedBin: ArrayBuffer, keys: ArrayBuffer, diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 560cd072ae66..29168a36f3fc 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -198,8 +198,6 @@ class MessageReceiverInner extends EventTarget { serverTrustRoot: Uint8Array; - signalingKey: ArrayBuffer; - socket?: WebSocket; socketStatus = SocketStatus.CLOSED; @@ -220,7 +218,6 @@ class MessageReceiverInner extends EventTarget { oldUsername: string, username: string, password: string, - signalingKey: ArrayBuffer, options: { serverTrustRoot: string; } @@ -230,7 +227,6 @@ class MessageReceiverInner extends EventTarget { this.count = 0; this.processedCount = 0; - this.signalingKey = signalingKey; this.username = oldUsername; this.uuid = username; this.password = password; @@ -479,7 +475,6 @@ class MessageReceiverInner extends EventTarget { } const job = async () => { - let plaintext: Uint8Array; const headers = request.headers || []; if (!request.body) { @@ -488,16 +483,7 @@ class MessageReceiverInner extends EventTarget { ); } - if (headers.includes('X-Signal-Key: true')) { - plaintext = new FIXMEU8( - await Crypto.decryptWebsocketMessage( - typedArrayToArrayBuffer(request.body), - this.signalingKey - ) - ); - } else { - plaintext = request.body; - } + const plaintext = request.body; try { const decoded = Proto.Envelope.decode(plaintext); @@ -2683,7 +2669,6 @@ export default class MessageReceiver { oldUsername: string, username: string, password: string, - signalingKey: ArrayBuffer, options: { serverTrustRoot: string; retryCached?: string; @@ -2694,7 +2679,6 @@ export default class MessageReceiver { oldUsername, username, password, - signalingKey, options ); this.inner = inner; diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 60949a148a12..b93a98a6396e 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -831,7 +831,6 @@ const URL_CALLS = { multiRecipient: 'v1/messages/multi_recipient', profile: 'v1/profile', registerCapabilities: 'v1/devices/capabilities', - removeSignalingKey: 'v1/accounts/signaling_key', reportMessage: 'v1/messages/report', signed: 'v2/keys/signed', storageManifest: 'v1/storage/manifest', @@ -1051,7 +1050,6 @@ export type WebAPIType = { ) => Promise; registerKeys: (genKeys: KeysType) => Promise; registerSupportForUnauthenticatedDelivery: () => Promise; - removeSignalingKey: () => Promise; reportMessage: (senderE164: string, serverGuid: string) => Promise; requestVerificationSMS: (number: string) => Promise; requestVerificationVoice: (number: string) => Promise; @@ -1244,7 +1242,6 @@ export function initialize({ registerCapabilities, registerKeys, registerSupportForUnauthenticatedDelivery, - removeSignalingKey, reportMessage, requestVerificationSMS, requestVerificationVoice, @@ -1617,13 +1614,6 @@ export function initialize({ }); } - async function removeSignalingKey() { - return _ajax({ - call: 'removeSignalingKey', - httpType: 'DELETE', - }); - } - async function getDevices() { return _ajax({ call: 'devices', diff --git a/ts/textsecure/storage/User.ts b/ts/textsecure/storage/User.ts index e77d87dfc80d..e377effe4f65 100644 --- a/ts/textsecure/storage/User.ts +++ b/ts/textsecure/storage/User.ts @@ -58,8 +58,8 @@ export class User { return this.storage.get('deviceNameEncrypted'); } - public getSignalingKey(): ArrayBuffer | undefined { - return this.storage.get('signaling_key'); + public async removeSignalingKey(): Promise { + return this.storage.remove('signaling_key'); } private _getDeviceIdFromUuid(): string | undefined { diff --git a/ts/types/Storage.d.ts b/ts/types/Storage.d.ts index 81bd223b897e..4273176ea281 100644 --- a/ts/types/Storage.d.ts +++ b/ts/types/Storage.d.ts @@ -98,7 +98,6 @@ export type StorageAccessType = { unidentifiedDeliveryIndicators: boolean; groupCredentials: Array; lastReceivedAtCounter: number; - signaling_key: ArrayBuffer; skinTone: number; unreadCount: number; 'challenge:retry-message-ids': ReadonlyArray<{ @@ -113,6 +112,7 @@ export type StorageAccessType = { // Deprecated senderCertificateWithUuid: never; + signaling_key: never; }; export interface StorageInterface {