Skip to content

otplib API Documentation / otplib / class / OTPURIGenerateOptions

Type Alias: OTPURIGenerateOptions ​

OTPURIGenerateOptions = object

Defined in: packages/otplib/src/class.ts:207

Options for generating URI with the OTP class

Properties ​

algorithm? ​

optional algorithm?: HashAlgorithm

Defined in: packages/otplib/src/class.ts:229

Hash algorithm (default: 'sha1')


counter? ​

optional counter?: number

Defined in: packages/otplib/src/class.ts:246

Counter value (default: 0) Used by HOTP strategy


digits? ​

optional digits?: Digits

Defined in: packages/otplib/src/class.ts:234

Number of digits (default: 6)


issuer ​

issuer: string

Defined in: packages/otplib/src/class.ts:211

Issuer name (e.g., 'ACME Co')


label ​

label: string

Defined in: packages/otplib/src/class.ts:216

Label/Account name (e.g., 'john@example.com')


period? ​

optional period?: number

Defined in: packages/otplib/src/class.ts:240

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


secret ​

secret: string

Defined in: packages/otplib/src/class.ts:224

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.

Released under the MIT License.