Reset User Codes
Remove all codes
Reset both access code and passcode if they were set.
This method can be prohibited if card.settings.isResettingUserCodesAllowed is set tofalse.

Request

passcode <String> [optional] Passcode to set. If empty, user will be prompted to enter code before operation.
cardId <String> CID, Unique Tangem card ID number.
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 SuccessResponse (click to see more) object in response.

Example

Swift
Kotlin
Java
JS (ReactNative)
JS (Cordova)
Dart
JSON-RPC
1
let cardId = card.cardId
2
3
tangemSdk.resetUserCodes(cardId: cardId) { result in
4
switch result {
5
case .success:
6
print("All user codes have been reset")
7
case .failure(let error):
8
print(error)
9
}
10
}
Copied!
1
val cardId = card.cardId
2
3
tangemSdk.resetUserCodes(
4
cardId = cardId
5
) { result ->
6
when (result) {
7
is CompletionResult.Success -> {
8
runOnUiThread {
9
Log.d(TAG, "All user codes have been reset")
10
}
11
}
12
is CompletionResult.Failure -> {
13
runOnUiThread {
14
Log.d(TAG, result.error)
15
}
16
}
17
}
18
}
Copied!
1
String cardId = card.getCardId();
2
3
tangemSdk.resetUserCodes(cardId, null, result -> {
4
if (result instanceof CompletionResult.Success) {
5
SuccessResponse response = ((CompletionResult.Success<SuccessResponse>) result).getData();
6
Log.d(TAG, "Both codes have been reset");
7
} else if (result instanceof CompletionResult.Failure) {
8
TangemError error = ((CompletionResult.Failure<SuccessResponse>) result).getError();
9
Log.d(TAG, error.getCustomMessage());
10
}
11
return Unit.INSTANCE;
12
});
Copied!
1
Copied!
1
Copied!
1
Copied!
1
// Request
2
{
3
"jsonrpc":"2.0",
4
"id":1,
5
"method":"reset_usercodes"
6
}
7
8
// Response
9
{
10
"jsonrpc":"2.0",
11
"result":{
12
"cardId":"c000111122223333"
13
},
14
"id":1
15
}
Copied!
Last modified 7mo ago
Copy link