Time-Based One-Time Password Algorithm Java Library
Switch branches/tags
Nothing to show
Clone or download
Latest commit 9143006 Apr 6, 2015
Failed to load latest commit information.
src refactor Apr 5, 2015
README.md Update README.md Apr 5, 2015
pom.xml Development v1.0.1-SNAPSHOT Jan 19, 2014


TOTP - Time-Based One-Time Password Algorithm Library

RFC6238 Java implementation that is compatibile with Google Authenticator Application.

Provides utility class for generating links for QR codes that can be scanned by Goodle Authenticator. It is also capable of generating authentication codes as well as their verification.

It is very easy to use:

TOTPManager manager = new TOTPManager();

byte[] secret = Secret.generate();

// generate Google Authenticator QR Code
String encoded = Secret.toBase32(secret);
String qr = GoogleAuthenticator.getQRUrl("jdoe", "example.com", encoded);

// generate TOTP code
int code = manager.generate(secret);
boolean valid = manager.validate(secret, code); // by default code is valid for 60 seconds

Demo available for preview at: http://security-totp.appspot.com/