EncryptedCredentialStore

@Singleton
class EncryptedCredentialStore @Inject constructor(context: Context)

Keystore-backed encrypted storage for every account's secrets (passwords, tokens, homeserver URLs) and small metadata (protocol, display name).

Backed by EncryptedSharedPreferences with an MasterKey AES-256-GCM master key. Every value is namespaced by accountId so multiple accounts of the same or different protocols never collide ("<accountId>:<key>").

Constructors

Link copied to clipboard
@Inject
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun get(accountId: String, key: String): String?

Returns the secret stored under key for accountId, or null if absent.

Link copied to clipboard

Returns every non-metadata key/value pair stored for accountId, with the account-id namespace prefix stripped from the keys.

Link copied to clipboard
fun getDisplayName(accountId: String): String?

Returns the stored display name for accountId, or null if unknown.

Link copied to clipboard
fun getProtocol(accountId: String): String?

Returns the stored protocol id for accountId, or null if unknown.

Link copied to clipboard

Returns the global Tor SOCKS5 proxy password, or null if not configured.

Link copied to clipboard

Returns every account id present in the store — derived from the namespace prefix of each stored key, filtered to only ids that have a recorded protocol.

Link copied to clipboard
fun put(accountId: String, key: String, value: String)

Stores an arbitrary secret value under key, namespaced to accountId.

Link copied to clipboard
fun putAccountMeta(accountId: String, protocol: String, displayName: String)

Records the protocol id and human-readable displayName for accountId.

Link copied to clipboard
fun putProxyPassword(password: String?)

Stores (or clears, if password is null/blank) the global Tor SOCKS5 proxy password.

Link copied to clipboard
fun removeAccount(accountId: String)

Deletes every stored key (secrets + metadata) belonging to accountId.