VirtualAuthenticator Class

A software authenticator (https://w3c.github.io/webauthn/#virtual-authenticators): it creates and stores public key credential sources, and signs the assertions with them. Its credentials can be added, listed and removed by the application, as with the WebDriver extension commands.

public sealed class VirtualAuthenticator

Remarks

The authenticator can be used from any thread.

Properties

NameDescription
DefaultBackupEligibilityGets the default backup eligibility of the credentials that the authenticator creates.
DefaultBackupStateGets the default backup state of the credentials that the authenticator creates.
ExtensionsGets the authenticator extensions that the authenticator supports.
HasResidentKeyGets whether the authenticator can store client-side discoverable credentials.
HasUserVerificationGets whether the authenticator can perform user verification.
IdGets the id of the authenticator (https://w3c.github.io/webauthn/#authenticatorid).
IsUserConsentingGets or sets whether the user consents to the operations of the authenticator.
IsUserVerifiedGets or sets whether the user verification succeeds (https://w3c.github.io/webauthn/#set-user-verified).
ProtocolGets the protocol of the authenticator.
TransportGets the transport of the authenticator.

DefaultBackupEligibility

VirtualAuthenticators.cs

Gets the default backup eligibility of the credentials that the authenticator creates.

public bool DefaultBackupEligibility { get; }

Property value

bool

DefaultBackupState

VirtualAuthenticators.cs

Gets the default backup state of the credentials that the authenticator creates.

public bool DefaultBackupState { get; }

Property value

bool

Gets the authenticator extensions that the authenticator supports.

public IReadOnlyList<string> Extensions { get; }

Property value

IReadOnlyList<string>

Gets whether the authenticator can store client-side discoverable credentials.

public bool HasResidentKey { get; }

Property value

bool

HasUserVerification

VirtualAuthenticators.cs

Gets whether the authenticator can perform user verification.

public bool HasUserVerification { get; }

Property value

bool

Gets the id of the authenticator (https://w3c.github.io/webauthn/#authenticatorid).

public string Id { get; }

Property value

string

IsUserConsenting

VirtualAuthenticators.cs

Gets or sets whether the user consents to the operations of the authenticator.

public bool IsUserConsenting { get; set; }

Property value

bool

Gets or sets whether the user verification succeeds (https://w3c.github.io/webauthn/#set-user-verified).

public bool IsUserVerified { get; set; }

Property value

bool

Gets the protocol of the authenticator.

public VirtualAuthenticatorProtocol Protocol { get; }

Gets the transport of the authenticator.

public string Transport { get; }

Property value

string

Methods

NameDescription
AddCredential(VirtualCredential)Adds a credential to the authenticator (https://w3c.github.io/webauthn/#add-credential). A discoverable credential of the same RP ID and user handle replaces the existing one.
GetCredentials()Returns a snapshot of the credentials of the authenticator (https://w3c.github.io/webauthn/#get-credentials).
RemoveAllCredentials()Removes all the credentials (https://w3c.github.io/webauthn/#remove-all-credentials).
RemoveCredential(ReadOnlySpan<byte>)Removes a credential (https://w3c.github.io/webauthn/#remove-credential). Returns false when the authenticator has no credential with this id.
SetCredentialProperties(ReadOnlySpan<byte>, bool?, bool?)Sets the properties of a credential (https://w3c.github.io/webauthn/#set-credential-properties): the null values are not changed. Returns false when the authenticator has no credential with this id.
SetSignCount(ReadOnlySpan<byte>, uint?)Sets the signature counter of a credential (https://w3c.github.io/webauthn/#set-credential-properties): null removes the counter. Returns false when the authenticator has no credential with this id.

AddCredential(VirtualCredential)

VirtualAuthenticators.cs

Adds a credential to the authenticator (https://w3c.github.io/webauthn/#add-credential). A discoverable credential of the same RP ID and user handle replaces the existing one.

public void AddCredential(VirtualCredential credential)

Parameters

credential VirtualCredential

Exceptions

ArgumentException
The private key is not valid, or the credential is discoverable and the authenticator does not support them or it has no user handle.

GetCredentials()

VirtualAuthenticators.cs

Returns a snapshot of the credentials of the authenticator (https://w3c.github.io/webauthn/#get-credentials).

public IReadOnlyList<VirtualCredential> GetCredentials()

RemoveAllCredentials()

VirtualAuthenticators.cs

Removes all the credentials (https://w3c.github.io/webauthn/#remove-all-credentials).

public void RemoveAllCredentials()

RemoveCredential(ReadOnlySpan<byte>)

VirtualAuthenticators.cs

Removes a credential (https://w3c.github.io/webauthn/#remove-credential). Returns false when the authenticator has no credential with this id.

public bool RemoveCredential(ReadOnlySpan<byte> credentialId)

Parameters

credentialId ReadOnlySpan<byte>

Returns

bool

SetCredentialProperties(ReadOnlySpan<byte>, bool?, bool?)

VirtualAuthenticators.cs

Sets the properties of a credential (https://w3c.github.io/webauthn/#set-credential-properties): the null values are not changed. Returns false when the authenticator has no credential with this id.

public bool SetCredentialProperties(ReadOnlySpan<byte> credentialId, bool? backupEligibility, bool? backupState)

Parameters

credentialId ReadOnlySpan<byte>
The id of the credential.
backupEligibility bool?
The backup eligibility, or null.
backupState bool?
The backup state, or null.

Returns

bool

SetSignCount(ReadOnlySpan<byte>, uint?)

VirtualAuthenticators.cs

Sets the signature counter of a credential (https://w3c.github.io/webauthn/#set-credential-properties): null removes the counter. Returns false when the authenticator has no credential with this id.

public bool SetSignCount(ReadOnlySpan<byte> credentialId, uint? signCount)

Parameters

credentialId ReadOnlySpan<byte>
signCount uint?

Returns

bool