diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-06-15 15:49:32 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-06-15 16:17:59 +0530 |
commit | 5dac84c3c882ee42bc541042684de18d7166fdd3 (patch) | |
tree | 227d2cec4c494be13bb942b70ab913b90325e452 /app/src | |
parent | c168ce2e8643b86eb9fd25339d79a9a070005f83 (diff) |
refactor: consistently adopt PGP over GPG for naming
PGP is the standard, GPG is an implementation of it. We're adhering to PGP, and not using GPG.
Diffstat (limited to 'app/src')
13 files changed, 66 insertions, 67 deletions
diff --git a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt index ea1d9c76..0ce4b3e3 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt @@ -6,9 +6,9 @@ package app.passwordstore.data.crypto import android.content.SharedPreferences -import app.passwordstore.crypto.GpgIdentifier import app.passwordstore.crypto.PGPDecryptOptions import app.passwordstore.crypto.PGPEncryptOptions +import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.crypto.PGPKeyManager import app.passwordstore.crypto.PGPainlessCryptoHandler import app.passwordstore.crypto.errors.CryptoHandlerException @@ -40,20 +40,20 @@ constructor( suspend fun decrypt( password: String, - identities: List<GpgIdentifier>, + identities: List<PGPIdentifier>, message: ByteArrayInputStream, out: ByteArrayOutputStream, ) = withContext(dispatcherProvider.io()) { decryptPgp(password, identities, message, out) } suspend fun encrypt( - identities: List<GpgIdentifier>, + identities: List<PGPIdentifier>, content: ByteArrayInputStream, out: ByteArrayOutputStream, ) = withContext(dispatcherProvider.io()) { encryptPgp(identities, content, out) } private suspend fun decryptPgp( password: String, - identities: List<GpgIdentifier>, + identities: List<PGPIdentifier>, message: ByteArrayInputStream, out: ByteArrayOutputStream, ): Result<Unit, CryptoHandlerException> { @@ -63,7 +63,7 @@ constructor( } private suspend fun encryptPgp( - identities: List<GpgIdentifier>, + identities: List<PGPIdentifier>, content: ByteArrayInputStream, out: ByteArrayOutputStream, ): Result<Unit, CryptoHandlerException> { diff --git a/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt b/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt index e00809a8..0632e3c8 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/GPGPassphraseCache.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt @@ -4,15 +4,14 @@ import android.content.Context import androidx.core.content.edit import androidx.security.crypto.EncryptedSharedPreferences import androidx.security.crypto.MasterKey -import app.passwordstore.crypto.GpgIdentifier +import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.util.coroutines.DispatcherProvider import app.passwordstore.util.extensions.getString import javax.inject.Inject import kotlinx.coroutines.withContext /** Implements a rudimentary [EncryptedSharedPreferences]-backed cache for GPG passphrases. */ -@Suppress("Unused") // Soon -class GPGPassphraseCache +class PGPPassphraseCache @Inject constructor( private val dispatcherProvider: DispatcherProvider, @@ -20,7 +19,7 @@ constructor( suspend fun cachePassphrase( context: Context, - identifier: GpgIdentifier, + identifier: PGPIdentifier, passphrase: String, ) { withContext(dispatcherProvider.io()) { @@ -30,7 +29,7 @@ constructor( suspend fun retrieveCachedPassphrase( context: Context, - identifier: GpgIdentifier, + identifier: PGPIdentifier, ): String? { return withContext(dispatcherProvider.io()) { getPreferences(context).getString(identifier.toString()) @@ -39,7 +38,7 @@ constructor( suspend fun clearCachedPassphrase( context: Context, - identifier: GpgIdentifier, + identifier: PGPIdentifier, ) { withContext(dispatcherProvider.io()) { getPreferences(context).edit { remove(identifier.toString()) } diff --git a/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt b/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt index 77497671..be3443ef 100644 --- a/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt +++ b/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt @@ -7,7 +7,7 @@ package app.passwordstore.data.password import android.content.Context import android.content.Intent import app.passwordstore.data.repo.PasswordRepository -import app.passwordstore.ui.crypto.BasePgpActivity +import app.passwordstore.ui.crypto.BasePGPActivity import app.passwordstore.ui.main.LaunchActivity import java.io.File @@ -21,7 +21,7 @@ data class PasswordItem( val fullPathToParent = file.absolutePath.replace(rootDir.absolutePath, "").replace(file.name, "") - val longName = BasePgpActivity.getLongName(fullPathToParent, rootDir.absolutePath, toString()) + val longName = BasePGPActivity.getLongName(fullPathToParent, rootDir.absolutePath, toString()) override fun equals(other: Any?): Boolean { return (other is PasswordItem) && (other.file == file) diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt index 959728cd..8d0cf28a 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt @@ -13,16 +13,16 @@ import android.os.Bundle import android.view.autofill.AutofillManager import androidx.lifecycle.lifecycleScope import app.passwordstore.R -import app.passwordstore.data.crypto.GPGPassphraseCache +import app.passwordstore.data.crypto.PGPPassphraseCache import app.passwordstore.data.passfile.PasswordEntry -import app.passwordstore.ui.crypto.BasePgpActivity +import app.passwordstore.ui.crypto.BasePGPActivity import app.passwordstore.ui.crypto.PasswordDialog import app.passwordstore.util.auth.BiometricAuthenticator import app.passwordstore.util.autofill.AutofillPreferences import app.passwordstore.util.autofill.AutofillResponseBuilder import app.passwordstore.util.autofill.DirectoryStructure import app.passwordstore.util.extensions.asLog -import app.passwordstore.util.features.Feature.EnableGPGPassphraseCache +import app.passwordstore.util.features.Feature.EnablePGPPassphraseCache import app.passwordstore.util.features.Features import com.github.androidpasswordstore.autofillparser.AutofillAction import com.github.androidpasswordstore.autofillparser.Credentials @@ -41,11 +41,11 @@ import logcat.LogPriority.ERROR import logcat.logcat @AndroidEntryPoint -class AutofillDecryptActivity : BasePgpActivity() { +class AutofillDecryptActivity : BasePGPActivity() { @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @Inject lateinit var features: Features - @Inject lateinit var passphraseCache: GPGPassphraseCache + @Inject lateinit var passphraseCache: PGPPassphraseCache private lateinit var directoryStructure: DirectoryStructure @@ -70,9 +70,9 @@ class AutofillDecryptActivity : BasePgpActivity() { directoryStructure = AutofillPreferences.directoryStructure(this) logcat { action.toString() } requireKeysExist { - val gpgIdentifiers = getGpgIdentifiers("") ?: return@requireKeysExist + val gpgIdentifiers = getPGPIdentifiers("") ?: return@requireKeysExist if ( - features.isEnabled(EnableGPGPassphraseCache) && BiometricAuthenticator.canAuthenticate(this) + features.isEnabled(EnablePGPPassphraseCache) && BiometricAuthenticator.canAuthenticate(this) ) { BiometricAuthenticator.authenticate( this, @@ -143,7 +143,7 @@ class AutofillDecryptActivity : BasePgpActivity() { } private suspend fun decryptCredential(file: File, password: String): Credentials? { - val gpgIdentifiers = getGpgIdentifiers("") ?: return null + val gpgIdentifiers = getPGPIdentifiers("") ?: return null runCatching { file.readBytes().inputStream() } .onFailure { e -> logcat(ERROR) { e.asLog("File to decrypt not found") } diff --git a/app/src/main/java/app/passwordstore/ui/crypto/BasePgpActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt index 417565a7..d0039d52 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/BasePgpActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt @@ -18,7 +18,7 @@ import androidx.annotation.StringRes import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.lifecycleScope import app.passwordstore.R -import app.passwordstore.crypto.GpgIdentifier +import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.data.crypto.CryptoRepository import app.passwordstore.data.repo.PasswordRepository import app.passwordstore.injection.prefs.SettingsPreferences @@ -41,7 +41,7 @@ import kotlinx.coroutines.withContext @Suppress("Registered") @AndroidEntryPoint -open class BasePgpActivity : AppCompatActivity() { +open class BasePGPActivity : AppCompatActivity() { /** Full path to the repository */ val repoPath by unsafeLazy { intent.getStringExtra("REPO_PATH")!! } @@ -110,12 +110,12 @@ open class BasePgpActivity : AppCompatActivity() { val hasKeys = repository.hasKeys() if (!hasKeys) { withContext(dispatcherProvider.main()) { - MaterialAlertDialogBuilder(this@BasePgpActivity) + MaterialAlertDialogBuilder(this@BasePGPActivity) .setTitle(resources.getString(R.string.no_keys_imported_dialog_title)) .setMessage(resources.getString(R.string.no_keys_imported_dialog_message)) .setPositiveButton(resources.getString(R.string.button_label_import)) { _, _ -> onKeyImport = onKeysExist - keyImportAction.launch(Intent(this@BasePgpActivity, PGPKeyImportActivity::class.java)) + keyImportAction.launch(Intent(this@BasePGPActivity, PGPKeyImportActivity::class.java)) } .show() } @@ -147,12 +147,12 @@ open class BasePgpActivity : AppCompatActivity() { } /** - * Get a list of available [GpgIdentifier]s for the current password repository. This method + * Get a list of available [PGPIdentifier]s for the current password repository. This method * throws when no identifiers were able to be parsed. If this method returns null, it means that * an invalid identifier was encountered and further execution must stop to let the user correct * the problem. */ - fun getGpgIdentifiers(subDir: String): List<GpgIdentifier>? { + fun getPGPIdentifiers(subDir: String): List<PGPIdentifier>? { val repoRoot = PasswordRepository.getRepositoryDirectory() val gpgIdentifierFile = File(repoRoot, subDir).findTillRoot(".gpg-id", repoRoot) @@ -162,7 +162,7 @@ open class BasePgpActivity : AppCompatActivity() { .readLines() .filter { it.isNotBlank() } .map { line -> - GpgIdentifier.fromString(line) + PGPIdentifier.fromString(line) ?: run { // The line being empty means this is most likely an empty `.gpg-id` // file we created. Skip the validation so we can make the user add a @@ -176,7 +176,7 @@ open class BasePgpActivity : AppCompatActivity() { return null } } - .filterIsInstance<GpgIdentifier>() + .filterIsInstance<PGPIdentifier>() if (gpgIdentifiers.isEmpty()) { error("Failed to parse identifiers from .gpg-id: ${gpgIdentifierFile.readText()}") } diff --git a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt index 552332f1..ca6cd257 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt @@ -11,8 +11,8 @@ import android.view.Menu import android.view.MenuItem import androidx.lifecycle.lifecycleScope import app.passwordstore.R -import app.passwordstore.crypto.GpgIdentifier -import app.passwordstore.data.crypto.GPGPassphraseCache +import app.passwordstore.crypto.PGPIdentifier +import app.passwordstore.data.crypto.PGPPassphraseCache import app.passwordstore.data.passfile.PasswordEntry import app.passwordstore.data.password.FieldItem import app.passwordstore.databinding.DecryptLayoutBinding @@ -21,7 +21,7 @@ import app.passwordstore.util.auth.BiometricAuthenticator import app.passwordstore.util.extensions.getString import app.passwordstore.util.extensions.unsafeLazy import app.passwordstore.util.extensions.viewBinding -import app.passwordstore.util.features.Feature.EnableGPGPassphraseCache +import app.passwordstore.util.features.Feature.EnablePGPPassphraseCache import app.passwordstore.util.features.Features import app.passwordstore.util.settings.Constants import app.passwordstore.util.settings.PreferenceKeys @@ -42,10 +42,10 @@ import logcat.LogPriority.ERROR import logcat.logcat @AndroidEntryPoint -class DecryptActivity : BasePgpActivity() { +class DecryptActivity : BasePGPActivity() { @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory - @Inject lateinit var passphraseCache: GPGPassphraseCache + @Inject lateinit var passphraseCache: PGPPassphraseCache @Inject lateinit var features: Features private val binding by viewBinding(DecryptLayoutBinding::inflate) @@ -67,7 +67,7 @@ class DecryptActivity : BasePgpActivity() { } } if ( - features.isEnabled(EnableGPGPassphraseCache) && + features.isEnabled(EnablePGPPassphraseCache) && BiometricAuthenticator.canAuthenticate(this@DecryptActivity) ) { BiometricAuthenticator.authenticate( @@ -150,7 +150,7 @@ class DecryptActivity : BasePgpActivity() { } private fun decrypt(isError: Boolean, authResult: BiometricAuthenticator.Result) { - val gpgIdentifiers = getGpgIdentifiers("") ?: return + val gpgIdentifiers = getPGPIdentifiers("") ?: return lifecycleScope.launch(dispatcherProvider.main()) { if (authResult is BiometricAuthenticator.Result.Success) { val cachedPassphrase = @@ -168,7 +168,7 @@ class DecryptActivity : BasePgpActivity() { private fun askPassphrase( isError: Boolean, - gpgIdentifiers: List<GpgIdentifier>, + gpgIdentifiers: List<PGPIdentifier>, authResult: BiometricAuthenticator.Result, ) { if (retries < MAX_RETRIES) { @@ -206,7 +206,7 @@ class DecryptActivity : BasePgpActivity() { private suspend fun decryptWithCachedPassphrase( passphrase: String, - identifiers: List<GpgIdentifier>, + identifiers: List<PGPIdentifier>, authResult: BiometricAuthenticator.Result, ) { when (val result = decryptWithPassphrase(passphrase, identifiers)) { @@ -225,7 +225,7 @@ class DecryptActivity : BasePgpActivity() { private suspend fun decryptWithPassphrase( password: String, - gpgIdentifiers: List<GpgIdentifier>, + gpgIdentifiers: List<PGPIdentifier>, ) = runCatching { val message = withContext(dispatcherProvider.io()) { File(fullPath).readBytes().inputStream() } val outputStream = ByteArrayOutputStream() diff --git a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt index f724ec3c..10677091 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt @@ -63,7 +63,7 @@ import logcat.asLog import logcat.logcat @AndroidEntryPoint -class PasswordCreationActivity : BasePgpActivity() { +class PasswordCreationActivity : BasePGPActivity() { private val binding by viewBinding(PasswordCreationActivityBinding::inflate) @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @@ -330,7 +330,7 @@ class PasswordCreationActivity : BasePgpActivity() { } // pass enters the key ID into `.gpg-id`. - val gpgIdentifiers = getGpgIdentifiers(directory.text.toString()) ?: return@with + val gpgIdentifiers = getPGPIdentifiers(directory.text.toString()) ?: return@with val content = "$editPass\n$editExtra" val path = when { diff --git a/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt b/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt index 8e7f52c5..15cd77ad 100644 --- a/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt @@ -11,7 +11,7 @@ import android.os.Handler import android.os.Looper import androidx.appcompat.app.AppCompatActivity import androidx.core.content.edit -import app.passwordstore.ui.crypto.BasePgpActivity +import app.passwordstore.ui.crypto.BasePGPActivity import app.passwordstore.ui.crypto.DecryptActivity import app.passwordstore.ui.passwords.PasswordStore import app.passwordstore.util.auth.BiometricAuthenticator @@ -56,12 +56,12 @@ class LaunchActivity : AppCompatActivity() { if (intent.action == ACTION_DECRYPT_PASS) getDecryptIntent().apply { putExtra( - BasePgpActivity.EXTRA_FILE_PATH, - intent.getStringExtra(BasePgpActivity.EXTRA_FILE_PATH) + BasePGPActivity.EXTRA_FILE_PATH, + intent.getStringExtra(BasePGPActivity.EXTRA_FILE_PATH) ) putExtra( - BasePgpActivity.EXTRA_REPO_PATH, - intent.getStringExtra(BasePgpActivity.EXTRA_REPO_PATH) + BasePGPActivity.EXTRA_REPO_PATH, + intent.getStringExtra(BasePGPActivity.EXTRA_REPO_PATH) ) } else Intent(this, PasswordStore::class.java) diff --git a/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt b/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt index 80b08b77..76e2702c 100644 --- a/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt +++ b/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt @@ -25,8 +25,8 @@ import androidx.lifecycle.lifecycleScope import app.passwordstore.R import app.passwordstore.data.password.PasswordItem import app.passwordstore.data.repo.PasswordRepository -import app.passwordstore.ui.crypto.BasePgpActivity -import app.passwordstore.ui.crypto.BasePgpActivity.Companion.getLongName +import app.passwordstore.ui.crypto.BasePGPActivity +import app.passwordstore.ui.crypto.BasePGPActivity.Companion.getLongName import app.passwordstore.ui.crypto.DecryptActivity import app.passwordstore.ui.crypto.PasswordCreationActivity import app.passwordstore.ui.dialogs.FolderCreationDialogFragment @@ -393,9 +393,9 @@ class PasswordStore : BaseGitActivity() { val currentDir = currentDir logcat(INFO) { "Adding file to : ${currentDir.absolutePath}" } val intent = Intent(this, PasswordCreationActivity::class.java) - intent.putExtra(BasePgpActivity.EXTRA_FILE_PATH, currentDir.absolutePath) + intent.putExtra(BasePGPActivity.EXTRA_FILE_PATH, currentDir.absolutePath) intent.putExtra( - BasePgpActivity.EXTRA_REPO_PATH, + BasePGPActivity.EXTRA_REPO_PATH, PasswordRepository.getRepositoryDirectory().absolutePath ) listRefreshAction.launch(intent) diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt index 04a57635..40a8654d 100644 --- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt +++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import app.passwordstore.R -import app.passwordstore.crypto.GpgIdentifier +import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.ui.compose.theme.APSThemePreview import app.passwordstore.util.extensions.conditional import kotlinx.collections.immutable.ImmutableList @@ -41,10 +41,10 @@ import kotlinx.collections.immutable.toPersistentList @Composable fun KeyList( - identifiers: ImmutableList<GpgIdentifier>, - onItemClick: (identifier: GpgIdentifier) -> Unit, + identifiers: ImmutableList<PGPIdentifier>, + onItemClick: (identifier: PGPIdentifier) -> Unit, modifier: Modifier = Modifier, - onKeySelected: ((identifier: GpgIdentifier) -> Unit)? = null, + onKeySelected: ((identifier: PGPIdentifier) -> Unit)? = null, ) { if (identifiers.isEmpty()) { Column( @@ -69,10 +69,10 @@ fun KeyList( @Composable private fun KeyItem( - identifier: GpgIdentifier, - onItemClick: (identifier: GpgIdentifier) -> Unit, + identifier: PGPIdentifier, + onItemClick: (identifier: PGPIdentifier) -> Unit, modifier: Modifier = Modifier, - onKeySelected: ((identifier: GpgIdentifier) -> Unit)? = null, + onKeySelected: ((identifier: PGPIdentifier) -> Unit)? = null, ) { var isDeleting by remember { mutableStateOf(false) } DeleteConfirmationDialog( @@ -85,8 +85,8 @@ private fun KeyItem( ) val label = when (identifier) { - is GpgIdentifier.KeyId -> identifier.id.toString() - is GpgIdentifier.UserId -> identifier.email + is PGPIdentifier.KeyId -> identifier.id.toString() + is PGPIdentifier.UserId -> identifier.email } Row( modifier = @@ -144,8 +144,8 @@ private fun KeyListPreview() { KeyList( identifiers = listOfNotNull( - GpgIdentifier.fromString("ultramicroscopicsilicovolcanoconiosis@example.com"), - GpgIdentifier.fromString("0xB950AE2813841585"), + PGPIdentifier.fromString("ultramicroscopicsilicovolcanoconiosis@example.com"), + PGPIdentifier.fromString("0xB950AE2813841585"), ) .toPersistentList(), onItemClick = {} diff --git a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt index e3c3e90c..c5625612 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt @@ -32,7 +32,7 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider { titleRes = R.string.pref_pgp_ascii_armor_title persistent = true } - switch(Feature.EnableGPGPassphraseCache.configKey) { + switch(Feature.EnablePGPPassphraseCache.configKey) { titleRes = R.string.pref_passphrase_cache_title summaryRes = R.string.pref_passphrase_cache_summary defaultValue = false diff --git a/app/src/main/java/app/passwordstore/util/features/Feature.kt b/app/src/main/java/app/passwordstore/util/features/Feature.kt index a0729f4d..55e4eaeb 100644 --- a/app/src/main/java/app/passwordstore/util/features/Feature.kt +++ b/app/src/main/java/app/passwordstore/util/features/Feature.kt @@ -23,8 +23,8 @@ enum class Feature( /** Opt into the new SSH layer implemented as a freestanding module. */ EnableNewSSHLayer(false, "enable_new_ssh"), - /** Opt into a cache layer for GPG passphrases. */ - EnableGPGPassphraseCache(false, "enable_gpg_passphrase_cache"), + /** Opt into a cache layer for PGP passphrases. */ + EnablePGPPassphraseCache(false, "enable_gpg_passphrase_cache"), ; companion object { diff --git a/app/src/main/java/app/passwordstore/util/viewmodel/PGPKeyListViewModel.kt b/app/src/main/java/app/passwordstore/util/viewmodel/PGPKeyListViewModel.kt index a08b41fa..6711cae1 100644 --- a/app/src/main/java/app/passwordstore/util/viewmodel/PGPKeyListViewModel.kt +++ b/app/src/main/java/app/passwordstore/util/viewmodel/PGPKeyListViewModel.kt @@ -5,8 +5,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import app.passwordstore.crypto.GpgIdentifier import app.passwordstore.crypto.KeyUtils +import app.passwordstore.crypto.PGPIdentifier import app.passwordstore.crypto.PGPKeyManager import com.github.michaelbull.result.Err import com.github.michaelbull.result.Ok @@ -20,7 +20,7 @@ import kotlinx.coroutines.launch @HiltViewModel class PGPKeyListViewModel @Inject constructor(private val keyManager: PGPKeyManager) : ViewModel() { - var keys: ImmutableList<GpgIdentifier> by mutableStateOf(persistentListOf()) + var keys: ImmutableList<PGPIdentifier> by mutableStateOf(persistentListOf()) init { updateKeySet() @@ -40,7 +40,7 @@ class PGPKeyListViewModel @Inject constructor(private val keyManager: PGPKeyMana } } - fun deleteKey(identifier: GpgIdentifier) { + fun deleteKey(identifier: PGPIdentifier) { viewModelScope.launch { keyManager.removeKey(identifier) updateKeySet() |