@@ -10,10 +10,9 @@ import android.os.Bundle
1010import android.view.Menu
1111import android.view.MenuItem
1212import androidx.lifecycle.lifecycleScope
13- import com.proton.Gopenpgp.crypto.Crypto
14- import com.proton.Gopenpgp.helper.Helper
1513import dagger.hilt.android.AndroidEntryPoint
1614import dev.msfjarvis.aps.R
15+ import dev.msfjarvis.aps.data.crypto.GopenpgpCryptoHandler
1716import dev.msfjarvis.aps.data.passfile.PasswordEntry
1817import dev.msfjarvis.aps.data.password.FieldItem
1918import dev.msfjarvis.aps.databinding.DecryptLayoutBinding
@@ -36,6 +35,7 @@ class GopenpgpDecryptActivity : BasePgpActivity() {
3635
3736 private val binding by viewBinding(DecryptLayoutBinding ::inflate)
3837 @Inject lateinit var passwordEntryFactory: PasswordEntryFactory
38+ @Inject lateinit var gopenpgpCrypto: GopenpgpCryptoHandler
3939 private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) }
4040
4141 private var passwordEntry: PasswordEntry ? = null
@@ -125,13 +125,13 @@ class GopenpgpDecryptActivity : BasePgpActivity() {
125125 private fun decrypt () =
126126 lifecycleScope.launch {
127127 // 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() }
129129 val result =
130130 withContext(Dispatchers .IO ) {
131- Helper .decryptBinaryMessageArmored (
131+ gopenpgpCrypto.decrypt (
132132 PRIV_KEY ,
133133 PASS .toByteArray(charset = Charsets .UTF_8 ),
134- message.armored ,
134+ message,
135135 )
136136 }
137137 startAutoDismissTimer()
0 commit comments