public void ShouldGenerateRightCode()
        {
            Totp totp = new Totp(secret, new StaticClock());

            string now = totp.now();

            Assert.AreEqual("002941", now);
            totp.verify(now);
        }
示例#2
0
    public void generateOTP(string unparsed)
    {
        var secret = JsonHelper.Deserialize<string[]>(unparsed)[0];

        Totp generator = new Totp(secret);

        PluginResult result = new PluginResult(PluginResult.Status.OK, generator.now());
        DispatchCommandResult(result);
    }
        public void ShouldGenerateRightCodeTwoDigits()
        {
            Totp totp = new Totp(secret, new StaticClock(), Digits.Two);

            string now = totp.now();

            Assert.AreEqual("41", now);
            totp.verify(now);
        }
示例#4
0
 private string generate(string secret)
 {
     Totp generator = new Totp(secret);
     return generator.now();
 }