otplib API Documentation / otplib / class / OTPGenerateOptions
Type Alias: OTPGenerateOptions
OTPGenerateOptions =
object
Defined in: otplib/src/class.ts:65
Options for generating a token with the OTP class
Properties
algorithm?
optionalalgorithm:HashAlgorithm
Defined in: otplib/src/class.ts:77
Hash algorithm (default: 'sha1')
counter?
optionalcounter:number
Defined in: otplib/src/class.ts:106
Counter value Used by HOTP strategy (required)
digits?
optionaldigits:Digits
Defined in: otplib/src/class.ts:82
Number of digits (default: 6)
epoch?
optionalepoch:number
Defined in: otplib/src/class.ts:88
Current Unix epoch timestamp in seconds (default: now) Used by TOTP strategy
guardrails?
optionalguardrails:OTPGuardrails
Defined in: otplib/src/class.ts:111
Validation guardrails
hooks?
optionalhooks:OTPHooks
Defined in: otplib/src/class.ts:116
Hooks for customizing token encoding and validation
period?
optionalperiod:number
Defined in: otplib/src/class.ts:100
Time step in seconds (default: 30) Used by TOTP strategy
secret
secret:
string|Uint8Array
Defined in: otplib/src/class.ts:72
Base32-encoded secret key
Note: By default, strings are assumed to be Base32 encoded. If you have a raw string/passphrase, you must convert it to Uint8Array first.
t0?
optionalt0:number
Defined in: otplib/src/class.ts:94
Initial Unix time to start counting time steps (default: 0) Used by TOTP strategy