time2fa
time2fa copied to clipboard
Validation of TOTP always false when adding custom period
Hi
I wanted to use your package. But I face an issue.
I tried to following to create a TOTP
// Generate the OTP
const config = generateConfig({
period: 120,
});
const secret = generateSecret(config.secretSize);
const codes = Totp.generatePasscodes({ secret: secret }, config);
and the following to validate (of course with passcode and secret from above)
// Validate the OTP
const config = generateConfig({
period: 120,
});
const valid = Totp.validate({ passcode: '097991', secret: '2X4A3XCNPJJSHU4O' }, config);
This always results in false
. When I remove the period: 120
in the config, it works.
Any idea? Is there a limit for the period?