Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / e2ee-p2p / src / main / java / com / vayunmathur / e2ee / E2eeKeyStore.kt
E2eeKeyStore.kt14 lines · 628 BRaw
| 1 | package com.vayunmathur.e2ee |
| 2 | |
| 3 | /** |
| 4 | * Minimal persistence abstraction used by [PqcIdentity] to store the device keypair. Apps adapt |
| 5 | * their own secure storage (e.g. an encrypted DataStore) to this interface so the e2ee module stays |
| 6 | * decoupled from any particular storage implementation. |
| 7 | */ |
| 8 | interface E2eeKeyStore { |
| 9 | /** Returns the stored bytes for [name], or null if absent. */ |
| 10 | suspend fun getBytes(name: String): ByteArray? |
| 11 | |
| 12 | /** Persists [value] under [name]. When [onlyIfAbsent], an existing value is not overwritten. */ |
| 13 | suspend fun setBytes(name: String, value: ByteArray, onlyIfAbsent: Boolean = false) |
| 14 | } |