diff --git a/README.md b/README.md index c898ab5..e85236b 100644 --- a/README.md +++ b/README.md @@ -47,15 +47,12 @@ authenticator.verifyToken(formattedKey, formattedToken); authenticator.verifyToken(formattedKey, '000 000'); // null + +authenticator.generateTotpUri(formattedKey, "john.doe@email.com", "ACME Co", 'SHA1', 6, 30); +// +// otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30 ``` -OTPAuth Scheme --------------- - -* -* `otpauth://totp/<>:<>?secret=<>&issuer=<>` -* `otpauth://totp/<>:<>?secret=<>&issuer=<>&algorithm=<>&digits=<>&period=<>` - API --- @@ -73,6 +70,18 @@ validates a time-based token within a +/- 30 second (90 seconds) window returns `null` on failure or an object such as `{ delta: 0 }` on success +### generateTotpUri(formattedKey, accountName, issuer, algorithm, digits, period) + +generates an `OTPAUTH://` scheme URI for QR Code generation. + +**OTPAuth Scheme** + +* +* `otpauth://totp/<>:<>?secret=<>&issuer=<>` +* `otpauth://totp/<>:<>?secret=<>&issuer=<>&algorithm=<>&digits=<>&period=<>` + +Note that `ISSUER` is specified twice for backwards / forwards compatibility. + QR Code -------