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:

c632b32ff8/src/org/thoughtcrime/securesms/database/GroupDatabase.java (L222)
This commit is contained in:
lilia 2014-10-14 18:28:36 -07:00
parent 5b0573293f
commit 320d1f18ae

View file

@ -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];