mirror of
https://github.com/status-im/keycard-connect.git
synced 2025-01-24 01:39:31 +00:00
move constants to own file
This commit is contained in:
parent
494126e985
commit
900abe0db5
@ -7,8 +7,6 @@ import im.status.keycard.io.CardChannel
|
|||||||
import im.status.keycard.io.CardListener
|
import im.status.keycard.io.CardListener
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
const val REQ_INTERACTIVE_SCRIPT = 0x01
|
|
||||||
|
|
||||||
class CardScriptExecutor(activity: Activity) : CardListener {
|
class CardScriptExecutor(activity: Activity) : CardListener {
|
||||||
class Context(val mainActivity: Activity) {
|
class Context(val mainActivity: Activity) {
|
||||||
var cardChannel: CardChannel? = null
|
var cardChannel: CardChannel? = null
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package im.status.keycard.connect.data
|
||||||
|
|
||||||
|
const val PAIRING_ACTIVITY_PASSWORD = "pairingPassword"
|
||||||
|
|
||||||
|
const val PIN_ACTIVITY_ATTEMPTS = "remainingAttempts"
|
||||||
|
const val PIN_ACTIVITY_CARD_UID = "cardUID"
|
||||||
|
|
||||||
|
const val INIT_ACTIVITY_PIN = "initPIN"
|
||||||
|
const val INIT_ACTIVITY_PUK = "initPUK"
|
||||||
|
const val INIT_ACTIVITY_PAIRING = "initPairing"
|
||||||
|
|
||||||
|
const val REQ_INTERACTIVE_SCRIPT = 0x01
|
@ -9,7 +9,6 @@ import im.status.keycard.applet.Pairing
|
|||||||
import androidx.security.crypto.EncryptedSharedPreferences
|
import androidx.security.crypto.EncryptedSharedPreferences
|
||||||
import androidx.security.crypto.MasterKeys
|
import androidx.security.crypto.MasterKeys
|
||||||
|
|
||||||
|
|
||||||
object PairingManager {
|
object PairingManager {
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
|
|
||||||
|
@ -11,11 +11,9 @@ import android.util.Base64.NO_PADDING
|
|||||||
import android.util.Base64.NO_WRAP
|
import android.util.Base64.NO_WRAP
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
|
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
|
||||||
|
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
|
||||||
const val INIT_ACTIVITY_PIN = "initPIN"
|
import im.status.keycard.connect.data.INIT_ACTIVITY_PUK
|
||||||
const val INIT_ACTIVITY_PUK = "initPUK"
|
|
||||||
const val INIT_ACTIVITY_PAIRING = "initPairing"
|
|
||||||
|
|
||||||
class InitActivity : AppCompatActivity() {
|
class InitActivity : AppCompatActivity() {
|
||||||
private lateinit var pin: String
|
private lateinit var pin: String
|
||||||
|
@ -8,6 +8,7 @@ import android.content.Intent
|
|||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.card.*
|
import im.status.keycard.connect.card.*
|
||||||
import im.status.keycard.connect.data.PairingManager
|
import im.status.keycard.connect.data.PairingManager
|
||||||
|
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private lateinit var cardManager: NFCCardManager
|
private lateinit var cardManager: NFCCardManager
|
||||||
|
@ -8,9 +8,8 @@ import android.widget.EditText
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.PINCache
|
import im.status.keycard.connect.data.PINCache
|
||||||
|
import im.status.keycard.connect.data.PIN_ACTIVITY_ATTEMPTS
|
||||||
const val PIN_ACTIVITY_ATTEMPTS = "remainingAttempts"
|
import im.status.keycard.connect.data.PIN_ACTIVITY_CARD_UID
|
||||||
const val PIN_ACTIVITY_CARD_UID = "cardUID"
|
|
||||||
|
|
||||||
class PINActivity : AppCompatActivity() {
|
class PINActivity : AppCompatActivity() {
|
||||||
private lateinit var cardUID: ByteArray
|
private lateinit var cardUID: ByteArray
|
||||||
|
@ -7,8 +7,7 @@ import android.view.View
|
|||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
|
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
|
||||||
const val PAIRING_ACTIVITY_PASSWORD = "pairingPassword"
|
|
||||||
|
|
||||||
class PairingActivity : AppCompatActivity() {
|
class PairingActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@ -19,10 +18,7 @@ class PairingActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
fun ok(view: View) {
|
fun ok(view: View) {
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.putExtra(
|
intent.putExtra(PAIRING_ACTIVITY_PASSWORD, findViewById<EditText>(R.id.passwordText).text.toString())
|
||||||
PAIRING_ACTIVITY_PASSWORD, findViewById<EditText>(
|
|
||||||
R.id.passwordText
|
|
||||||
).text.toString())
|
|
||||||
setResult(Activity.RESULT_OK, intent)
|
setResult(Activity.RESULT_OK, intent)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user