Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up
🎲TOTP(Time-based one-time password) generator, support for Google Authenticator
http://t.cn/RnaSS4n
JavaScript
Permalink
Type |
Name |
Latest commit message |
Commit time |
|
Failed to load latest commit information. |
|
demo
|
📝Update readme
|
Mar 22, 2018
|
|
dist
|
✨build for browser
|
Mar 22, 2018
|
|
lib
|
✨build for browser
|
Mar 22, 2018
|
|
test
|
📝generate url for google authenticator
|
Mar 22, 2018
|
|
.gitignore
|
🎉 implementation of HOTP
|
Mar 21, 2018
|
|
.npmignore
|
🎉 implementation of HOTP
|
Mar 21, 2018
|
|
.travis.yml
|
✅add travice ci support
|
Mar 21, 2018
|
|
LICENSE
|
📝Add how-to and domo
|
Mar 22, 2018
|
|
README.md
|
📝Update readme
|
Mar 22, 2018
|
|
index.js
|
📝generate url for google authenticator
|
Mar 22, 2018
|
|
package.json
|
📝generate url for google authenticator
|
Mar 22, 2018
|
|
webpack.config.js
|
✨build for browser
|
Mar 22, 2018
|
Two-factor authentication implementation in pure javascript. One-time password generator (HOTP/TOTP) with support for Google Authenticator.
Live Demo
Preview
Demo
Getting Started
Install
npm i totp.js
Node.js
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('[email protected]', 'Totp.js')
// 'otpauth://totp/[email protected]?issuer=Totp.js&secret=GAXGGYT2OU2DEOJR'
// OR
const totp2 = new TOTP(TOTP.base32.encode('your key'));
totp2.genOTP()
For Browser
<script src="./dist/totp.min.js" />
<script>
var key = TOTP.randomKey();
var totp = new TOTP(key);
console.log(totp.genOTP());
</script>
Enjoy!
Lisence
© MIT
文章来源: https://github.com/wuyanxin/totp.js
如有侵权请联系:admin#unsafe.sh