Skip to content

otplib API Documentation / otplib / / OTPVerifyFunctionalOptions

Type Alias: OTPVerifyFunctionalOptions ​

OTPVerifyFunctionalOptions = OTPFunctionalOptions & object

Defined in: packages/otplib/src/types.ts:123

Options for OTP verification

Extends OTPFunctionalOptions with token and tolerance parameters.

Type Declaration ​

afterTimeStep? ​

optional afterTimeStep?: number

Minimum allowed TOTP time step for replay protection (optional)

Rejects tokens with timeStep <= afterTimeStep. Only used by TOTP strategy.

counterTolerance? ​

optional counterTolerance?: number | [number, number]

Counter tolerance for HOTP verification (default: 0)

  • Number: creates look-ahead only tolerance [0, n]
  • Tuple [past, future]: explicit window control

epochTolerance? ​

optional epochTolerance?: number | [number, number]

Time tolerance in seconds for TOTP verification (default: 0)

  • Number: symmetric tolerance (same for past and future)
  • Tuple [past, future]: asymmetric tolerance Use [5, 0] for RFC-compliant past-only verification.

token ​

token: string

OTP code to verify

Released under the MIT License.