= OTP Auth provider

We provide an implementation of `link:../../apidocs/io/vertx/ext/auth/authentication/AuthenticationProvider.html[AuthenticationProvider]` which uses the one time passwords
to perform authentication.
The module supports the Google Authenticator, you can choose any convenient library for creating the QR code with key, or simply transfer key in the format base32.

To use this project, add the following
dependency to the _dependencies_ section of your build descriptor:

* Maven (in your `pom.xml`):

[source,xml,subs="+attributes"]
----
<dependency>
 <groupId>io.vertx</groupId>
 <artifactId>vertx-auth-otp</artifactId>
 <version>4.5.6</version>
</dependency>
----

* Gradle (in your `build.gradle` file):

[source,groovy,subs="+attributes"]
----
compile 'io.vertx:vertx-auth-otp:4.5.6'
----

---

== HOTP Authentication
To create an instance of the Hotp auth provider, use `link:../../apidocs/io/vertx/ext/auth/otp/hotp/HotpAuth.html#create-io.vertx.ext.auth.otp.hotp.HotpAuthOptions-[HotpAuth.create]` as follows:

=== HOTP Configuration

The class `link:../../apidocs/io/vertx/ext/auth/otp/hotp/HotpAuthOptions.html[HotpAuthOptions]` is used to configure the Hotp authentication provider:

`passwordLength`:: the set otp code length, valid value between 6 and 8, default value equal 6.

`authAttemptsLimit`:: the limit auth attempts.

`lookAheadWindow`:: the resynchronization mechanism usage.

=== Notes

Note that when authenticating using this implementation, it assumes `identifier`, `key` and `counter` fields are present in the authentication info

== TOTP Authentication

To create an instance of the Totp auth provider, use `link:../../apidocs/io/vertx/ext/auth/otp/totp/TotpAuth.html#create-io.vertx.ext.auth.otp.totp.TotpAuthOptions-[TotpAuth.create]` as follows

=== TOTP Configuration

The class `link:../../apidocs/io/vertx/ext/auth/otp/totp/TotpAuthOptions.html[TotpAuthOptions]` is used to configure the Totp authentication provider:

`passwordLength`:: the set otp code length, valid value between 6 and 8, default value equal 6.

`authAttemptsLimit`:: the limit auth attempts.

`period`:: time period in seconds during which the authentication code is valid, default value equal 30.

=== Notes

Note that when authenticating using this implementation, it assumes `identifier`, `key` fields are present in the authentication info