Comment on page
Scan card
Getting the card's data.
This command should always be executed on the first step in order to retrieve all open information from the card, including public keys of the wallets and all settings that have been pre-configured during production.
Once the command is executed, an NFC session will be opened and the user will be prompted to tap the card against the phone. User will see an animation showing how to properly tap the card.
Unlike iPhones in which the NFC antenna is always on the top edge of the phone, in Android devices its position is mostly different.
To help users to tap the card right, Tangem SDK will show one of more that 300 animations for specific devices.
Even if the phone is new and there is no NFC position information in the SDK, the user will be prompted for a short tutorial on how to find the antenna using the card.
initialMessage <Message> [optional]
This message will be shown in the NFC session dialog.
Default: "Tap the card to your phone exactly as it shown above".
Swift
Kotlin
Java
JS (React Native)
JS (Cordova)
Dart
JSON-RPC
private lazy var tangemSdk: TangemSdk = .init()
...
tangemSdk.scanCard() { result in
switch result {
case .success(let card):
print(card)
case .failure(let error):
print(error)
}
}
val tangemSdk: TangemSdk = TangemSdk.init(activity)
...
tangemSdk.scanCard { result ->
when (result) {
is CompletionResult.Success -> {
runOnUiThread {
Log.d(TAG, result.card)
}
}
is CompletionResult.Failure -> {
runOnUiThread {
Log.d(TAG, result.error)
}
}
}
}
TangemSdk tangemSdk = TangemSdkKt.init(TangemSdk.Companion, activity, new Config());
tangemSdk.scanCard(null, result -> {
if (result instanceof CompletionResult.Success) {
Card card = ((CompletionResult.Success<Card>) result).getData();
Log.d(TAG, card.getCardId());
} else if (result instanceof CompletionResult.Failure) {
TangemError error = ((CompletionResult.Failure<Card>) result).getError();
Log.d(TAG, error.getCustomMessage());
}
return Unit.INSTANCE;
});let card;
TangemSdk.scanCard(undefined)
.then((result) => {
card = result
})
.catch(err => console.log(err));
var card;
var initialMessage = {"body": "body", "header": "header"};
var ScanCardCallback = function (response, error) {
if (response) {
card = response;
}
alert({"response": response, "error": error});
};
TangemSdk.scanCard(initialMessage, ScanCardCallback);
//Request
{
"jsonrpc":"2.0",
"id":1,
"method":"scan"
}
//Example result
{
"linkedTerminalStatus" : "none",
"supportedCurves" : [
"secp256k1",
"ed25519",
"secp256r1"
],
"cardPublicKey" : "0400D05BCAC34B58AA48BF998FB68667A3112262275200431EA235EC4616A15287B5D21F15E45740AB6B829F415950DBC7A68493DCF5FD270C8CAAB0E975E9A0D9",
"settings" : {
"isSettingPasscodeAllowed" : true,
"maxWalletsCount" : 36,
"isOverwritingIssuerExtraDataRestricted" : false,
"isRemovingAccessCodeAllowed" : false,
"isLinkedTerminalEnabled" : true,
"securityDelay" : 3000,
"isSettingAccessCodeAllowed" : false,
"supportedEncryptionModes" : [
"strong",
"fast",
"none"
],
"isPermanentWallet" : true,
"isSelectBlockchainAllowed" : true,
"isIssuerDataProtectedAgainstReplay" : true,
"isHDWalletsAllowed" : true,
},
"issuer" : {
"name" : "TANGEM AG",
"publicKey" : "0456E7C3376329DFAE7388DF1695670386103C92486A87644FA9E512C9CF4E92FE970EFDFBB7A35446F2A937505E6C70D78E965533B31C252B607F3C6B3112B603"
},
"firmwareVersion" : {
"minor" : 12,
"patch" : 0,
"major" : 4,
"stringValue" : "4.12r",
"type" : "r"
},
"batchId" : "CB79",
"attestation" : {
"cardKeyAttestation" : "verified",
"walletKeysAttestation" : "verified",
"firmwareAttestation" : "skipped",
"cardUniquenessAttestation" : "skipped"
},
"manufacturer" : {
"name" : "TANGEM",
"manufactureDate" : "2021-04-01",
"signature" : "1671A9AB2D9D5B99177E841C8DC35842452A095088CD01B48D753631571AAB21EEAC0F96BC87142268C32EFB3AF8A8C80DB55BE6D1970FAFBC72E00F896F69EA"
},
"cardId" : "CB79000000018201",
"wallets" : [
{
"publicKey" : "FA3F41EE40DAB4DB96B4AD5BEC697A552EEB1AACF2C6A10B1B37A9A724608533",
"totalSignedHashes" : 1,
"curve" : "ed25519",
"settings" : {
"isPermanent" : false
},
"index" : 0
},
{
"publicKey" : "0440C533E007D029C1F345CA70A9F6016EC7A95C775B6320AE84248F20B647FBBD90FF56A2D9C3A1984279ED2367274A49079789E130444541C2F15907D5570B49",
"totalSignedHashes" : 0,
"curve" : "secp256k1",
"settings" : {
"isPermanent" : true
},
"index" : 1
},
{
"publicKey" : "04DDFACEF55A95EAB2CDCC8E86CE779342D2E2A53CF8F0F20BF2B248336AE3EEA6DD62D1F4C5420A71D6212073B136034CDC878DAD3AE3FDFA3360E6FE6184F470",
"totalSignedHashes" : 0,
"curve" : "secp256r1",
"settings" : {
"isPermanent" : true
},
"index" : 2
}
],
"isPasscodeSet" : true
}
Last modified 2yr ago