diff --git a/src/fido/cbor_get_assertion.c b/src/fido/cbor_get_assertion.c index e4a28cc..21412e6 100644 --- a/src/fido/cbor_get_assertion.c +++ b/src/fido/cbor_get_assertion.c @@ -481,9 +481,22 @@ int cbor_get_assertion(const uint8_t *data, size_t len, bool next) { if (selcred->opts.present == true && selcred->opts.rk == ptrue) { CBOR_CHECK(cbor_encode_uint(&mapEncoder, 0x04)); - CBOR_CHECK(cbor_encoder_create_map(&mapEncoder, &mapEncoder2, 1)); + uint8_t lu = 1; + if (selcred->userName.present == true) + lu++; + if (selcred->userDisplayName.present == true) + lu++; + CBOR_CHECK(cbor_encoder_create_map(&mapEncoder, &mapEncoder2, lu)); CBOR_CHECK(cbor_encode_text_stringz(&mapEncoder2, "id")); CBOR_CHECK(cbor_encode_byte_string(&mapEncoder2, selcred->userId.data, selcred->userId.len)); + if (selcred->userName.present == true) { + CBOR_CHECK(cbor_encode_text_stringz(&mapEncoder2, "name")); + CBOR_CHECK(cbor_encode_text_stringz(&mapEncoder2, selcred->userName.data)); + } + if (selcred->userDisplayName.present == true) { + CBOR_CHECK(cbor_encode_text_stringz(&mapEncoder2, "displayName")); + CBOR_CHECK(cbor_encode_text_stringz(&mapEncoder2, selcred->userDisplayName.data)); + } CBOR_CHECK(cbor_encoder_close_container(&mapEncoder, &mapEncoder2)); } if (numberOfCredentials > 1 && next == false) { diff --git a/src/fido/credential.c b/src/fido/credential.c index 284acdd..e970c02 100644 --- a/src/fido/credential.c +++ b/src/fido/credential.c @@ -137,6 +137,12 @@ int credential_load(const uint8_t *cred_id, size_t cred_id_len, const uint8_t *r else if (val_u == 0x03) { CBOR_FIELD_GET_BYTES(cred->userId, 1); } + else if (val_u == 0x04) { + CBOR_FIELD_GET_TEXT(cred->userName, 1); + } + else if (val_u == 0x05) { + CBOR_FIELD_GET_TEXT(cred->userDisplayName, 1); + } else if (val_u == 0x06) { CBOR_FIELD_GET_UINT(cred->creation, 1); }