mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 11:12:40 +00:00
Catch key pair restoration errors
This commit is contained in:
@@ -129,9 +129,14 @@ class KeyPairActivity : BaseActionBarActivity() {
|
|||||||
Mode.Register -> keyPair = this.keyPair!!
|
Mode.Register -> keyPair = this.keyPair!!
|
||||||
Mode.Restore -> {
|
Mode.Restore -> {
|
||||||
val mnemonic = mnemonicEditText.text.toString()
|
val mnemonic = mnemonicEditText.text.toString()
|
||||||
val hexEncodedPrivateKey = MnemonicCodec(languageFileDirectory).decode(mnemonic)
|
try {
|
||||||
IdentityKeyUtil.generateIdentityKeyPair(this, hexEncodedPrivateKey)
|
val hexEncodedPrivateKey = MnemonicCodec(languageFileDirectory).decode(mnemonic)
|
||||||
keyPair = IdentityKeyUtil.getIdentityKeyPair(this)
|
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
|
val publicKey = keyPair.publicKey
|
||||||
|
|||||||
Reference in New Issue
Block a user