aboutsummaryrefslogtreecommitdiffstats
path: root/crypto-common/src/main/kotlin/app/passwordstore/crypto/KeyManager.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/KeyManager.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/KeyManager.kt')
-rw-r--r--crypto-common/src/main/kotlin/app/passwordstore/crypto/KeyManager.kt41
1 files changed, 0 insertions, 41 deletions
diff --git a/crypto-common/src/main/kotlin/app/passwordstore/crypto/KeyManager.kt b/crypto-common/src/main/kotlin/app/passwordstore/crypto/KeyManager.kt
deleted file mode 100644
index c9db3734..00000000
--- a/crypto-common/src/main/kotlin/app/passwordstore/crypto/KeyManager.kt
+++ /dev/null
@@ -1,41 +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 com.github.michaelbull.result.Result
-
-/**
- * [KeyManager] defines a contract for implementing a management system for [Key]s as they would be
- * used by an implementation of [CryptoHandler] to obtain eligible public or private keys as
- * required.
- */
-public interface KeyManager<Key, KeyIdentifier> {
-
- /**
- * Inserts a [key] into the store. If the key already exists, this method will return
- * [app.passwordstore.crypto.errors.KeyAlreadyExistsException] unless [replace] is `true`.
- */
- public suspend fun addKey(key: Key, replace: Boolean = false): Result<Key, Throwable>
-
- /** Finds a key for [identifier] in the store and deletes it. */
- public suspend fun removeKey(identifier: KeyIdentifier): Result<Unit, Throwable>
-
- /**
- * Get a [Key] for the given [id]. The actual semantics of what [id] is are left to individual
- * implementations to figure out for themselves. For example, in GPG this can be a full
- * hexadecimal key ID, an email, a short hex key ID, and probably a few more things.
- */
- public suspend fun getKeyById(id: KeyIdentifier): Result<Key, Throwable>
-
- /** Returns all keys currently in the store as a [List]. */
- public suspend fun getAllKeys(): Result<List<Key>, Throwable>
-
- /**
- * Get a stable identifier for the given [key]. The returned key ID should be suitable to be used
- * as an identifier for the cryptographic identity tied to this key.
- */
- public suspend fun getKeyId(key: Key): KeyIdentifier?
-}