totp-authenticator

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

GroupId

GroupId

com.github.cheergoivan
ArtifactId

ArtifactId

totp-authenticator
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

totp-authenticator
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

https://github.com/cheergoivan/totp-authenticator

Download totp-authenticator

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator/ -->
<dependency>
    <groupId>com.github.cheergoivan</groupId>
    <artifactId>totp-authenticator</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator/
implementation 'com.github.cheergoivan:totp-authenticator:1.0'
// https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator/
implementation ("com.github.cheergoivan:totp-authenticator:1.0")
'com.github.cheergoivan:totp-authenticator:jar:1.0'
<dependency org="com.github.cheergoivan" name="totp-authenticator" rev="1.0">
  <artifact name="totp-authenticator" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.cheergoivan', module='totp-authenticator', version='1.0')
)
libraryDependencies += "com.github.cheergoivan" % "totp-authenticator" % "1.0"
[com.github.cheergoivan/totp-authenticator "1.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.8.2

Project Modules

There are no modules declared in this project.

TOTP Authenticator

A Java implementation of TOTP(time-base one-time password) and the algorithm is described in rfc6238.

Features

  • Generate TOTP with a secret key
  • Validate TOTP according to the secret key and the totp from prover

Quick start

Add Maven dependency

<dependency>
   <groupId>com.github.cheergoivan</groupId>
   <artifactId>totp-authenticator</artifactId>
   <version>1.0</version>
</dependency>

Usage

TOTPAuthenticator auth = TOTPAuthenticator.builder().build();
String secret = "jsjbdfislfd";
String totp = auth.generateTOTP(secret);
System.out.println(totp);
System.out.println(auth.validateTOTP(secret, totp));

Spring Boot Starter

I provide a spring boot starter for totp-authenticator, please check this project: totp-authenticator-spring-boot-starter

License

This project is licensed under the Apache 2 License.

Versions

Version
1.0