/// <summary>
        /// SetRegisterCredentialResult method implementation
        /// </summary>
        private int SetRegisterCredentialResult(AuthenticationContext ctx, string jsonResponse)
        {
            try
            {
                string jsonOptions = ctx.CredentialOptions;
                if (string.IsNullOrEmpty(jsonOptions))
                {
                    throw new ArgumentNullException(jsonOptions);
                }
                if (string.IsNullOrEmpty(jsonResponse))
                {
                    throw new ArgumentNullException(jsonResponse);
                }

                MFAWebAuthNUser user = RuntimeRepository.GetUser(Config, ctx.UPN);
                if (user != null)
                {
                    RegisterCredentialOptions options = RegisterCredentialOptions.FromJson(jsonOptions);


                    bool callback(IsCredentialIdUniqueToUserParams args)
                    {
                        var users = RuntimeRepository.GetUsersByCredentialId(Config, user, args.CredentialId);

                        if (users.Count > 0)
                        {
                            return(false);
                        }
                        return(true);
                    }

                    AuthenticatorAttestationRawResponse attestationResponse = JsonConvert.DeserializeObject <AuthenticatorAttestationRawResponse>(jsonResponse);
                    RegisterCredentialResult            success             = _webathn.SetRegisterCredentialResult(attestationResponse, options, callback);

                    RuntimeRepository.AddUserCredential(Config, options.User.FromCore(), new MFAUserCredential
                    {
                        Descriptor       = new MFAPublicKeyCredentialDescriptor(success.Result.CredentialId),
                        PublicKey        = success.Result.PublicKey,
                        UserHandle       = success.Result.User.Id,
                        SignatureCounter = success.Result.Counter,
                        CredType         = success.Result.CredType,
                        RegDate          = DateTime.Now,
                        AaGuid           = success.Result.Aaguid
                    });
                    return((int)AuthenticationResponseKind.Biometrics);
                }
                else
                {
                    Log.WriteEntry(string.Format("{0}\r\n{1}", ctx.UPN, "User does not exists !"), System.Diagnostics.EventLogEntryType.Error, 5000);
                    return((int)AuthenticationResponseKind.Error);
                }
            }
            catch (Exception e)
            {
                Log.WriteEntry(string.Format("{0}\r\n{1}", ctx.UPN, e.Message), System.Diagnostics.EventLogEntryType.Error, 5000);
                return((int)AuthenticationResponseKind.Error);
            }
        }
        /// <summary>
        /// SetRegisterCredentialResult method implementation
        /// </summary>
        private int SetRegisterCredentialResult(AuthenticationContext ctx, string jsonResponse, out string error)
        {
            bool isDeserialized = false;

            try
            {
                string jsonOptions = ctx.CredentialOptions;
                if (string.IsNullOrEmpty(jsonOptions))
                {
                    throw new ArgumentNullException(jsonOptions);
                }
                if (string.IsNullOrEmpty(jsonResponse))
                {
                    throw new ArgumentNullException(jsonResponse);
                }

                MFAWebAuthNUser user = RuntimeRepository.GetUser(Config, ctx.UPN);
                if (user != null)
                {
                    CredentialCreateOptions options = CredentialCreateOptions.FromJson(jsonOptions);

#pragma warning disable CS1998 // Cette méthode async n'a pas d'opérateur 'await' et elle s'exécutera de façon synchrone
                    IsCredentialIdUniqueToUserAsyncDelegate callback = async(args) =>
#pragma warning restore CS1998 // Cette méthode async n'a pas d'opérateur 'await' et elle s'exécutera de façon synchrone
                    {
                        var users = RuntimeRepository.GetUsersByCredentialId(Config, user, args.CredentialId);
                        if (users.Count > 0)
                        {
                            return(false);
                        }
                        return(true);
                    };
                    AuthenticatorAttestationRawResponse attestationResponse = JsonConvert.DeserializeObject <AuthenticatorAttestationRawResponse>(jsonResponse);
                    isDeserialized = true;
                    CredentialMakeResult success = _webathn.SetRegisterCredentialResult(attestationResponse, options, callback).Result;

                    RuntimeRepository.AddUserCredential(Config, user, new MFAUserCredential
                    {
                        Descriptor       = new MFAPublicKeyCredentialDescriptor(success.Result.CredentialId),
                        PublicKey        = success.Result.PublicKey,
                        UserHandle       = success.Result.User.Id,
                        SignatureCounter = success.Result.Counter,
                        CredType         = success.Result.CredType,
                        RegDate          = DateTime.Now,
                        AaGuid           = success.Result.Aaguid,
                        NickName         = ctx.NickName
                    });
                    error = string.Empty;
                    return((int)AuthenticationResponseKind.Biometrics);
                }
                else
                {
                    Log.WriteEntry(string.Format("{0}\r\n{1}", ctx.UPN, "User does not exists !"), System.Diagnostics.EventLogEntryType.Error, 5000);
                    error = string.Format("{0}\r\n{1}", ctx.UPN, "User does not exists !");
                    return((int)AuthenticationResponseKind.Error);
                }
            }
            catch (Exception e)
            {
                if (isDeserialized)
                {
                    Log.WriteEntry(string.Format("{0}\r\n{1}", ctx.UPN, e.Message), EventLogEntryType.Error, 5000);
                }
                else
                {
                    Log.WriteEntry(string.Format("{0}\r\n{1}", ctx.UPN, jsonResponse), EventLogEntryType.Error, 5000);
                }
                error = e.Message;
                return((int)AuthenticationResponseKind.Error);
            }
        }