# totper

> Module for generating TOTP Codes and other things related to TOTP

Latest version **1.0.1** (published 2023-05-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install totper
pnpm add totper
yarn add totper
bun add totper
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-05-28 |
| First published | 2023-05-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 24.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kamil Kozioł |
| Maintainers | kamil-koziol |
| Keywords | totp, totper, One time password |

## Links

- npm: https://www.npmjs.com/package/totper
- npm.io page: https://npm.io/package/totper

## Dependencies (1)

- [thirty-two](https://npm.io/package/thirty-two.md) ^1.0.2

## Recent versions

- 1.0.1 (latest) — 2023-05-28
- 1.0.0 — 2023-05-23

## README

# totper

Module for generating TOTP Codes and other things related to TOTP

# Usage

```js
const secretKey = generateRandomTOTPSecretKey();
console.log(`Generated TOTP Secret Key: ${secretKey}`);

const totpCode = generateTOTPCode(secretKey);
console.log(`Generated TOTP Code: ${totpCode}`);

const isValid = verifyTOTPCode(secretKey, totpCode);
console.log(`Is Valid TOTP Code? ${isValid}`);
```

You can also specify amount of digits (`default = 6`) and provide custom time step (`default = 30`) in seconds

```js
let digits = 10;
let timeStep = 20;
const totpCode = generateTOTPCode(secretKey, digits, timeStep);
console.log(`Generated TOTP Code: ${totpCode}`);
```

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