コード例 #1
0
 /// <summary>
 /// Initialize an OTP instance with the shared secret generated on Registration process
 /// </summary>
 /// <param name="secret"> Shared secret </param>
 /// <param name="clock">  Clock responsible for retrieve the current interval </param>
 public Totp(string secret, Clock clock)
 {
     this.secret = secret;
     this.clock  = clock;
 }
コード例 #2
0
        public void TestClock()
        {
            //given
            var clock = new Clock(1);

            //when
            var interval = clock.CurrentInterval;

            //then
            //interval is bigger then the one from now
            Assert.IsTrue(interval > 1443013417L);
        }
コード例 #3
0
 /// <summary>
 /// Initialize an OTP instance with the shared secret generated on Registration process
 /// </summary>
 /// <param name="secret"> Shared secret </param>
 public Totp(string secret)
 {
     this.secret = secret;
     clock       = new Clock();
 }