Exemple #1
0
        public void TestOtp(string uri, int ref1, int ref2, int offset)
        {
            var otpuri = new Uri(uri);
            var otp    = OtpGenerator.ParseUri(otpuri);

            Assert.AreEqual(ref1, otp.GenerateRaw());
            Assert.AreEqual(ref2, otp.GenerateRaw(offset - 1));
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Enter URI to parse:");
            var suri = Console.ReadLine();
            var uri  = new Uri(suri);
            var otp  = OtpGenerator.ParseUri(uri);

            while (true)
            {
                Console.WriteLine("New window:");
                foreach (var code in otp.GenerateWindow(groupSize: 3))
                {
                    Console.WriteLine(code);
                }

                if (Console.ReadKey(true).KeyChar == 'q')
                {
                    return;
                }
            }
        }