Skip to content

Releases: hrax/security-totp

Security TOTP v1.0.0

19 Jan 15:03
Compare
Choose a tag to compare

First release of Time-Base One-Time Password Algorithm Library. Allows generation and validation of time-based authentication codes as well as provides compatibility with Google Authenticator application and can generate URL to QR codes that can be scanned for easy data entry.

It is also very easy to use:

TOTP totp = new TOTP();

byte[] secret = TOTPSecret.generate();

String encoded = TOTPSecret.encode(secret);
String qr = GoogleAuthenticator.getQRUrl("jdoe", "example.com", encoded);

byte[] decoded = TOTPSecret.decode(key);
int code = totp.generate(secret);
boolean valid = totp.validate(decoded, code);

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