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.

Request parameters

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".

Response

This command will return the Card (click to see more) object in response.

Example

Swift
Kotlin
Java
JS (React Native)
JS (Cordova)
Dart
JSON-RPC
1
private lazy var tangemSdk: TangemSdk = .init()
2
...
3
4
tangemSdk.scanCard() { result in
5
switch result {
6
case .success(let card):
7
print(card)
8
case .failure(let error):
9
print(error)
10
}
11
}
Copied!
1
val tangemSdk: TangemSdk = TangemSdk.init(activity)
2
...
3
4
tangemSdk.scanCard { result ->
5
when (result) {
6
is CompletionResult.Success -> {
7
runOnUiThread {
8
Log.d(TAG, result.card)
9
}
10
}
11
is CompletionResult.Failure -> {
12
runOnUiThread {
13
Log.d(TAG, result.error)
14
}
15
}
16
}
17
}
Copied!
1
TangemSdk tangemSdk = TangemSdkKt.init(TangemSdk.Companion, activity, new Config());
2
3
tangemSdk.scanCard(null, result -> {
4
if (result instanceof CompletionResult.Success) {
5
Card card = ((CompletionResult.Success<Card>) result).getData();
6
Log.d(TAG, card.getCardId());
7
} else if (result instanceof CompletionResult.Failure) {
8
TangemError error = ((CompletionResult.Failure<Card>) result).getError();
9
Log.d(TAG, error.getCustomMessage());
10
}
11
return Unit.INSTANCE;
12
});let card;
Copied!
1
TangemSdk.scanCard(undefined)
2
.then((result) => {
3
card = result
4
})
5
.catch(err => console.log(err));
Copied!
1
var card;
2
var initialMessage = {"body": "body", "header": "header"};
3
var ScanCardCallback = function (response, error) {
4
if (response) {
5
card = response;
6
}
7
alert({"response": response, "error": error});
8
};
9
10
TangemSdk.scanCard(initialMessage, ScanCardCallback);
Copied!
1
Copied!
1
//Request
2
{
3
"jsonrpc":"2.0",
4
"id":1,
5
"method":"scan"
6
}
7
8
//Example result
9
{
10
"linkedTerminalStatus" : "none",
11
"supportedCurves" : [
12
"secp256k1",
13
"ed25519",
14
"secp256r1"
15
],
16
"cardPublicKey" : "0400D05BCAC34B58AA48BF998FB68667A3112262275200431EA235EC4616A15287B5D21F15E45740AB6B829F415950DBC7A68493DCF5FD270C8CAAB0E975E9A0D9",
17
"settings" : {
18
"isSettingPasscodeAllowed" : true,
19
"maxWalletsCount" : 36,
20
"isOverwritingIssuerExtraDataRestricted" : false,
21
"isRemovingAccessCodeAllowed" : false,
22
"isLinkedTerminalEnabled" : true,
23
"securityDelay" : 3000,
24
"isSettingAccessCodeAllowed" : false,
25
"supportedEncryptionModes" : [
26
"strong",
27
"fast",
28
"none"
29
],
30
"isPermanentWallet" : true,
31
"isSelectBlockchainAllowed" : true,
32
"isIssuerDataProtectedAgainstReplay" : true,
33
"isHDWalletsAllowed" : true,
34
},
35
"issuer" : {
36
"name" : "TANGEM AG",
37
"publicKey" : "0456E7C3376329DFAE7388DF1695670386103C92486A87644FA9E512C9CF4E92FE970EFDFBB7A35446F2A937505E6C70D78E965533B31C252B607F3C6B3112B603"
38
},
39
"firmwareVersion" : {
40
"minor" : 12,
41
"patch" : 0,
42
"major" : 4,
43
"stringValue" : "4.12r",
44
"type" : "r"
45
},
46
"batchId" : "CB79",
47
"attestation" : {
48
"cardKeyAttestation" : "verified",
49
"walletKeysAttestation" : "verified",
50
"firmwareAttestation" : "skipped",
51
"cardUniquenessAttestation" : "skipped"
52
},
53
"manufacturer" : {
54
"name" : "TANGEM",
55
"manufactureDate" : "2021-04-01",
56
"signature" : "1671A9AB2D9D5B99177E841C8DC35842452A095088CD01B48D753631571AAB21EEAC0F96BC87142268C32EFB3AF8A8C80DB55BE6D1970FAFBC72E00F896F69EA"
57
},
58
"cardId" : "CB79000000018201",
59
"wallets" : [
60
{
61
"publicKey" : "FA3F41EE40DAB4DB96B4AD5BEC697A552EEB1AACF2C6A10B1B37A9A724608533",
62
"totalSignedHashes" : 1,
63
"curve" : "ed25519",
64
"settings" : {
65
"isPermanent" : false
66
},
67
"index" : 0
68
},
69
{
70
"publicKey" : "0440C533E007D029C1F345CA70A9F6016EC7A95C775B6320AE84248F20B647FBBD90FF56A2D9C3A1984279ED2367274A49079789E130444541C2F15907D5570B49",
71
"totalSignedHashes" : 0,
72
"curve" : "secp256k1",
73
"settings" : {
74
"isPermanent" : true
75
},
76
"index" : 1
77
},
78
{
79
"publicKey" : "04DDFACEF55A95EAB2CDCC8E86CE779342D2E2A53CF8F0F20BF2B248336AE3EEA6DD62D1F4C5420A71D6212073B136034CDC878DAD3AE3FDFA3360E6FE6184F470",
80
"totalSignedHashes" : 0,
81
"curve" : "secp256r1",
82
"settings" : {
83
"isPermanent" : true
84
},
85
"index" : 2
86
}
87
],
88
"isPasscodeSet" : true
89
}
Copied!
Last modified 7mo ago