Update to openpgp-ktx 1.0.0 (#585)
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
parent
fdbbb467b2
commit
0a01911d87
3 changed files with 173 additions and 164 deletions
|
@ -567,12 +567,12 @@ class AutofillService : AccessibilityService() {
|
|||
}
|
||||
|
||||
private inner class OnBoundListener : OpenPgpServiceConnection.OnBound {
|
||||
override fun onBound(service: IOpenPgpService2?) {
|
||||
override fun onBound(service: IOpenPgpService2) {
|
||||
decryptAndVerify()
|
||||
}
|
||||
|
||||
override fun onError(e: Exception?) {
|
||||
e?.printStackTrace()
|
||||
override fun onError(e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@ import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_category
|
|||
import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_edit
|
||||
import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_file_edit
|
||||
import kotlinx.android.synthetic.main.encrypt_layout.generate_password
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import me.msfjarvis.openpgpktx.OpenPgpError
|
||||
import me.msfjarvis.openpgpktx.util.OpenPgpApi
|
||||
import me.msfjarvis.openpgpktx.util.OpenPgpApi.Companion.ACTION_DECRYPT_VERIFY
|
||||
|
@ -243,6 +246,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
val iStream = FileUtils.openInputStream(File(fullPath))
|
||||
val oStream = ByteArrayOutputStream()
|
||||
|
||||
GlobalScope.launch(IO) {
|
||||
api?.executeApiAsync(data, iStream, oStream, object : OpenPgpApi.IOpenPgpCallback {
|
||||
override fun onReturn(result: Intent?) {
|
||||
when (result?.getIntExtra(RESULT_CODE, RESULT_CODE_ERROR)) {
|
||||
|
@ -413,6 +417,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypts the password and the extra content
|
||||
|
@ -453,6 +458,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
|
||||
val path = if (intent.getBooleanExtra("fromDecrypt", false)) fullPath else "$fullPath/$editName.gpg"
|
||||
|
||||
GlobalScope.launch(IO) {
|
||||
api?.executeApiAsync(data, iStream, oStream, object : OpenPgpApi.IOpenPgpCallback {
|
||||
override fun onReturn(result: Intent?) {
|
||||
when (result?.getIntExtra(RESULT_CODE, RESULT_CODE_ERROR)) {
|
||||
|
@ -484,6 +490,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens EncryptActivity with the information for this file to be edited
|
||||
|
@ -559,6 +566,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
private fun getKeyIds(receivedIntent: Intent? = null) {
|
||||
val data = receivedIntent ?: Intent()
|
||||
data.action = OpenPgpApi.ACTION_GET_KEY_IDS
|
||||
GlobalScope.launch(IO) {
|
||||
api?.executeApiAsync(data, null, null, object : OpenPgpApi.IOpenPgpCallback {
|
||||
override fun onReturn(result: Intent?) {
|
||||
when (result?.getIntExtra(RESULT_CODE, RESULT_CODE_ERROR)) {
|
||||
|
@ -585,13 +593,14 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Exception?) {}
|
||||
override fun onError(e: Exception) {}
|
||||
|
||||
/**
|
||||
* The action to take when the PGP service is bound
|
||||
*/
|
||||
override fun onBound(service: IOpenPgpService2?) {
|
||||
override fun onBound(service: IOpenPgpService2) {
|
||||
initOpenPgpApi()
|
||||
when (operation) {
|
||||
"EDIT", "DECRYPT" -> decryptAndVerify()
|
||||
|
|
|
@ -40,7 +40,7 @@ ext.deps = [
|
|||
commons_codec: 'commons-codec:commons-codec:1.13',
|
||||
jsch: 'com.jcraft:jsch:0.1.55',
|
||||
jgit: 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r',
|
||||
openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:0.1.0',
|
||||
openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:1.0.0',
|
||||
ssh_auth: 'org.sufficientlysecure:sshauthentication-api:1.0'
|
||||
],
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue