bump package version to 1.1.5
[squeep-totp] / README.md
1 # @squeep/totp
2
3 Simple helper classes for dealing with One-Time Passwords of varying flavor.
4
5 ## API
6
7 ```javascript
8 const { TOTP } = require('@squeep/totp');
9
10 const key = await TOTP.createKey(); // defaults create a hex-encoded sha1 key
11
12 const {
13 secret, // key encoded as base32
14 uri, // key and metadata encoded as an otpauth URI
15 svg, // otpauth URI encoded as QR code
16 } = TOTP.createKeySVG({ accountname: 'test@example.com', issuer: 'Squeep', }, key, 'hex');
17
18 const totp = new TOTP({
19 key,
20 keyEncoding: 'hex',
21 });
22
23 const token = totp.generate(); // The current token for the key.
24
25 const isValid = totp.validate('123456');
26 ```