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.
- C#
- VB.NET
public class PublicKeyCredentialParameters
Public Class PublicKeyCredentialParameters
See #dictdef-publickeycredentialparameters.
Constructors
PublicKeyCredentialParameters()
Creates a new instance of PublicKeyCredentialParameters.
Example:
var parameter = new PublicKeyCredentialParameters
{
Alg = COSEAlgorithmIdentifier.ES256
};
PublicKeyCredentialParameters(alg, type)
Creates a new instance of PublicKeyCredentialParameters with the given configuration.
| Name | Type | Description |
|---|---|---|
| alg | COSEAlgorithmIdentifier | The signature algorithm the new credential will use. |
| type | String | The 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
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.
Type
String: This member specifies the type of credential to be created (i.e. "public-key").
Methods
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}