public bool Verify(long otp, OAuthUser user) { var key = user.GetOTPKey(); for (long i = user.OTPCounter - _options.HOTPWindow; i <= user.OTPCounter; i++) { if (GenerateOtp(key, i) == otp) { return(true); } } return(false); }
public bool Verify(long otp, OAuthUser user) { var currentDateTime = DateTime.UtcNow; var key = user.GetOTPKey(); for (long offset = -1; offset <= 1; offset++) { var step = CalculateTimeStep(currentDateTime) + offset; if (GenerateOtp(key, step) == otp) { return(true); } } return(false); }
public long GenerateOtp(OAuthUser oauthUser, DateTime date) { return(GenerateOtp(oauthUser.GetOTPKey(), CalculateTimeStep(date))); }
public long GenerateOtp(OAuthUser oauthUser) { return(GenerateOtp(oauthUser.GetOTPKey(), CalculateTimeStep(DateTime.UtcNow))); }
public long GenerateOtp(OAuthUser user) { return(GenerateOtp(user.GetOTPKey(), user.OTPCounter)); }