in Fido/app/src/main/java/com/fido/example/fido2apiexample/Fido2DemoActivity.java [523:556]
private void highlightAuthenticatedToken(String signResult) {
String credentialId;
try {
JSONObject signResultJson = new JSONObject(signResult);
JSONObject credentialJson = signResultJson.getJSONObject(KEY_CREDENTIAL);
credentialId = credentialJson.getString(KEY_CREDENTIAL_ID);
} catch (JSONException e) {
Log.e(TAG, "Error extracting information from JSON sign result", e);
return;
}
int whichToken = -1;
Log.i(TAG, "Successfully authenticated credential Id: " + credentialId);
for (int position = 0; position < securityTokens.size(); position++) {
Map<String, String> tokenMap = securityTokens.get(position);
Log.d(TAG, "token map at position " + position + " is " + tokenMap.toString());
Log.i(
TAG,
"highlightAuthenticatedToken registered public_key: " + tokenMap.get(KEY_KEY_HANDLE));
if (credentialId.equals(tokenMap.get(KEY_KEY_HANDLE))) {
whichToken = position;
break;
}
}
if (whichToken >= 0) {
Log.i(TAG, "highlightAuthenticatedToken whichToken: " + whichToken);
View card =
recyclerView
.getLayoutManager()
.findViewByPosition(whichToken)
.findViewById(R.id.information);
card.setPressed(true);
card.setPressed(false);
}
}