commit bf9444dfb62e8ca76e6ef06895e2d3ee92c41bed
parent 095020d8f8ca6c9f1807942e59e3b03b4b86362d
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Fri, 27 Oct 2023 01:56:54 +0200

fix(core/e2ee): failed to send to unencrypted conversations
- auto enable feature after a shared key exchange

Diffstat:
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/EndToEndEncryption.kt | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/EndToEndEncryption.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/EndToEndEncryption.kt @@ -130,6 +130,7 @@ class EndToEndEncryption : MessagingRuleFeature( context.longToast("Failed to accept public key") return@warnKeyOverwrite } + setState(conversationId, true) context.longToast("Public key successfully accepted") sendCustomMessage(conversationId, RESPONSE_SK_MESSAGE_ID) { @@ -150,6 +151,7 @@ class EndToEndEncryption : MessagingRuleFeature( context.longToast("Failed to accept secret") return@warnKeyOverwrite } + setState(conversationId, true) 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)) } - 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(", ")}") return@subscribe }