Пример #1
0
        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);
    }
Пример #3
0
        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();
 }