diff options
| author | Aditya Wasan <adityawasan55@gmail.com> | 2021-08-17 04:14:43 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-17 04:14:43 +0530 |
| commit | b7abd561f561af451ec717746e198a8686d10868 (patch) | |
| tree | 16af9397d205d6501624ba4e98389e21764d9dd3 /crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt | |
| parent | 9982562dc4e1ab4dbd058cf9d3c3c46fc598dec8 (diff) | |
| download | HardenedPass-b7abd561f561af451ec717746e198a8686d10868.tar.gz HardenedPass-b7abd561f561af451ec717746e198a8686d10868.zip | |
Add `KeyPair` and `KeyManager` to manage keys in the app (#1487)
Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt')
| -rw-r--r-- | crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt new file mode 100644 index 00000000..b5ba881e --- /dev/null +++ b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt @@ -0,0 +1,19 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package dev.msfjarvis.aps.data.crypto + +import com.github.michaelbull.result.Result + +public interface KeyManager<T : KeyPair> { + + public suspend fun addKey(key: T, replace: Boolean = false): Result<T, Throwable> + public suspend fun removeKey(key: T): Result<T, Throwable> + public suspend fun getKeyById(id: String): Result<T, Throwable> + public suspend fun getAllKeys(): Result<List<T>, Throwable> + + /** Given a [fileName], return whether this instance can handle it. */ + public fun canHandle(fileName: String): Boolean +} |
