From 926c92f700f5f7aa2d470892db3e72646390ad8a Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 1 Apr 2020 12:10:54 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tangemtest/ucase/ui/ParamsViewModel.kt | 2 +- .../ui/widgets/impl/item/DescriptionWidget.kt | 7 +- .../src/main/res/layout/vh_actions.xml | 2 + .../main/res/layout/w_field_description.xml | 2 +- tangem-demo/src/main/res/values/colors.xml | 3 + .../src/main/res/values/strings_action.xml | 13 +- .../res/values/strings_personalization.xml | 160 ++++++++++-------- .../src/main/res/values/strings_tlv.xml | 9 +- 8 files changed, 114 insertions(+), 84 deletions(-) diff --git a/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/ui/ParamsViewModel.kt b/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/ui/ParamsViewModel.kt index 3de5fece3d..b1ae11b280 100644 --- a/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/ui/ParamsViewModel.kt +++ b/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/ui/ParamsViewModel.kt @@ -120,7 +120,7 @@ internal class Notifier(private val vm: ParamsViewModel) { when (taskEvent.error) { is TaskError.UserCancelled -> { if (notShowedError == null) { - vm.seError.postValue("User was cancelled") + vm.seError.postValue("User canceled the action") } else { vm.seError.postValue("${notShowedError!!::class.simpleName}") notShowedError = null diff --git a/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/variants/personalize/ui/widgets/impl/item/DescriptionWidget.kt b/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/variants/personalize/ui/widgets/impl/item/DescriptionWidget.kt index c6ded4ac0d..c50a5e91dd 100644 --- a/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/variants/personalize/ui/widgets/impl/item/DescriptionWidget.kt +++ b/tangem-demo/src/main/java/com/tangem/tangemtest/ucase/variants/personalize/ui/widgets/impl/item/DescriptionWidget.kt @@ -27,11 +27,16 @@ abstract class DescriptionWidget( } private fun initDescriptionWidget() { - getResDescription()?.let { tvDescription?.setText(it) } dataItem.viewModel.viewState.onDescriptionVisibilityChanged = { changeDescriptionVisibility(it) } } protected fun changeDescriptionVisibility(state: Int) { + val tv = tvDescription ?: return + val descriptionId = getResDescription() ?: return + val description = tv.context.getString(descriptionId) + if (description.isEmpty()) return + + tv.text = description TransitionManager.beginDelayedTransition(view.parent as ViewGroup, AutoTransition()) descriptionContainer.visibility = state } diff --git a/tangem-demo/src/main/res/layout/vh_actions.xml b/tangem-demo/src/main/res/layout/vh_actions.xml index 00b4c79e44..a6081ea0a7 100644 --- a/tangem-demo/src/main/res/layout/vh_actions.xml +++ b/tangem-demo/src/main/res/layout/vh_actions.xml @@ -17,6 +17,8 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + android:textSize="18sp" + android:textColor="@color/action_name" tools:text="Action method" /> + android:textColor="@color/field_description" /> \ No newline at end of file diff --git a/tangem-demo/src/main/res/values/colors.xml b/tangem-demo/src/main/res/values/colors.xml index a2934770dc..085eae29c4 100644 --- a/tangem-demo/src/main/res/values/colors.xml +++ b/tangem-demo/src/main/res/values/colors.xml @@ -6,6 +6,9 @@ #26000000 + #2B2B2B + #888888 + #C6C6C6 #FFE391 #FFFFFF diff --git a/tangem-demo/src/main/res/values/strings_action.xml b/tangem-demo/src/main/res/values/strings_action.xml index 9854798730..ed962e51fb 100644 --- a/tangem-demo/src/main/res/values/strings_action.xml +++ b/tangem-demo/src/main/res/values/strings_action.xml @@ -1,7 +1,7 @@ - Scan + Read Card Sign Personalize Depersonalize @@ -13,11 +13,12 @@ Write issuer extra data Read user data Write user data - - SomeDescription - SomeDescription - SomeDescription - SomeDescription + ​ + This command returns all data about the card and the wallet, including unique card number (CID) that has to be submitted while calling all other commands + Depending on Signing_Method parameter defined during personalization, this command signs data using Wallet_PrivateKey + Personalization is an initialization procedure, required before start using a card. During this procedure all card setting are performed. During this procedure all data exchange are encrypted because it\'s usually done at the third-party factory. + This command reset card to initial state - erase all data, writed during previous personalization and previous usage. + \nCommand available on SDK cards only SomeDescription SomeDescription SomeDescription diff --git a/tangem-demo/src/main/res/values/strings_personalization.xml b/tangem-demo/src/main/res/values/strings_personalization.xml index 07d531ca90..365ba71b3b 100644 --- a/tangem-demo/src/main/res/values/strings_personalization.xml +++ b/tangem-demo/src/main/res/values/strings_personalization.xml @@ -1,6 +1,8 @@ + Personalize + Depersonalize Card number Common Signing method @@ -12,7 +14,7 @@ Settings mask protocol encryption Settings mask ndef Pins - + ​ Series Number Curve @@ -46,7 +48,7 @@ Forbid purge Allow select blockchain Use block - One APDU at once + One session – one command Use CVC Allow swap PIN Allow swap PIN2 @@ -69,74 +71,90 @@ PIN3 CVC Pause before PIN2 - - Description for the field: Card number - Description for the field: Common - Description for the field: Signing method - Description for the field: Sign hash external properties - Description for the field: Denomination - Description for the field: Token - Description for the field: Product mask - Description for the field: Settings mask - Description for the field: Settings mask protocol encryption - Description for the field: Settings mask ndef - Description for the field: Pins - - Description for the field: Series - Description for the field: Number - Description for the field: Curve - Description for the field: Blockchain - Description for the field: Custom blockchain - Description for the field: Max signatures - Description for the field: Create wallet - Description for the field: Sign TX hashes (0) - Description for the field: Sign raw TX (1) - Description for the field: Sign validated TX hashes (2) - Description for the field: Sign validated raw TX (3) - Description for the field: Sign validated TX hashes with issuer data (4) - Description for the field: Sign validated raw TX with issuer data (5) - Description for the field: Sign hash external (6) - Description for the field: Pin-less floor limit - Description for the field: Cr(ypto)Ex(tract) key - Description for the field: Require terminal Cert signature - Description for the field: Require terminal TX signature - Description for the field: Check PIN3 on card - Description for the field: Write on personalize - Description for the field: Denomination - Description for the field: It\'s token - Description for the field: Symbol - Description for the field: Contract address - Description for the field: Decimal - Description for the field: Note - Description for the field: Tag - Description for the field: ID card - Description for the field: Is reusable - Description for the field: Need activation - Description for the field: Forbid purge - Description for the field: Allow select blockchain - Description for the field: Use block - Description for the field: One APDU at once - Description for the field: Use CVC - Description for the field: Allow swap PIN - Description for the field: Allow swap PIN2 - Description for the field: Forbid default PIN - Description for the field: Smart Security Delay - Description for the field: Protect issuer data against replay - Description for the field: Security delay if validated - Description for the field: Skip PIN2 and CVC if validated - Description for the field: Skip security delay on linked terminal - Description for the field: Restrict overwrite extra issuer data - Description for the field: Allow unencrypted - Description for the field: Allow \'FAST\' encryption - Description for the field: Use NDEF - Description for the field: Dynamic NDEF - Description for the field: Disable precomputed NDEF - Description for the field: AAR - Description for the field: Custom AAR package name - Description for the field: PIN - Description for the field: PIN2 - Description for the field: PIN3 - Description for the field: CVC - Description for the field: Pause before PIN2 + ​ + Unique Tangem card ID number. It will be generated automatically with Series and Number. + + Depending on these parameters, SIGN command signs following data using Wallet_PrivateKey: array of transaction hashes, single raw transaction. In case the card issuer supports 2FA, the card will firstly verify issuer’s signature of transaction hash before signing transaction hash using Wallet_PrivateKey. In case the card issuer requires the card to store additional data (e.g. wallet balance, SPV proof, timestamps, etc. – see details in Security section), COS will verify issuer’s signature of hash of concatenated transaction hashes and Issuer_Data hash, and issuer’s signature of Issuer_Data hash, and then proceed to signing transaction hash using Wallet_PrivateKey. + + + These fields can be used by the host application to provide additional infromation about tokens stored within the wallet of the card. + These fields can be used by the host application to provide additional infromation about product type. + + Card Operation System supports three options of communication + + + ​ + + + Elliptic curve used for all wallet key operations. Supported curves: ‘secp256k1’, ‘ed25519’. + Name of the blockchain. It\'s just a textfield in the card. It\'s needed for host app to tell what blockchain should it use. + You can use this field, to create something special + Total number of signatures allowed for the wallet when the card was personalized + Off - don’t create wallet (user must be create wallet by himself with App) + \nOn - create wallet (after personalization wallet alredy will be created and card ready to use) + Allow card to sign hashed transaction + Allow card to sign raw transaction. The raw transaction will be hashed by a hash function before signing. + Allow card to sign hashed transaction, that was signed by issuer before + Allow card to sign raw transaction, that was signed by issuer before + Allow card to sign hashed transaction, that was signed by issuer before, and update issuer data at the same time + Allow card to sign raw transaction, that was signed by issuer before, and update issuer data at the same time + Allow card to sign POS transactions + + Unique card secret key (shared with acquirers server) + + + + + + + Symbol of the token + Token\'s Smart contract address + Number of decimals in token value + Self-custodial wallet or note + Anti-counterfeit tag + Personal ID card + Defines what happens when user calls PURGE_WALLET command: + \nOff - Card will switch to Purged state + \nOn - Card will switch to Empty state and let create a new wallet again + + + If this option is turned on, card will reject PURGE_WALLET command + If this option is turned on, wallet elliptic curve and blockchain information can be changed on CREATE_WALLET command + + Card will execute only one command during one communication session, thus requiring user to physically take the card away from the host after each action (all commands except for READ_CARD) + All commands requiring PIN2 will also require additional CVC code printed on the card + Is user allowed to change PIN1 with SET_PIN command + Is user allowed to change PIN2 with SET_PIN command + SET_PIN commands will not change PIN1 to default value (‘000000’) + Security delay Pause_Before_PIN2 will not be applied if PIN2 is not default + Off – No replay protection on write issuer data + \nOn – Enable replay protection on write issuer data (card will require additional Issuer_Data_Counter incremented on each write) + + Off – Enforce security delay in SIGN command if the issuer validates the transaction (for signing methods 2, 3, 4 and 5) + \nOn – Skip security delay in SIGN command if the issuer validates the transaction (for signing methods 2, 3, 4 and 5) + + Off – Require and check PIN2 and CVC in SIGN command if the issuer validates the transaction (for signing method 2, 3, 4 and 5) + \nOn – Skip checking PIN2 and CVC in SIGN command if the issuer validates the transaction (for signing method 2, 3, 4 and 5) + + App can optionally generate ECDSA key pair Terminal_PrivateKey / Terminal_PublicKey. And then submit Terminal_PublicKey to the card in any SIGN command. Once SIGN is successfully executed by COS, including PIN2 verification and/or completion of security delay, the submitted Terminal_PublicKey key is stored by COS. After that, the App instance is deemed trusted by COS and COS will allow skipping security delay for subsequent SIGN operations thus improving convenience without sacrificing security. + Prohibit overwriting Issuer_Extra_Data + Allow plain data packets with non-encrypted Payload: + \nThis option is not recommended for large-scale commercial projects, because it potentially exposes the card to eavesdropping and replay attacks. + Allow Fast symmetric encryption with mutual challenges + Whether the card should emulate NDEF. In default configuration, two NDEF records are loaded during personalization: (1) Tangem web site address, (2) name of Android App package in Google Play Store. + Tangem card supports a special wallet validation mechanism for smartphones that can only read NDEF tags + \nOff – Disable dynamic generation of NDEF for iOS + \nOn – Enable dynamic NDEF for iOS + + Off – Enable precomputed dynamic NDEF to work around iPhone 7+ NFC bug + \nOn – Disable precomputed dynamic NDEF + + Android Application Record. Android Application ID, Package name of Android apllication. Android OS will open this app or send user to Google Play page if it\'s not installed. If this field is empty, Android OS will try to open URI from URI field. + + PIN1 code to access the card. Default unhashed value: ‘000000’. + PIN2 code to confirm transaction signatures and swap PIN operations. Default unhashed value: ‘000’. + PIN3 code to confirm POS transaction with amount that exceed pin-less floor limit. + 3-digit code, that can be printed on the card + Delay in seconds before COS executes commands protected by PIN2 \ No newline at end of file diff --git a/tangem-demo/src/main/res/values/strings_tlv.xml b/tangem-demo/src/main/res/values/strings_tlv.xml index c52314beba..fe18360367 100644 --- a/tangem-demo/src/main/res/values/strings_tlv.xml +++ b/tangem-demo/src/main/res/values/strings_tlv.xml @@ -1,9 +1,10 @@ - Card Id - Transaction out hash + Card Id (CID) + Hash to sign + ​ + Unique Tangem card ID number + Hashed transaction you want to be signed - SomeTlvDescription - SomeTlvDescription \ No newline at end of file