Skip to content

otplib API Documentation / @otplib/hotp / HOTPOptions

Type Alias: HOTPOptions

HOTPOptions = object

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

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:28

Hash algorithm to use (default: 'sha1')


base32?

readonly optional base32: Base32Plugin

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

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


counter?

readonly optional counter: number | bigint

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

The counter value (8-byte unsigned integer)


crypto?

readonly optional crypto: CryptoPlugin

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

Crypto plugin to use for HMAC operations


digits?

readonly optional digits: Digits

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

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


guardrails?

readonly optional guardrails: OTPGuardrails

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

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


issuer?

readonly optional issuer: string

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

Service provider name (for URI generation)


label?

readonly optional label: string

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

User identifier/email/username (for URI generation)


secret?

readonly optional secret: string | Uint8Array

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

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

Released under the MIT License.