Exemple #1
0
        private void btnCreateOTP_Click(object sender, EventArgs e)
        {
            if (cboKeys.SelectedIndex < 0)
            {
                return;
            }
            YubikeySettings key = ((YubikeysCollection)cboKeys.DataSource)[cboKeys.SelectedIndex];
            string          otp = OTPCreator.CreateOTP(key, this);

            txtOTP.Text = otp;
            Clipboard.SetData(DataFormats.StringFormat, otp);
        }
Exemple #2
0
        void _enterOTPHandler_OnHotKeyEvent(object sender, EventArgs e)
        {
            if (cboKeys.SelectedIndex < 0)
            {
                return;
            }
            YubikeySettings key = ((YubikeysCollection)cboKeys.DataSource)[cboKeys.SelectedIndex];
            string          otp = OTPCreator.CreateOTP(key, this);

            txtOTP.Text = otp;
            SendKeys.SendWait(otp);
            if (key.PressEnter)
            {
                SendKeys.Flush();
                Thread.Sleep(_enterKeyDelay);
                SendKeys.Send("{ENTER}");
            }
        }