diff --git a/Demo/Controller.cs b/Demo/Controller.cs index 103f50f9..f4ee83ca 100644 --- a/Demo/Controller.cs +++ b/Demo/Controller.cs @@ -140,7 +140,7 @@ public async Task MakeCredential([FromBody] AuthenticatorAttestation } catch (Exception e) { - return Json(new CredentialMakeResult(status: "error", errorMessage: FormatException(e), result: null)); + return Json(new MakeNewCredentialResult(status: "error", errorMessage: FormatException(e), result: null)); } } diff --git a/Src/Fido2.Models/Objects/MakeNewCredentialResult.cs b/Src/Fido2.Models/Objects/MakeNewCredentialResult.cs new file mode 100644 index 00000000..0fbf3c21 --- /dev/null +++ b/Src/Fido2.Models/Objects/MakeNewCredentialResult.cs @@ -0,0 +1,20 @@ +#nullable enable + +namespace Fido2NetLib.Objects; + +/// +/// Result of parsing and verifying attestation. Used to transport Public Key back to RP +/// +public sealed class MakeNewCredentialResult : Fido2ResponseBase +{ + public MakeNewCredentialResult(string status, string errorMessage, RegisteredPublicKeyCredential? result) + { + Status = status; + ErrorMessage = errorMessage; + Result = result; + } + + public RegisteredPublicKeyCredential? Result { get; } + + // todo: add debuginfo? +} diff --git a/Src/Fido2/Fido2.cs b/Src/Fido2/Fido2.cs index c8e1585b..11e76d0a 100644 --- a/Src/Fido2/Fido2.cs +++ b/Src/Fido2/Fido2.cs @@ -62,7 +62,7 @@ public CredentialCreateOptions RequestNewCredential( /// /// /// - public async Task MakeNewCredentialAsync( + public async Task MakeNewCredentialAsync( AuthenticatorAttestationRawResponse attestationResponse, CredentialCreateOptions origChallenge, IsCredentialIdUniqueToUserAsyncDelegate isCredentialIdUniqueToUser, @@ -72,7 +72,7 @@ public async Task MakeNewCredentialAsync( var success = await parsedResponse.VerifyAsync(origChallenge, _config, isCredentialIdUniqueToUser, _metadataService, cancellationToken); // todo: Set Errormessage etc. - return new CredentialMakeResult( + return new MakeNewCredentialResult( status: "ok", errorMessage: string.Empty, result: success @@ -119,23 +119,6 @@ public async Task MakeAssertionAsync( return result; } - - /// - /// Result of parsing and verifying attestation. Used to transport Public Key back to RP - /// - public sealed class CredentialMakeResult : Fido2ResponseBase - { - public CredentialMakeResult(string status, string errorMessage, RegisteredPublicKeyCredential? result) - { - Status = status; - ErrorMessage = errorMessage; - Result = result; - } - - public RegisteredPublicKeyCredential? Result { get; } - - // todo: add debuginfo? - } } /// diff --git a/Src/Fido2/IFido2.cs b/Src/Fido2/IFido2.cs index d49233cb..585dc12a 100644 --- a/Src/Fido2/IFido2.cs +++ b/Src/Fido2/IFido2.cs @@ -22,7 +22,7 @@ Task MakeAssertionAsync( IsUserHandleOwnerOfCredentialIdAsync isUserHandleOwnerOfCredentialIdCallback, CancellationToken cancellationToken = default); - Task MakeNewCredentialAsync( + Task MakeNewCredentialAsync( AuthenticatorAttestationRawResponse attestationResponse, CredentialCreateOptions origChallenge, IsCredentialIdUniqueToUserAsyncDelegate isCredentialIdUniqueToUser, diff --git a/Test/Attestation/None.cs b/Test/Attestation/None.cs index d8e509ca..9ee39ea9 100644 --- a/Test/Attestation/None.cs +++ b/Test/Attestation/None.cs @@ -25,7 +25,7 @@ public async Task TestNone() _attestationObject.Add("attStmt", new CborMap()); _credentialPublicKey = Fido2Tests.MakeCredentialPublicKey((keyType, alg, crv)); - Fido2.CredentialMakeResult res; + MakeNewCredentialResult res; res = await MakeAttestationResponseAsync(); diff --git a/Test/Attestation/Packed.cs b/Test/Attestation/Packed.cs index 28195bc4..e48d62fb 100644 --- a/Test/Attestation/Packed.cs +++ b/Test/Attestation/Packed.cs @@ -202,7 +202,7 @@ public async Task TestFull() DateTimeOffset notAfter = notBefore.AddDays(2); var attDN = new X500DistinguishedName("CN=Testing, OU=Authenticator Attestation, O=FIDO2-NET-LIB, C=US"); - Fido2.CredentialMakeResult res = null; + MakeNewCredentialResult res = null; switch (type) { diff --git a/Test/Fido2Tests.cs b/Test/Fido2Tests.cs index 3bc5ed99..b7bfc7a0 100644 --- a/Test/Fido2Tests.cs +++ b/Test/Fido2Tests.cs @@ -150,7 +150,7 @@ public Attestation() idFidoGenCeAaGuidExt = new X509Extension(oidIdFidoGenCeAaGuid, _asnEncodedAaguid, false); } - public async Task MakeAttestationResponseAsync() + public async Task MakeAttestationResponseAsync() { _attestationObject.Set("authData", new CborByteString(_authData.ToByteArray()));