Creates a TOTP object.
Optional
config: {Configuration options.
Optional
algorithm?: stringHMAC hashing algorithm.
Optional
digits?: numberToken length.
Optional
issuer?: stringAccount provider.
Optional
issuerInLabel?: booleanInclude issuer prefix in label.
Optional
label?: stringAccount label.
Optional
period?: numberToken time-step duration.
Optional
secret?: string | SecretSecret key.
HMAC hashing algorithm.
Token length.
Account provider.
Include issuer prefix in label.
Account label.
Token time-step duration.
Secret key.
Static
defaultsDefault configuration.
Calculates the counter. i.e. the number of periods since timestamp 0.
Optional
config: { timestamp?: number } = {}Configuration options.
Optional
timestamp?: numberTimestamp value in milliseconds.
Counter.
Generates a TOTP token.
Optional
config: { timestamp?: number } = {}Configuration options.
Optional
timestamp?: numberTimestamp value in milliseconds.
Token.
Calculates the remaining time in milliseconds until the next token is generated.
Optional
config: { timestamp?: number } = {}Configuration options.
Optional
timestamp?: numberTimestamp value in milliseconds.
counter.
Returns a Google Authenticator key URI.
URI.
Validates a TOTP token.
Configuration options.
Optional
timestamp?: numberTimestamp value in milliseconds.
Token value.
Optional
window?: numberWindow of counter values to test.
Token delta or null if it is not found in the search window, in which case it should be considered invalid.
Static
counterCalculates the counter. i.e. the number of periods since timestamp 0.
Optional
config: { period?: number; timestamp?: number } = {}Configuration options.
Optional
period?: numberToken time-step duration.
Optional
timestamp?: numberTimestamp value in milliseconds.
Counter.
Static
generateGenerates a TOTP token.
Configuration options.
Optional
algorithm?: stringHMAC hashing algorithm.
Optional
digits?: numberToken length.
Optional
period?: numberToken time-step duration.
Secret key.
Optional
timestamp?: numberTimestamp value in milliseconds.
Token.
Static
remainingCalculates the remaining time in milliseconds until the next token is generated.
Optional
config: { period?: number; timestamp?: number } = {}Configuration options.
Optional
period?: numberToken time-step duration.
Optional
timestamp?: numberTimestamp value in milliseconds.
counter.
Static
validateValidates a TOTP token.
Configuration options.
Optional
algorithm?: stringHMAC hashing algorithm.
Optional
digits?: numberToken length.
Optional
period?: numberToken time-step duration.
Secret key.
Optional
timestamp?: numberTimestamp value in milliseconds.
Token value.
Optional
window?: numberWindow of counter values to test.
Token delta or null if it is not found in the search window, in which case it should be considered invalid.
TOTP: Time-Based One-Time Password Algorithm.
See
RFC 6238