mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-21 02:11:31 +00:00
Debug
This commit is contained in:
parent
80bbeee7ce
commit
e2ce43c3cd
@ -279,6 +279,10 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
MultiDeviceProtocol.handleUnlinkingRequestIfNeeded(context, content);
|
MultiDeviceProtocol.handleUnlinkingRequestIfNeeded(context, content);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (message.getClosedGroupUpdate().isPresent()) {
|
||||||
|
ClosedGroupsProtocol.handleSharedSenderKeysUpdate(context, message.getClosedGroupUpdate().get(), content.getSender());
|
||||||
|
}
|
||||||
|
|
||||||
if (message.isEndSession()) {
|
if (message.isEndSession()) {
|
||||||
handleEndSessionMessage(content, smsMessageId);
|
handleEndSessionMessage(content, smsMessageId);
|
||||||
} else if (message.isGroupUpdate()) {
|
} else if (message.isGroupUpdate()) {
|
||||||
|
@ -36,7 +36,8 @@ public abstract class PushReceivedJob extends BaseJob {
|
|||||||
|
|
||||||
if (envelope.isReceipt()) {
|
if (envelope.isReceipt()) {
|
||||||
handleReceipt(envelope);
|
handleReceipt(envelope);
|
||||||
} else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage() || envelope.isUnidentifiedSender() || envelope.isFallbackMessage()) {
|
} else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage()
|
||||||
|
|| envelope.isUnidentifiedSender() || envelope.isFallbackMessage() || envelope.isClosedGroupCiphertext()) {
|
||||||
handleMessage(envelope, isPushNotification);
|
handleMessage(envelope, isPushNotification);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());
|
Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());
|
||||||
|
@ -59,7 +59,7 @@ class ClosedGroupPoller private constructor(private val context: Context, privat
|
|||||||
// region Private API
|
// region Private API
|
||||||
private fun poll() {
|
private fun poll() {
|
||||||
if (!isPolling) { return }
|
if (!isPolling) { return }
|
||||||
val publicKeys = database.getAllClosedGroupPublicKeys()
|
val publicKeys = database.getAllClosedGroupPublicKeys().map { "05$it" }
|
||||||
publicKeys.forEach { publicKey ->
|
publicKeys.forEach { publicKey ->
|
||||||
SwarmAPI.shared.getSwarm(publicKey).bind { swarm ->
|
SwarmAPI.shared.getSwarm(publicKey).bind { swarm ->
|
||||||
val snode = swarm.getRandomElementOrNull() ?: throw InsufficientSnodesException() // Should be cryptographically secure
|
val snode = swarm.getRandomElementOrNull() ?: throw InsufficientSnodesException() // Should be cryptographically secure
|
||||||
|
@ -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.ClosedGroupRatchet
|
||||||
import org.whispersystems.signalservice.loki.protocol.closedgroups.ClosedGroupSenderKey
|
import org.whispersystems.signalservice.loki.protocol.closedgroups.ClosedGroupSenderKey
|
||||||
import org.whispersystems.signalservice.loki.protocol.closedgroups.SharedSenderKeysDatabaseProtocol
|
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 {
|
class SharedSenderKeysDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), SharedSenderKeysDatabaseProtocol {
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ class SharedSenderKeysDatabase(context: Context, helper: SQLCipherOpenHelper) :
|
|||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
override fun isSSKBasedClosedGroup(groupPublicKey: String): Boolean {
|
override fun isSSKBasedClosedGroup(groupPublicKey: String): Boolean {
|
||||||
|
if (!PublicKeyValidation.isValid(groupPublicKey)) { return false }
|
||||||
return getAllClosedGroupPublicKeys().contains(groupPublicKey)
|
return getAllClosedGroupPublicKeys().contains(groupPublicKey)
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -180,6 +180,7 @@ object ClosedGroupsProtocol {
|
|||||||
ApplicationContext.getInstance(context).jobManager.add(job)
|
ApplicationContext.getInstance(context).jobManager.add(job)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
public fun handleSharedSenderKeysUpdate(context: Context, closedGroupUpdate: SignalServiceProtos.ClosedGroupUpdate, senderPublicKey: String) {
|
public fun handleSharedSenderKeysUpdate(context: Context, closedGroupUpdate: SignalServiceProtos.ClosedGroupUpdate, senderPublicKey: String) {
|
||||||
when (closedGroupUpdate.type) {
|
when (closedGroupUpdate.type) {
|
||||||
SignalServiceProtos.ClosedGroupUpdate.Type.NEW -> handleNewClosedGroup(context, closedGroupUpdate)
|
SignalServiceProtos.ClosedGroupUpdate.Type.NEW -> handleNewClosedGroup(context, closedGroupUpdate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user