diff options
author | Christoph Enzmann <christoph.enzmann@confer.ch> | 2013-12-05 13:13:15 +0100 |
---|---|---|
committer | Christoph Enzmann <christoph.enzmann@confer.ch> | 2013-12-05 13:13:15 +0100 |
commit | 9b8c9cc8bafa315516b6ac704859c6d13ce1b768 (patch) | |
tree | 5f4ffdafc831bc27c48f5f3f255ea1242564f895 | |
parent | 296062ea41f87ba3f3167a51b1212235eee9bbb0 (diff) | |
download | TwoStepsAuthenticator-9b8c9cc8bafa315516b6ac704859c6d13ce1b768.zip TwoStepsAuthenticator-9b8c9cc8bafa315516b6ac704859c6d13ce1b768.tar.gz TwoStepsAuthenticator-9b8c9cc8bafa315516b6ac704859c6d13ce1b768.tar.bz2 |
Interface for UsedCodesManager
-rw-r--r-- | TwoStepsAuthenticator/IUsedCodesManager.cs | 25 | ||||
-rw-r--r-- | TwoStepsAuthenticator/TwoStepsAuthenticator.csproj | 1 | ||||
-rw-r--r-- | TwoStepsAuthenticator/UsedCodesManager.cs | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/TwoStepsAuthenticator/IUsedCodesManager.cs b/TwoStepsAuthenticator/IUsedCodesManager.cs new file mode 100644 index 0000000..205df9d --- /dev/null +++ b/TwoStepsAuthenticator/IUsedCodesManager.cs @@ -0,0 +1,25 @@ +using System; + +namespace TwoStepsAuthenticator { + + /// <summary> + /// Manages used code to prevent repeated use of a code. + /// </summary> + interface IUsedCodesManager { + + /// <summary> + /// Adds secret/code pair. + /// </summary> + /// <param name="secret"></param> + /// <param name="code"></param> + void AddCode(string secret, string code); + + /// <summary> + /// Checks if code was previously used. + /// </summary> + /// <param name="secret"></param> + /// <param name="code"></param> + /// <returns></returns> + bool IsCodeUsed(string secret, string code); + } +} diff --git a/TwoStepsAuthenticator/TwoStepsAuthenticator.csproj b/TwoStepsAuthenticator/TwoStepsAuthenticator.csproj index 467679a..2ca64ae 100644 --- a/TwoStepsAuthenticator/TwoStepsAuthenticator.csproj +++ b/TwoStepsAuthenticator/TwoStepsAuthenticator.csproj @@ -42,6 +42,7 @@ <Compile Include="Base32Encoding.cs" /> <Compile Include="Authenticator.cs" /> <Compile Include="CounterAuthenticator.cs" /> + <Compile Include="IUsedCodesManager.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="TimeAuthenticator.cs" /> <Compile Include="UsedCodesManager.cs" /> diff --git a/TwoStepsAuthenticator/UsedCodesManager.cs b/TwoStepsAuthenticator/UsedCodesManager.cs index 0359acb..57699c5 100644 --- a/TwoStepsAuthenticator/UsedCodesManager.cs +++ b/TwoStepsAuthenticator/UsedCodesManager.cs @@ -7,7 +7,7 @@ using System.Timers; namespace TwoStepsAuthenticator { - public class UsedCodesManager + public class UsedCodesManager : TwoStepsAuthenticator.IUsedCodesManager { internal class UsedCode { |