Tlaster/KotlinPGP

Application is hung, when i using 'generateKeyPair'

Closed this issue · 2 comments

fun onGenerateBtnClick(view: View){
       if (passEdit.text.toString().trim().isNotEmpty()){
            val name = first_name + " " + last_name
            Log.i("pgp", "PROGRAM STOP HERE")
            val kp = KotlinPGP.generateKeyPair(
                GenerateKeyData(
                    name = name,
                    email = "beeruleandroid@outlook.com",
                    password = passEdit.text.toString()
                )
            )
            openPGP.setText(kp.publicKey)
            privatePGP.setText(kp.publicKey)
        } else{
            Toast.makeText(this, resources.getText(R.string.generate_empty), Toast.LENGTH_LONG).show()
        }
    }

I added your library as you wrote

KotlinPGP.generateKeyPair takes a long time and you can use kotlinx.coroutines to avoid hanging

Thanks. It working.