public async Task BuildCredentialRegistrationOptionsAsync()

in Source/WebApp-IdentityProvider-MFA/Services/FIDO2TwoFactorProvider.cs [133:165]


        public async Task<CredentialCreateOptions> BuildCredentialRegistrationOptionsAsync(ApplicationUser user)
        {
            try
            {
                var fidoUser = new Fido2ApplicationUser(user);

                var items = await _fido2credentialsStore.GetCredentialsByUserAsync(fidoUser);

                List<PublicKeyCredentialDescriptor> existingCredentials = (await _fido2credentialsStore.GetCredentialsByUserAsync(fidoUser)).Select(c => new PublicKeyCredentialDescriptor(c.CredentialId)).ToList();

                var authenticatorSelection = new AuthenticatorSelection
                {
                    RequireResidentKey = false,
                    UserVerification = UserVerificationRequirement.Preferred
                };
                var extensions = new AuthenticationExtensionsClientInputs
                {
                    Extensions = true,
                    Location = true,
                    UserVerificationIndex = true,
                    UserVerificationMethod = true,
                    BiometricAuthenticatorPerformanceBounds = new AuthenticatorBiometricPerfBounds { FAR = float.MaxValue, FRR = float.MaxValue }
                };

                var options = _fido2.RequestNewCredential(fidoUser, existingCredentials, authenticatorSelection, AttestationConveyancePreference.None, extensions);

                return options;
            }
            catch (Exception e)
            {/*TODO*/
                return null;
            }
        }