# simple-totp

> A module which lets you generate TOTP codes with zero dependencies. Also, encode/decode base32 values

Latest version **2.0.0** (published 2023-02-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install simple-totp
pnpm add simple-totp
yarn add simple-totp
bun add simple-totp
```

## 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 | 2.0.0 |
| Published | 2023-02-02 |
| First published | 2020-03-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Aleksei Kuzmichev |
| Maintainers | a.kuzmichev |
| Keywords | totp, base32 |

## Links

- npm: https://www.npmjs.com/package/simple-totp
- Repository: https://github.com/lesha-co/simple-totp
- Homepage: https://github.com/lesha-co/simple-totp#readme
- Issues: https://github.com/lesha-co/simple-totp/issues
- npm.io page: https://npm.io/package/simple-totp

## Recent versions

- 2.0.0 (latest) — 2023-02-02
- 1.4.2 — 2023-01-31
- 1.4.1 — 2023-01-31
- 1.4.0 — 2023-01-31
- 1.3.0 — 2022-08-25
- 1.2.1 — 2022-08-24
- 1.2.0 — 2022-08-24
- 1.1.1 — 2022-08-24
- 1.1.0 — 2022-08-23
- 1.0.5 — 2020-04-10
- 1.0.4 — 2020-04-10
- 1.0.3 — 2020-03-30
- 1.0.2 — 2020-03-27
- 1.0.1 — 2020-03-27
- 1.0.0 — 2020-03-27

## README

[![Build Status](https://travis-ci.org/lesha-co/simple-totp.svg?branch=master)](https://travis-ci.org/lesha-co/simple-totp)
[![Coverage Status](https://coveralls.io/repos/github/lesha-co/simple-totp/badge.svg?branch=master)](https://coveralls.io/github/lesha-co/simple-totp?branch=master)

# Simple TOTP


## Use this library to generate OTP passwords like Google Authenticator
```js
import {getTOTP} from "simple-totp";

const totp = getTOTP("JBSWY3DP", "base32", Date.now(), 6); 
// {
//  totp: "012345",
//  remainingMs: 29995
// }
```

## Also, convert base32 <=> Uint8Array 
Because base32 is used to encode binary data, it uses Uint8Array as a container. There are also several helper functions to convert 
```js
import {convert} from "simple-totp";
const Hello = convert('base32', 'ascii', 'JBSWY3DP')//= 'Hello' 
const JBSWY3DP = convert('ascii', 'base32', 'Hello')//= 'JBSWY3DP' 


```

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