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)
pull/749/head
lilia 11 years ago
parent 5b0573293f
commit 320d1f18ae

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

Loading…
Cancel
Save