diff --git a/Src/Fido2.Models/AssertionOptions.cs b/Src/Fido2.Models/AssertionOptions.cs index 4ac4fb9c..c867625e 100644 --- a/Src/Fido2.Models/AssertionOptions.cs +++ b/Src/Fido2.Models/AssertionOptions.cs @@ -54,6 +54,12 @@ public class AssertionOptions [JsonPropertyName("hints")] public IReadOnlyList Hints { get; set; } = Array.Empty(); + /// + /// This member is intended for use by Relying Parties that wish to select a preference regarding the attestation statement format used, if such an attestation is requested. + /// + [JsonPropertyName("attestationFormats")] + public IReadOnlyList AttestationFormats { get; set; } = []; + /// /// This OPTIONAL member contains additional parameters requesting additional processing by the client and authenticator. /// For example, if transaction confirmation is sought from the user, then the prompt string might be included as an extension. diff --git a/Src/Fido2.Models/CredentialCreateOptions.cs b/Src/Fido2.Models/CredentialCreateOptions.cs index 1e5b2239..cafe2a58 100644 --- a/Src/Fido2.Models/CredentialCreateOptions.cs +++ b/Src/Fido2.Models/CredentialCreateOptions.cs @@ -49,6 +49,15 @@ public sealed class CredentialCreateOptions [JsonPropertyName("attestation")] public AttestationConveyancePreference Attestation { get; set; } = AttestationConveyancePreference.None; + /// + /// This member is intended for use by Relying Parties that wish to select a preference regarding the attestation statement format used, if such an attestation is requested. + /// + /// + /// This parameter is advisory and the authenticator MAY use an attestation statement not enumerated in this parameter. + /// + [JsonPropertyName("attestationFormats")] + public IReadOnlyList AttestationFormats { get; set; } = []; + /// /// This member is intended for use by Relying Parties that wish to select the appropriate authenticators to participate in the create() operation. /// diff --git a/Src/Fido2.Models/Objects/AttestationStatementFormatIdentifier.cs b/Src/Fido2.Models/Objects/AttestationStatementFormatIdentifier.cs new file mode 100644 index 00000000..02201a82 --- /dev/null +++ b/Src/Fido2.Models/Objects/AttestationStatementFormatIdentifier.cs @@ -0,0 +1,55 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; + +namespace Fido2NetLib.Objects; + +/// +/// The attestation statement format identifier in WebAuthn specifies the format of the attestation statement that is used to attest to the authenticity of a credential created by a WebAuthn authenticator. +/// https://www.iana.org/assignments/webauthn/webauthn.xhtml +/// +[JsonConverter(typeof(FidoEnumConverter))] +public enum AttestationStatementFormatIdentifier +{ + /// + /// The "packed" attestation statement format is a WebAuthn-optimized format for attestation. It uses a very compact but still extensible encoding method. This format is implementable by authenticators with limited resources (e.g., secure elements). + /// + [EnumMember(Value = "packed")] + Packed, + + /// + /// The "TPM" attestation statement format returns an attestation statement in the same format as the packed attestation statement format, although the rawData and signature fields are computed differently. + /// + [EnumMember(Value = "tpm")] + Tpm, + + /// + /// Platform authenticators on versions "N", and later, may provide this proprietary "hardware attestation" statement. + /// + [EnumMember(Value = "android-key")] + AndroidKey, + + /// + /// Android-based platform authenticators MAY produce an attestation statement based on the Android SafetyNet API. + /// + [EnumMember(Value = "android-safetynet")] + AndroidSafetyNet, + + /// + /// Used with FIDO U2F authenticators. + /// + [EnumMember(Value = "fido-u2f")] + FidoU2f, + + /// + /// Used with Apple devices' platform authenticators. + /// + [EnumMember(Value = "apple")] + Apple, + + /// + /// Used to replace any authenticator-provided attestation statement when a WebAuthn Relying Party indicates it does not wish to receive attestation information. + /// + [EnumMember(Value = "none")] + None +} + diff --git a/Src/Fido2.Models/Objects/AuthenticationExtensionsDevicePublicKeyInputs.cs b/Src/Fido2.Models/Objects/AuthenticationExtensionsDevicePublicKeyInputs.cs index e0cfddca..246f5688 100644 --- a/Src/Fido2.Models/Objects/AuthenticationExtensionsDevicePublicKeyInputs.cs +++ b/Src/Fido2.Models/Objects/AuthenticationExtensionsDevicePublicKeyInputs.cs @@ -9,5 +9,5 @@ public sealed class AuthenticationExtensionsDevicePublicKeyInputs public string Attestation { get; set; } = "none"; [JsonPropertyName("attestationFormats")] - public string[] AttestationFormats { get; set; } = Array.Empty(); + public IReadOnlyList AttestationFormats { get; set; } = Array.Empty(); }