Skip to content

Commit

Permalink
return null when failed to decrypt or encrypt messages
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Jun 28, 2024
1 parent 2117f85 commit 6988317
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/src/main/java/com/greenart7c3/nostrsigner/SignerProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ class SignerProvider : ContentProvider() {
type,
account,
pubkey,
) ?: "Could not decrypt the message"
)
} catch (e: Exception) {
"Could not decrypt the message"
null
}

database.applicationDao().addHistory(
Expand All @@ -297,13 +297,11 @@ class SignerProvider : ContentProvider() {
),
)

if (type == SignerType.NIP04_ENCRYPT && result == "Could not decrypt the message") {
return null
} else {
val cursor = MatrixCursor(arrayOf("signature", "event"))
cursor.addRow(arrayOf<Any>(result, result))
return cursor
}
if (result == null) return null

val cursor = MatrixCursor(arrayOf("signature", "event"))
cursor.addRow(arrayOf<Any>(result, result))
return cursor
}

"content://$appId.GET_PUBLIC_KEY" -> {
Expand Down

0 comments on commit 6988317

Please sign in to comment.