Links

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
let cardId = card.cardId
tangemSdk.resetUserCodes(cardId: cardId) { result in
switch result {
case .success:
print("All user codes have been reset")
case .failure(let error):
print(error)
}
}
val cardId = card.cardId
tangemSdk.resetUserCodes(
cardId = cardId
) { result ->
when (result) {
is CompletionResult.Success -> {
runOnUiThread {
Log.d(TAG, "All user codes have been reset")
}
}
is CompletionResult.Failure -> {
runOnUiThread {
Log.d(TAG, result.error)
}
}
}
}
String cardId = card.getCardId();
tangemSdk.resetUserCodes(cardId, null, result -> {
if (result instanceof CompletionResult.Success) {
SuccessResponse response = ((CompletionResult.Success<SuccessResponse>) result).getData();
Log.d(TAG, "Both codes have been reset");
} else if (result instanceof CompletionResult.Failure) {
TangemError error = ((CompletionResult.Failure<SuccessResponse>) result).getError();
Log.d(TAG, error.getCustomMessage());
}
return Unit.INSTANCE;
});
// Request
{
"jsonrpc":"2.0",
"id":1,
"method":"reset_usercodes"
}
// Response
{
"jsonrpc":"2.0",
"result":{
"cardId":"c000111122223333"
},
"id":1
}
Last modified 1yr ago