Skip to content

otplib API Documentation / @otplib/hotp / HOTPOptions

Type Alias: HOTPOptions

HOTPOptions = object

Defined in: hotp/src/types.ts:23

HOTP configuration options

All properties are optional for flexible class-based configuration. Use HOTPGenerateOptions or HOTPVerifyOptions for function parameters where certain fields are required.

Properties

algorithm?

readonly optional algorithm: HashAlgorithm

Defined in: hotp/src/types.ts:29

Hash algorithm to use (default: 'sha1')


base32?

readonly optional base32: Base32Plugin

Defined in: hotp/src/types.ts:35

Base32 plugin to decode string secrets (required if secret is a string)


counter?

readonly optional counter: number | bigint

Defined in: hotp/src/types.ts:27

The counter value (8-byte unsigned integer)


crypto?

readonly optional crypto: CryptoPlugin

Defined in: hotp/src/types.ts:33

Crypto plugin to use for HMAC operations


digits?

readonly optional digits: Digits

Defined in: hotp/src/types.ts:31

Number of digits in the OTP code (default: 6)


guardrails?

readonly optional guardrails: OTPGuardrails

Defined in: hotp/src/types.ts:45

Custom guardrails to override validation limits Must be created via createGuardrails() factory Use this carefully - see danger-zone documentation


hooks?

readonly optional hooks: OTPHooks

Defined in: hotp/src/types.ts:51

Hooks for customizing token encoding and validation. Allows non-standard OTP variants (e.g., Steam Guard) to replace the default numeric encoding with custom schemes.


issuer?

readonly optional issuer: string

Defined in: hotp/src/types.ts:37

Service provider name (for URI generation)


label?

readonly optional label: string

Defined in: hotp/src/types.ts:39

User identifier/email/username (for URI generation)


secret?

readonly optional secret: string | Uint8Array

Defined in: hotp/src/types.ts:25

The shared secret key (Base32-encoded string or raw bytes)

Released under the MIT License.