Updated on 2026-08-14

This commit is contained in:
Tangem 2021-10-24 18:06:07 +03:00
parent 7b456a1d08
commit 167dae1f75
4 changed files with 6 additions and 15 deletions

@ -1 +1 @@
Subproject commit e80938f7d9ba378a91ac544a9170597e64afa696
Subproject commit 0cf3af21e6f441e6323a1ba127ee7518168797df

View file

@ -1,6 +1,8 @@
package com.tangem.tap.domain.tasks
import com.tangem.*
import com.tangem.blockchain.common.BlockchainSdkConfig
import com.tangem.blockchain.common.WalletManagerFactory
import com.tangem.common.CompletionResult
import com.tangem.common.card.Card
import com.tangem.common.card.FirmwareVersion
@ -18,6 +20,7 @@ import com.tangem.tap.domain.extensions.getSingleWallet
import com.tangem.tap.domain.tasks.product.ScanResponse
import com.tangem.tap.domain.twins.TwinCardsManager
import com.tangem.tap.domain.twins.isTangemTwin
import com.tangem.tap.store
class ScanNoteTask(val card: Card? = null) : CardSessionRunnable<ScanResponse> {
@ -118,7 +121,6 @@ class ScanNoteTask(val card: Card? = null) : CardSessionRunnable<ScanResponse> {
private fun getErrorIfExcludedCard(card: Card): TangemError? {
if (card.isExcluded()) return TapSdkError.CardForDifferentApp
// Disable new cards on the old version of the app // TODO: remove when cards are supported
if (card.isMultiCurrencyWallet() || card.isNote()) return UpdateAppToUseThisCard()
// Disable new multi-currency HD wallet cards on the old version of the app
// if (card.isMultiCurrencyWallet()) return UpdateAppToUseThisCard()
return null

View file

@ -65,9 +65,7 @@ class TwinCardsManager(private val scanResponse: ScanResponse, context: Context)
preparingMessage = preparingMessage,
creatingWalletMessage = creatingWalletMessage
)
val response = tangemSdkManager.runTaskAsync(
task, null, initialMessage
)
val response = tangemSdkManager.runTaskAsync(task, null, initialMessage)
when (response) {
is CompletionResult.Success -> {
secondCardPublicKey = response.data.wallet.publicKey.toHexString()
@ -116,14 +114,6 @@ class TwinCardsManager(private val scanResponse: ScanResponse, context: Context)
return CryptoUtils.verify(cardWalletPublicKey, publicKey, signedKey)
}
fun verifyTwinPublicKey(issuerData: ByteArray, cardWalletPublicKey: ByteArray?): Boolean {
if (issuerData.size < 65) return false
val publicKey = issuerData.sliceArray(0 until 65)
val signedKey = issuerData.sliceArray(65 until issuerData.size)
return (cardWalletPublicKey != null &&
CryptoUtils.verify(cardWalletPublicKey, publicKey, signedKey))
}
private fun getIssuerKeys(context: Context, publicKey: String): KeyPair {
val issuer = getIssuers(context).first { it.publicKey == publicKey }
return KeyPair(

View file

@ -191,10 +191,9 @@ private fun prepareAllowedSecurityOptions(
): EnumSet<SecurityOption> {
val prohibitDefaultPin = card?.settings?.isResettingUserCodesAllowed != true
val prohibitDefaultPin = card?.settings?.isRemovingAccessCodeAllowed != true
val allowedSecurityOptions = EnumSet.noneOf(SecurityOption::class.java)
if (card?.isTwinCard() == true) {
if (card?.isTangemTwin() == true) {
allowedSecurityOptions.add(SecurityOption.PassCode)
}
if ((currentSecurityOption == SecurityOption.LongTap) || !prohibitDefaultPin) {