diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -1,6 +1,30 @@ TwoStepsAuthenticator ===================== -.net implementation of the TOTP: Time-Based One-Time Password Algorithm - RFC 6238 http://tools.ietf.org/html/rfc6238 +.net implementation of the TOTP: Time-Based One-Time Password Algorithm<br/> +RFC 6238 http://tools.ietf.org/html/rfc6238 compatible with Microsoft Authenticator for Windows Phone, and Google Authenticator for Android and iPhone. + +You can use this library as well for a client application (if you want to create your own authenticator) or for a server application (add two-step authentication on your asp.net website) + +For a client application, you need to save the secret key for your user. <br/> +Then, you only have to call the method GetCode(string) : + +<pre><code>var secret = user.secretAuthToken; +var authenticator = new TwoStepsAuthenticator.Authenticator(); +var code = authenticator.GetCode(secret);</code></pre> + +On a server application, you will have to generate a secret key, and share it with the user, who will have to enter it in his own authenticator app. + +<pre><code>var authenticator = new TwoStepsAuthenticator.Authenticator(); +var key = authenticator.GenerateKey();</code></pre> + +When the user will login, he will have to give you the code generated by his authenticator.<br/> +You can check if the code is correct with the method CheckCode(string secret, string code).<br/> +If the code is incorrect, don't log him. + +<pre><code>var secret = user.secretAuthToken; +var code = Request.Form["code"]; +var authenticator = new TwoStepsAuthenticator.Authenticator(); +var isok = authenticator.CheckCode(secret, code);</code></pre> |