summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Jennings <stephen.g.jennings@gmail.com>2014-03-19 01:58:13 -0700
committerStephen Jennings <stephen.g.jennings@gmail.com>2014-03-19 01:58:13 -0700
commitbcae90ac8719d742233d36f9493110aed2bb194a (patch)
tree801047369a3603501b084636f37b890fe65b32f8
parent78638ebfa58b6078a99961178da6106655a6b014 (diff)
downloadOATH.Net-bcae90ac8719d742233d36f9493110aed2bb194a.zip
OATH.Net-bcae90ac8719d742233d36f9493110aed2bb194a.tar.gz
OATH.Net-bcae90ac8719d742233d36f9493110aed2bb194a.tar.bz2
Update README
-rw-r--r--README.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/README.md b/README.md
index 56cb373..be0d66c 100644
--- a/README.md
+++ b/README.md
@@ -20,17 +20,18 @@ Add to your project with "`Install-Package OATH.Net`".
string secretKey = user.SecretKey;
int otpDigits = 8;
- Key key = new Key(secretKey);
+ Key key = new Key(); // Generate a new key
+ user.SecretKey = key.Base32; // Persist this for later
+
TimeBasedOtpGenerator otp = new TimeBasedOtpGenerator(key, otpDigits);
return otp.GenerateOtp(DateTime.UtcNow);
}
public bool AuthorizedWithTOTP(string userSuppliedCode, User user)
{
- string secretKey = user.SecretKey;
int otpDigits = 8;
+ Key key = new Key(user.SecretKey);
- Key key = new Key(secretKey);
TimeBasedOtpGenerator otp = new TimeBasedOtpGenerator(key, otpDigits);
return otp.ValidateOtp(userSuppliedCode, DateTime.UtcNow);
}
@@ -40,11 +41,10 @@ Add to your project with "`Install-Package OATH.Net`".
public bool AuthorizedWithHOTP(string userSuppliedCode, User user)
{
- string secretKey = user.SecretKey;
int otpDigits = 8;
int counterValue = user.NextCounterValue();
+ Key key = new Key(user.SecretKey);
- Key key = new Key(secretKey);
CounterBasedOtpGenerator otp = new CounterBasedOtpGenerator(key, otpDigits);
string validCode = otp.ComputeOtp(counterValue);