Interface TOTPConfig

interface TOTPConfig {
    algorithm: DigestAlgorithm;
    counter: number;
    digits: 6 | 8;
    issuer: string;
    label: string;
    period: number;
    secret: string | Secret;
    timestamp?: number | Date;
    window: number;
}

Hierarchy (view full)

Properties

algorithm: DigestAlgorithm

The algorithm to use for digest generation.

Note: Most authenticator applications have limited support for anything other than SHA1

Default

SHA1
counter: number

The HOTP counter

Note: This should be incremented upon each use to prevent replay attacks. user must also increment.

Note: This value is overwritten when TOTP is used.

Default

0
digits: 6 | 8

The number of digits to use for the OTP

Default

6
issuer: string

Displays as the "issuer" in most Authenticator applications

Default

<empty>
label: string

Displays as the account label in most Authenticator applications

Default

'Change Me'
period: number

Default

60
secret: string | Secret

The Secret seed for the generation/validation of the OTP

Default

<random>
timestamp?: number | Date

Default

Date.now()
window: number

The window of permitted OTP codes when verifying. A value of 1 would allow an OTP that is valid for the current counter/period +/- 1. A value of 2 would allow +/- 2.

Default

1