feat(gpg): add methods to clear entries from GPG passphrase cache

This commit is contained in:
Harsh Shandilya 2023-05-19 18:58:48 +05:30
parent 65509eaa54
commit 5420faff34
No known key found for this signature in database

View file

@ -37,6 +37,19 @@ constructor(
}
}
suspend fun clearCachedPassphrase(
context: Context,
identifier: GpgIdentifier,
) {
withContext(dispatcherProvider.io()) {
getPreferences(context).edit { remove(identifier.toString()) }
}
}
suspend fun clearAllCachedPassphrases(context: Context) {
withContext(dispatcherProvider.io()) { getPreferences(context).edit { clear() } }
}
private suspend fun getPreferences(context: Context) =
withContext(dispatcherProvider.io()) {
EncryptedSharedPreferences.create(