/// <summary> /// Returns CredentialCreateOptions including a challenge to be sent to the browser/authr to create new credentials /// </summary> /// <returns></returns> /// <param name="attestationPreference">This member is intended for use by Relying Parties that wish to express their preference for attestation conveyance. The default is none.</param> /// <param name="excludeCredentials">Recommended. This member is intended for use by Relying Parties that wish to limit the creation of multiple credentials for the same account on a single authenticator.The client is requested to return an error if the new credential would be created on an authenticator that also contains one of the credentials enumerated in this parameter.</param> public CredentialCreateOptions RequestNewCredential( Fido2User user, List <PublicKeyCredentialDescriptor> excludeCredentials, AuthenticatorSelection authenticatorSelection, AttestationConveyancePreference attestationPreference, AuthenticationExtensionsClientInputs extensions = null) { var challenge = new byte[_config.ChallengeSize]; _crypto.GetBytes(challenge); var options = CredentialCreateOptions.Create(_config, challenge, user, authenticatorSelection, attestationPreference, excludeCredentials, extensions); return(options); }
/// <summary> /// Returns CredentialCreateOptions including a challenge to be sent to the browser/authr to create new credentials /// </summary> /// <returns></returns> /// <param name="attestationPreference">This member is intended for use by Relying Parties that wish to express their preference for attestation conveyance. The default is none.</param> /// <param name="excludeCredentials">Recommended. This member is intended for use by Relying Parties that wish to limit the creation of multiple credentials for the same account on a single authenticator.The client is requested to return an error if the new credential would be created on an authenticator that also contains one of the credentials enumerated in this parameter.</param> public CredentialCreateOptions RequestNewCredential(User user, List <PublicKeyCredentialDescriptor> excludeCredentials, AuthenticatorSelection authenticatorSelection, AttestationConveyancePreference attestationPreference) { // note: I have no idea if this crypto is ok... var challenge = new byte[Config.ChallengeSize]; _crypto.GetBytes(challenge); var options = CredentialCreateOptions.Create(Config, challenge, user, authenticatorSelection, attestationPreference, excludeCredentials); return(options); }
public static CredentialCreateOptions Create(Configuration config, byte[] challenge, User user, AuthenticatorSelection authenticatorSelection, AttestationConveyancePreference attestationConveyancePreference, List <PublicKeyCredentialDescriptor> excludeCredentials, AuthenticationExtensionsClientInputs extensions) { return(new CredentialCreateOptions { Status = "ok", ErrorMessage = string.Empty, Challenge = challenge, Rp = new Rp(config.ServerDomain, config.ServerName), Timeout = config.Timeout, User = user, PubKeyCredParams = new List <PubKeyCredParam>() { // Add additional as appropriate ES256, RS256, PS256, ES384, RS384, PS384, ES512, RS512, PS512, }, AuthenticatorSelection = authenticatorSelection, Attestation = attestationConveyancePreference, ExcludeCredentials = excludeCredentials ?? new List <PublicKeyCredentialDescriptor>(), Extensions = extensions }); }