From b7abd561f561af451ec717746e198a8686d10868 Mon Sep 17 00:00:00 2001 From: Aditya Wasan Date: Tue, 17 Aug 2021 04:14:43 +0530 Subject: Add `KeyPair` and `KeyManager` to manage keys in the app (#1487) Co-authored-by: Harsh Shandilya --- .../dev/msfjarvis/aps/data/crypto/KeyManager.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt (limited to 'crypto-common/src/main/kotlin/dev/msfjarvis/aps/data/crypto/KeyManager.kt') 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 { + + public suspend fun addKey(key: T, replace: Boolean = false): Result + public suspend fun removeKey(key: T): Result + public suspend fun getKeyById(id: String): Result + public suspend fun getAllKeys(): Result, Throwable> + + /** Given a [fileName], return whether this instance can handle it. */ + public fun canHandle(fileName: String): Boolean +} -- cgit v1.2.3