summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-04-27 22:32:36 +0530
committerGitHub <noreply@github.com>2022-04-27 17:02:36 +0000
commitd4a4ac06ed419221d3a1f967ca3a66b1e163ddb8 (patch)
tree8f501a3443e4fb422a213fc169f198f23e4fc511 /app/src/main
parentb8b069364289421a875bdc6227c8554161e26183 (diff)
crypto-pgpainless: prepare for error handling (#1877)
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/data/crypto/CryptoRepository.kt5
1 files changed, 1 insertions, 4 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/data/crypto/CryptoRepository.kt b/app/src/main/java/dev/msfjarvis/aps/data/crypto/CryptoRepository.kt
index 2923b117..0e262e7a 100644
--- a/app/src/main/java/dev/msfjarvis/aps/data/crypto/CryptoRepository.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/data/crypto/CryptoRepository.kt
@@ -5,7 +5,6 @@
package dev.msfjarvis.aps.data.crypto
-import com.github.michaelbull.result.runCatching
import com.github.michaelbull.result.unwrap
import dev.msfjarvis.aps.crypto.PGPKeyManager
import dev.msfjarvis.aps.crypto.PGPainlessCryptoHandler
@@ -42,9 +41,7 @@ constructor(
) {
val keys = pgpKeyManager.getAllKeys().unwrap()
// Iterates through the keys until the first successful decryption, then returns.
- keys.firstOrNull { key ->
- runCatching { pgpCryptoHandler.decrypt(key, password, message, out) }.isOk()
- }
+ keys.firstOrNull { key -> pgpCryptoHandler.decrypt(key, password, message, out).isOk() }
}
private suspend fun encryptPgp(content: ByteArrayInputStream, out: ByteArrayOutputStream) {