private async Task LoadSettings() { YubiCryptOAuth2Token storedAccessToken = SettingsHelper.LoadSetting <YubiCryptOAuth2Token>(Consts.SETTINGS_ACCESS_TOKEN_KEY); TFTokenData storedTokenSecretData = SettingsHelper.LoadSetting <TFTokenData>(Consts.SETTINGS_TOKEN_SECRET_KEY); var localStoredFiles = await localStorageFolder.GetFilesAsync(); if (storedAccessToken != null) { authenticationInfoText.Text = string.Format("Access token expires: {0}", storedAccessToken.Expires); DeleteTokenButton.IsEnabled = true; } else { authenticationInfoText.Text = "No access token."; DeleteTokenButton.IsEnabled = false; } if (storedTokenSecretData != null) { keyStorageInfoText.Text = string.Format("Storing Secret Key for token with Serial# {0}.", storedTokenSecretData.SerialNumber); DeleteKeyButton.IsEnabled = true; } else { keyStorageInfoText.Text = "No stored token information"; DeleteKeyButton.IsEnabled = false; } DeleteLocalFilesButton.IsEnabled = false; LocalFileStorageInfo.Text = string.Format("{0} decrypted file(s) stored locally.", localStoredFiles.Count); if (localStoredFiles.Count > 0) { DeleteLocalFilesButton.IsEnabled = true; } }
private async Task RefreshUI() { YubiCryptOAuth2Token storedAccessToken = SettingsHelper.LoadSetting <YubiCryptOAuth2Token>(Consts.SETTINGS_ACCESS_TOKEN_KEY); if (CheckAccessToken(storedAccessToken)) { client = new YubiCryptClient(clientId, clientSecret, storedAccessToken); if (!IsTokenSecretAvailable()) { await TokenSecretFirstTimeSetup(); return; } var secret = SettingsHelper.LoadSetting <TFTokenData>(Consts.SETTINGS_TOKEN_SECRET_KEY); await LoadFileListAsync(); } else { await RenewAccessToken(); } }