Interface CodeGenerator
@AvailableSince("0.0.25")
public interface CodeGenerator
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodeGeneratorcreate()static CodeGeneratorcreate(HashingAlgorithm algorithm, int digits)
-
Method Details
-
create
- Returns:
- The created code generator
-
create
static CodeGenerator create(HashingAlgorithm algorithm, int digits) throws InvalidParameterException - Parameters:
algorithm- The hashing algorithm to usedigits- The number of digits to generate (for example 6 means 000000 and 999999)- Returns:
- The created code generator
- Throws:
InvalidParameterException- If the algorithm or the number of digits is invalid
-
generate
- Parameters:
secret- The shared secret key to generate the code withcounter- The current time bucket number (Number of seconds since epoch / bucket period)- Returns:
- The n-digit code for the secret/counter.
- Throws:
Exception
-