Interface CodeGenerator

All Known Implementing Classes:
DefaultCodeGenerator

public interface CodeGenerator
Generates the n-digit code for a shared secret and a counter (RFC 4226 HOTP; RFC 6238 TOTP uses the time bucket as the counter).
  • Method Summary

    Modifier and Type
    Method
    Description
    generate(String secret, long counter)
     
  • Method Details

    • generate

      String generate(String secret, long counter) throws CodeGenerationException
      Parameters:
      secret - The shared secret/key to generate the code with.
      counter - The current time bucket number. Number of seconds since epoch / bucket period.
      Returns:
      The n-digit code for the secret/counter.
      Throws:
      CodeGenerationException - Thrown if the code generation fails for any reason.