mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 05:37:48 +02:00
fix(core/e2ee): failed to send to unencrypted conversations
- auto enable feature after a shared key exchange
This commit is contained in:
@ -130,6 +130,7 @@ class EndToEndEncryption : MessagingRuleFeature(
|
|||||||
context.longToast("Failed to accept public key")
|
context.longToast("Failed to accept public key")
|
||||||
return@warnKeyOverwrite
|
return@warnKeyOverwrite
|
||||||
}
|
}
|
||||||
|
setState(conversationId, true)
|
||||||
context.longToast("Public key successfully accepted")
|
context.longToast("Public key successfully accepted")
|
||||||
|
|
||||||
sendCustomMessage(conversationId, RESPONSE_SK_MESSAGE_ID) {
|
sendCustomMessage(conversationId, RESPONSE_SK_MESSAGE_ID) {
|
||||||
@ -150,6 +151,7 @@ class EndToEndEncryption : MessagingRuleFeature(
|
|||||||
context.longToast("Failed to accept secret")
|
context.longToast("Failed to accept secret")
|
||||||
return@warnKeyOverwrite
|
return@warnKeyOverwrite
|
||||||
}
|
}
|
||||||
|
setState(conversationId, true)
|
||||||
context.longToast("Done! You can now exchange encrypted messages with this friend.")
|
context.longToast("Done! You can now exchange encrypted messages with this friend.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,7 +413,7 @@ class EndToEndEncryption : MessagingRuleFeature(
|
|||||||
conversationIds.add(SnapUUID.fromBytes(getByteArray(1, 1, 1) ?: return@eachBuffer))
|
conversationIds.add(SnapUUID.fromBytes(getByteArray(1, 1, 1) ?: return@eachBuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversationIds.any { !getState(it.toString()) }) {
|
if (conversationIds.any { !getState(it.toString()) || getE2EParticipants(it.toString()).isEmpty() }) {
|
||||||
context.log.debug("Skipping encryption for conversation ids: ${conversationIds.joinToString(", ")}")
|
context.log.debug("Skipping encryption for conversation ids: ${conversationIds.joinToString(", ")}")
|
||||||
return@subscribe
|
return@subscribe
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user