Пример #1
0
        private async Task <bool> TokenSecretFirstTimeSetup()
        {
            var noTokenMessage = new MessageDialog(this.resourceLoader.GetString("Message_NoTokenSecret"));
            await noTokenMessage.ShowAsync();

            var passphraseDialog = new RetrieveTokenSecretDialog();
            ContentDialogResult passphraseDialogResult = await passphraseDialog.ShowAsync();

            if (passphraseDialogResult == ContentDialogResult.Primary)
            {
                await ToggleProgressBar(true);

                var tokenStoredSecret = await client.GetTokenStoredSecret(passphraseDialog.TokenGeneratedOTP);

                TFTokenData tokenSecret = new TFTokenData();
                tokenSecret.SerialNumber = tokenStoredSecret.TokenSerialNumber;
                await Task.Run(() =>
                {
                    tokenSecret.SecretKey = engine.DecryptTokenSecret(tokenStoredSecret.TFKDEncryptedSecret, tokenStoredSecret.TFKDEncryptionSalt, passphraseDialog.Passphrase);
                });

                SettingsHelper.SaveSetting(Consts.SETTINGS_TOKEN_SECRET_KEY, tokenSecret);
                await ToggleProgressBar(false);

                return(true);
            }

            return(false);
        }
Пример #2
0
        private async Task GetAccessToken(string authorizationCode)
        {
            try
            {
                var token = await _client.GetOAuth2AccessToken(authorizationCode);

                SettingsHelper.SaveSetting("YubiCryptAccessToken", token);
            }
            catch (Exception)
            {
                throw;
            }
        }