mirror of
https://github.com/status-im/keycard-connect.git
synced 2025-01-09 18:45:58 +00:00
show mnemonics
This commit is contained in:
parent
2845545845
commit
eabb16ecc5
@ -17,7 +17,8 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".ui.LoadKeyActivity"></activity>
|
||||
<activity android:name=".ui.ShowMnemonicActivity" />
|
||||
<activity android:name=".ui.LoadKeyActivity" />
|
||||
<activity android:name=".ui.SignTransactionActivity" />
|
||||
<activity android:name=".ui.SignMessageActivity" />
|
||||
<activity android:name=".ui.PUKActivity" />
|
||||
|
@ -6,6 +6,7 @@ import im.status.keycard.applet.KeycardCommandSet
|
||||
import im.status.keycard.applet.Mnemonic
|
||||
import im.status.keycard.connect.data.*
|
||||
import im.status.keycard.connect.ui.LoadKeyActivity
|
||||
import im.status.keycard.connect.ui.ShowMnemonicActivity
|
||||
import java.io.IOException
|
||||
import java.lang.Exception
|
||||
|
||||
@ -17,8 +18,9 @@ class LoadKeyCommand(private var loadType: Int = LOAD_NONE, private var mnemonic
|
||||
}
|
||||
|
||||
private fun showMnemonic(activity: Activity, m: Mnemonic) {
|
||||
//TODO: implement show mnemonic screen
|
||||
println(m.toMnemonicPhrase())
|
||||
val intent = Intent(activity, ShowMnemonicActivity::class.java)
|
||||
intent.putExtra(MNEMONIC_PHRASE, m.words)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
|
||||
private fun generateKey(cmdSet: KeycardCommandSet): CardCommand.Result {
|
||||
|
@ -25,6 +25,7 @@ const val LOAD_GENERATE_BIP39 = 1
|
||||
const val LOAD_GENERATE = 2
|
||||
const val LOAD_MNEMONIC = "loadKeyMnemonic"
|
||||
|
||||
const val MNEMONIC_PHRASE = "mnemonicPhrase"
|
||||
|
||||
const val REQ_INTERACTIVE_SCRIPT = 0x01
|
||||
const val REQ_WALLETCONNECT = 0x02
|
||||
|
@ -0,0 +1,23 @@
|
||||
package im.status.keycard.connect.ui
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import im.status.keycard.connect.R
|
||||
import im.status.keycard.connect.data.MNEMONIC_PHRASE
|
||||
|
||||
class ShowMnemonicActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_show_mnemonic)
|
||||
|
||||
val mnemonic = intent.getStringArrayExtra(MNEMONIC_PHRASE)
|
||||
val mnemonicView = findViewById<TextView>(R.id.mnemonicView)
|
||||
mnemonicView.text = mnemonic?.joinToString()
|
||||
}
|
||||
|
||||
fun ok(@Suppress("UNUSED_PARAMETER") view: View) {
|
||||
finish()
|
||||
}
|
||||
}
|
43
app/src/main/res/layout/activity_show_mnemonic.xml
Normal file
43
app/src/main/res/layout/activity_show_mnemonic.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.ShowMnemonicActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mnemonicLabel"
|
||||
android:layout_width="358dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:text="@string/mnemonic_label"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.493"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/okButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="108dp"
|
||||
android:onClick="ok"
|
||||
android:text="@string/mnemonic_ok_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.496"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mnemonicView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mnemonicView"
|
||||
android:layout_width="359dp"
|
||||
android:layout_height="272dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mnemonicLabel"
|
||||
tools:text="initial require hint finger typical weapon giant produce select viable hybrid ostrich" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -7,7 +7,6 @@
|
||||
<string name="pin_label">PIN</string>
|
||||
<string name="puk_label">PUK</string>
|
||||
<string name="pairing_label">Pairing password</string>
|
||||
<string name="title_activity_change_pin">ChangePINActivity</string>
|
||||
<string name="change_pin_prompt">New PIN</string>
|
||||
<string name="change_pin">Change PIN</string>
|
||||
<string name="puk_prompt">Insert your PUK</string>
|
||||
@ -19,9 +18,11 @@
|
||||
<string name="sign_tx_label">Sign transaction</string>
|
||||
<string name="sign_tx_to_label">To</string>
|
||||
<string name="load_key_generate_oncard">Generate on card</string>
|
||||
<string name="load_generate_on_card_label" >Generate keys on card without BIP39 mnemonic. Maximum security, but no backup possible.</string>
|
||||
<string name="load_import_mnemonic" >Import Mnemonic</string>
|
||||
<string name="load_generate_on_card_label">Generate keys on card without BIP39 mnemonic. Maximum security, but no backup possible.</string>
|
||||
<string name="load_import_mnemonic">Import Mnemonic</string>
|
||||
<string name="load_import_mnemonic_label">Import BIP39 Mnemonic</string>
|
||||
<string name="load_generate_mnemonic" >Generate BIP39 Mnemonic</string>
|
||||
<string name="load_generate_mnemonic">Generate BIP39 Mnemonic</string>
|
||||
<string name="load_generate_mnemonic_label">Generate and load BIP39 mnemonic. You will be shown the mnemonic after it is loaded</string>
|
||||
<string name="mnemonic_ok_button">I have wrote these words down</string>
|
||||
<string name="mnemonic_label">Please write these words down. They won\'t be presented again and there is no way to recover them.</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user