Interface: TOTPSecret
Defined in: src/auth/types.ts:162
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?
optionalalgorithm?:TOTPAlgorithm
Defined in: src/auth/types.ts:169
The HMAC hash algorithm used to generate the associated token, if it differs from the library default.
digits?
optionaldigits?:number
Defined in: src/auth/types.ts:165
The number of digits the associated token contains, if it differs from the library default.
epochTolerance?
optionalepochTolerance?:number|number[]
Defined in: src/auth/types.ts:175
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?
optionallastTimeStep?:number
Defined in: src/auth/types.ts:182
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?
optionalperiod?:number
Defined in: src/auth/types.ts:167
The time step, in seconds, that the associated token remains valid for, if it differs from the library default.
secret
secret:
string
Defined in: src/auth/types.ts:163
uid?
optionaluid?:string
Defined in: src/auth/types.ts:188
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.