This commit is contained in:
nielsandriesse
2020-08-11 11:51:51 +10:00
parent 80bbeee7ce
commit e2ce43c3cd
5 changed files with 10 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ class ClosedGroupPoller private constructor(private val context: Context, privat
// region Private API
private fun poll() {
if (!isPolling) { return }
val publicKeys = database.getAllClosedGroupPublicKeys()
val publicKeys = database.getAllClosedGroupPublicKeys().map { "05$it" }
publicKeys.forEach { publicKey ->
SwarmAPI.shared.getSwarm(publicKey).bind { swarm ->
val snode = swarm.getRandomElementOrNull() ?: throw InsufficientSnodesException() // Should be cryptographically secure

View File

@@ -9,6 +9,7 @@ import org.thoughtcrime.securesms.util.Hex
import org.whispersystems.signalservice.loki.protocol.closedgroups.ClosedGroupRatchet
import org.whispersystems.signalservice.loki.protocol.closedgroups.ClosedGroupSenderKey
import org.whispersystems.signalservice.loki.protocol.closedgroups.SharedSenderKeysDatabaseProtocol
import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation
class SharedSenderKeysDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), SharedSenderKeysDatabaseProtocol {
@@ -105,6 +106,7 @@ class SharedSenderKeysDatabase(context: Context, helper: SQLCipherOpenHelper) :
// endregion
override fun isSSKBasedClosedGroup(groupPublicKey: String): Boolean {
if (!PublicKeyValidation.isValid(groupPublicKey)) { return false }
return getAllClosedGroupPublicKeys().contains(groupPublicKey)
}
// endregion

View File

@@ -180,6 +180,7 @@ object ClosedGroupsProtocol {
ApplicationContext.getInstance(context).jobManager.add(job)
}
@JvmStatic
public fun handleSharedSenderKeysUpdate(context: Context, closedGroupUpdate: SignalServiceProtos.ClosedGroupUpdate, senderPublicKey: String) {
when (closedGroupUpdate.type) {
SignalServiceProtos.ClosedGroupUpdate.Type.NEW -> handleNewClosedGroup(context, closedGroupUpdate)