diff options
Diffstat (limited to 'crypto-common/src/main/kotlin')
-rw-r--r-- | crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt | 4 | ||||
-rw-r--r-- | crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoOptions.kt | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt b/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt index ea42af6d..898cf058 100644 --- a/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt +++ b/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt @@ -11,7 +11,7 @@ import java.io.InputStream import java.io.OutputStream /** Generic interface to implement cryptographic operations on top of. */ -public interface CryptoHandler<Key> { +public interface CryptoHandler<Key, EncOpts : CryptoOptions, DecryptOpts : CryptoOptions> { /** * Decrypt the given [ciphertextStream] using a set of potential [keys] and [passphrase], and @@ -24,6 +24,7 @@ public interface CryptoHandler<Key> { passphrase: String, ciphertextStream: InputStream, outputStream: OutputStream, + options: DecryptOpts, ): Result<Unit, CryptoHandlerException> /** @@ -35,6 +36,7 @@ public interface CryptoHandler<Key> { keys: List<Key>, plaintextStream: InputStream, outputStream: OutputStream, + options: EncOpts, ): Result<Unit, CryptoHandlerException> /** Given a [fileName], return whether this instance can handle it. */ diff --git a/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoOptions.kt b/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoOptions.kt new file mode 100644 index 00000000..1e60cdba --- /dev/null +++ b/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoOptions.kt @@ -0,0 +1,8 @@ +package app.passwordstore.crypto + +/** Defines the contract for a grab-bag of options for individual cryptographic operations. */ +public interface CryptoOptions { + + /** Returns a [Boolean] indicating if the [option] is enabled for this operation. */ + public fun isOptionEnabled(option: String): Boolean +} |