Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/totp-generator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/totp-generator

TypeScript definitions for totp-generator

  • 0.0.8
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/totp-generator

Summary

This package contains type definitions for totp-generator (https://github.com/bellstrand/totp-generator).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/totp-generator.

index.d.ts

/**
 * Possible SHA variants taken from [jsSHA](https://github.com/Caligatio/jsSHA).
 */
type TotpAlgorithm =
    | "SHA-1"
    | "SHA-224"
    | "SHA-256"
    | "SHA-384"
    | "SHA-512"
    | "SHA3-224"
    | "SHA3-256"
    | "SHA3-384"
    | "SHA3-512";

interface TotpOptions {
    period?: number | undefined;
    /**
     * The desired SHA variant (SHA-1, SHA-224, SHA-256, SHA-384, SHA-512,
     * SHA3-224, SHA3-256, SHA3-384, SHA3-512).
     */
    algorithm?: TotpAlgorithm | undefined;
    digits?: number | undefined;
    timestamp?: number | undefined;
}

/**
 * Generates a `TOTP token` from a TOTP key
 *
 * Keys provided must be **base32 strings**, ie. only containing characters matching `(A-Z, 2-7, =)`.
 *
 * The **default** settings are:
 * - SHA-1
 * - 30 second period
 * - 6 digits
 * - Current time
 *
 * Settings can be provided as an optional second parameter inside an object.
 * ```ts
 * import totp = require("totp-generator");
 *
 * const token = totp("JBSWY3DPEHPK3PXP", {
 *  digits: 8,
 *  algorithm: "SHA-512",
 *  period: 60,
 *  timestamp: 1465324707000,
 * });
 * ```
 */
declare function getToken(key: string, options?: TotpOptions): string;
export = getToken;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by haykam821.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc