Package com.bastiaanjansen.otp
Class HOTPGenerator
- java.lang.Object
-
- com.bastiaanjansen.otp.HOTPGenerator
-
public final class HOTPGenerator extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHOTPGenerator.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HOTPGeneratorfromURI(URI uri)Stringgenerate(long counter)HMACAlgorithmgetAlgorithm()intgetPasswordLength()URIgetURI(int counter, String issuer)URIgetURI(int counter, String issuer, String account)URIgetURI(String type, String issuer, String account, Map<String,String> query)booleanverify(String code, long counter)booleanverify(String code, long counter, int delayWindow)static HOTPGeneratorwithDefaultValues(byte[] secret)
-
-
-
Method Detail
-
fromURI
public static HOTPGenerator fromURI(URI uri) throws URISyntaxException
- Throws:
URISyntaxException
-
withDefaultValues
public static HOTPGenerator withDefaultValues(byte[] secret)
-
getURI
public URI getURI(int counter, String issuer) throws URISyntaxException
- Throws:
URISyntaxException
-
getURI
public URI getURI(int counter, String issuer, String account) throws URISyntaxException
- Throws:
URISyntaxException
-
getPasswordLength
public int getPasswordLength()
-
getAlgorithm
public HMACAlgorithm getAlgorithm()
-
verify
public boolean verify(String code, long counter)
-
verify
public boolean verify(String code, long counter, int delayWindow)
-
generate
public String generate(long counter) throws IllegalStateException
- Throws:
IllegalStateException
-
getURI
public URI getURI(String type, String issuer, String account, Map<String,String> query) throws URISyntaxException
- Throws:
URISyntaxException
-
-