diff options
Diffstat (limited to 'TwoStepsAuthenticator/CounterAuthenticator.cs')
-rw-r--r-- | TwoStepsAuthenticator/CounterAuthenticator.cs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/TwoStepsAuthenticator/CounterAuthenticator.cs b/TwoStepsAuthenticator/CounterAuthenticator.cs index fffae73..ae67ee5 100644 --- a/TwoStepsAuthenticator/CounterAuthenticator.cs +++ b/TwoStepsAuthenticator/CounterAuthenticator.cs @@ -11,14 +11,12 @@ namespace TwoStepsAuthenticator { /// </summary> public class CounterAuthenticator : Authenticator { private readonly int WindowSize; - private readonly IUsedCodesManager UsedCodeManager; - public CounterAuthenticator(int windowSize = 10, IUsedCodesManager usedCodeManager = null) { + public CounterAuthenticator(int windowSize = 10) { if (windowSize <= 0) { throw new ArgumentException("look-ahead window size must be positive"); } - this.UsedCodeManager = (usedCodeManager == null) ? Authenticator.DefaultUsedCodeManager.Value : usedCodeManager; this.WindowSize = windowSize; } @@ -59,11 +57,9 @@ namespace TwoStepsAuthenticator { for (uint i = 0; i <= WindowSize; i++) { ulong checkCounter = counter + i; - if (ConstantTimeEquals(GetCode(secret, checkCounter), code) && !UsedCodeManager.IsCodeUsed(checkCounter, code)) { + if (ConstantTimeEquals(GetCode(secret, checkCounter), code)) { codeMatch = true; successfulSequenceNumber = checkCounter; - - UsedCodeManager.AddCode(successfulSequenceNumber, code); } } |