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

                var keyHash = await _cryptoService.HashPasswordAsync(password, null);

                var storedKeyHash = await _cryptoService.GetKeyHashAsync();

                if (storedKeyHash == null || keyHash == null || storedKeyHash != keyHash)
                {
                    return(false);
                }

                return(true);
            };

            return(await _platformUtilsService.ShowPasswordDialogAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, validator));
        }
        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));
        }
Esempio n. 3
0
 public async Task <bool> ShowPasswordPromptAsync()
 {
     return(await _platformUtilsService.ShowPasswordDialogAsync(AppResources.PasswordConfirmation, AppResources.PasswordConfirmationDesc, ValidatePasswordAsync));
 }