aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-10-29 04:36:00 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-10-29 04:36:00 +0530
commit633cbe271460980ff18a350fb6b7864a424ec83a (patch)
treebe3560a97823f02316ad8d220c0b53ce893a99c9 /app/src/main
parent390286f95fffdfad434f60a460fff21473fefc32 (diff)
feat(crypto-common): support passing arbitrary crypto options
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt
index b673e94c..233dedef 100644
--- a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt
+++ b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt
@@ -6,6 +6,8 @@
package app.passwordstore.data.crypto
import app.passwordstore.crypto.GpgIdentifier
+import app.passwordstore.crypto.PGPDecryptOptions
+import app.passwordstore.crypto.PGPEncryptOptions
import app.passwordstore.crypto.PGPKeyManager
import app.passwordstore.crypto.PGPainlessCryptoHandler
import app.passwordstore.crypto.errors.CryptoHandlerException
@@ -42,8 +44,9 @@ constructor(
message: ByteArrayInputStream,
out: ByteArrayOutputStream,
): Result<Unit, CryptoHandlerException> {
+ val decryptionOptions = PGPDecryptOptions.Builder().build()
val keys = pgpKeyManager.getAllKeys().unwrap()
- return pgpCryptoHandler.decrypt(keys, password, message, out)
+ return pgpCryptoHandler.decrypt(keys, password, message, out, decryptionOptions)
}
private suspend fun encryptPgp(
@@ -51,11 +54,13 @@ constructor(
content: ByteArrayInputStream,
out: ByteArrayOutputStream,
): Result<Unit, CryptoHandlerException> {
+ val encryptionOptions = PGPEncryptOptions.Builder().build()
val keys = identities.map { id -> pgpKeyManager.getKeyById(id) }.getAll()
return pgpCryptoHandler.encrypt(
keys,
content,
out,
+ encryptionOptions,
)
}
}