@@ -10,10 +10,9 @@ import android.os.Bundle
10
10
import android.view.Menu
11
11
import android.view.MenuItem
12
12
import androidx.lifecycle.lifecycleScope
13
- import com.proton.Gopenpgp.crypto.Crypto
14
- import com.proton.Gopenpgp.helper.Helper
15
13
import dagger.hilt.android.AndroidEntryPoint
16
14
import dev.msfjarvis.aps.R
15
+ import dev.msfjarvis.aps.data.crypto.GopenpgpCryptoHandler
17
16
import dev.msfjarvis.aps.data.passfile.PasswordEntry
18
17
import dev.msfjarvis.aps.data.password.FieldItem
19
18
import dev.msfjarvis.aps.databinding.DecryptLayoutBinding
@@ -36,6 +35,7 @@ class GopenpgpDecryptActivity : BasePgpActivity() {
36
35
37
36
private val binding by viewBinding(DecryptLayoutBinding ::inflate)
38
37
@Inject lateinit var passwordEntryFactory: PasswordEntryFactory
38
+ @Inject lateinit var gopenpgpCrypto: GopenpgpCryptoHandler
39
39
private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) }
40
40
41
41
private var passwordEntry: PasswordEntry ? = null
@@ -125,13 +125,13 @@ class GopenpgpDecryptActivity : BasePgpActivity() {
125
125
private fun decrypt () =
126
126
lifecycleScope.launch {
127
127
// TODO(msfjarvis): native methods are fallible, add error handling once out of testing
128
- val message = withContext(Dispatchers .IO ) { Crypto .newPGPMessage( File (fullPath).readBytes() ) }
128
+ val message = withContext(Dispatchers .IO ) { File (fullPath).readBytes() }
129
129
val result =
130
130
withContext(Dispatchers .IO ) {
131
- Helper .decryptBinaryMessageArmored (
131
+ gopenpgpCrypto.decrypt (
132
132
PRIV_KEY ,
133
133
PASS .toByteArray(charset = Charsets .UTF_8 ),
134
- message.armored ,
134
+ message,
135
135
)
136
136
}
137
137
startAutoDismissTimer()
0 commit comments