Updated on 2026-08-14

This commit is contained in:
Tangem 2019-11-18 17:28:57 +03:00
parent e8073b746a
commit 44f44669b5
3 changed files with 104 additions and 11 deletions

View file

@ -15,7 +15,7 @@ import com.tangem.tasks.TaskError
* Deserialized response from the Tangem card after [CheckWalletCommand].
*
* @property cardId Unique Tangem card ID number
* @property salt Random salt generated by the card
* @property salt Random salt generated by the card.
* @property walletSignature Challenge and salt signed with the wallet private key.
*/
class CheckWalletResponse(
@ -44,7 +44,6 @@ class CheckWalletCommand(
Tlv(TlvTag.CardId, cardId.hexToBytes()),
Tlv(TlvTag.Challenge, challenge)
)
return CommandApdu(Instruction.CheckWallet, tlvData)
}
@ -62,6 +61,4 @@ class CheckWalletCommand(
throw TaskError.SerializeCommandError()
}
}
}

View file

@ -125,27 +125,124 @@ class CardData(
* Response for [ReadCommand]. Contains detailed card information.
*/
class Card(
/**
* Unique Tangem card ID number.
*/
val cardId: String,
/**
* Name of Tangem card manufacturer.
*/
val manufacturerName: String,
/**
* Current status of the card.
*/
val status: CardStatus,
/**
* Version of Tangem COS.
*/
val firmwareVersion: String?,
/**
* Public key that is used to authenticate the card against manufacturers database.
* It is generated one time during card manufacturing.
*/
val cardPublicKey: ByteArray?,
/**
* Card settings defined by personalization (bit mask: 0 Enabled, 1 Disabled).
*/
val settingsMask: SettingsMask?,
/**
* Public key that is used by the card issuer to sign IssuerData field.
*/
val issuerPublicKey: ByteArray?,
/**
* Explicit text name of the elliptic curve used for all wallet key operations.
* Supported curves: secp256k1 and ed25519.
*/
val curve: EllipticCurve?,
/**
* Total number of signatures allowed for the wallet when the card was personalized.
*/
val maxSignatures: Int?,
/**
* Defines what data should be submitted to SIGN command.
*/
val signingMethod: SigningMethod?,
/**
* Delay in seconds before COS executes commands protected by PIN2.
*/
val pauseBeforePin2: Int?,
/**
* Public key of the blockchain wallet.
*/
val walletPublicKey: ByteArray?,
/**
* Remaining number of [SignCommand] operations before the wallet will stop signing transactions.
*/
val walletRemainingSignatures: Int?,
/**
* Total number of signed single hashes returned by the card in
* [SignCommand] responses since card personalization.
* Sums up array elements within all [SignCommand].
*/
val walletSignedHashes: Int?,
/**
* Any non-zero value indicates that the card experiences some hardware problems.
* User should withdraw the value to other blockchain wallet as soon as possible.
* Non-zero Health tag will also appear in responses of all other commands.
*/
val health: Int?,
/**
* Whether the card requires issuers confirmation of activation.
*/
val isActivated: Boolean,
/**
* A random challenge generated by personalisation that should be signed and returned
* to COS by the issuer to confirm the card has been activated.
* This field will not be returned if the card is activated.
*/
val activationSeed: ByteArray?,
/**
* Returned only if [SigningMethod.SignPos] enabling POS transactions is supported by card.
*/
val paymentFlowVersion: ByteArray?,
/**
* This value can be initialized by terminal and will be increased by COS on execution of every [SignCommand].
* For example, this field can store blockchain nonce for quick one-touch transaction on POS terminals.
* Returned only if [SigningMethod.SignPos] enabling POS transactions is supported by card.
*/
val userCounter: Int?,
/**
* When this value is true, it means that the application is linked to the card,
* and COS will not enforce security delay if [SignCommand] will be called
* with [TlvTag.TerminalTransactionSignature] parameter containing a correct signature of raw data
* to be signed made with [TlvTag.TerminalPublicKey].
*/
val terminalIsLinked: Boolean,
/**
* Detailed information about card contents. Format is defined by the card issuer.
* Cards complaint with Tangem Wallet application should have TLV format.
*/
val cardData: CardData?
) : CommandResponse

View file

@ -15,15 +15,15 @@ import com.tangem.tasks.TaskError
/**
* @param cardId CID, Unique Tangem card ID number
* @param signature Signed hashes (array of resulting signatures)
* @param remainingSignatures Remaining number of sign operations before the wallet will stop signing transactions.
* @param signedHashes Total number of signed single hashes returned by the card in sign command responses.
* @param walletRemainingSignatures Remaining number of sign operations before the wallet will stop signing transactions.
* @param walletSignedHashes Total number of signed single hashes returned by the card in sign command responses.
* Sums up array elements within all SIGN commands
*/
class SignResponse(
val cardId: String,
val signature: ByteArray,
val remainingSignatures: Int,
val signedHashes: Int
val walletRemainingSignatures: Int,
val walletSignedHashes: Int
) : CommandResponse
/**
@ -64,7 +64,6 @@ class SignCommand(private val hashes: Array<ByteArray>, private val cardId: Stri
}
/**
d
* Application can optionally submit a public key Terminal_PublicKey in [SignCommand].
* Submitted key is stored by the Tangem card if it differs from a previous submitted Terminal_PublicKey.
* The Tangem card will not enforce security delay if [SignCommand] will be called with
@ -86,8 +85,8 @@ d
return SignResponse(
cardId = tlvMapper.map(TlvTag.CardId),
signature = tlvMapper.map(TlvTag.Signature),
remainingSignatures = tlvMapper.map(TlvTag.RemainingSignatures),
signedHashes = tlvMapper.map(TlvTag.SignedHashes)
walletRemainingSignatures = tlvMapper.map(TlvTag.RemainingSignatures),
walletSignedHashes = tlvMapper.map(TlvTag.SignedHashes)
)
}
}