diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt b/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt index 193c363c..e00809a8 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt @@ -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( |