Skip to content

Commit 1e32b9b

Browse files
authored
Rename CredentialMakeResult to MakeNewCredentialResult and adjust its namespace (#433)
* Move CredentialMakeResult to Fido2NetLib.Objects namespace * Rename CredentialMakeResult to MakeNewCredentialResult * Remove unnecessary usings
1 parent 934abe4 commit 1e32b9b

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

Demo/Controller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public async Task<JsonResult> MakeCredential([FromBody] AuthenticatorAttestation
140140
}
141141
catch (Exception e)
142142
{
143-
return Json(new CredentialMakeResult(status: "error", errorMessage: FormatException(e), result: null));
143+
return Json(new MakeNewCredentialResult(status: "error", errorMessage: FormatException(e), result: null));
144144
}
145145
}
146146

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#nullable enable
2+
3+
namespace Fido2NetLib.Objects;
4+
5+
/// <summary>
6+
/// Result of parsing and verifying attestation. Used to transport Public Key back to RP
7+
/// </summary>
8+
public sealed class MakeNewCredentialResult : Fido2ResponseBase
9+
{
10+
public MakeNewCredentialResult(string status, string errorMessage, RegisteredPublicKeyCredential? result)
11+
{
12+
Status = status;
13+
ErrorMessage = errorMessage;
14+
Result = result;
15+
}
16+
17+
public RegisteredPublicKeyCredential? Result { get; }
18+
19+
// todo: add debuginfo?
20+
}

Src/Fido2/Fido2.cs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public CredentialCreateOptions RequestNewCredential(
6262
/// <param name="isCredentialIdUniqueToUser"></param>
6363
/// <param name="cancellationToken"></param>
6464
/// <returns></returns>
65-
public async Task<CredentialMakeResult> MakeNewCredentialAsync(
65+
public async Task<MakeNewCredentialResult> MakeNewCredentialAsync(
6666
AuthenticatorAttestationRawResponse attestationResponse,
6767
CredentialCreateOptions origChallenge,
6868
IsCredentialIdUniqueToUserAsyncDelegate isCredentialIdUniqueToUser,
@@ -72,7 +72,7 @@ public async Task<CredentialMakeResult> MakeNewCredentialAsync(
7272
var success = await parsedResponse.VerifyAsync(origChallenge, _config, isCredentialIdUniqueToUser, _metadataService, cancellationToken);
7373

7474
// todo: Set Errormessage etc.
75-
return new CredentialMakeResult(
75+
return new MakeNewCredentialResult(
7676
status: "ok",
7777
errorMessage: string.Empty,
7878
result: success
@@ -119,23 +119,6 @@ public async Task<VerifyAssertionResult> MakeAssertionAsync(
119119

120120
return result;
121121
}
122-
123-
/// <summary>
124-
/// Result of parsing and verifying attestation. Used to transport Public Key back to RP
125-
/// </summary>
126-
public sealed class CredentialMakeResult : Fido2ResponseBase
127-
{
128-
public CredentialMakeResult(string status, string errorMessage, RegisteredPublicKeyCredential? result)
129-
{
130-
Status = status;
131-
ErrorMessage = errorMessage;
132-
Result = result;
133-
}
134-
135-
public RegisteredPublicKeyCredential? Result { get; }
136-
137-
// todo: add debuginfo?
138-
}
139122
}
140123

141124
/// <summary>

Src/Fido2/IFido2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Task<VerifyAssertionResult> MakeAssertionAsync(
2222
IsUserHandleOwnerOfCredentialIdAsync isUserHandleOwnerOfCredentialIdCallback,
2323
CancellationToken cancellationToken = default);
2424

25-
Task<Fido2.CredentialMakeResult> MakeNewCredentialAsync(
25+
Task<MakeNewCredentialResult> MakeNewCredentialAsync(
2626
AuthenticatorAttestationRawResponse attestationResponse,
2727
CredentialCreateOptions origChallenge,
2828
IsCredentialIdUniqueToUserAsyncDelegate isCredentialIdUniqueToUser,

Test/Attestation/None.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task TestNone()
2525

2626
_attestationObject.Add("attStmt", new CborMap());
2727
_credentialPublicKey = Fido2Tests.MakeCredentialPublicKey((keyType, alg, crv));
28-
Fido2.CredentialMakeResult res;
28+
MakeNewCredentialResult res;
2929

3030
res = await MakeAttestationResponseAsync();
3131

Test/Attestation/Packed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public async Task TestFull()
202202
DateTimeOffset notAfter = notBefore.AddDays(2);
203203
var attDN = new X500DistinguishedName("CN=Testing, OU=Authenticator Attestation, O=FIDO2-NET-LIB, C=US");
204204

205-
Fido2.CredentialMakeResult res = null;
205+
MakeNewCredentialResult res = null;
206206

207207
switch (type)
208208
{

Test/Fido2Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public Attestation()
150150
idFidoGenCeAaGuidExt = new X509Extension(oidIdFidoGenCeAaGuid, _asnEncodedAaguid, false);
151151
}
152152

153-
public async Task<Fido2.CredentialMakeResult> MakeAttestationResponseAsync()
153+
public async Task<MakeNewCredentialResult> MakeAttestationResponseAsync()
154154
{
155155
_attestationObject.Set("authData", new CborByteString(_authData.ToByteArray()));
156156

0 commit comments

Comments
 (0)