Skip to main content

PublicKeyCredentialParameters

Namespace: Wisej.Ext.WebAuthn

Assembly: Wisej.Ext.WebAuthn (4.1.0.0)

Contains information about the desired properties of the credential to be created.

public class PublicKeyCredentialParameters

See #dictdef-publickeycredentialparameters.

Constructors​

Instance member PublicKeyCredentialParameters()​

Creates a new instance of PublicKeyCredentialParameters.

Example:

var parameter = new PublicKeyCredentialParameters
{
Alg = COSEAlgorithmIdentifier.ES256
};

Instance member PublicKeyCredentialParameters(alg, type)​

Creates a new instance of PublicKeyCredentialParameters with the given configuration.

NameTypeDescription
algCOSEAlgorithmIdentifierThe signature algorithm the new credential will use.
typeStringThe type of credential key. Defaults to "public-key".

Example:

// List the accepted algorithms in order of preference.
var parameters = new[]
{
new PublicKeyCredentialParameters(COSEAlgorithmIdentifier.ES256),
new PublicKeyCredentialParameters(COSEAlgorithmIdentifier.RS256)
};

CredentialsResponse response = await WebAuthn.CreateAsync(
challenge, rp, user, parameters, selection, 60000, AttestationConveyancePreference.None);

Properties​

Instance member Alg​

COSEAlgorithmIdentifier: Specifies the cryptographic signature algorithm with which the newly generated credential will be used, and thus also the type of asymmetric key pair to be generated, e.g., RSA or Elliptic Curve.

Instance member Type​

String: This member specifies the type of credential to be created (i.e. "public-key").

Methods​

Instance member ToJSON()​

Returns a JSON representation of the current object.

Returns: String. A JSON string with the type and alg members, where alg is the numeric COSE identifier.

Example:

var parameter = new PublicKeyCredentialParameters(COSEAlgorithmIdentifier.ES256);

string json = parameter.ToJSON();
// {"type":"public-key","alg":-7}