aboutsummaryrefslogtreecommitdiffstats
path: root/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt
blob: 2f901354ed0ace56a03929ca77b53efad3074c70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
 * SPDX-License-Identifier: GPL-3.0-only
 */

package dev.msfjarvis.aps.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
}