Exemplo n.º 1
1
        private void button2_Click(object sender, EventArgs e)
        {
            key = Base32Encoder.Decode(textBox2.Text);
            otp = new Totp(key);
            label3.Text = otp.ComputeTotp();

            timer1.Enabled = true;
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            key = KeyGeneration.GenerateRandomKey(40);

            textBox1.Text = Base32Encoder.Encode(key);

            otp = new Totp(key);
            label1.Text = otp.ComputeTotp();

            var url = KeyUrl.GetTotpUrl(key, "VERYVERYVERYVERYLONG");
            label2.Text = url;

            writer.Format = BarcodeFormat.QR_CODE;
            writer.Options.PureBarcode = false;
            writer.Options.Margin = 0;
            writer.Options.Width = 175;
            writer.Options.Height = 175;
            var matrix = writer.Encode(url);
            pictureBox1.Image = render.Render(matrix, BarcodeFormat.QR_CODE, string.Empty);
            pictureBox1.Invalidate();

            timer1.Enabled = true;
        }