<div dir="ltr"><div>Hi Philip,</div><div><br></div><div>No, is should change after the timebox and I just ran you test by and I got the following output:<br></div><div><div>868722</div><div>651334</div><div>651334</div><div>651334</div><div>109894</div><div>109894</div><div>109894</div><div>398712</div><div>398712</div><div>398712</div></div><div><br></div><div>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]</div><div><br></div><div>[1] <a href="https://github.com/aerogear/aerogear-otp-java/blob/master/src/test/java/org/jboss/aerogear/security/otp/TotpTest.java#L107-L188">https://github.com/aerogear/aerogear-otp-java/blob/master/src/test/java/org/jboss/aerogear/security/otp/TotpTest.java#L107-L188</a></div><div><br></div><div>So I'm not sure what the problem is that you are seeing.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 4:03 PM, Philip Gillißen <span dir="ltr"><<a href="mailto:guerda@freenet.de" target="_blank">guerda@freenet.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear list,<br>
<br>
<br>
I recently discovered your library for TOTP and would like to include it in one of my applications.<br>
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.<br>
<br>
If I call generator.now() repeatedly, the token does not change, even if the timebox (30 seconds) is already finished.<br>
<br>
<br>
Here's a small demo code to show my problem:<br>
<br>
<br>
<br>
public static void main(String[] args) {<br>
String secret = Base32.random();<br>
Totp generator = new Totp(secret);<br>
for (int i = 0; i < 10; i++) {<br>
String tmpNow = generator.now();<br>
System.out.println(tmpNow);<br>
try {<br>
Thread.sleep(10000);<br>
} catch (InterruptedException e) {<br>
e.printStackTrace();<br>
}<br>
}<br>
<br>
}<br>
<br>
<br>
The printed out token is always the same. It only changes if I reinitialize the generator (Totp) with<br>
generator = new Totp(secret); each time I want to generate a token.<br>
<br>
<br>
My question is: Is this the desired behavior to only generate new tokens when the generator is newly created?<br>
Do I have to call any other method to check if a new token would be now applicable?<br>
<br>
<br>
Thanks in advance for your help!<br>
<br>
<br>
Kind regards,<br>
Philip<br>
<br>
<br>
<br>
<br>
<br>
---<br>
Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! <a href="http://email.freenet.de/basic/Informationen" rel="noreferrer" target="_blank">http://email.freenet.de/basic/Informationen</a><br>
<br>
<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cheers,<div> Erik Jan</div></div></div>
</div>