Skip to content

Commit

Permalink
Added missing values to AuthenticatorTransport enum.
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferStrube committed Aug 7, 2024
1 parent 930597d commit 6c7ae75
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public override AuthenticatorTransport Read(ref Utf8JsonReader reader, Type type
"usb" => AuthenticatorTransport.Usb,
"nfc" => AuthenticatorTransport.Nfc,
"ble" => AuthenticatorTransport.Ble,
"smard-card" => AuthenticatorTransport.SmartCard,
"hybrid" => AuthenticatorTransport.Hybrid,
"internal" => AuthenticatorTransport.Internal,
var value => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.")
var value => throw new ArgumentException($"Value '{value}' was not a valid {nameof(AuthenticatorTransport)}.")
};
}

Expand All @@ -24,8 +26,10 @@ public override void Write(Utf8JsonWriter writer, AuthenticatorTransport value,
AuthenticatorTransport.Usb => "usb",
AuthenticatorTransport.Nfc => "nfc",
AuthenticatorTransport.Ble => "ble",
AuthenticatorTransport.SmartCard => "smard-card",
AuthenticatorTransport.Hybrid => "hybrid",
AuthenticatorTransport.Internal => "internal",
_ => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.")
_ => throw new ArgumentException($"Value '{value}' was not a valid {nameof(AuthenticatorTransport)}.")
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,38 @@

namespace KristofferStrube.Blazor.WebAuthentication;

/// <summary>
/// Authenticators may implement various transports for communicating with clients.
/// This enum defines hints as to how clients might communicate with a particular authenticator in order to obtain an assertion for a specific credential.
/// </summary>
/// <remarks><see href="https://w3c.github.io/webauthn/#enum-transport">See the API definition here</see>.</remarks>
[JsonConverter(typeof(AuthenticatorTransportConverter))]
public enum AuthenticatorTransport
{
/// <summary>
/// Indicates the respective authenticator can be contacted over removable USB.
/// </summary>
Usb,
/// <summary>
/// Indicates the respective authenticator can be contacted over Near Field Communication (NFC).
/// </summary>
Nfc,
/// <summary>
/// Indicates the respective authenticator can be contacted over Bluetooth Smart (Bluetooth Low Energy / BLE).
/// </summary>
Ble,
/// <summary>
/// Indicates the respective authenticator can be contacted over ISO/IEC 7816 smart card with contacts.
/// </summary>
SmartCard,
/// <summary>
/// Indicates the respective authenticator can be contacted using a combination of (often separate) data-transport and proximity mechanisms.
/// This supports, for example, authentication on a desktop computer using a smartphone.
/// </summary>
Hybrid,
/// <summary>
/// Indicates the respective authenticator is contacted using a client device-specific transport, i.e., it is a platform authenticator.
/// These authenticators are not removable from the client device.
/// </summary>
Internal,
}

0 comments on commit 6c7ae75

Please sign in to comment.