Fixed an issue where the group keyPair was getting encoded incorrectly

This commit is contained in:
Morgan Pretty 2023-06-02 15:32:31 +10:00
parent 6a4641bfce
commit ff7b7cd0b9
3 changed files with 7 additions and 5 deletions

View File

@ -833,7 +833,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
name = name, name = name,
members = members, members = members,
priority = ConfigBase.PRIORITY_VISIBLE, priority = ConfigBase.PRIORITY_VISIBLE,
encPubKey = encryptionKeyPair.publicKey.serialize(), encPubKey = (encryptionKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
encSecKey = encryptionKeyPair.privateKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(),
disappearingTimer = 0L, disappearingTimer = 0L,
joinedAt = (formationTimestamp / 1000L) joinedAt = (formationTimestamp / 1000L)
@ -866,7 +866,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
val groupInfo = userGroups.getOrConstructLegacyGroupInfo(groupPublicKey).copy( val groupInfo = userGroups.getOrConstructLegacyGroupInfo(groupPublicKey).copy(
name = name, name = name,
members = membersMap, members = membersMap,
encPubKey = latestKeyPair.publicKey.serialize(), encPubKey = (latestKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
encSecKey = latestKeyPair.privateKey.serialize(), encSecKey = latestKeyPair.privateKey.serialize(),
priority = if (isPinned(threadID)) PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE, priority = if (isPinned(threadID)) PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE,
disappearingTimer = recipientSettings.expireMessages.toLong() disappearingTimer = recipientSettings.expireMessages.toLong()

View File

@ -9,6 +9,7 @@ import org.session.libsession.utilities.Address
import org.session.libsession.utilities.GroupRecord import org.session.libsession.utilities.GroupRecord
import org.session.libsession.utilities.GroupUtil import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.recipients.Recipient import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.crypto.ecc.DjbECPublicKey
import org.thoughtcrime.securesms.ApplicationContext import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.dependencies.ConfigFactory import org.thoughtcrime.securesms.dependencies.ConfigFactory
@ -54,8 +55,8 @@ object ClosedGroupManager {
name = group.title, name = group.title,
disappearingTimer = groupRecipientSettings.expireMessages.toLong(), disappearingTimer = groupRecipientSettings.expireMessages.toLong(),
priority = if (storage.isPinned(threadId)) ConfigBase.PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE, priority = if (storage.isPinned(threadId)) ConfigBase.PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE,
encSecKey = latestKeyPair.privateKey.serialize(), encPubKey = (latestKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
encPubKey = latestKeyPair.publicKey.serialize() encSecKey = latestKeyPair.privateKey.serialize()
) )
groups.set(toSet) groups.set(toSet)
} }

View File

@ -23,6 +23,7 @@ import org.session.libsession.utilities.Address
import org.session.libsession.utilities.GroupUtil import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.TextSecurePreferences import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.WindowDebouncer import org.session.libsession.utilities.WindowDebouncer
import org.session.libsignal.crypto.ecc.DjbECPublicKey
import org.session.libsignal.utilities.Hex import org.session.libsignal.utilities.Hex
import org.session.libsignal.utilities.toHexString import org.session.libsignal.utilities.toHexString
import org.thoughtcrime.securesms.database.GroupDatabase import org.thoughtcrime.securesms.database.GroupDatabase
@ -254,7 +255,7 @@ object ConfigurationMessageUtilities {
name = group.title, name = group.title,
members = admins + members, members = admins + members,
priority = if (isPinned) ConfigBase.PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE, priority = if (isPinned) ConfigBase.PRIORITY_PINNED else ConfigBase.PRIORITY_VISIBLE,
encPubKey = encryptionKeyPair.publicKey.serialize(), encPubKey = (encryptionKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
encSecKey = encryptionKeyPair.privateKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(),
disappearingTimer = recipient.expireMessages.toLong(), disappearingTimer = recipient.expireMessages.toLong(),
joinedAt = (group.formationTimestamp / 1000L) joinedAt = (group.formationTimestamp / 1000L)