Skip to content

Commit f072880

Browse files
Make functions more readable
1 parent 9a73ff3 commit f072880

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Yubico.YubiKey/src/Yubico/YubiKey/Fido2/Commands/EnumerateRpsBeginResponse.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,16 @@ public EnumerateRpsBeginResponse(ResponseApdu responseApdu)
7272
{
7373
var credentialManagementData = _response.GetData();
7474

75-
if (credentialManagementData.RelyingParty is not null &&
75+
bool conditionsMet =
76+
credentialManagementData.RelyingParty is not null &&
7677
credentialManagementData.RelyingPartyIdHash is not null &&
7778
credentialManagementData.TotalRelyingPartyCount is not null &&
78-
credentialManagementData.RelyingParty.IsMatchingRelyingPartyId(credentialManagementData.RelyingPartyIdHash.Value))
79+
credentialManagementData.RelyingParty.IsMatchingRelyingPartyId(credentialManagementData.RelyingPartyIdHash.Value);
80+
81+
if (conditionsMet)
7982
{
8083
return (credentialManagementData.TotalRelyingPartyCount.Value, credentialManagementData.RelyingParty);
81-
}
84+
}
8285

8386
throw new Ctap2DataException(ExceptionMessages.InvalidFido2Info);
8487
}

Yubico.YubiKey/src/Yubico/YubiKey/Fido2/Commands/EnumerateRpsGetNextResponse.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ public EnumerateRpsGetNextResponse(ResponseApdu responseApdu)
4343
public RelyingParty GetData()
4444
{
4545
var credentialManagementData = _response.GetData();
46-
if (credentialManagementData.RelyingParty is not null &&
46+
47+
bool conditionsMet =
48+
credentialManagementData.RelyingParty is not null &&
4749
credentialManagementData.RelyingPartyIdHash is not null &&
48-
credentialManagementData.RelyingParty.IsMatchingRelyingPartyId(credentialManagementData.RelyingPartyIdHash.Value))
50+
credentialManagementData.RelyingParty.IsMatchingRelyingPartyId(credentialManagementData.RelyingPartyIdHash.Value);
51+
52+
if (conditionsMet)
4953
{
5054
return credentialManagementData.RelyingParty;
5155
}

0 commit comments

Comments
 (0)