You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like a code to be valid only for 30 second in its period:
int MFA_PERIOD = 30;
int MFA_ALLOWED_TIME_PERIOD_DISCREPANCY = 0;
DefaultCodeVerifier verifier = new DefaultCodeVerifier(codeGenerator, timeProvider);
verifier.setTimePeriod(MFA_PERIOD );
verifier.setAllowedTimePeriodDiscrepancy(MFA_ALLOWED_TIME_PERIOD_DISCREPANCY);
But when i call the method "isValidCode" i get:
java.lang.ArithmeticException: / by zero
at java.base/java.lang.Math.floorDiv(Math.java:1288)
at dev.samstevens.totp.code.DefaultCodeVerifier.isValidCode(DefaultCodeVerifier.java:30)
I can get the same result doing:
MFA_PERIOD = 15;
MFA_ALLOWED_TIME_PERIOD_DISCREPANCY = 1;
t|--------------|-----15sec----|
^generating otp xyz
t|-----------------------------|
xyz is valid for 30 secondi
But is this the correct solution?
The text was updated successfully, but these errors were encountered:
alessandroAmedei
changed the title
AllowedTimePeriodDiscrepancy can not be zero
"java.lang.ArithmeticException: / by zero" AllowedTimePeriodDiscrepancy can not be zero
Oct 23, 2024
I would like a code to be valid only for 30 second in its period:
But when i call the method "isValidCode" i get:
I can get the same result doing:
But is this the correct solution?
The text was updated successfully, but these errors were encountered: