Skip to content

otplib API Documentation / otplib / OTPFunctionalOptions

Type Alias: OTPFunctionalOptions

OTPFunctionalOptions = object

Defined in: otplib/src/types.ts:44

Common options for OTP generation

These options apply to both TOTP and HOTP strategies.

Properties

algorithm?

optional algorithm: HashAlgorithm

Defined in: otplib/src/types.ts:75

Hash algorithm (default: 'sha1')


base32?

optional base32: Base32Plugin

Defined in: otplib/src/types.ts:65

Base32 plugin to use (default: ScureBase32Plugin)


counter?

optional counter: number

Defined in: otplib/src/types.ts:104

Counter value Used by HOTP strategy (required)


crypto?

optional crypto: CryptoPlugin

Defined in: otplib/src/types.ts:60

Crypto plugin to use (default: NobleCryptoPlugin)


digits?

optional digits: Digits

Defined in: otplib/src/types.ts:80

Number of digits (default: 6)


epoch?

optional epoch: number

Defined in: otplib/src/types.ts:92

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


guardrails?

optional guardrails: OTPGuardrails

Defined in: otplib/src/types.ts:70

Validation guardrails


period?

optional period: number

Defined in: otplib/src/types.ts:86

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


secret

secret: string

Defined in: otplib/src/types.ts:48

Base32-encoded secret key


strategy?

optional strategy: OTPStrategy

Defined in: otplib/src/types.ts:55

OTP strategy to use (default: 'totp')

  • 'totp': Time-based OTP
  • 'hotp': HMAC-based OTP

t0?

optional t0: number

Defined in: otplib/src/types.ts:98

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

Released under the MIT License.