PublicKeyCredential Class

A public key credential of Web Authentication (https://w3c.github.io/webauthn/#iface-pkcredential): the result of a registration (navigator.credentials.create()) or of an authentication (navigator.credentials.get()).

public sealed class PublicKeyCredential : Credential
Inheritance
Credential PublicKeyCredential

Properties

NameDescription
AuthenticatorAttachmentGets the attachment modality of the authenticator (platform or cross-platform), or null.
IdGets the base64url encoding of the credential ID.
RawIdGets the credential ID (https://w3c.github.io/webauthn/#dom-publickeycredential-identifier-slot).
RawIdBufferGets the ArrayBuffer of the credential ID for the scripts: use PublicKeyCredential.RawId in .NET code.
ResponseGets the response of the authenticator: an AuthenticatorAttestationResponse or an AuthenticatorAssertionResponse.
TypeGets the type of the credential: public-key.

AuthenticatorAttachment

PublicKeyCredential.cs

Gets the attachment modality of the authenticator (platform or cross-platform), or null.

public string? AuthenticatorAttachment { get; }

Gets the base64url encoding of the credential ID.

public override string Id { get; }

Gets the credential ID (https://w3c.github.io/webauthn/#dom-publickeycredential-identifier-slot).

public ReadOnlyMemory<byte> RawId { get; }

Property value

ReadOnlyMemory<byte>

Gets the ArrayBuffer of the credential ID for the scripts: use PublicKeyCredential.RawId in .NET code.

public object RawIdBuffer { get; }

Gets the type of the credential: public-key.

public override string Type { get; }

Property value

string

Methods

NameDescription
GetClientCapabilities()Returns the capabilities of the client (https://w3c.github.io/webauthn/#sctn-getClientCapabilities), sorted by name: the values of ClientCapability and the implemented extensions (extension: followed by their identifier).
GetClientExtensionResults()Returns the outputs of the client extensions (https://w3c.github.io/webauthn/#dom-publickeycredential-getclientextensionresults).
IsConditionalMediationAvailable()Whether the conditional mediation of navigator.credentials.get() is available: true.
IsUserVerifyingPlatformAuthenticatorAvailable()Whether a user-verifying platform authenticator is available (https://w3c.github.io/webauthn/#sctn-isUserVerifyingPlatformAuthenticatorAvailable): an authenticator of WebAuthenticationOptions.Authenticators whose transport is internal and that can perform user verification.
ParseCreationOptionsFromJson(PublicKeyCredentialCreationOptionsJson)Converts the JSON type of the options of a registration (https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON): the base64url-encoded strings are decoded. Throws an EncodingError DomException when a value is not a valid base64url encoding.
ParseRequestOptionsFromJson(PublicKeyCredentialRequestOptionsJson)Converts the JSON type of the options of an authentication (https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON): the base64url-encoded strings are decoded. Throws an EncodingError DomException when a value is not a valid base64url encoding.
SignalAllAcceptedCredentials(AllAcceptedCredentialsOptions)Signals the complete list of the credentials of a user (https://w3c.github.io/webauthn/#sctn-signalAllAcceptedCredentials): the virtual authenticators remove the discoverable credentials of the user that are not in the list. The task fails with a TypeErrorException when a value is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.
SignalCurrentUserDetails(CurrentUserDetailsOptions)Signals the current name and display name of a user (https://w3c.github.io/webauthn/#sctn-signalCurrentUserDetails): the virtual authenticators update the discoverable credential of the user. The task fails with a TypeErrorException when the user ID is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.
SignalUnknownCredential(UnknownCredentialOptions)Signals that the relying party does not recognize a credential (https://w3c.github.io/webauthn/#sctn-signalUnknownCredential): the virtual authenticators remove it. The task fails with a TypeErrorException when the credential ID is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.
ToJson()Returns the JSON type of the credential (https://w3c.github.io/webauthn/#dom-publickeycredential-tojson): a RegistrationResponseJson or an AuthenticationResponseJson, whose binary values are base64url-encoded.

GetClientCapabilities()

PublicKeyCredential.cs

Returns the capabilities of the client (https://w3c.github.io/webauthn/#sctn-getClientCapabilities), sorted by name: the values of ClientCapability and the implemented extensions (extension: followed by their identifier).

public static Task<IReadOnlyList<KeyValuePair<string, bool>>> GetClientCapabilities()

GetClientExtensionResults()

PublicKeyCredential.cs

Returns the outputs of the client extensions (https://w3c.github.io/webauthn/#dom-publickeycredential-getclientextensionresults).

public AuthenticationExtensionsClientOutputs GetClientExtensionResults()

IsConditionalMediationAvailable()

PublicKeyCredential.cs

Whether the conditional mediation of navigator.credentials.get() is available: true.

public new static Task<bool> IsConditionalMediationAvailable()

IsUserVerifyingPlatformAuthenticatorAvailable()

PublicKeyCredential.cs

Whether a user-verifying platform authenticator is available (https://w3c.github.io/webauthn/#sctn-isUserVerifyingPlatformAuthenticatorAvailable): an authenticator of WebAuthenticationOptions.Authenticators whose transport is internal and that can perform user verification.

public static Task<bool> IsUserVerifyingPlatformAuthenticatorAvailable()

ParseCreationOptionsFromJson(PublicKeyCredentialCreationOptionsJson)

PublicKeyCredential.cs

Converts the JSON type of the options of a registration (https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON): the base64url-encoded strings are decoded. Throws an EncodingError DomException when a value is not a valid base64url encoding.

public static PublicKeyCredentialCreationOptions ParseCreationOptionsFromJson(PublicKeyCredentialCreationOptionsJson options)

ParseRequestOptionsFromJson(PublicKeyCredentialRequestOptionsJson)

PublicKeyCredential.cs

Converts the JSON type of the options of an authentication (https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON): the base64url-encoded strings are decoded. Throws an EncodingError DomException when a value is not a valid base64url encoding.

public static PublicKeyCredentialRequestOptions ParseRequestOptionsFromJson(PublicKeyCredentialRequestOptionsJson options)

SignalAllAcceptedCredentials(AllAcceptedCredentialsOptions)

PublicKeyCredential.cs

Signals the complete list of the credentials of a user (https://w3c.github.io/webauthn/#sctn-signalAllAcceptedCredentials): the virtual authenticators remove the discoverable credentials of the user that are not in the list. The task fails with a TypeErrorException when a value is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.

public static Task SignalAllAcceptedCredentials(AllAcceptedCredentialsOptions options)

SignalCurrentUserDetails(CurrentUserDetailsOptions)

PublicKeyCredential.cs

Signals the current name and display name of a user (https://w3c.github.io/webauthn/#sctn-signalCurrentUserDetails): the virtual authenticators update the discoverable credential of the user. The task fails with a TypeErrorException when the user ID is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.

public static Task SignalCurrentUserDetails(CurrentUserDetailsOptions options)

SignalUnknownCredential(UnknownCredentialOptions)

PublicKeyCredential.cs

Signals that the relying party does not recognize a credential (https://w3c.github.io/webauthn/#sctn-signalUnknownCredential): the virtual authenticators remove it. The task fails with a TypeErrorException when the credential ID is not a valid base64url encoding, and a SecurityError DomException when the RP ID is not valid for the origin of the caller.

public static Task SignalUnknownCredential(UnknownCredentialOptions options)

Returns the JSON type of the credential (https://w3c.github.io/webauthn/#dom-publickeycredential-tojson): a RegistrationResponseJson or an AuthenticationResponseJson, whose binary values are base64url-encoded.

public object ToJson()