summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-07-16 12:18:38 +0530
committerGitHub <noreply@github.com>2020-07-16 12:18:38 +0530
commitd4379a47791ea0002eda9821f35c632f1e224962 (patch)
tree2800d02bc7c2e412777cd4d7e00105b575f5d375
parent41ecdd7b08bf3119c365ed8ce29fb95c63668e4b (diff)
Remove manual key selection and start actually using `.gpg-id` (#916)
Co-authored-by: Aditya Wasan <adityawasan55@gmail.com> Co-authored-by: Fabian Henneke <fabian@henneke.me>
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/src/main/AndroidManifest.xml5
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt22
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt37
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt31
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt9
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/GetKeyIdsActivity.kt90
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt111
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt2
-rw-r--r--app/src/main/res/values-ar/strings.xml6
-rw-r--r--app/src/main/res/values-cs/strings.xml9
-rw-r--r--app/src/main/res/values-de/strings.xml8
-rw-r--r--app/src/main/res/values-es/strings.xml12
-rw-r--r--app/src/main/res/values-fr/strings.xml12
-rw-r--r--app/src/main/res/values-ja/strings.xml6
-rw-r--r--app/src/main/res/values-ru/strings.xml13
-rw-r--r--app/src/main/res/values-zh-rCN/strings.xml6
-rw-r--r--app/src/main/res/values-zh-rTW/strings.xml6
-rw-r--r--app/src/main/res/values/strings.xml20
-rw-r--r--app/src/main/res/xml/preference.xml9
21 files changed, 115 insertions, 302 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35f99d5c..23b188a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file.
- OTP codes can be automatically filled from SMS (requires Android P+ and Google Play Services)
- Importing TOTP secrets using QR codes
- Navigate into newly created folders and scroll to newly created passwords
+- Support per-directory keys
## [1.9.2] - 2020-06-30
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5fcbe706..1fea64ba 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -83,11 +83,6 @@
android:parentActivityName=".PasswordStore"
android:windowSoftInputMode="adjustResize" />
- <activity
- android:name=".crypto.GetKeyIdsActivity"
- android:parentActivityName=".PasswordStore"
- android:theme="@style/NoBackgroundTheme" />
-
<service
android:name=".autofill.AutofillService"
android:enabled="@bool/enable_accessibility_autofill"
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
index 5d76eef0..57e636d1 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
@@ -416,17 +416,6 @@ class PasswordStore : AppCompatActivity(R.layout.activity_pwdstore) {
return // if not empty, just show me the passwords!
}
}
- val keyIds = settings.getStringSet(PreferenceKeys.OPENPGP_KEY_IDS_SET, HashSet())
- if (keyIds != null && keyIds.isEmpty()) {
- MaterialAlertDialogBuilder(this)
- .setMessage(resources.getString(R.string.key_dialog_text))
- .setPositiveButton(resources.getString(R.string.dialog_positive)) { _, _ ->
- val intent = Intent(activity, UserPreference::class.java)
- repositoryInitAction.launch(intent)
- }
- .setNegativeButton(resources.getString(R.string.dialog_negative), null)
- .show()
- }
createRepository()
}
@@ -580,17 +569,6 @@ class PasswordStore : AppCompatActivity(R.layout.activity_pwdstore) {
.show()
return false
}
- if (settings.getStringSet(PreferenceKeys.OPENPGP_KEY_IDS_SET, HashSet()).isNullOrEmpty()) {
- MaterialAlertDialogBuilder(this)
- .setTitle(resources.getString(R.string.no_key_selected_dialog_title))
- .setMessage(resources.getString(R.string.no_key_selected_dialog_text))
- .setPositiveButton(resources.getString(R.string.dialog_ok)) { _, _ ->
- val intent = Intent(activity, UserPreference::class.java)
- startActivity(intent)
- }
- .show()
- return false
- }
return true
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
index f713ad26..98873fad 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
@@ -39,12 +39,10 @@ import com.github.ajalt.timberkt.Timber.tag
import com.github.ajalt.timberkt.d
import com.github.ajalt.timberkt.w
import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import com.google.android.material.snackbar.Snackbar
import com.zeapo.pwdstore.autofill.AutofillPreferenceActivity
import com.zeapo.pwdstore.autofill.oreo.BrowserAutofillSupportLevel
import com.zeapo.pwdstore.autofill.oreo.getInstalledBrowsersWithAutofillSupportLevel
import com.zeapo.pwdstore.crypto.BasePgpActivity
-import com.zeapo.pwdstore.crypto.GetKeyIdsActivity
import com.zeapo.pwdstore.git.GitConfigActivity
import com.zeapo.pwdstore.git.GitServerConfigActivity
import com.zeapo.pwdstore.pwgenxkpwd.XkpwdDictionary
@@ -57,8 +55,6 @@ import com.zeapo.pwdstore.utils.autofillManager
import com.zeapo.pwdstore.utils.getEncryptedPrefs
import java.io.File
import java.io.IOException
-import java.util.HashSet
-import me.msfjarvis.openpgpktx.util.OpenPgpUtils
typealias ClickListener = Preference.OnPreferenceClickListener
typealias ChangeListener = Preference.OnPreferenceChangeListener
@@ -106,9 +102,6 @@ class UserPreference : AppCompatActivity() {
}
}
- // Crypto preferences
- val keyPreference = findPreference<Preference>(PreferenceKeys.OPENPGP_KEY_ID_PREF)
-
// General preferences
val showTimePreference = findPreference<Preference>(PreferenceKeys.GENERAL_SHOW_TIME)
val clearClipboard20xPreference = findPreference<CheckBoxPreference>(PreferenceKeys.CLEAR_CLIPBOARD_20X)
@@ -155,24 +148,6 @@ class UserPreference : AppCompatActivity() {
appVersionPreference?.summary = "Version: ${BuildConfig.VERSION_NAME}"
- keyPreference?.let { pref ->
- updateKeyIDsSummary(pref)
- pref.onPreferenceClickListener = ClickListener {
- val providerPackageName = requireNotNull(sharedPreferences.getString(PreferenceKeys.OPENPGP_PROVIDER_LIST, ""))
- if (providerPackageName.isEmpty()) {
- Snackbar.make(requireView(), resources.getString(R.string.provider_toast_text), Snackbar.LENGTH_LONG).show()
- false
- } else {
- val intent = Intent(callingActivity, GetKeyIdsActivity::class.java)
- val keySelectResult = registerForActivityResult(StartActivityForResult()) {
- updateKeyIDsSummary(pref)
- }
- keySelectResult.launch(intent)
- true
- }
- }
- }
-
sshKeyPreference?.onPreferenceClickListener = ClickListener {
callingActivity.getSshKey()
true
@@ -369,18 +344,6 @@ class UserPreference : AppCompatActivity() {
}
}
- private fun updateKeyIDsSummary(preference: Preference) {
- val selectedKeys = (sharedPreferences.getStringSet(PreferenceKeys.OPENPGP_KEY_IDS_SET, null)
- ?: HashSet()).toTypedArray()
- preference.summary = if (selectedKeys.isEmpty()) {
- resources.getString(R.string.pref_no_key_selected)
- } else {
- selectedKeys.joinToString(separator = ";") { s ->
- OpenPgpUtils.convertKeyIdToHex(s.toLong())
- }
- }
- }
-
private fun updateXkPasswdPrefsVisibility(newValue: Any?, prefIsCustomDict: CheckBoxPreference?, prefCustomDictPicker: Preference?) {
when (newValue as String) {
BasePgpActivity.KEY_PWGEN_TYPE_CLASSIC -> {
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt
index eabd24c0..3656bc7e 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt
@@ -24,6 +24,7 @@ import com.zeapo.pwdstore.autofill.oreo.Credentials
import com.zeapo.pwdstore.autofill.oreo.DirectoryStructure
import com.zeapo.pwdstore.autofill.oreo.FillableForm
import com.zeapo.pwdstore.model.PasswordEntry
+import com.zeapo.pwdstore.utils.OPENPGP_PROVIDER
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.FileNotFoundException
@@ -53,7 +54,6 @@ class AutofillDecryptActivity : AppCompatActivity(), CoroutineScope {
private const val EXTRA_FILE_PATH = "com.zeapo.pwdstore.autofill.oreo.EXTRA_FILE_PATH"
private const val EXTRA_SEARCH_ACTION =
"com.zeapo.pwdstore.autofill.oreo.EXTRA_SEARCH_ACTION"
- private const val OPENPGP_PROVIDER = "org.sufficientlysecure.keychain"
private var decryptFileRequestCode = 1
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
index 39164e8f..ec8e7f9b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
@@ -14,8 +14,6 @@ import android.os.Build
import android.os.Bundle
import android.text.format.DateUtils
import android.view.WindowManager
-import android.widget.Toast
-import androidx.activity.result.ActivityResultLauncher
import androidx.annotation.CallSuper
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
@@ -26,7 +24,7 @@ import com.github.ajalt.timberkt.i
import com.google.android.material.snackbar.Snackbar
import com.zeapo.pwdstore.ClipboardService
import com.zeapo.pwdstore.R
-import com.zeapo.pwdstore.UserPreference
+import com.zeapo.pwdstore.utils.OPENPGP_PROVIDER
import com.zeapo.pwdstore.utils.PreferenceKeys
import com.zeapo.pwdstore.utils.clipboard
import com.zeapo.pwdstore.utils.snackbar
@@ -74,12 +72,6 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
val settings: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(this) }
/**
- * Read-only field for getting the list of OpenPGP key IDs that we have access to.
- */
- var keyIDs = emptySet<String>()
- private set
-
- /**
* Handle to the [OpenPgpApi] instance that is used by subclasses to interface with OpenKeychain.
*/
private var serviceConnection: OpenPgpServiceConnection? = null
@@ -87,15 +79,13 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
/**
* [onCreate] sets the window up with the right flags to prevent auth leaks through screenshots
- * or recent apps screen and fills in [keyIDs] from [settings]
+ * or recent apps screen.
*/
@CallSuper
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
tag(TAG)
-
- keyIDs = settings.getStringSet(PreferenceKeys.OPENPGP_KEY_IDS_SET, null) ?: emptySet()
}
/**
@@ -128,20 +118,11 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
}
/**
- * Method for subclasses to initiate binding with [OpenPgpServiceConnection]. The design choices
- * here are a bit dubious at first glance. We require passing a [ActivityResultLauncher] because
- * it lets us react to having a OpenPgp provider selected without relying on the now deprecated
- * [startActivityForResult].
+ * Method for subclasses to initiate binding with [OpenPgpServiceConnection].
*/
- fun bindToOpenKeychain(onBoundListener: OpenPgpServiceConnection.OnBound, activityResult: ActivityResultLauncher<Intent>) {
- val providerPackageName = settings.getString(PreferenceKeys.OPENPGP_PROVIDER_LIST, "")
- if (providerPackageName.isNullOrEmpty()) {
- Toast.makeText(this, resources.getString(R.string.provider_toast_text), Toast.LENGTH_LONG).show()
- activityResult.launch(Intent(this, UserPreference::class.java))
- } else {
- serviceConnection = OpenPgpServiceConnection(this, providerPackageName, onBoundListener)
- serviceConnection?.bindToService()
- }
+ fun bindToOpenKeychain(onBoundListener: OpenPgpServiceConnection.OnBound) {
+ serviceConnection = OpenPgpServiceConnection(this, OPENPGP_PROVIDER, onBoundListener)
+ serviceConnection?.bindToService()
}
/**
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
index 3425a346..cc70dcc1 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
@@ -13,7 +13,6 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.activity.result.IntentSenderRequest
-import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
import androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult
import androidx.lifecycle.lifecycleScope
import com.github.ajalt.timberkt.e
@@ -57,13 +56,9 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
}
}
- private val openKeychainResult = registerForActivityResult(StartActivityForResult()) {
- decryptAndVerify()
- }
-
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- bindToOpenKeychain(this, openKeychainResult)
+ bindToOpenKeychain(this)
title = name
with(binding) {
setContentView(root)
@@ -134,7 +129,7 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
@OptIn(ExperimentalTime::class)
private fun decryptAndVerify(receivedIntent: Intent? = null) {
if (api == null) {
- bindToOpenKeychain(this, openKeychainResult)
+ bindToOpenKeychain(this)
return
}
val data = receivedIntent ?: Intent()
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/GetKeyIdsActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/GetKeyIdsActivity.kt
deleted file mode 100644
index 97f6bab2..00000000
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/GetKeyIdsActivity.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-package com.zeapo.pwdstore.crypto
-
-import android.content.Intent
-import android.os.Bundle
-import androidx.activity.result.IntentSenderRequest
-import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
-import androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult
-import androidx.core.content.edit
-import androidx.lifecycle.lifecycleScope
-import com.github.ajalt.timberkt.Timber
-import com.github.ajalt.timberkt.e
-import com.zeapo.pwdstore.utils.PreferenceKeys
-import com.zeapo.pwdstore.utils.snackbar
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import me.msfjarvis.openpgpktx.util.OpenPgpApi
-import org.openintents.openpgp.IOpenPgpService2
-
-class GetKeyIdsActivity : BasePgpActivity() {
-
- private val getKeyIds = registerForActivityResult(StartActivityForResult()) { getKeyIds() }
-
- private val userInteractionRequiredResult = registerForActivityResult(StartIntentSenderForResult()) { result ->
- if (result.data == null) {
- setResult(RESULT_CANCELED, null)
- finish()
- return@registerForActivityResult
- }
-
- when (result.resultCode) {
- RESULT_OK -> getKeyIds(result.data)
- RESULT_CANCELED -> {
- setResult(RESULT_CANCELED, result.data)
- finish()
- }
- }
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- bindToOpenKeychain(this, getKeyIds)
- }
-
- override fun onBound(service: IOpenPgpService2) {
- super.onBound(service)
- getKeyIds()
- }
-
- override fun onError(e: Exception) {
- e(e)
- }
-
- /**
- * Get the Key ids from OpenKeychain
- */
- private fun getKeyIds(receivedIntent: Intent? = null) {
- val data = receivedIntent ?: Intent()
- data.action = OpenPgpApi.ACTION_GET_KEY_IDS
- lifecycleScope.launch(Dispatchers.IO) {
- api?.executeApiAsync(data, null, null) { result ->
- when (result?.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
- OpenPgpApi.RESULT_CODE_SUCCESS -> {
- try {
- val ids = result.getLongArrayExtra(OpenPgpApi.RESULT_KEY_IDS)
- ?: LongArray(0)
- val keys = ids.map { it.toString() }.toSet()
- // use Long
- settings.edit { putStringSet(PreferenceKeys.OPENPGP_KEY_IDS_SET, keys) }
- snackbar(message = "PGP keys selected")
- setResult(RESULT_OK)
- finish()
- } catch (e: Exception) {
- Timber.e(e) { "An Exception occurred" }
- }
- }
- OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED -> {
- val sender = getUserInteractionRequestIntent(result)
- userInteractionRequiredResult.launch(IntentSenderRequest.Builder(sender).build())
- }
- OpenPgpApi.RESULT_CODE_ERROR -> handleError(result)
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
index 286f2951..6cacf4b9 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
@@ -11,7 +11,10 @@ import android.text.InputType
import android.view.Menu
import android.view.MenuItem
import android.view.View
+import androidx.activity.result.ActivityResultLauncher
+import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
+import androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult
import androidx.core.view.isVisible
import androidx.core.widget.doOnTextChanged
import androidx.lifecycle.lifecycleScope
@@ -40,6 +43,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.msfjarvis.openpgpktx.util.OpenPgpApi
import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection
+import me.msfjarvis.openpgpktx.util.OpenPgpUtils
import org.eclipse.jgit.api.Git
class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
@@ -51,13 +55,45 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
private val suggestedExtra by lazy { intent.getStringExtra(EXTRA_EXTRA_CONTENT) }
private val shouldGeneratePassword by lazy { intent.getBooleanExtra(EXTRA_GENERATE_PASSWORD, false) }
private val editing by lazy { intent.getBooleanExtra(EXTRA_EDITING, false) }
- private val doNothing = registerForActivityResult(StartActivityForResult()) {}
- private var oldCategory: String? = null
private val oldFileName by lazy { intent.getStringExtra(EXTRA_FILE_NAME) }
+ private var oldCategory: String? = null
+ private var copy: Boolean = false
+
+ private val userInteractionRequiredResult: ActivityResultLauncher<IntentSenderRequest> = registerForActivityResult(StartIntentSenderForResult()) { result ->
+ if (result.data == null) {
+ setResult(RESULT_CANCELED, null)
+ finish()
+ return@registerForActivityResult
+ }
+
+ when (result.resultCode) {
+ RESULT_OK -> encrypt(result.data)
+ RESULT_CANCELED -> {
+ setResult(RESULT_CANCELED, result.data)
+ finish()
+ }
+ }
+ }
+
+ private fun File.findTillRoot(fileName: String, rootPath: File): File? {
+ val gpgFile = File(this, fileName)
+ if (gpgFile.exists()) return gpgFile
+
+ if (this.absolutePath == rootPath.absolutePath) {
+ return null
+ }
+
+ val parent = parentFile
+ return if (parent != null && parent.exists()) {
+ parent.findTillRoot(fileName, rootPath)
+ } else {
+ null
+ }
+ }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- bindToOpenKeychain(this, doNothing)
+ bindToOpenKeychain(this)
title = if (editing)
getString(R.string.edit_password)
else
@@ -172,8 +208,14 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
setResult(RESULT_CANCELED)
finish()
}
- R.id.save_password -> encrypt()
- R.id.save_and_copy_password -> encrypt(copy = true)
+ R.id.save_password -> {
+ copy = false
+ encrypt()
+ }
+ R.id.save_and_copy_password -> {
+ copy = true
+ encrypt()
+ }
else -> return super.onOptionsItemSelected(item)
}
return true
@@ -202,10 +244,42 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
otpImportButton.isVisible = !entry.hasTotp()
}
+ private sealed class GpgIdentifier {
+ data class KeyId(val id: Long) : GpgIdentifier()
+ data class UserId(val email: String) : GpgIdentifier()
+ }
+
+ @OptIn(ExperimentalUnsignedTypes::class)
+ private fun parseGpgIdentifier(identifier: String) : GpgIdentifier? {
+ // Match long key IDs:
+ // FF22334455667788 or 0xFF22334455667788
+ val maybeLongKeyId = identifier.removePrefix("0x").takeIf {
+ it.matches("[a-fA-F0-9]{16}".toRegex())
+ }
+ if (maybeLongKeyId != null) {
+ val keyId = maybeLongKeyId.toULong()
+ return GpgIdentifier.KeyId(maybeLongKeyId.toLong())
+ }
+
+ // Match fingerprints:
+ // FF223344556677889900112233445566778899 or 0xFF223344556677889900112233445566778899
+ val maybeFingerprint = identifier.removePrefix("0x").takeIf {
+ it.matches("[a-fA-F0-9]{40}".toRegex())
+ }
+ if (maybeFingerprint != null) {
+ // Truncating to the long key ID is not a security issue since OpenKeychain only accepts
+ // non-ambiguous key IDs.
+ val keyId = maybeFingerprint.takeLast(16).toULong(16)
+ return GpgIdentifier.KeyId(keyId.toLong())
+ }
+
+ return OpenPgpUtils.splitUserId(identifier).email?.let { GpgIdentifier.UserId(it) }
+ }
+
/**
* Encrypts the password and the extra content
*/
- private fun encrypt(copy: Boolean = false) = with(binding) {
+ private fun encrypt(receivedIntent: Intent? = null) = with(binding) {
val editName = filename.text.toString().trim()
val editPass = password.text.toString()
val editExtra = extraContent.text.toString()
@@ -227,12 +301,25 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
copyPasswordToClipboard(editPass)
}
- val data = Intent()
+ val data = receivedIntent ?: Intent()
data.action = OpenPgpApi.ACTION_ENCRYPT
- // EXTRA_KEY_IDS requires long[]
- val longKeys = keyIDs.map { it.toLong() }
- data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, longKeys.toLongArray())
+ // pass enters the key ID into `.gpg-id`.
+ val repoRoot = PasswordRepository.getRepositoryDirectory(applicationContext)
+ val gpgIdentifierFile = File(repoRoot, directory.text.toString()).findTillRoot(".gpg-id", repoRoot)
+ if (gpgIdentifierFile == null) {
+ snackbar(message = resources.getString(R.string.failed_to_find_key_id))
+ return@with
+ }
+ val gpgIdentifierFileContent = gpgIdentifierFile.useLines { it.firstOrNull() } ?: ""
+ when (val identifier = parseGpgIdentifier(gpgIdentifierFileContent)) {
+ is GpgIdentifier.KeyId -> data.putExtra(OpenPgpApi.EXTRA_KEY_IDS, arrayOf(identifier.id))
+ is GpgIdentifier.UserId -> data.putExtra(OpenPgpApi.EXTRA_USER_IDS, arrayOf(identifier.email))
+ null -> {
+ snackbar(message = resources.getString(R.string.invalid_gpg_id))
+ return@with
+ }
+ }
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true)
val content = "$editPass\n$editExtra"
@@ -347,6 +434,10 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
e(e) { "An Exception occurred" }
}
}
+ OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED -> {
+ val sender = getUserInteractionRequestIntent(result)
+ userInteractionRequiredResult.launch(IntentSenderRequest.Builder(sender).build())
+ }
OpenPgpApi.RESULT_CODE_ERROR -> handleError(result)
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt b/app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt
index 19b651b7..b274b47d 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt
@@ -29,6 +29,8 @@ import com.zeapo.pwdstore.utils.PasswordRepository.Companion.getRepositoryDirect
import java.io.File
import org.eclipse.jgit.api.Git
+const val OPENPGP_PROVIDER = "org.sufficientlysecure.keychain"
+
fun Int.clearFlag(flag: Int): Int {
return this and flag.inv()
}
diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml
index 8b87028d..300e03e3 100644
--- a/app/src/main/res/values-ar/strings.xml
+++ b/app/src/main/res/values-ar/strings.xml
@@ -14,7 +14,6 @@
<string name="edit">تعديل</string>
<string name="delete">حذف</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">لم يتم إختيار مزود الأوبن بي جي بي بعد !</string>
<string name="file_toast_text">الرجاء إدخال إسم ملف</string>
<!-- Git Async Task -->
<string name="running_dialog_text">جاري تنفيذ الأمر ...</string>
@@ -54,7 +53,6 @@
<string name="username">إسم المستخدم :</string>
<string name="edit_password">تعديل كلمة السر</string>
<string name="copy_password">نسخ كلمة السر</string>
- <string name="copy_username">نسخ إسم المستخدم</string>
<string name="share_as_plaintext">شارك كنص مجرد</string>
<string name="last_changed">آخِر تعديل %s</string>
<!-- Preferences -->
@@ -64,8 +62,6 @@
<string name="pref_ssh_see_key_title">إظهار مفتاح الـ SSH العمومي الذي تم توليده</string>
<string name="pref_git_delete_repo">حذف المستودع</string>
<string name="pref_dialog_delete_title">تنحية المستودع</string>
- <string name="pref_crypto_title">التشفير</string>
- <string name="pref_provider_title">إختيار مزود الأوبن بي جي بي OpenPGP</string>
<string name="pref_category_general_title">الإعدادات العامة</string>
<string name="pref_copy_title">نسخ كلمة السر تلقائيًا</string>
<string name="ssh_key_success_dialog_title">تم استيراد مفتاح الـ SSH</string>
@@ -108,8 +104,6 @@
<string name="show_extra_content_pref_title">إظهار المزيد من المحتوى</string>
<string name="pwd_generate_button">توليد</string>
<string name="refresh_list">تحديث القائمة</string>
- <string name="show_password">إظهار كلمة السر</string>
- <string name="show_extra">إظهار المزيد من المحتوى</string>
<string name="app_icon_hint">أيقونة التطبيق</string>
<string name="folder_icon_hint">أيقونة المجلد</string>
diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml
index e6c69ab3..fdb0aca3 100644
--- a/app/src/main/res/values-cs/strings.xml
+++ b/app/src/main/res/values-cs/strings.xml
@@ -19,8 +19,6 @@
<string name="change">Změnit</string>
<string name="use">Použít</string>
<string name="directory_selected_title">Tento adresář je již vybrán</string>
- <string name="no_key_selected_dialog_title">OpenPGP klíč nebyl zvolen</string>
- <string name="no_key_selected_dialog_text">Přesměrujeme Vás na nastavení. Prosím, zvolte si Váš OpenPGP klíč.</string>
<string name="password_exists_title">Heslo již existuje!</string>
<string name="password_exists_message">Toto přepíše%1$s %2$s .</string>
@@ -29,7 +27,6 @@
<string name="git_commit_edit_text">Upravit heslo %1$s s použítím Android Password Store.</string>
<string name="git_commit_remove_text">Odstranit %1$s ze store. </string>
<!-- PGPHandler -->
- <string name="provider_toast_text">Nebyl vybrán poskytovatel OpenPGP!</string>
<string name="clipboard_password_toast_text">Heslo zkopírováno do schránky, máte %d sekund na jeho zkopírování.</string>
<string name="clipboard_password_no_clear_toast_text">Heslo zkopírováno do schránky</string>
<string name="file_toast_text">Zadejte prosím jméno souboru</string>
@@ -89,7 +86,6 @@
<string name="username">Jméno:</string>
<string name="edit_password">Editovat heslo</string>
<string name="copy_password">Kopírovat heslo</string>
- <string name="copy_username">Kopírovat jméno</string>
<string name="share_as_plaintext">Sdílet v nešifrované podobě</string>
<string name="last_changed">Naposled změněno %s</string>
<!-- Preferences -->
@@ -99,9 +95,6 @@
<string name="pref_ssh_see_key_title">Zobrazit vygenerovaný veřejný SSH klíč</string>
<string name="pref_git_delete_repo">Smazat repozitář</string>
<string name="pref_dialog_delete_title">Vyčistit repozitář</string>
- <string name="pref_crypto_title">Šifrování</string>
- <string name="pref_provider_title">Vybrat poskytovatele OpenPGP</string>
- <string name="pref_key_title">Vybrat ID OpenPGP klíče</string>
<string name="pref_category_general_title">Všeobecné</string>
<string name="pref_copy_title">Automaticky kopírovat heslo</string>
<string name="pref_copy_dialog_title">Automatické kopírování hesla do schránky po úspěšném dešifrování.</string>
@@ -159,7 +152,6 @@
<string name="refresh_list">Obnovit seznam</string>
<string name="no_repo_selected">Nebyl vybrát externí repozitář</string>
<string name="send_plaintext_password_to">Odeslat heslo jako plaintext za použití…</string>
- <string name="show_password">Pokaż hasło</string>
<!-- Autofill -->
<string name="autofill_description">Automaticky vyplňuje pole hesel v aplikacích. Funguje pouze pro verzi Androidu 4.3 a vyšší. Není závislé na schránce pro Android verze 5.0 a vyšší.</string>
<string name="autofill_apps_default">Použít výchozí nastavení</string>
@@ -168,5 +160,4 @@
<string name="autofill_apps_match">Spárovat s</string>
<string name="autofill_apps_never">Nikdy nepárovat</string>
<string name="autofill_apps_delete">Smazat</string>
- <string name="get_last_changed_failed">Failed to get last changed date</string>
</resources>
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 257d45ca..7f1aae8b 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -17,7 +17,6 @@
<string name="edit">Bearbeiten</string>
<string name="delete">Löschen</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">Kein OpenPGP-Provider ausgewählt!</string>
<string name="clipboard_password_toast_text">Passwort ist in der Zwischenablage, du hast %d Sekunden, um es einzufügen.</string>
<string name="file_toast_text">Bitte setze einen Pfad</string>
<string name="empty_toast_text">Du kannst kein leeres Passwort setzen oder leere Extra-Angaben</string>
@@ -66,7 +65,6 @@
<string name="username">Benutzername:</string>
<string name="edit_password">Passwort bearbeiten</string>
<string name="copy_password">Passwort kopieren</string>
- <string name="copy_username">Benutzername kopieren</string>
<string name="share_as_plaintext">Als Klartext teilen</string>
<string name="last_changed">Zuletzt geändert %s</string>
<!-- Preferences -->
@@ -77,9 +75,6 @@
<string name="pref_ssh_see_key_title">Zeige erstellten öffentlichen SSH-Key</string>
<string name="pref_git_delete_repo">Repository löschen</string>
<string name="pref_dialog_delete_title">Repository löschen</string>
- <string name="pref_crypto_title">Kryptografie</string>
- <string name="pref_provider_title">Wähle OpenPGP-Provider</string>
- <string name="pref_key_title">Wähle OpenPGP-Key ID</string>
<string name="pref_category_general_title">Allgemein</string>
<string name="pref_copy_title">Kopiere Passwort automatisch</string>
<string name="pref_copy_dialog_title">Kopiert das Passwort in die Zwischenablage, wenn der Eintrag entschlüsselt wurde.</string>
@@ -139,8 +134,6 @@
<string name="refresh_list">Aktualisieren</string>
<string name="no_repo_selected">Kein externes Repository ausgewählt</string>
<string name="send_plaintext_password_to">Passwort senden als Nur-Text mit behilfe von…</string>
- <string name="show_password">Password wiedergeben</string>
- <string name="show_extra">Zeige weiteren Inhalt</string>
<string name="app_icon_hint">App Icon</string>
<string name="folder_icon_hint">Verzeichnis Icon</string>
@@ -160,5 +153,4 @@
<string name="autofill_ins_1_hint">Bildschirmfoto Accessibility Services</string>
<string name="autofill_ins_2_hint">Bildschirmfoto des Schalters in Accessibility Services</string>
<string name="autofill_ins_3_hint">Bildschirmfoto von Autofill in Aktion</string>
- <string name="get_last_changed_failed">Das Abrufen des letzten Änderungsdatums ist fehlgeschlagen.</string>
</resources>
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 4eecf660..a1fd8725 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -16,8 +16,6 @@
<string name="move">Mover</string>
<string name="edit">Editar</string>
<string name="delete">Eliminar</string>
- <string name="no_key_selected_dialog_title">No se ha seleccionado una llave OpenPGP</string>
- <string name="no_key_selected_dialog_text">Serás redirigido a los ajustes. Por favor selecciona tu llave OpenPGP.</string>
<!-- git commits -->
<string name="git_commit_add_text">"Contraseña para %1$s agregada usando Android Password Store."</string>
<string name="git_commit_edit_text">"%1$s editada usando Android Password Store."</string>
@@ -25,7 +23,6 @@
<string name="git_commit_move_text">"Renombrado %1$s a %2$s usando Android Password Store.."</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">¡No se ha seleccionado ningún proveedor OpenGPG!</string>
<string name="clipboard_password_toast_text">Contraseña copiada al portapapeles, tienes %d segundos para pegarla.</string>
<string name="clipboard_password_no_clear_toast_text">Contraseña copiada al portapapeles</string>
<string name="file_toast_text">Por favor selecciona un nombre de archivo</string>
@@ -82,7 +79,6 @@
<string name="username">Nombre de usuario:</string>
<string name="edit_password">Editar contraseña</string>
<string name="copy_password">Copiar contraseña</string>
- <string name="copy_username">Copiar nombre de usuario</string>
<string name="share_as_plaintext">Compartir como texto plano</string>
<string name="last_changed">Última modificación %s</string>
@@ -94,10 +90,6 @@
<string name="pref_ssh_see_key_title">Ver llave pública SSH generada</string>
<string name="pref_git_delete_repo">Eliminar repositorio</string>
<string name="pref_dialog_delete_title">Limpiar repositorio</string>
- <string name="pref_crypto_title">Cifrado</string>
- <string name="pref_provider_title">Selecciona un proveedor OpenPGP</string>
- <string name="pref_key_title">Selecciona la llave OpenPGP</string>
- <string name="pref_no_key_selected">Ninguna llave seleccionada</string>
<string name="pref_category_general_title">General</string>
<string name="pref_copy_title">Copiar contraseña automáticamente</string>
<string name="pref_copy_dialog_title">Automáticamente copia la contraseña al portapapeles si el descifrado fue exitoso.</string>
@@ -167,8 +159,6 @@
<string name="refresh_list">Actualizar lista</string>
<string name="no_repo_selected">Ningún repositorio externo seleccionado</string>
<string name="send_plaintext_password_to">Enviar contraseña en texto plano usando…</string>
- <string name="show_password">Mostrar contraseña</string>
- <string name="show_extra">Mostrar contenido extra</string>
<string name="app_icon_hint">Ícono de app</string>
<string name="folder_icon_hint">Ícono de directorio</string>
@@ -187,7 +177,6 @@
<string name="autofill_toast_username">Selecciona un campo editable para pegar el nombre de usuario.\nNombre de usuario disponible por %d segundos.</string>
<string name="ssh_key_does_not_exist">Imposible abrir la llave privada SSH. Por favor verifica que el archivo exista</string>
<string name="new_password_title">Nueva contraseña</string>
- <string name="edit_password_title">Editando</string>
<string name="autofill_ins_1_hint">Pantalla de Servicios de Accesibilidad</string>
<string name="autofill_ins_2_hint">Pantalla de activación en Servicios de Accesibilidad</string>
<string name="autofill_ins_3_hint">Pantalla de servicio de autollenado en acción</string>
@@ -198,5 +187,4 @@
<string name="hackish_tools">Hackish tools</string>
<string name="abort_rebase">Abortar rebase</string>
<string name="commit_hash">Hash del commit</string>
- <string name="get_last_changed_failed">Error al obtener la fecha de último cambio</string>
</resources>
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index c4c75b55..f9ac6d51 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -20,8 +20,6 @@
<string name="use">Utiliser</string>
<string name="directory_selected_title">Répertoire déjà sélectionné</string>
<string name="directory_selected_message">Voulez-vous utiliser \"%1$s\"?</string>
- <string name="no_key_selected_dialog_title">Clé OpenPGP non sélectionnée</string>
- <string name="no_key_selected_dialog_text">Nous allons vous rediriger vers les paramètres. Veuillez sélectionner votre clé OpenPGP.</string>
<string name="password_exists_title">Le mot de passe existe!</string>
<string name="password_exists_message">Cela écrasera %1$s avec %2$s.</string>
@@ -32,7 +30,6 @@
<string name="git_commit_move_text">Renommer %1$sà %2$s. </string>
<!-- PGPHandler -->
- <string name="provider_toast_text">Aucun prestataire OpenPGP sélectionné !</string>
<string name="clipboard_password_toast_text">Mot de passe copié dans le presse papier, vous avez %d secondes pour coller celui-ci.</string>
<string name="file_toast_text">Renseignez un nom de fichier</string>
<string name="empty_toast_text">Vous ne pouvez pas utiliser un mot de passe vide ou des données supplémentaires vide</string>
@@ -89,7 +86,6 @@
<string name="username">Nom d\'utilisateur</string>
<string name="edit_password">Éditer le mot de passe</string>
<string name="copy_password">Copier le mot de passe</string>
- <string name="copy_username">Copier le nom d\'utilisateur</string>
<string name="share_as_plaintext">Partager en clair</string>
<string name="last_changed">Dernière modification le %s</string>
@@ -101,10 +97,6 @@
<string name="pref_ssh_see_key_title">Voir la clef publique SSH générée</string>
<string name="pref_git_delete_repo">Supprimer le dépôt</string>
<string name="pref_dialog_delete_title">Effacer le dépôt</string>
- <string name="pref_crypto_title">Chiffrement</string>
- <string name="pref_provider_title">Sélection du prestataire OpenPGP</string>
- <string name="pref_key_title">Sélection de votre identifiant OpenPGP</string>
- <string name="pref_no_key_selected">Aucune clé sélectionnée</string>
<string name="pref_category_general_title">Général</string>
<string name="pref_copy_title">Copie automatique du mot de passe</string>
<string name="pref_copy_dialog_title">Copie automatiquement le mot de passe vers le presse-papier si le déchiffrement a réussi.</string>
@@ -167,8 +159,6 @@
<string name="refresh_list">Rafraichir la liste</string>
<string name="no_repo_selected">Pas de dépôt externe séléctionné</string>
<string name="send_plaintext_password_to">Envoyer le mot de passe en clair via…</string>
- <string name="show_password">Montrer le mot de passe</string>
- <string name="show_extra">Afficher le contenu supplémentaire</string>
<string name="app_icon_hint">Icône de l\'application</string>
<string name="folder_icon_hint">Icône du dossier</string>
@@ -186,7 +176,6 @@
<string name="autofill_paste_username">Coller le nom d\'utilisateur?\n\n%s</string>
<string name="ssh_key_does_not_exist">Impossible d\'ouvrir la clef ssh, merci de vérifier que le ficher existe</string>
<string name="new_password_title">Nouveau mot de passe</string>
- <string name="edit_password_title">Montage</string>
<string name="autofill_ins_1_hint">Capture des services d\'accessibilité</string>
<string name="autofill_ins_2_hint">Capture de bascule dans les services d\'accessibilité</string>
<string name="autofill_ins_3_hint">Capture du service de remplissage automatique en action</string>
@@ -197,5 +186,4 @@
<string name="git_operation_remember_passphrase">Se rappeler de la phrase secrète dans la configuration de l\'application (peu sûr)</string>
<string name="hackish_tools">Outils de hack</string>
<string name="commit_hash">Commettre la clé</string>
- <string name="get_last_changed_failed">Failed to get last changed date</string>
</resources>
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 02dd3219..d65de8a5 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -18,7 +18,6 @@
<string name="git_commit_add_text">追加 %1$s ストアから。</string>
<string name="git_commit_edit_text">編集 %1$s ストアから。</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">OpenPGP プロバイダが選択されていません!</string>
<string name="clipboard_password_toast_text">パスワードをクリップボードにコピーしました %d 秒以内に貼り付けしてください。</string>
<string name="file_toast_text">ファイル名を入力してください</string>
<string name="empty_toast_text">空のパスワードを使用したり、追加のコンテンツを空にすることはできません</string>
@@ -64,9 +63,6 @@
<string name="pref_ssh_see_key_title">生成した公開 SSH 鍵を表示</string>
<string name="pref_git_delete_repo">リポジトリを削除</string>
<string name="pref_dialog_delete_title">リポジトリをクリア</string>
- <string name="pref_crypto_title">暗号化</string>
- <string name="pref_provider_title">OpenPGP プロバイダーを選択</string>
- <string name="pref_key_title">OpenPGP 鍵 ID を選択</string>
<string name="pref_category_general_title">全般</string>
<string name="pref_copy_title">自動的にパスワードをコピー</string>
<string name="pref_copy_dialog_title">復号化が成功した後、自動的にパスワードをクリップボードにコピーします。</string>
@@ -120,7 +116,6 @@
<string name="refresh_list">リストを更新</string>
<string name="no_repo_selected">外部リポジトリが選択されていません</string>
<string name="send_plaintext_password_to">パスワードをプレーンテキストとして送信…</string>
- <string name="show_password">パスワードを表示</string>
<!-- Autofill -->
<string name="autofill_description">アプリのパスワードフィールドを自動入力します。 Android バージョン 4.3 以降でのみ動作します。 Android 5.0 以降のクリップボードには依存しません。</string>
<string name="autofill_apps_default">デフォルト設定を使用する</string>
@@ -129,5 +124,4 @@
<string name="autofill_apps_match">一致</string>
<string name="autofill_apps_never">一致しない</string>
<string name="autofill_apps_delete">削除</string>
- <string name="get_last_changed_failed">最終変更日の取得に失敗しました</string>
</resources>
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index ff36585b..3b41758f 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -20,8 +20,6 @@
<string name="use">Использовать</string>
<string name="directory_selected_title">Директория уже выбрана</string>
<string name="directory_selected_message">Вы хотите использовать \"%1$s\"?</string>
- <string name="no_key_selected_dialog_title">Ключ OpenPGP не выбран</string>
- <string name="no_key_selected_dialog_text">Мы перенаправим вас в настройки. Пожалуйста, выберите ваш OpenGPG ключ.</string>
<string name="password_exists_title">Пароль уже существует!</string>
<string name="password_exists_message">Это перезапишет %1$sна%2$s</string>
@@ -32,7 +30,6 @@
<string name="git_commit_move_text">Переименовать %1$sв%2$s.</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">Не выбран провайдер OpenPGP!</string>
<string name="clipboard_password_toast_text">Пароль скопирован в буфер обмена, у вас есть %d секунд чтобы вставить его.</string>
<string name="clipboard_password_no_clear_toast_text">Пароль скопирован в буфер обмена</string>
<string name="file_toast_text">Пожалуйста, укажите имя файла</string>
@@ -94,7 +91,6 @@
<string name="username">Имя пользователя:</string>
<string name="edit_password">Редактировать пароль</string>
<string name="copy_password">Скопировать пароль</string>
- <string name="copy_username">Скопировать имя пользователя</string>
<string name="share_as_plaintext">Поделиться в открытом виде</string>
<string name="last_changed">Последние изменение %s</string>
@@ -106,10 +102,6 @@
<string name="pref_ssh_see_key_title">Просмотреть публичный SSH ключ</string>
<string name="pref_git_delete_repo">Удалить репозиторий</string>
<string name="pref_dialog_delete_title">Очистить репозиторий</string>
- <string name="pref_crypto_title">Шифрование</string>
- <string name="pref_provider_title">Выберите провайдера OpenPGP</string>
- <string name="pref_key_title">Выберите ключ OpenPGP</string>
- <string name="pref_no_key_selected">Ключи не выбраны</string>
<string name="pref_category_general_title">Общие</string>
<string name="pref_copy_title">Автоматически копировать пароль</string>
<string name="pref_copy_dialog_title">Автоматически копировать пароль в буфер обмена после успешного расшифрования</string>
@@ -199,9 +191,6 @@
<string name="refresh_list">Обновить список</string>
<string name="no_repo_selected">Внешний репозиторий не выбран</string>
<string name="send_plaintext_password_to">Поделиться паролем в открытом виде с помощью</string>
- <string name="show_password">Показать пароль</string>
- <string name="show_extra">Показать дополнительную информацию</string>
- <string name="hide_extra">Скрыть расширенный контекст</string>
<string name="app_icon_hint">Иконка приложения</string>
<string name="folder_icon_hint">Иконка папки</string>
@@ -244,7 +233,6 @@
<string name="autofill_toast_username">Выберите поле ввода для вставки имени пользователя.\nИмя пользователя можно вставить в течение %d секунд.</string>
<string name="ssh_key_does_not_exist">Невозможно открыть приватный ключ ssh, пожалуйста проверьте, что файл существует</string>
<string name="new_password_title">Новый пароль</string>
- <string name="edit_password_title">Редактирование</string>
<string name="autofill_ins_1_hint">Снимок экрана сервисов доступности</string>
<string name="autofill_ins_2_hint">Снимок экрана переключателя в сервисах доступности</string>
<string name="autofill_ins_3_hint">Снимок экрана сервиса автозаполнения в действии</string>
@@ -258,7 +246,6 @@
<string name="abort_rebase">Прервать перебазирование и записать изменения в новую ветку</string>
<string name="reset_to_remote">Полный сброс до состояния удаленной ветки</string>
<string name="commit_hash">Хэш-сумма изменений</string>
- <string name="get_last_changed_failed">Failed to get last changed date</string>
<string name="openkeychain_ssh_api_connect_fail">Ошибка при подключении к сервису OpenKeychain SSH API</string>
<string name="no_ssh_api_provider">Не найдено SSH API провайдеров. OpenKeychain установлен?</string>
<string name="ssh_api_pending_intent_failed">Ожидаемое намерение SSH API не удалось</string>
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 34ef46a1..8a57de7b 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -18,7 +18,6 @@
<string name="git_commit_add_text">使用Android Password Store来添加 %1$s</string>
<string name="git_commit_edit_text">使用Android Password Store来修改 %1$s</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">未选择提供OpenPGP的应用</string>
<string name="clipboard_password_toast_text">密码已复制到剪贴板, 你有 %d 秒的时间将其粘贴到其他地方.</string>
<string name="file_toast_text">请提供一个文件名</string>
<string name="empty_toast_text">无法使用空白密码或者空白的额外内容</string>
@@ -64,9 +63,6 @@
<string name="pref_ssh_see_key_title">查看生成的 SSH 公钥</string>
<string name="pref_git_delete_repo">删除 Repo</string>
<string name="pref_dialog_delete_title">清空 Repo</string>
- <string name="pref_crypto_title">加密</string>
- <string name="pref_provider_title">选择 OpenPGP 应用</string>
- <string name="pref_key_title">选择 OpenPGP Key Id</string>
<string name="pref_category_general_title">通用</string>
<string name="pref_copy_title">自动复制密码</string>
<string name="pref_copy_dialog_title">解密成功后自动将密码复制到剪贴板</string>
@@ -117,7 +113,6 @@
<string name="refresh_list">刷新列表</string>
<string name="no_repo_selected">未选择外部 Repo</string>
<string name="send_plaintext_password_to">将密码以纯文本发送…</string>
- <string name="show_password">显示密码</string>
<!-- Autofill -->
<string name="autofill_description">在app中自动输入密码. 此功能只在 Andorid 4.3 及以上版本中可用. 在 Andorid 5.0 及以上版本中不依赖剪贴板</string>
<string name="autofill_apps_default">使用默认设置</string>
@@ -126,5 +121,4 @@
<string name="autofill_apps_match">匹配</string>
<string name="autofill_apps_never">从不匹配</string>
<string name="autofill_apps_delete">删除</string>
- <string name="get_last_changed_failed">获取上次修改日期失败</string>
</resources>
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index b38380b4..6b120faf 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -15,7 +15,6 @@
<string name="creation_dialog_text">在嘗試新增密碼或任何同步操作之前請在下方 clone 或新增一個新的 Repo</string>
<string name="delete">刪除</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">未選擇提供 OpenPGP 的 app</string>
<string name="clipboard_password_toast_text">密碼已複製到剪貼簿, 你有 %d 秒的時間將其貼上到其他地方.</string>
<string name="file_toast_text">請填寫文件名稱</string>
<string name="empty_toast_text">不能使用空白密碼或者空白的備註</string>
@@ -61,9 +60,6 @@
<string name="pref_ssh_see_key_title">顯示生成的 SSH 公鑰</string>
<string name="pref_git_delete_repo">刪除 Repo</string>
<string name="pref_dialog_delete_title">清空 Repo</string>
- <string name="pref_crypto_title">加密</string>
- <string name="pref_provider_title">選擇 OpenPGP app</string>
- <string name="pref_key_title">選擇 OpenPGP Key Id</string>
<string name="pref_category_general_title">一般</string>
<string name="pref_copy_title">自動複製密碼</string>
<string name="pref_copy_dialog_title">解密成功後自動將密碼複製到剪貼簿</string>
@@ -114,7 +110,6 @@
<string name="refresh_list">重新整理</string>
<string name="no_repo_selected">未選擇外部 Repo</string>
<string name="send_plaintext_password_to">將密碼以純文字傳送…</string>
- <string name="show_password">顯示密碼</string>
<!-- Autofill -->
<string name="autofill_description">在app中自動填入密碼. 此功能只能在 Andorid 4.3 及以上版本中使用. 在 Andorid 5.0 及以上版本中不需要剪貼簿</string>
<string name="autofill_apps_default">使用預設值</string>
@@ -123,5 +118,4 @@
<string name="autofill_apps_match">自動填入</string>
<string name="autofill_apps_never">手動</string>
<string name="autofill_apps_delete">刪除</string>
- <string name="get_last_changed_failed">Failed to get last changed date</string>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a616896f..0bf7f413 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -23,7 +23,6 @@
<!-- Password Store -->
<string name="creation_dialog_text">Please clone or create a new repository below before trying to add a password or running any synchronization operation.</string>
- <string name="key_dialog_text">A valid PGP key must be selected in Settings before initializing the repository</string>
<plurals name="delete_dialog_text">
<item quantity="one">Are you sure you want to delete the password?</item>
<item quantity="other">Are you sure you want to delete %d passwords?</item>
@@ -35,8 +34,6 @@
<string name="use">Use</string>
<string name="directory_selected_title">Directory already selected</string>
<string name="directory_selected_message">Do you want to use \"%1$s\"?</string>
- <string name="no_key_selected_dialog_title">OpenPGP key not selected</string>
- <string name="no_key_selected_dialog_text">We will redirect you to settings. Please select your OpenPGP Key.</string>
<string name="password_exists_title">Password already exists!</string>
<string name="password_exists_message">This will overwrite %1$s with %2$s.</string>
<string name="password_move_error_title">Error while moving passwords</string>
@@ -50,7 +47,6 @@
<string name="git_commit_move_multiple_text">Move multiple passwords to %1$s.</string>
<!-- PGPHandler -->
- <string name="provider_toast_text">No OpenPGP provider selected!</string>
<string name="clipboard_password_toast_text">Password copied to clipboard, you have %d seconds to paste it somewhere.</string>
<string name="clipboard_password_no_clear_toast_text">Password copied to clipboard</string>
<string name="clipboard_copied_text">Copied to clipboard</string>
@@ -117,10 +113,8 @@
<string name="username">Username:</string>
<string name="edit_password">Edit password</string>
<string name="copy_password">Copy password</string>
- <string name="copy_username">Copy username</string>
<string name="share_as_plaintext">Share as plaintext</string>
<string name="last_changed">Last changed %s</string>
- <string name="view_otp">View OTP</string>
<!-- Preferences -->
<string name="pref_repository_title">Repository</string>
@@ -131,10 +125,6 @@
<string name="pref_ssh_see_key_title">View generated public SSH key</string>
<string name="pref_git_delete_repo">Delete repository</string>
<string name="pref_dialog_delete_title">Clear repository</string>
- <string name="pref_crypto_title">Crypto</string>
- <string name="pref_provider_title">Select OpenPGP provider</string>
- <string name="pref_key_title">Select OpenPGP key ID</string>
- <string name="pref_no_key_selected">No key selected</string>
<string name="pref_category_general_title">General</string>
<string name="pref_category_title_passwords">Passwords</string>
<string name="pref_clipboard_timeout_title">Password copy timeout</string>
@@ -237,9 +227,6 @@
<string name="refresh_list">Refresh list</string>
<string name="no_repo_selected">No external repository selected</string>
<string name="send_plaintext_password_to">Send password as plaintext using…</string>
- <string name="show_password">Show password</string>
- <string name="show_extra">Show extra content</string>
- <string name="hide_extra">Hide extra content</string>
<string name="app_icon_hint">App icon</string>
<string name="folder_icon_hint">Folder icon</string>
@@ -291,7 +278,6 @@
<string name="autofill_toast_username">Select an editable field to paste the username.\nUsername is available for %d seconds.</string>
<string name="ssh_key_does_not_exist">Unable to open the ssh private key, please check that the file exists</string>
<string name="new_password_title">New password</string>
- <string name="edit_password_title">Editing</string>
<string name="autofill_ins_1_hint">Screenshot of accessibility services</string>
<string name="autofill_ins_2_hint">Screenshot of toggle in accessibility services</string>
<string name="autofill_ins_3_hint">Screenshot of autofill service in action</string>
@@ -307,7 +293,6 @@
<string name="abort_rebase">Abort rebase and push new branch</string>
<string name="reset_to_remote">Hard reset to remote branch</string>
<string name="commit_hash">Commit hash</string>
- <string name="get_last_changed_failed">Failed to get last changed date</string>
<string name="openkeychain_ssh_api_connect_fail">Failed to connect to OpenKeychain SSH API service.</string>
<string name="no_ssh_api_provider">No SSH API provider found. Is OpenKeychain installed?</string>
<string name="ssh_api_pending_intent_failed">SSH API pending intent failed</string>
@@ -349,15 +334,12 @@
<string name="connection_mode_ssh_key">SSH key</string>
<string name="connection_mode_basic_authentication">Password</string>
<string name="connection_mode_openkeychain" translatable="false">OpenKeychain</string>
- <string name="connection_mode_none">None</string>
<string name="git_server_config_save_success">Successfully saved configuration</string>
<string name="git_server_config_save_error_prefix">Configuration error: %s</string>
<string name="git_config_error_hostname_empty">empty hostname</string>
<string name="git_config_error_generic">please verify your settings and try again</string>
<string name="git_config_error_nonnumeric_port">port must be numeric</string>
<string name="git_config_error_custom_port_absolute">path must be absolute (start with \'/\') when using a custom port</string>
- <string name="git_operation_unable_to_open_ssh_key_title">Unable to open the ssh-key</string>
- <string name="git_operation_unable_to_open_ssh_key_message">Please check that it was imported.</string>
<string name="git_operation_wrong_passphrase">Wrong passphrase</string>
<string name="git_operation_wrong_password">Wrong password</string>
<string name="bottom_sheet_create_new_folder">Create new folder</string>
@@ -390,6 +372,8 @@
<string name="otp_import_failure">Failed to import TOTP configuration</string>
<string name="oreo_autofill_chrome_compat_fix_preference_title">Improve reliability in Chrome</string>
<string name="exporting_passwords">Exporting passwords…</string>
+ <string name="failed_to_find_key_id">Failed to locate .gpg-id, is your store set up correctly?</string>
+ <string name="invalid_gpg_id">Found .gpg-id, but it did not contain a key ID, fingerprint or user ID</string>
<string name="invalid_filename_text">File name must not contain \'/\', set directory above</string>
<string name="directory_hint">Directory</string>
</resources>
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index 3c39bfad..318b8431 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -78,15 +78,6 @@
app:title="@string/pref_select_external_repository" />
</PreferenceCategory>
- <PreferenceCategory app:title="@string/pref_crypto_title">
- <me.msfjarvis.openpgpktx.preference.OpenPgpAppPreference
- app:key="openpgp_provider_list"
- app:title="@string/pref_provider_title" />
- <Preference
- app:key="openpgp_key_id_pref"
- app:title="@string/pref_key_title" />
- </PreferenceCategory>
-
<PreferenceCategory app:title="@string/password_generator_category_title">
<ListPreference
app:defaultValue="classic"