Exemplo n.º 1
0
        private async Task <bool> ValidatePasswordAsync(string password)
        {
            // Assume user has canceled.
            if (string.IsNullOrWhiteSpace(password))
            {
                return(false);
            }
            ;

            return(await _cryptoService.CompareAndUpdateKeyHashAsync(password, null));
        }
        public async Task <bool> ShowPasswordPromptAsync()
        {
            Func <string, Task <bool> > validator = async(string password) =>
            {
                // Assume user has canceled.
                if (string.IsNullOrWhiteSpace(password))
                {
                    return(false);
                }
                ;

                return(await _cryptoService.CompareAndUpdateKeyHashAsync(password, null));
            };

            return(await _platformUtilsService.ShowPasswordDialogAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, validator));
        }
Exemplo n.º 3
0
        async public Task <bool> VerifyUser(string secret, VerificationType verificationType)
        {
            if (string.IsNullOrEmpty(secret))
            {
                await InvalidSecretErrorAsync(verificationType);

                return(false);
            }

            if (verificationType == VerificationType.OTP)
            {
                var request = new VerifyOTPRequest(secret);
                try
                {
                    await _apiService.PostAccountVerifyOTPAsync(request);
                }
                catch
                {
                    await InvalidSecretErrorAsync(verificationType);

                    return(false);
                }
            }
            else
            {
                var passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(secret, null);

                if (!passwordValid)
                {
                    await InvalidSecretErrorAsync(verificationType);

                    return(false);
                }
            }

            return(true);
        }