Links: API, Interfaces, Classes, Functions, Types, Variables
Options for TOTP generation.
export interface TOTPOptions {
digits?: number;
algorithm?: TOTPAlgorithm;
period?: number;
timestamp?: number;
}
See also: TOTPAlgorithm
Links: API, Interfaces, Classes, Functions, Types, Variables
export class TOTP {
static generate(secret: number[], options?: TOTPOptions): string
static validate(secret: number[], passcode: string, options?: TOTPValidateOptions): boolean
}
See also: TOTPOptions, TOTPValidateOptions
Generates a Time-based One-Time Password (TOTP).
static generate(secret: number[], options?: TOTPOptions): string
See also: TOTPOptions
Returns
The generated TOTP.
Argument Details
Validates a Time-based One-Time Password (TOTP).
static validate(secret: number[], passcode: string, options?: TOTPValidateOptions): boolean
See also: TOTPValidateOptions
Returns
A boolean indicating whether the passcode is valid.
Argument Details
Links: API, Interfaces, Classes, Functions, Types, Variables
TOTPAlgorithm |
TOTPValidateOptions |
Links: API, Interfaces, Classes, Functions, Types, Variables
export type TOTPAlgorithm = "SHA-1" | "SHA-256" | "SHA-512"
Links: API, Interfaces, Classes, Functions, Types, Variables
Options for TOTP validation.
export type TOTPValidateOptions = TOTPOptions & {
skew?: number;
}
See also: TOTPOptions
Links: API, Interfaces, Classes, Functions, Types, Variables