Esempio n. 1
0
 /// <summary>
 /// Remaining seconds in current window
 /// </summary>
 /// <param name="timestamp">The timestamp</param>
 /// <returns>Number of remaining seconds</returns>
 public int RemainingSeconds(DateTime timestamp)
 {
     return(UnixTimestampHelper.RemainingSecondsForSpecificTime(correctedTime.GetCorrectedTime(timestamp), step));
 }
Esempio n. 2
0
        private bool VerifyTotpForSpecificTime(DateTime timestamp, string totp, VerificationWindow window, out long timeStepMatched)
        {
            var initialStep = UnixTimestampHelper.CalculateTimeStepFromTimestamp(timestamp, step);

            return(Verify(initialStep, totp, out timeStepMatched, window));
        }
Esempio n. 3
0
 /// <summary>
 /// Remaining seconds in current window based on UtcNow
 /// </summary>
 /// <remarks>
 /// It will be corrected against a corrected UTC time using the provided time correction.  If none was provided then simply the current UTC will be used.
 /// </remarks>
 /// <returns>Number of remaining seconds</returns>
 public int RemainingSeconds()
 {
     return(UnixTimestampHelper.RemainingSecondsForSpecificTime(correctedTime.CorrectedUtcNow, step));
 }
Esempio n. 4
0
        private string ComputeTotpFromSpecificTime(DateTime timestamp)
        {
            var window = UnixTimestampHelper.CalculateTimeStepFromTimestamp(timestamp, step);

            return(Compute(window, hashMode));
        }