WebAuthn
Namespace: Wisej.Ext.WebAuthn
Assembly: Wisej.Ext.WebAuthn
Provides methods for creating and retrieving credentials from the client following the Web Authorization API standards.
- C#
- VB.NET
public class WebAuthn
Public Class WebAuthn
Methods
CreateAsync(challenge, rp, user, publicKeyCredentialParameters, authenticatorSelection, timeout, attestation)
Creates new credentials for the client.
| Parameter | Type | Description |
|---|---|---|
| challenge | String | Random string for validating the request. |
| rp | RelyingParty | Relaying Party (rp), the organization responsible for registering and authenticating the user. |
| user | PublicKeyCredentialUserEntity | Information about the user currently registering. |
| publicKeyCredentialParameters | PublicKeyCredentialParameters[] | Array describing what public key types are acceptable to the server. |
| authenticatorSelection | AuthenticatorSelectionCriteria | "platform" (Windows Hello) vs "cross-platform" (Yubikey) required. |
| timeout | Int32 | The time in milliseconds that the user has to respond to a prompt for registration. |
| attestation | AttestationConveyancePreference | allows servers to indicate how important the attestation data is to this registration event. |
Returns: Task<CredentialsResponse>. The client's credentials.
GetAsync(challenge, allowCredentials, timeout)
Gets the requested credentials from the client.
| Parameter | Type | Description |
|---|---|---|
| challenge | String | Random string for validating the request. |
| allowCredentials | PublicKeyCredentialDescriptor | Which credential the server would like the user to authenticate with. |
| timeout | Int32 | The time in milliseconds that the user has to respond to a prompt for registration. |
Returns: Task<CredentialsResponse>.
IsUserVerifyingPlatformAuthenticatorAvailableAsync()
Checks whether the client device has a user-verifying platform authenticator available for use.
Returns: Task<Boolean>. True if the device has a user-verifying platform authenticator.
Validate(publicKey, authenticatorDataBase64, clientDataBase64, signature)
Validates the given attestation against the provided public key.
| Parameter | Type | Description |
|---|---|---|
| publicKey | PublicKey | The public key generated during registration. |
| authenticatorDataBase64 | String | "platform" (Windows Hello) vs "cross-platform" (Yubikey) required. |
| clientDataBase64 | String | Client data base64 encoded. |
| signature | Byte[] | Authentication signature. |
Returns: Boolean. The success of the validation.
Throws: