Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/otpauth/dist/otpauth.umd.min.js>TOTP

One Time Password (HOTP/TOTP) library for Node.js, Deno and browsers.
Go to Latest
class TOTP
import { TOTP } from "https://deno.land/x/otpauth@v9.0.2/dist/otpauth.umd.min.js";

TOTP: Time-Based One-Time Password Algorithm.

Constructors

new
TOTP(unnamed 0?: { issuer?: string | undefined; label?: string | undefined; secret?: string | Secret | undefined; algorithm?: string | undefined; digits?: number | undefined; period?: number | undefined; } | undefined)

Creates a TOTP object.

Properties

algorithm: string

HMAC hashing algorithm.

digits: number

Token length.

issuer: string

Account provider.

label: string

Account label.

period: number

Token time-step duration.

secret: Secret

Secret key.

Methods

generate(unnamed 0?: { timestamp?: number | undefined; } | undefined): string

Generates a TOTP token.

toString(): string

Returns a Google Authenticator key URI.

validate(unnamed 0: { token: string; timestamp?: number | undefined; window?: number | undefined; }): number | null

Validates a TOTP token.

Static Properties

readonly
defaults: { issuer: string; label: string; algorithm: string; digits: number; period: number; window: number; }

Default configuration.

Static Methods

generate(unnamed 0: { secret: Secret; algorithm?: string | undefined; digits?: number | undefined; period?: number | undefined; timestamp?: number | undefined; }): string

Generates a TOTP token.

validate(unnamed 0: { token: string; secret: Secret; algorithm?: string | undefined; digits: number; period?: number | undefined; timestamp?: number | undefined; window?: number | undefined; }): number | null

Validates a TOTP token.