# chai-totp

> TOTP (Time-Based One-Time Password Algorithm), 两步验证中使用的密码是一次性密码（One-Time Password 简称OTP），动态口令

Latest version **1.0.1** (published 2020-02-27) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-02-27 |
| First published | 2020-02-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 94.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lavi Chai |
| Maintainers | ttxx |
| Keywords | otp, hotp, totp, Two-factor authentication, Google authenticator |

## Links

- npm: https://www.npmjs.com/package/chai-totp
- Repository: https://gitee.com/yooler/chai-totp
- Homepage: https://gitee.com/yooler/chai-totp/blob/master/README.md
- Issues: https://gitee.com/yooler/chai-totp/issues
- npm.io page: https://npm.io/package/chai-totp

## Dependencies (2)

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

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-02-27
- 1.0.0 — 2020-02-20

## README

# chai-totp

#### 介绍
nodejs和javascript的两步验证，支持谷歌两步身份验证。

#### 安装教程

1.  npm install chai-totp

#### 使用说明

1.  Nodejs
```javascript
 const TOTP = require('totp.js');
 
 // generate a base32 secret key
 const key = TOTP.randomKey();
 // 'GAXGGYT2OU2DEOJR'
 
 const totp = new TOTP(key);
 const code = totp.genOTP();
 // '552179'
 totp.verify(code)
 // true
 
 // generate Google Authenticator supported URL
 totp.gaURL('handsome@totp.js', 'Totp.js')
 // 'otpauth://totp/handsome@totp.js?issuer=Totp.js&secret=GAXGGYT2OU2DEOJR'
 
 // OR
 const totp2 = new TOTP(TOTP.base32.encode('your key'));
 totp2.genOTP()
```

#### 参与贡献

1.  Fork 本仓库
2.  新建 Feat_xxx 分支
3.  提交代码
4.  新建 Pull Request

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