Skip to content

otplib API Documentation / otplib / OTPGenerateOptions

Type Alias: OTPGenerateOptions

OTPGenerateOptions = object

Defined in: otplib/src/class.ts:59

Options for generating a token with the OTP class

Properties

algorithm?

optional algorithm: HashAlgorithm

Defined in: otplib/src/class.ts:68

Hash algorithm (default: 'sha1')


counter?

optional counter: number

Defined in: otplib/src/class.ts:97

Counter value Used by HOTP strategy (required)


digits?

optional digits: Digits

Defined in: otplib/src/class.ts:73

Number of digits (default: 6)


epoch?

optional epoch: number

Defined in: otplib/src/class.ts:79

Current Unix epoch timestamp in seconds (default: now) Used by TOTP strategy


guardrails?

optional guardrails: OTPGuardrails

Defined in: otplib/src/class.ts:102

Validation guardrails


period?

optional period: number

Defined in: otplib/src/class.ts:91

Time step in seconds (default: 30) Used by TOTP strategy


secret

secret: string

Defined in: otplib/src/class.ts:63

Base32-encoded secret key


t0?

optional t0: number

Defined in: otplib/src/class.ts:85

Initial Unix time to start counting time steps (default: 0) Used by TOTP strategy

Released under the MIT License.