otplib API Documentation / otplib / OTPVerifyOptions
Type Alias: OTPVerifyOptions
OTPVerifyOptions =
object
Defined in: otplib/src/class.ts:108
Options for verifying a token with the OTP class
Properties
algorithm?
optionalalgorithm:HashAlgorithm
Defined in: otplib/src/class.ts:122
Hash algorithm (default: 'sha1')
counter?
optionalcounter:number
Defined in: otplib/src/class.ts:151
Counter value Used by HOTP strategy (required)
counterTolerance?
optionalcounterTolerance:number|number[]
Defined in: otplib/src/class.ts:166
Counter tolerance for HOTP verification (default: 0)
- Number: symmetric look-ahead window
- Array: asymmetric window
digits?
optionaldigits:Digits
Defined in: otplib/src/class.ts:127
Number of digits (default: 6)
epoch?
optionalepoch:number
Defined in: otplib/src/class.ts:133
Current Unix epoch timestamp in seconds (default: now) Used by TOTP strategy
epochTolerance?
optionalepochTolerance:number| [number,number]
Defined in: otplib/src/class.ts:159
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.
guardrails?
optionalguardrails:OTPGuardrails
Defined in: otplib/src/class.ts:171
Validation guardrails
period?
optionalperiod:number
Defined in: otplib/src/class.ts:145
Time step in seconds (default: 30) Used by TOTP strategy
secret
secret:
string
Defined in: otplib/src/class.ts:112
Base32-encoded secret key
t0?
optionalt0:number
Defined in: otplib/src/class.ts:139
Initial Unix time to start counting time steps (default: 0) Used by TOTP strategy
token
token:
string
Defined in: otplib/src/class.ts:117
OTP code to verify