# @types/authenticator

> TypeScript definitions for authenticator

Latest version **1.1.4** (published 2023-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/authenticator
pnpm add @types/authenticator
yarn add @types/authenticator
bun add @types/authenticator
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2023-11-06 |
| First published | 2019-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51464 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/authenticator
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/authenticator
- npm.io page: https://npm.io/package/@types/authenticator

## Recent versions

- 1.1.4 (latest) — 2023-11-06
- 1.1.1 (ts4.0) — 2022-03-14
- 1.1.0 (ts2.0) — 2019-08-21
- 1.1.3 — 2023-10-17
- 1.1.2 — 2023-09-22

## README

# Installation
> `npm install --save @types/authenticator`

# Summary
This package contains type definitions for authenticator (https://git.coolaj86.com/coolaj86/node-authenticator.js#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/authenticator.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/authenticator/index.d.ts)
````ts
/**
 * Object returned by `verifyToken()`.
 * delta: number
 */
export interface VerifyResult {
    delta: number;
}

/**
 * Generates a 32-character (160-bit) base32 key.
 */
export function generateKey(): string;

/**
 * Generates a 6-digit (20-bit) decimal time-based token.
 * @param formattedKey 32-character (160-bit) base32 key.
 */
export function generateToken(formattedKey: string): string;

/**
 * Generates an `OTPAUTH://` scheme URI for QR Code generation.
 * @param formattedKey 32-character (160-bit) base32 key.
 * @param accountName User account e.g. user@gmail.com
 * @param issuer The provider or service this account is associated with, URL-
 * encoded according to RFC 3986
 * @param algorithm The algorithm may have the values:
 * - SHA1 (default)
 * - SHA256
 * - SHA512
 * @param digits The digits parameter may have the values 6 or 8, and determines
 * how long of a one-time passcode to display to the user.
 * @param period The amount of time the TOTP code will be valid for, in seconds.
 */
export function generateTotpUri(
    formattedKey: string,
    accountName: string,
    issuer: string,
    algorithm: string,
    digits: number,
    period: number,
): string;

/**
 * Validates a time-based token within a +/- 30 second (90 seconds) window
 * returns `null` on failure or an object such as `{ delta: 0 }` on success.
 * @param formattedKey 32-character (160-bit) base32 key.
 * @param formattedToken 6-digit (20-bit) decimal time-based token.
 */
export function verifyToken(formattedKey: string, formattedToken: string): VerifyResult | null;

````

### Additional Details
 * Last updated: Mon, 06 Nov 2023 22:41:04 GMT
 * Dependencies: none

# Credits
These definitions were written by .

---
_Source: https://npm.io/package/@types/authenticator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
