mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-03 13:47:45 +00:00
fix: remove disappearing config overwrite and fix EC key pair's pubkey being group's identity pubkey
This commit is contained in:
parent
affdf1ca07
commit
f6d351f9c3
@ -8,7 +8,6 @@ import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPol
|
|||||||
import org.session.libsession.utilities.Address
|
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.libsignal.crypto.ecc.DjbECPublicKey
|
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
|
||||||
@ -41,7 +40,7 @@ object ClosedGroupManager {
|
|||||||
return groups.eraseLegacyGroup(groupPublicKey)
|
return groups.eraseLegacyGroup(groupPublicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ConfigFactory.updateLegacyGroup(groupRecipientSettings: Recipient.RecipientSettings, group: GroupRecord) {
|
fun ConfigFactory.updateLegacyGroup(group: GroupRecord) {
|
||||||
val groups = userGroups ?: return
|
val groups = userGroups ?: return
|
||||||
if (!group.isClosedGroup) return
|
if (!group.isClosedGroup) return
|
||||||
val storage = MessagingModuleConfiguration.shared.storage
|
val storage = MessagingModuleConfiguration.shared.storage
|
||||||
@ -53,7 +52,6 @@ object ClosedGroupManager {
|
|||||||
val toSet = legacyInfo.copy(
|
val toSet = legacyInfo.copy(
|
||||||
members = latestMemberMap,
|
members = latestMemberMap,
|
||||||
name = group.title,
|
name = group.title,
|
||||||
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,
|
||||||
encPubKey = (latestKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
|
encPubKey = (latestKeyPair.publicKey as DjbECPublicKey).publicKey, // 'serialize()' inserts an extra byte
|
||||||
encSecKey = latestKeyPair.privateKey.serialize()
|
encSecKey = latestKeyPair.privateKey.serialize()
|
||||||
|
@ -336,7 +336,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
?: return Log.w("Loki", "No recipient settings when trying to update group config")
|
?: return Log.w("Loki", "No recipient settings when trying to update group config")
|
||||||
val latestGroup = storage.getGroup(groupID)
|
val latestGroup = storage.getGroup(groupID)
|
||||||
?: return Log.w("Loki", "No group record when trying to update group config")
|
?: return Log.w("Loki", "No group record when trying to update group config")
|
||||||
groupConfigFactory.updateLegacyGroup(latestRecipient, latestGroup)
|
groupConfigFactory.updateLegacyGroup(latestGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupMembers(val members: List<String>, val zombieMembers: List<String>)
|
class GroupMembers(val members: List<String>, val zombieMembers: List<String>)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.session.libsession.messaging.messages.control
|
package org.session.libsession.messaging.messages.control
|
||||||
|
|
||||||
import com.google.protobuf.ByteString
|
import com.google.protobuf.ByteString
|
||||||
import org.session.libsession.messaging.messages.copyExpiration
|
|
||||||
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.crypto.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
@ -91,7 +90,7 @@ class ClosedGroupControlMessage() : ControlMessage() {
|
|||||||
when (type) {
|
when (type) {
|
||||||
NEW -> takeIf { it.hasPublicKey() && it.hasEncryptionKeyPair() && it.hasName() }?.let {
|
NEW -> takeIf { it.hasPublicKey() && it.hasEncryptionKeyPair() && it.hasName() }?.let {
|
||||||
ECKeyPair(
|
ECKeyPair(
|
||||||
DjbECPublicKey(publicKey.toByteArray()),
|
DjbECPublicKey(encryptionKeyPair.publicKey.toByteArray()),
|
||||||
DjbECPrivateKey(encryptionKeyPair.privateKey.toByteArray())
|
DjbECPrivateKey(encryptionKeyPair.privateKey.toByteArray())
|
||||||
).let { Kind.New(publicKey, name, it, membersList, adminsList, expirationTimer) }
|
).let { Kind.New(publicKey, name, it, membersList, adminsList, expirationTimer) }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user