diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2022-01-18 17:40:16 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 17:40:16 +0530 |
| commit | 5509558eedbcd90f130b32d4e6c41632da291b15 (patch) | |
| tree | 7b6839928889698ebe0da48a83b2e1532ed6d094 /crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt | |
| parent | 3ead6596ba9c2b65434f6cd948bf6ebf41a230eb (diff) | |
| download | HardenedPass-5509558eedbcd90f130b32d4e6c41632da291b15.tar.gz HardenedPass-5509558eedbcd90f130b32d4e6c41632da291b15.zip | |
Parameterize key and key identifier types for KeyManager (#1669)
Diffstat (limited to 'crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt')
| -rw-r--r-- | crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt index dacdfc6a..aa71abf6 100644 --- a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt +++ b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt @@ -12,7 +12,7 @@ import com.github.michaelbull.result.Result * used by an implementation of [CryptoHandler] to obtain eligible public or private keys as * required. */ -public interface KeyManager { +public interface KeyManager<Key, KeyIdentifier> { /** * Inserts a [key] into the store. If the key already exists, this method will return @@ -28,7 +28,7 @@ public interface KeyManager { * 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: String): Result<Key, Throwable> + 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> @@ -37,7 +37,7 @@ public interface KeyManager { * 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): String? + public suspend fun getKeyId(key: Key): KeyIdentifier? /** Given a [fileName], return whether this instance can handle it. */ public fun canHandle(fileName: String): Boolean |
