mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-12 15:56:43 +01:00
Don't try to decrypt if message is blank
This commit is contained in:
@@ -23,12 +23,14 @@ abstract class GeneralListEvent(
|
|||||||
fun bookmarkedPeople() = taggedUsers()
|
fun bookmarkedPeople() = taggedUsers()
|
||||||
|
|
||||||
fun plainContent(privKey: ByteArray): String? {
|
fun plainContent(privKey: ByteArray): String? {
|
||||||
|
if (content.isBlank()) return null
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
val sharedSecret = Utils.getSharedSecret(privKey, pubKey.hexToByteArray())
|
val sharedSecret = Utils.getSharedSecret(privKey, pubKey.hexToByteArray())
|
||||||
|
|
||||||
return Utils.decrypt(content, sharedSecret)
|
return Utils.decrypt(content, sharedSecret)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w("GeneralList", "Error decrypting the message ${e.message}")
|
Log.w("GeneralList", "Error decrypting the message ${e.message} for ${dTag()}")
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user