remove calls to deprecated methods, optimize imports

This commit is contained in:
Michele Balistreri 2020-10-12 13:18:03 +02:00 committed by Ksenia Balistreri
parent feb533c549
commit 2de8b5caf2
23 changed files with 45 additions and 36 deletions

View File

@ -6,8 +6,11 @@ import android.nfc.NfcAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import im.status.keycard.android.NFCCardManager
import im.status.keycard.connect.card.*
import im.status.keycard.connect.data.*
import im.status.keycard.connect.card.CardScriptExecutor
import im.status.keycard.connect.card.ScriptListener
import im.status.keycard.connect.data.PINCache
import im.status.keycard.connect.data.PairingManager
import im.status.keycard.connect.data.SettingsManager
import im.status.keycard.connect.net.EthereumRPC
import im.status.keycard.connect.net.WalletConnect

View File

@ -3,7 +3,10 @@ package im.status.keycard.connect.card
import android.app.Activity
import android.content.Intent
import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.*
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
import im.status.keycard.connect.data.INIT_ACTIVITY_PUK
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.InitActivity
import im.status.keycard.io.APDUException
import java.io.IOException

View File

@ -7,8 +7,6 @@ import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.PairingActivity
import im.status.keycard.io.APDUException
import java.io.IOException
class OpenSecureChannelCommand : CardCommand {
private var pairingPassword: String? = null

View File

@ -1,7 +1,6 @@
package im.status.keycard.connect.card
import java.io.IOException
import java.lang.Exception
fun scriptWithSecureChannel(): List<CardCommand> = listOf(SelectCommand(), InitCommand(), OpenSecureChannelCommand())
fun scriptWithAuthentication(): List<CardCommand> = scriptWithSecureChannel().plus(VerifyPINCommand())

View File

@ -3,7 +3,10 @@ package im.status.keycard.connect.card
import android.app.Activity
import android.content.Intent
import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.*
import im.status.keycard.connect.data.PIN_ACTIVITY_ATTEMPTS
import im.status.keycard.connect.data.PIN_ACTIVITY_CARD_UID
import im.status.keycard.connect.data.PUK_ACTIVITY_ATTEMPTS
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.PINActivity
import im.status.keycard.connect.ui.PUKActivity
import im.status.keycard.io.APDUException

View File

@ -3,7 +3,6 @@ package im.status.keycard.connect.data
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.TimeUnit
import kotlin.collections.HashMap
class PINCache {
//TODO: don't use Strings, the memory should be cleared before release. For this the entire

View File

@ -5,9 +5,9 @@ import android.content.SharedPreferences
import android.util.Base64
import android.util.Base64.NO_PADDING
import android.util.Base64.NO_WRAP
import im.status.keycard.applet.Pairing
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKeys
import androidx.security.crypto.MasterKey
import im.status.keycard.applet.Pairing
class PairingManager(context: Context) {
private val sharedPreferences: SharedPreferences
@ -17,8 +17,8 @@ class PairingManager(context: Context) {
}
init {
val masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC)
sharedPreferences = EncryptedSharedPreferences.create("pairings", masterKeyAlias, context, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM)
val masterKey = MasterKey.Builder(context).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
sharedPreferences = EncryptedSharedPreferences.create(context,"pairings", masterKey, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM)
}
fun getPairing(instanceUID: ByteArray): Pairing? {

View File

@ -6,7 +6,6 @@ import com.squareup.moshi.Types
import okhttp3.OkHttpClient
import okhttp3.Request
import org.kethereum.rpc.HttpEthereumRPC
import java.lang.Exception
import java.lang.reflect.Type
import java.math.BigInteger

View File

@ -24,7 +24,10 @@ import org.kethereum.extensions.transactions.getTokenTransferTo
import org.kethereum.extensions.transactions.getTokenTransferValue
import org.kethereum.extensions.transactions.isTokenTransfer
import org.kethereum.keccakshortcut.keccak
import org.kethereum.model.*
import org.kethereum.model.Address
import org.kethereum.model.SignatureData
import org.kethereum.model.SignedTransaction
import org.kethereum.model.Transaction
import org.komputing.khex.encode
import org.komputing.khex.extensions.hexToByteArray
import org.komputing.khex.extensions.toHexString
@ -32,9 +35,11 @@ import org.komputing.khex.extensions.toNoPrefixHexString
import org.komputing.khex.model.HexString
import org.walletconnect.Session
import org.walletconnect.Session.Config.Companion.fromWCUri
import org.walletconnect.impls.*
import org.walletconnect.impls.FileWCSessionStore
import org.walletconnect.impls.MoshiPayloadAdapter
import org.walletconnect.impls.OkHttpTransport
import org.walletconnect.impls.WCSession
import java.io.File
import java.lang.Exception
class WalletConnect(var bip32Path: String, var chainID: Long) : ExportKeyCommand.Listener, SignCommand.Listener, Session.Callback {

View File

@ -1,9 +1,9 @@
package im.status.keycard.connect.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ChangePINCommand

View File

@ -1,9 +1,9 @@
package im.status.keycard.connect.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ChangePUKCommand

View File

@ -1,9 +1,9 @@
package im.status.keycard.connect.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ChangePairingPasswordCommand

View File

@ -2,18 +2,18 @@ package im.status.keycard.connect.ui
import android.app.Activity
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Base64
import android.view.View
import im.status.keycard.globalplatform.Crypto
import android.util.Base64.NO_PADDING
import android.util.Base64.NO_WRAP
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
import im.status.keycard.connect.data.INIT_ACTIVITY_PUK
import im.status.keycard.globalplatform.Crypto
class InitActivity : AppCompatActivity() {
private lateinit var pin: String

View File

@ -2,10 +2,10 @@ package im.status.keycard.connect.ui
import android.app.Activity
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.*
import java.util.*

View File

@ -1,20 +1,20 @@
package im.status.keycard.connect.ui
import android.app.Activity
import android.content.Intent
import android.nfc.NfcAdapter
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.widget.ViewSwitcher
import androidx.appcompat.app.AppCompatActivity
import com.google.zxing.client.android.Intents
import com.google.zxing.integration.android.IntentIntegrator
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.*
import kotlin.reflect.KClass
import com.google.zxing.client.android.Intents
import im.status.keycard.connect.data.*
import kotlin.reflect.KClass
class MainActivity : AppCompatActivity(), ScriptListener {
private lateinit var viewSwitcher: ViewSwitcher

View File

@ -1,11 +1,11 @@
package im.status.keycard.connect.ui
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.PIN_ACTIVITY_ATTEMPTS

View File

@ -1,11 +1,11 @@
package im.status.keycard.connect.ui
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.PUK_ACTIVITY_ATTEMPTS

View File

@ -1,11 +1,11 @@
package im.status.keycard.connect.ui
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.EditText
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD

View File

@ -1,10 +1,10 @@
package im.status.keycard.connect.ui
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.CheckBox
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ReinstallCommand

View File

@ -1,11 +1,11 @@
package im.status.keycard.connect.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.ArrayAdapter
import android.widget.EditText
import android.widget.Spinner
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.CHAIN_IDS

View File

@ -1,9 +1,9 @@
package im.status.keycard.connect.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.MNEMONIC_PHRASE

View File

@ -1,10 +1,10 @@
package im.status.keycard.connect.ui
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.SIGN_TEXT_MESSAGE

View File

@ -1,10 +1,10 @@
package im.status.keycard.connect.ui
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.SIGN_TX_AMOUNT
import im.status.keycard.connect.data.SIGN_TX_CURRENCY