mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Catch key pair restoration errors
This commit is contained in:
parent
fcb5cbb74d
commit
8caaee7b43
@ -129,9 +129,14 @@ class KeyPairActivity : BaseActionBarActivity() {
|
||||
Mode.Register -> keyPair = this.keyPair!!
|
||||
Mode.Restore -> {
|
||||
val mnemonic = mnemonicEditText.text.toString()
|
||||
val hexEncodedPrivateKey = MnemonicCodec(languageFileDirectory).decode(mnemonic)
|
||||
IdentityKeyUtil.generateIdentityKeyPair(this, hexEncodedPrivateKey)
|
||||
keyPair = IdentityKeyUtil.getIdentityKeyPair(this)
|
||||
try {
|
||||
val hexEncodedPrivateKey = MnemonicCodec(languageFileDirectory).decode(mnemonic)
|
||||
IdentityKeyUtil.generateIdentityKeyPair(this, hexEncodedPrivateKey)
|
||||
keyPair = IdentityKeyUtil.getIdentityKeyPair(this)
|
||||
} catch (e: Exception) {
|
||||
val message = if (e is MnemonicCodec.DecodingError) e.description else MnemonicCodec.DecodingError.Generic.description
|
||||
return Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
val publicKey = keyPair.publicKey
|
||||
|
Loading…
Reference in New Issue
Block a user