public void TOTP_GenerateCode() { var result = TOTP.GenerateCode(); Assert.IsNotNull(result.Secret); Assert.AreNotEqual(0, result.Code); }
public void Veryfying() { var key = TOTP.GenerateKey(); var code = TOTP.GenerateCode(key); var result = TOTP.VerifyCode(key, code); result.Should().BeTrue(); }
public void TOTP_IsValid_out_of_sync_clocks() { var result = TOTP.GenerateCode(); Assert.IsTrue(TOTP.IsValid(result.Code, result.Secret, DateTime.UtcNow.AddSeconds(-32), 90)); }
public void TOTP_IsValid_fails() { var result = TOTP.GenerateCode(); Assert.IsFalse(TOTP.IsValid(result.Code, result.Secret, DateTime.UtcNow.AddSeconds(300), 90)); }