diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2024-09-26 17:49:58 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2024-09-26 17:49:58 +0530 |
commit | 04f4b9804f10e4724bac22d40bf01711ff708533 (patch) | |
tree | db4e01472f8f17d80fd00df2d3e233a4b0538184 /crypto/pgpainless/src/main | |
parent | cb22561878d4358dba974c16ba9a05cc693d411a (diff) |
Revert "refactor: use `Closeable#use` extension where applicable"
This reverts commit 69513bf24613d4ba540bcdeaffe04dc9330a65a4.
Diffstat (limited to 'crypto/pgpainless/src/main')
-rw-r--r-- | crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt index 4a800129..91826001 100644 --- a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt +++ b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt @@ -65,7 +65,8 @@ public class PGPainlessCryptoHandler @Inject constructor() : .addDecryptionKeys(keyringCollection, protector) .addDecryptionPassphrase(Passphrase.fromPassword(passphrase)) ) - decryptionStream.use { Streams.pipeAll(it, outputStream) } + Streams.pipeAll(decryptionStream, outputStream) + decryptionStream.close() return@runCatching } .mapError { error -> @@ -120,7 +121,8 @@ public class PGPainlessCryptoHandler @Inject constructor() : .setAsciiArmor(options.isOptionEnabled(PGPEncryptOptions.ASCII_ARMOR)) val encryptionStream = PGPainless.encryptAndOrSign().onOutputStream(outputStream).withOptions(producerOptions) - encryptionStream.use { Streams.pipeAll(plaintextStream, it) } + Streams.pipeAll(plaintextStream, encryptionStream) + encryptionStream.close() val result = encryptionStream.result publicKeyRingCollection.forEach { keyRing -> require(result.isEncryptedFor(keyRing)) { |