Hi,
I'm using the AeroGear OTP library to generate a TOTP that's valid for 30 minutes as opposed to the default 30 seconds. I noticed (as far as I'm aware) that I cannot change the AGClock interval. I've had a look at the source code and the counter is always `/ 30` as opposed to a `/ timeInterval` in the Java implementation. Am I using this correctly if I want my TOTP to be valid for 30 minutes instead? Or is the intention to use - {code}(id)initWithDate:(NSDate *)startingDate {code} and provide an NSDate that is 30 minutes in the future?
iOS Objective-C
{code} - (uint64_t)currentInterval {
NSTimeInterval seconds = [self.date timeIntervalSince1970]; uint64_t counter = (uint64_t) (seconds / 30); return counter; } {code}
Java
{code:java} public long getCurrentInterval() { calendar = GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC")); long currentTimeSeconds = calendar.getTimeInMillis() / 1000; return currentTimeSeconds / interval; } {code}
Regards, Michael |
|