Hi Philip,
No, is should change after the timebox and I just ran you test by and I got
the following output:
868722
651334
651334
651334
109894
109894
109894
398712
398712
398712
Some codes are there 3 time because the time box. So it's not always the
same? It's only the same for the configured time box 30 seconds by default.
Also there are test for the time box in the project [1]
[1]
https://github.com/aerogear/aerogear-otp-java/blob/master/src/test/java/o...
So I'm not sure what the problem is that you are seeing.
On Tue, Oct 27, 2015 at 4:03 PM, Philip Gillißen <guerda(a)freenet.de> wrote:
Dear list,
I recently discovered your library for TOTP and would like to include it
in one of my applications.
Unfortunately, I discovered a situation where the library does not do the
things I expected. I want to ask if this is me using the lib in a wrong way.
If I call generator.now() repeatedly, the token does not change, even if
the timebox (30 seconds) is already finished.
Here's a small demo code to show my problem:
public static void main(String[] args) {
String secret = Base32.random();
Totp generator = new Totp(secret);
for (int i = 0; i < 10; i++) {
String tmpNow = generator.now();
System.out.println(tmpNow);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
The printed out token is always the same. It only changes if I
reinitialize the generator (Totp) with
generator = new Totp(secret); each time I want to generate a token.
My question is: Is this the desired behavior to only generate new tokens
when the generator is newly created?
Do I have to call any other method to check if a new token would be now
applicable?
Thanks in advance for your help!
Kind regards,
Philip
---
Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen!
http://email.freenet.de/basic/Informationen
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
--
Cheers,
Erik Jan