Package com.bastiaanjansen.otp
Class SecretGenerator
java.lang.Object
com.bastiaanjansen.otp.SecretGenerator
public class SecretGenerator extends Object
A secret generator to generate OTP secrets
- Author:
- Bastiaan Jansen
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BITSDefault amount of bits for secret generation -
Constructor Summary
Constructors Constructor Description SecretGenerator() -
Method Summary
-
Field Details
-
DEFAULT_BITS
public static final int DEFAULT_BITSDefault amount of bits for secret generation- See Also:
- Constant Field Values
-
-
Constructor Details
-
SecretGenerator
public SecretGenerator()
-
-
Method Details
-
generate
public static byte[] generate()Generate an OTP base32 secret with default amount of bits- Returns:
- generated secret
-
generate
public static byte[] generate(int bits)Generate an OTP base32 secret- Parameters:
bits- length, this should match the length of the HMAC algorithm type: SHA1: 160 bits SHA256: 256 bits SHA512: 512 bits- Returns:
- generated secret
-