ts-sdk

API

Links: API, Interfaces, Classes, Functions, Types, Variables

Interfaces

Interface: TOTPOptions

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


Classes

Class: TOTP

export class TOTP {
    static generate(secret: number[], options?: TOTPOptions): string 
    static validate(secret: number[], passcode: string, options?: TOTPValidateOptions): boolean 
}

See also: TOTPOptions, TOTPValidateOptions

Class TOTP Details #### Method generate Generates a Time-based One-Time Password (TOTP). ```ts static generate(secret: number[], options?: TOTPOptions): string ``` See also: [TOTPOptions](#interface-totpoptions) Returns The generated TOTP. Argument Details + **secret** + The secret key for TOTP. + **options** + Optional parameters for TOTP. #### Method validate Validates a Time-based One-Time Password (TOTP). ```ts static validate(secret: number[], passcode: string, options?: TOTPValidateOptions): boolean ``` See also: [TOTPValidateOptions](#type-totpvalidateoptions) Returns A boolean indicating whether the passcode is valid. Argument Details + **secret** + The secret key for TOTP. + **passcode** + The passcode to validate. + **options** + Optional parameters for TOTP validation.

Links: API, Interfaces, Classes, Functions, Types, Variables


Functions

Types

 
TOTPAlgorithm
TOTPValidateOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TOTPAlgorithm

export type TOTPAlgorithm = "SHA-1" | "SHA-256" | "SHA-512"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TOTPValidateOptions

Options for TOTP validation.

export type TOTPValidateOptions = TOTPOptions & {
    skew?: number;
}

See also: TOTPOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Variables