aboutsummaryrefslogtreecommitdiffstats
path: root/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-08-10 03:21:47 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-08-10 03:31:08 +0530
commit959a56d7ffbc20db60721d7a09f399c8bdefe07e (patch)
tree0d9b14e0bb770fd6da2e04295f2c22c087142439 /crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt
parentefef72b6327c8e683c8844146e23d12104f12dd1 (diff)
downloadHardenedPass-959a56d7ffbc20db60721d7a09f399c8bdefe07e.tar.gz
HardenedPass-959a56d7ffbc20db60721d7a09f399c8bdefe07e.zip
refactor: un-flatten module structure
Diffstat (limited to 'crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt')
-rw-r--r--crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt44
1 files changed, 0 insertions, 44 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
deleted file mode 100644
index 898cf058..00000000
--- a/crypto-common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-package app.passwordstore.crypto
-
-import app.passwordstore.crypto.errors.CryptoHandlerException
-import com.github.michaelbull.result.Result
-import java.io.InputStream
-import java.io.OutputStream
-
-/** Generic interface to implement cryptographic operations on top of. */
-public interface CryptoHandler<Key, EncOpts : CryptoOptions, DecryptOpts : CryptoOptions> {
-
- /**
- * Decrypt the given [ciphertextStream] using a set of potential [keys] and [passphrase], and
- * writes the resultant plaintext to [outputStream]. The returned [Result] should be checked to
- * ensure it is **not** an instance of [com.github.michaelbull.result.Err] before the contents of
- * [outputStream] are used.
- */
- public fun decrypt(
- keys: List<Key>,
- passphrase: String,
- ciphertextStream: InputStream,
- outputStream: OutputStream,
- options: DecryptOpts,
- ): Result<Unit, CryptoHandlerException>
-
- /**
- * Encrypt the given [plaintextStream] to the provided [keys], and writes the encrypted ciphertext
- * to [outputStream]. The returned [Result] should be checked to ensure it is **not** an instance
- * of [com.github.michaelbull.result.Err] before the contents of [outputStream] are used.
- */
- public fun encrypt(
- keys: List<Key>,
- plaintextStream: InputStream,
- outputStream: OutputStream,
- options: EncOpts,
- ): Result<Unit, CryptoHandlerException>
-
- /** Given a [fileName], return whether this instance can handle it. */
- public fun canHandle(fileName: String): Boolean
-}