Skip to main content

Interface: TOTPSecret

Defined in: auth/src/auth/types.ts:186

Describes a secret used for TOTP authentication. The digits/period/algorithm parameters are captured at registration time (rather than always deferring to the current TOTPConfig) so a secret keeps verifying correctly even if the relying party's configured defaults change later.

Properties​

algorithm?​

optional algorithm?: TOTPAlgorithm

Defined in: auth/src/auth/types.ts:193

The HMAC hash algorithm used to generate the associated token, if it differs from the library default.


digits?​

optional digits?: number

Defined in: auth/src/auth/types.ts:189

The number of digits the associated token contains, if it differs from the library default.


epochTolerance?​

optional epochTolerance?: number | number[]

Defined in: auth/src/auth/types.ts:199

Specifies a tolerance window around the current time. It does not represent a strict duration in seconds (e.g., "±N seconds"), but rather dictates which periods overlap with the tolerance window [currentTime - tolerance, currentTime + tolerance]. Default value is [1, 0].


lastTimeStep?​

optional lastTimeStep?: number

Defined in: auth/src/auth/types.ts:206

The RFC 6238 time step at which a token was last successfully verified for this secret, if any. Used for replay protection: a token that matches at or before this time step is rejected, so an intercepted request can't be replayed for as long as the code remains within its validity window. Populated and persisted by the consuming application.


period?​

optional period?: number

Defined in: auth/src/auth/types.ts:191

The time step, in seconds, that the associated token remains valid for, if it differs from the library default.


secret​

secret: string

Defined in: auth/src/auth/types.ts:187


uid?​

optional uid?: string

Defined in: auth/src/auth/types.ts:212

The unique id of the underlying stored secret this data belongs to, if attached by the caller. Used internally to identify which specific secret to persist lastTimeStep onto when more than one TOTP secret is checked for a user in a single verification.