From 320d1f18ae227ec18c66137a6fe39dde1b4ae869 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 14 Oct 2014 18:28:36 -0700 Subject: [PATCH] Fix exception when protbuf-encoding groupIds An exception is thrown when protobuf tries to encode a number as the group id, which is declared to have type 'bytes'. Fix by make it an ArrayBuffer instead, and increase the length to 16, which is what the Android client uses: https://github.com/WhisperSystems/TextSecure/blob/c632b32ff89fe2b34cb8844cde37b77b580c7d0e/src/org/thoughtcrime/securesms/database/GroupDatabase.java#L222 --- js/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/helpers.js b/js/helpers.js index 03786a9a8..27cbd4209 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -423,7 +423,7 @@ window.textsecure.storage = function() { } while (groupId === undefined || textsecure.storage.getEncrypted("group" + groupId) !== undefined) { - groupId = new Uint32Array(textsecure.crypto.getRandomBytes(4))[0]; + groupId = textsecure.crypto.getRandomBytes(16); } var me = textsecure.utils.unencodeNumber(textsecure.storage.getUnencrypted("number_id"))[0];